Changes

/* Setting Up and Running an AC Sweep Test */
{{projectinfo|Tutorial| Time and Frequency Domain Analysis of an RLC Filter |b2TUT2_1.png|In this project, you will investigate a linear, time-varying, RLC circuit in both time and frequency domains.|
*Voltage SourceCapacitor*ResistorInductor*Part PropertiesVirtual Instrument*GroundOscilloscope *Wiring*Nodes*Live Simulation*DC Bias Transient Test*DC AC Sweep Test*Data GraphsPreset Graph Plots*Data TablesEditing Graph Axes|All versions|{{download|http://www.emagtech.com/contentdownloads/project-file-download-repository|ProjectRepo/AnalogLesson2.zip Analog Tutorial Lesson 2|[[EM.Cube]] 14.8}} }}
=== What You Will Learn ===
In this tutorial, you will investigate a linear, time-varying, RLC circuit shown in the figure below. Using this circuit, you'll learn how to analyze transient and frequency domain responses.You will also learn how to set up and use a virtual instrument like the Oscilloscope during a live simulation.
<table>
<tr>
<td> [[Image:b2TUT2_1.png|thumb|350px400px|A simple RLC filter.]] </td>
</tr>
</table>
=== Drawing the Circuit ===
We assume that at this point you have already completed Tutorial Lesson 1 and have acquired the basic circuit editing skills. If you haven’t, you may want to look over Tutorial Lesson 1 now. The following is a list of parts needed for this lesson:
|}
Note that you can use the [[Keyboard Shortcuts|keyboard shortcuts]] {{key|L}} and {{key|C}} for placing inductors and capacitors in your circuit. 1n represents 1 nano-unit. It can also be entered as 1E-9, or 1NF. 1u is 1 micro-unit, which can also be entered as 1E-6. [[RF.SpiceA/D]] is case-insensitive, so you could enter 1 micro-unit as 1e-6, or 1E-6. Also, the type of the unit is ignored, so 1NF and 1ns are both equivalent to 1n. 1 n, however, will be interpreted as 1, since spaces are illegal in values. Place all the four parts listed above and connect them as shown in the figure using wires. For the time being, leave the voltage source as a default DC source with 1V voltage. Do not forget to define a ground for your circuit.
== Setting Up and Running a Live Simulation ==
[[File:b2TUT2_2.png|thumb|500px]]
Recall that a "Live Simulation" is a continuous time domain simulation that runs indefinitely until it is paused or stopped and reset. Since simulations do not produce a graph, you will need to use [[Virtual Instruments]] virtual instruments to measure the circuit. Specifically, you will use a "'''Virtual Oscilloscope'''" in this lesson.
First, you are going to change the type of your voltage source V1 to a square wave generator. You may alternatively use the "'''Virtual Function Generator'''" for this purpose. Double-click the voltage source to open its property dialog. From the '''Transient Properties''', select the "'''Pulse'''" option. The table on the right list the various properties of the '''Pulse Waveform'''. The default amplitude is 1V. Keep all the default values except for "Pulse Width" and "Pulse Period". Change their values to 0.5m and 1m, respectively. Note that these values represent milliseconds. A period of 1ms with a pulse width of 0.5ms corresponds to a pulse repetition rate (or frequency) of 1KHz, with a duty cycle of 50%. This is shown in the opposite figure.
</table>
Now click the "Run/Go" [[File:b2Run_Tool.png]] button of the '''[[Main toolbar|Main Toolbar]]''', or use the keyboard shortcut "'''Ctrl+G'''" to start the live simulation. Keep in mind that sometime B2[[RF.Spice A/D]] may ask you to allow it to adjust certain simulation [[parameters]] like time step automatically. Click OK in such situations and let the program do its job. However, once the simulation starts, you may not see anything in the scope's display. Or there might be flashes of a signal, but no solid signals. When this happens, it is likely that Workshop is having trouble automatically setting one or both of the axis settings.  Let's look at the axes settings to see what's happening. Switch on the '''Vertical''' tab. The Vertical V/Div is automatically set at 1. We know that the reading at node 1 should be the source signal set to 1V. Therefore, the 1V/div setting for the Vertical V/div should at least display the input signal correctly. Next, switch to the '''Timebase''' tab. The Timebase s/div setting is where the X axis range is set. It is set to "Auto" by default, but if you look closely, the setting might be continuously changing, probably due to the fact that one or both of the signals is throwing off the period calculations made by Workshop. In these cases, you can change the Timebase settings manually. To override this, click the "'''Manual'''" button. Let's set the signal to at least show the injected 1KHz signal. The period for our 1KHz pulse is 1ms. Since your graph has 10 divisions, the setting for time/div must be 1ms/10 = 0.1ms, or 100us. So enter 100u into the Timebase box and either press the '''Enter Key''' or click on the small "Return Arrow" button to accept the change. Otherwise, the dialog may show 100u, but Workshop will still be using the old value. Now you should see the signals in the scope's display screen.
If you look at the output waveform more closely, you will discern very small fluctuating signal overshoots at the rise or fall of the pulse. In the next part of this lesson, you will run a transient test to zoom in that portion of the temporal waveform.
== Running a Transient Test ==
[[File:b2TUT2_7.png|thumb|350px400px|Transient Test Setup Dialog]]In the Toolbox on the left side panel, click on the "'''[[Tests]]'''" tab. Select the "'''Transient'''" option by checking the leftmost check box in the "basic" column. Then, click the "'''Setup'''" button in the Transient test row to open the test settings dialog Test Settings Dialog as shown in the figure below. Set the Start Time transient test parameters according to 0, Stop Time to 5m, Linearize Step to 1u and Step ceiling to 1uthe table below. Make sure that the '''Single Test''' tab is selected and the check box labeled "'''Graph'''" is checked in the "Output Results Options" section of the dialog.  {| border="0"|-| valign="top"||-{| class="wikitable"|-! scope="row"| Start Time| 0|-! scope="row"| Stop Time| 5m|-! scope="row"| Linearize Step| 10u|-! scope="row"| Step Ceiling| 1u|-! scope="row"| Preset Graph Plots| v(1), v(2)|}
<table>
</table>
Before running the test, you have to instruct B2[[RF.Spice A/D]] what you want to plot at the end of the test. Click the button labeled "'''Preset Graph Plots...'''". A new dialog opens up, which looks like the figure shown above. Select the signals v(1) and v(2) and click the button labeled {{key|Add->}} to move them to the graph table. Click the "Run Test" [[File:b2RunTest_Tool.png]] button of this dialog, or use the keyboard shortcut {{key|Ctrl+B}} to run the transient test. The following figure shows up at the bottom of the Workshop.
<table>
<tr>
<td>[[File:b2TUT2_9.png|thumb|720px|PlotGraph of input and output voltages over the 5ms interval.]]</td>
</tr>
</table>
Since the period of the input pulse waveform is 1ms, your specified time interval contains 5 periods. Both the source signal and output voltage signal are plotted on the same graph. The signal overshoot at the rise and fall of the pulse train are better visible here. In order to examine this transient behavior in more detail, change the transient test [[parameters]] as follows:
{| border="0"|-| valign="top"||-{| class="wikitable"|-! scope="row"| Start Time: | 0|-! scope="row"| Stop Time: | 10u |-! scope="row"| Linearize Step: | 1n |-! scope="row"| Step Ceiling: | 1n |-! scope="row"| Preset Graph Plots| v(1), v(2)|}
[[File:b2TUT2_11.png|thumb|left|250px|Edit Axes dialog.]]Run the transient test once again and examine the new graph that replace replaces the previous one. The transient behavior of the circuit in the first 10 microsecond microseconds is clearly visible now. You can further zoom in on that part of the graph. Make the graph view active and open the "'''Edit Axes'''" tab of the '''Toolbox'''.
<table>
<tr>
<td>[[File:b2TUT2_10.png|thumb|720px|PlotGraph of input and output voltages over the 10&mu;s interval.]]</td>
</tr>
</table>
<table>
<tr>
<td>[[File:b2TUT2_12.png|thumb|720px|PlotDetails of the graph after editing the minimum and maximum values of the left axis.]] </td>
</tr>
</table>
== Setting Up and Running an AC Sweep Test Changing the Source Period ==
[[File:b2TUT2_18The square wave input signal you used in the previous part had a period of 1ms corresponding to a repetition frequency of 1kHz.png|thumb|500px|Voltage sourceIn this part, you will change this frequency to 10MHz.]]Open the property dialog of your voltage source and in its Transient tab set the following parameters:
The AC Sweep Test generates the frequency response of a circuit. When you run an AC sweep test, the voltage sources always act as sinusoidal signal sources regardless of the type you have specified in the property dialog of the individual sources. Furthermore, the frequency of that source signals will be stepped through a range of frequencies while the response of the circuit is recorded at each step.{| border="0"|-| valign="top"||-{| class="wikitable"|-! scope="row"| V1| Initial Voltage| 0|-! scope="row"| V2| Peak Voltage| 1|-! scope="row"| Td| Initial Delay Time| 0|-! scope="row"| Tr| Rise Time| 1n|-! scope="row"| Tf| Fall Time| 1n|-! scope="row"| Pw| Pulse Width| 50n|-! scope="row"| Period| Period| 100n|}
Before you run an AC sweep test, you need to instruct B2.Spice which signal sources you want to treat as AC sources. To do so, double-click on your voltage source to open its property Open the setting dialog. This dialog has two tabs. The first tab, which you saw earlier, is labeled as "'''DC & Transient'''". The second tab, which you should open now, is labeled as "'''Small-Signal AC & Distortion'''". At the top of the tab is a box labeled "Signal Offset" with units of V/A. When your circuit has active devices, it is important to set a DC bias point. This box will set the DC offset of your source. For this lesson, leave this box blank. Next, you will see a section titled "AC Properties for Small Signal AC Analysis Only". This section consists of boxes for Magnitude transient pest panel and Phase of change the AC source plus the "Use Check Box". You have to check the last box to include the signal source test parameters as shown in your AC analysis. Set the magnitude to 1V and phase to 0 degrees. table below:
{| border="0"|-| valign="top"||-{Note|You cannot run an AC sweep test if none of your signal sources has an AC designation. [[B2.Spice A/D]] will generate an error message.}class="wikitable"|-! scope="row"| Start Time| 0|-! scope="row"| Stop Time| 1u|-! scope="row"| Linearize Step| 1n|-! scope="row"| Step Ceiling| 1n|-! scope="row"| Preset Graph Plots| v(1), v(2)|}
[[File:b2TUT2_21Run the transient test and examine the new graph that replaces the previous one.png|thumb|300px]]As you can see from the graph, your lowpass filter has now filtered out the high frequency spectral contents of the input pulse train. The output voltage is sinusoidal with a frequency of 10MHz.
Next, open the '''<table><tr><td>[[Tests]]''' tab of the '''Toolbox''', select the "'''AC Frequency Sweep'''" and click the Setup button to open the AC Sweep Settings DialogFile:b2TUT2_12A. Enter 1MHz and 100MHz for the Start and Stop Frequencies, respectively, select the "'''Decade'''" option png|thumb|720px|Graph of "'''Step Interval'''", input and set "'''Steps/Interval'''" to 20. These latter two specifications tell output voltages over the simulator to step 20 points per each decade, and a decade is a factor of 10&mu;s interval.]]</td></tr></table>
Before running the test, also specify the observables of your == Setting Up and Running an AC circuit simulation. Make sure that the '''Single Sweep Test''' tab is selected and the check box labeled "'''Graph'''" is checked in the "Output Results Options" section of the dialog. Click the button labeled "'''Preset Graph Plots...'''". ==
{{Note|An AC analysis involve complex-valued voltages and currents[[File:b2TUT2_18. You have to specify the format of the complex-valued signalspng|thumb|500px|Voltage source.}} ]]
Select The AC Sweep Test generates the signals vdb(1) and vdb(2) and click the button labeled "'''Add->'''" to move them to the graph table. This will produce plots frequency response of a circuit. When you run an AC sweep test, the magnitude voltage sources always act as sinusoidal signal sources regardless of voltages at nodes 1 and 2 expressed the type you have specified in the dB scale. Click the "Run Test" [[File:b2RunTest_Tool.png]] button transient tab of the test property dialog, or use of the keyboard shortcut "'''Ctrl+B'''" to run the AC sweep testindividual sources. The following figure shows up at Furthermore, the bottom frequency of the Workshop in that source signals will be stepped through a new Graph window:range of frequencies while the response of the circuit is recorded at each step.
{| border="0"|-| valign="top"|Before you run an AC sweep test, you need to instruct [[File:b2TUT2_19RF.png|thumb|400px|Edit Plots List DialogSpice A/D]]| valign=which signal sources you want to treat as AC sources. To do so, double-click on your voltage source to open its property dialog. This dialog has two tabs. The first tab, which you saw earlier, is labeled as "bottom'''DC & Transient'''"|[[File:b2TUT2_20.png|thumb|600px]]|The second tab, which you should open now, is labeled as "'''Small-|}Signal AC & Distortion'''". At the top of the tab is a box labeled '''Small-Signal Offset''' with units of V/A. When your circuit has active devices, it is important to set a DC bias point. This box will set the DC offset of your source. For this lesson, leave this box blank. Next, you will see a section titled "AC Properties for Small Signal AC Analysis Only". This section consists of boxes for Magnitude and Phase of the AC source plus the '''Use''' check box. You have to check the last box to include the signal source in your AC analysis. Set the magnitude to 1V and phase to 0 degrees.
{{Note|You will notice that the graph is in the form cannot run an AC sweep test if none of a Bode plotyour signal sources has an AC designation. That is, the magnitude is plotted in decibels, 20*log(Y value), and the frequency is plotted on a log scale[[RF. Spice A/D]] will generate an error message.}}  Next, you will plot open the phase '''Tests''' tab of the signals. Remember that you set the phase of the AC voltage source to 0 degrees. Open the Edit Plots List Dialog once again. Select the two dB-magnitude graphs in the table on the right by highlighting them (use the Shift or Ctrl keys for multiple selection) and move them back to the signal table using '''Toolbox''', select the "'''<-RemoveAC Frequency Sweep'''" and click the Setup buttonto open the AC Sweep Settings Dialog. Then, select Set the vp_deg(2) signal instead and move it frequency sweep parameters according to the graph tableshown. Note that you will not plot These specifications tell the zero phase simulator to step 20 points per each decade, and a decade is a factor of the voltage at node 110. Run the AC sweep test once again and see the phase plot as shown in the figure below:
{| border="0"
|-
| valign="top"|
[[File:b2TUT2_22.png|thumb|400px|Edit Plots List Dialog]]
| valign="bottom"|
[[File:b2TUT2_23.png|thumb|600px]]
|-
{| class="wikitable"
|-
! scope="row"| Start Frequency
| 1Meg
|-
! scope="row"| Stop Frequency
| 100Meg
|-
! scope="row"| Steps/Interval
| 20
|-
! scope="row"| Interval Type
| Decade
|-
! scope="row"| Preset Graph Plots
| vdb(2), vp_deg(2)
|}
 
<table>
<tr>
<td>[[File:b2TUT2_21.png|thumb|400px|AC Test Settings dialog.]]</td>
</tr>
</table>
 
[[File:b2TUT2_19.png|thumb|480px|Edit Plots List Dialog]]
Before running the test, also specify the observables of your AC circuit simulation. Make sure that the '''Single Test''' tab is selected and the check box labeled "'''Graph'''" is checked in the "Output Results Options" section of the dialog. Click the button labeled "'''Preset Graph Plots...'''".
 
{{Note|An AC analysis involve complex-valued voltages and currents. You have to specify the format of the complex-valued signals.}}
 
Select the signals vdb(2) and vp_deg(2) and click the button labeled {{key|Add->}} to move them to the graph table. This will produce plots of the magnitude and phase of the voltage at node 2 expressed in the dB scale and degrees, respectively. Click the "Run Test" [[File:b2RunTest_Tool.png]] button the test dialog, or use the keyboard shortcut "'''Ctrl+B'''" to run the AC sweep test. The following figure shows up at the bottom of the Workshop in a new Graph window:
 
<table>
<tr>
<td>[[File:b2TUT2_20.png|thumb|720px|Graph of amplitude and phase of the output AC voltage vs. frequency on a logarithmic scale.]]</td>
</tr>
</table>
 
You will notice that the amplitude and phase plots are initially plot on the same graph. First click on the surface of the plot to enable the "Graph View Mode". Note that the contents menu bar at the top of the screen changes. From the Edit Menu, select '''Separate Plots with Vertical Tiling'''. This splits the original graph to two separate graphs for the amplitude and phase. The amplitude graph is in the form of a Bode plot. That is, the magnitude is plotted in decibels, 20*log(Y value), and the frequency is plotted on a log scale. Keep in mind that since the amplitude of the input AC signal is fixed at 1V over the entire frequency range, its plot would be a horizontal line at 0dB. You can see from the graph that the output voltage drops to -3dB at about 7.5MHz.
<p>&nbsp;</p>
[[Image:Back_icon.png|40px]] '''[[RF.Spice_A/D #RF.Spice_A.2FD_Tutorials | Back to RF.Spice A/D Wiki Tutorial Gateway]]'''
28,333
edits