Basic Tutorial Lesson 2: Time and Frequency Domain Analysis of an RLC Filter

From Emagtech Wiki
Revision as of 17:54, 8 November 2016 by Kazem Sabet (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Tutorial Project: Time and Frequency Domain Analysis of an RLC Filter
B2TUT2 1.png

Objective: In this project, you will investigate a linear, time-varying, RLC circuit in both time and frequency domains.


  • Capacitor
  • Inductor
  • Virtual Instrument
  • Oscilloscope
  • Transient Test
  • AC Sweep Test
  • Preset Graph Plots
  • Editing Graph Axes

Minimum Version Required: All versions

'Download2x.png Download Link: Analog Lesson 2

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.

A simple RLC filter.

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:

Part Name Part Type Part Value
V1 Voltage Source 1
L1 Inductor 1u
C1 Capacitor 1n
R1 Resistor 50

Note that you can use the keyboard shortcuts L and 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.Spice A/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

B2TUT2 2.png

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 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.

Make sure circuit nodes are displayed. Your schematic should now look like the following figure:

The RLC filter schematic showing the node numbers.

Next, you will define the virtual oscilloscope. Go to the "Virtual Instrument Panel" on the right side of the screen and click on the button labeled "Add Meter". From the drop-down list, select "Oscilloscope". An empty oscilloscope window appears in the right side panel. Click the Setup button to expend the window and bring its settings dialog on. You should see a dialog like the figure below. Under the Traces tab, click the Input Trace 1 button to set up the first signal to measure on the oscilloscope. Set the input node to 1 and the reference node to 0. This will measure the voltage at node 1, which is where the voltage source is injected. Click on Input Trace 2 to set up the second signal. Set that input node to 2 and the reference to 0 and check the "Show" check box to display the signal. Workshop will try to automatically set the X and Y axis ranges to fit the signal into the graph window so you can leave all the other settings in the other tabs as they are.

The virtual oscilloscope instrument.
Vertical Tab of Oscilloscope Setup dialog.
Timebase Tab of Oscilloscope Setup dialog.

Now click the "Run/Go" B2Run Tool.png button of the Main Toolbar, or use the keyboard shortcut "Ctrl+G" to start the live simulation. Keep in mind that sometime 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

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 as shown in the figure below. Set the transient test parameters according to the 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.

Start Time 0
Stop Time 5m
Linearize Step 10u
Step Ceiling 1u
Preset Graph Plots v(1), v(2)
Edit Plot List dialog.

Before running the test, you have to instruct 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 Add-> to move them to the graph table. Click the "Run Test" B2RunTest Tool.png button of this dialog, or use the keyboard shortcut Ctrl+B to run the transient test. The following figure shows up at the bottom of the Workshop.

Graph of input and output voltages over the 5ms interval.

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:

Start Time 0
Stop Time 10u
Linearize Step 1n
Step Ceiling 1n
Preset Graph Plots v(1), v(2)
Edit Axes dialog.

Run the transient test once again and examine the new graph that replaces the previous one. The transient behavior of the circuit in the first 10 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.

Graph of input and output voltages over the 10μs interval.
Details of the graph after editing the minimum and maximum values of the left axis.

Changing the Source Period

The square wave input signal you used in the previous part had a period of 1ms corresponding to a repetition frequency of 1kHz. In 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:

V1 Initial Voltage 0
V2 Peak Voltage 1
Td Initial Delay Time 0
Tr Rise Time 1n
Tf Fall Time 1n
Pw Pulse Width 50n
Period Period 100n

Open the setting dialog of the transient pest panel and change the test parameters as shown in the table below:

Start Time 0
Stop Time 1u
Linearize Step 1n
Step Ceiling 1n
Preset Graph Plots v(1), v(2)

Run the transient test and examine the new graph that replaces the previous one. 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.

Graph of input and output voltages over the 10μs interval.

Setting Up and Running an AC Sweep Test

Voltage source.

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 transient tab of 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.

Before you run an AC sweep test, you need to instruct RF.Spice A/D 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 "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 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.

Attention icon.png You cannot run an AC sweep test if none of your signal sources has an AC designation. RF.Spice A/D will generate an error message.

Next, open the Tests tab of the Toolbox, select the "AC Frequency Sweep" and click the Setup button to open the AC Sweep Settings Dialog. Set the frequency sweep parameters according to the table shown. These specifications tell the simulator to step 20 points per each decade, and a decade is a factor of 10.

Start Frequency 1Meg
Stop Frequency 100Meg
Steps/Interval 20
Interval Type Decade
Preset Graph Plots vdb(2), vp_deg(2)
AC Test Settings dialog.
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...".

Attention icon.png 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 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" 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:

Graph of amplitude and phase of the output AC voltage vs. frequency on a logarithmic scale.

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.


Back icon.png Back to RF.Spice A/D Tutorial Gateway