An Introduction to Transient Analysis With MicroCap

advertisement
An Introduction to Transient Analysis With MicroCap
EE210 – Circuits and Systems
Tony Richardson
The use of MicroCap in simulating RLC circuits with DC sources will be demonstrated using the
example circuit shown in Figure 1.
t=0
5Ω
i
20 V
+
–
t=0
+
v
–
0.2 F
10 Ω
3A
Figure 1
We want to find the voltage v across the capacitor and the current i through the 5 Ω resistor for
t > 0. We need to find the capacitor voltage just prior to t = 0 when both switches close. As far as
the capacitor is concerned, prior to t = 0, the circuit appears as shown in Figure 2.
5Ω
i
20 V
+
–
+
v
–
0.2 F
Figure 2
The circuit is simple enough in this case that we can easily see that v = 20 V prior to t = 0. We can
verify this using MicroCap and Dynamic DC analysis. The result is shown in Figure 3 where the
initial capacitor voltage is seen to be 20 V.
After t = 0 the circuit appears as shown in Figure 4. Figure 5 shows the corresponding MicroCap
schematic. In order to get correct simulation results we need to specify the correct initial voltage
across the capacitor. There are several ways to do this in MicroCap, but the easiest method is to
just add “IC=20” after the capacitor value as shown in Figure 6. (Just double-click on the capacitor
to make this window appear.) It is important to get the polarity of the initial voltage correct.
Enable the Display Pin Names checkbox to view the polarity of a capacitor in the schematic. The
initial condition will be set with respect to this polarity. Turn the capacitor around, if necessary,
so that the pin names match the desired polarity.
We need to do a Transient Analysis to plot the voltage and current versus time. Node voltages are
the easiest variables to plot when doing a Transient Analysis. We need to know how MicroCap
assigns node numbers in order to plot the correct voltage. MicroCap will display node numbers
after clicking the Show Node Numbers icon as shown in Figure 5. The Reference Node is always
Node 0. There is only a single non-reference node in this circuit and as shown in Figure 5 it is
labeled Node 1 in MicroCap.
10/22/2007
Page 1 of 6
After setting up the circuit as shown in Figure 5, select Transient Analysis from the Analysis menu.
The Transient Analysis Limits window shown in Figure 7 will then appear. There are a large
number of options in this window and they must be set correctly in order to get correct results. The
default Time Range is 1 μs. This represents the maximum time in the simulation. We want to
change this to 5-10 time constants so that we can see the capacitor voltage settle down to its final
value. The time constant for the circuit in Figure 5 is 2/3 s. In Figure 8 the Time Range has been
changed to 6 s which corresponds to 9 time constants. The Maximum Time Step and Temperature
are left to their default values.
Figure 3: Dynamic DC Analysis (prior to t = 0)
5Ω
i
+
v
–
0.2 F
10 Ω
3A
Figure 4: Circuit After t = 0
At the bottom of the window we select the variables that we would like to plot. By default, the
voltages at Nodes 1 and 2 are selected for plotting. In this circuit there is not a second node, so the
second plot selection is deleted by clicking the mouse in the second plot selection line and then
clicking the Delete button at the top of the window.
10/22/2007
Page 2 of 6
The Run Options selection is left as Normal. The State Variables selection should be left as Zero.
Deselect the Operating Point option and select the Auto Scale Ranges option. It is very important
that the two Operating Point options be deselected to obtain correct results. A description of all of
the options in the window can be obtained by clicking the Help window at the top of the window.
Show Node Numbers
Figure 5: Circuit Schematic for t > 0
Figure 6: Setting the Initial Capacitor Voltage
10/22/2007
Page 3 of 6
Figure 7: The Transient Analysis Limits Window
Figure 8: The Transient Analysis Limits Window After Modification
Now, from the Transient menu, select Run. A plot of the voltage at Node 1 should now appear as
shown in Figure 9. The graph shows that the capacitor voltage is initially 20 V and settles to 10 V
in about 3.6 s (five time constants corresponds to 3.33 s).
To also plot the current through the 5 Ω resistor, select Limits from the Transient menu to redisplay
the Transient Analysis Limits window. Add a second plot line as shown in Figure 10. (You can
right-click in the Y Expression portion of the window and a menu will appear from which you can
select the current in the 5 Ω resistor (resistor R1).) When plotting currents through a device you
must take the default current direction into account. By default, the positive current is defined as
flowing from terminal named plus to the terminal named minus. You can display the terminal
names by clicking on the device in the schematic window and selecting the display Pin Names
option near the top of the window. You can then orient the device in the schematic so the default
current direction agrees with the desired current direction. The result is shown in Figure 11. We
see that the initial current is -4 A and settles to -2 A in about 3.6 s.
MicroCap also allows you to rerun a simulation for different values of a component and plot the
results together for comparison. The resulting plots of voltage and current are shown in Figure 12
when the 5 Ω resistor (resistor R1) is stepped through values of 5, 10, and 15 Ω. To do this just
10/22/2007
Page 4 of 6
click on the Stepping button at the top of the Transient Analysis Limits window. Choose the
component to step and the desired values to step through. Be sure to set the Step It button to Yes
before closing the window and rerunning the simulation.
Figure 9: A Graph of the Capacitor Voltage
Figure 10: Plotting the Current Through the 5 Ω Resistor
10/22/2007
Page 5 of 6
Figure 11: Plot of Desired Voltage and Current
Figure 12: Plot with R1 Equal to 5, 10, and 15 Ω
10/22/2007
Page 6 of 6
Download