Professional Documents
Culture Documents
All rights reserved. You are permitted to print this document provided that (1) the use of such is for personal use only and will
not be copied or posted on any network computer or broadcast in any media, and (2) no modifications of the document is
made. Unauthorized duplication, in whole or part, of this document by any means, mechanical or electronic, including
translation into another language, except for brief excerpts in published reviews, is prohibited without the express written
permission of Altium Limited. Unauthorized duplication of this work may also be prohibited by local statute. Violators may be
subject to both criminal and civil penalties, including fines and/or imprisonment. Altium, Altium Designer, Board Insight, Design
Explorer, DXP, LiveDesign, NanoBoard, NanoTalk, P-CAD, SimCode, Situs, TASKING, and Topological Autorouting and their
respective logos are trademarks or registered trademarks of Altium Limited or its subsidiaries. All other registered or
unregistered trademarks referenced herein are the property of their respective owners and no trademark rights to the same are
claimed.
Module Seq = 21
21.1 Circuit Simulation
The Altium Designer-based Circuit Simulator is a true mixed-signal simulator, meaning that it can
analyze circuits that include both analog and digital devices.
The Simulator uses an enhanced version of the event-driven XSpice, developed by the Georgia
Tech Research Institute (GTRI), which itself is based on Berkeley's SPICE3 code. It is fully
SPICE3f5 compatible, as well as providing support for a range of PSpice® device models.
Note: These models are not listed separately in this reference. PSpice support information is
included as part of the information for the relevant SPICE3f5 device model.
21.1.2 Exercise/Demo
Note: This project is available in the Altium Designer circuit simulation examples.
Note: The Altium simulator supports Spice 3F5 models and PSPICE models. SPICE models
used for circuit simulation (.ckt and .mdl files) are located within the integrated libraries in the
C:\Program Files\Altium Designer Summer 08\Library folder. You must use the
correct file extension for each model type.
Tip: A circuit for simulation must always have a path to ground. If it doesn’t you’ll receive iteration
limit reached error. To fix this provide a path to ground or modified the advanced options value
for RSHUNT to a figure of around 2-4Meg. Remember that the simulator assumes Capacitors
are perfect, i.e. no leakage.
6. Click on the Search button in the Libraries panel.
7. To search for all LF411 type components, in all supplied libraries, enter LF411 in the upper
part of the Libraries Search dialog. Set the Scope to Libraries on Path, and set the Path to
C:\Program Files\Altium Designer Summer 08\Library, with the Include
Subdirectories option enabled. Note that this will find all LF411 type components, you can
check if the chosen component includes a Spice model by selecting it in the Libraries panel,
and noting if there is a simulation model detailed in the Model Name region of the panel.
Note: to search for only components that include a simulation model, you would have used the
search string (Name like '*LF411*') and HasModel('SIM','*',true)
8. You may want to use a simulation model in your design other than the one already supplied
with the component in its integrated library. If you download a model file from a
manufacturer’s website, it is recommended that you copy it into your design’s project folder.
For the sake of this example, we will remove and re-add the SPICE model, LF411C.ckt.
9. Copy LF411C.ckt and paste this file into the folder where your project files reside using
windows Explorer. If you have created the circuit from scratch, there is a copy of the model
file in C:\Program Files\Altium Designer Summer 08\Examples\Circuit
Simulation\Filter.
10. Add the model file to the project by selecting the project name (Filter.PrjPCB) in the Projects
panel, right-click and select Add Existing to Project. Choose the model file and click Open.
17. Modify the Model Pin mapping by selecting the matching pins from the Model Pin drop-down
lists, as shown in Figure 2. Close the dialogs when finished.
We can add the voltage sources needed to power the design when simulating.
1. We will place the VDD power source first. Search for the component VSRC in the Libraries
panel and then add the simulation sources.IntLib library to the Available Libraries list. Note
that there are other simulation libraries available in the \Project
Files\Altium2004\Library\Simulation folder.
2. As you place the power source, press TAB to edit its properties. Click on the SIM model
VSRC in the Models list in the Component Properties dialog and click on Edit. In the Sim
Model-Voltage Source/DC Source dialog, check the Model Kind is set to Voltage Source and
the Model Sub-Kind to DC Source.
3. Click on the Parameters tab to set up the voltage value required. Type 5V in the Value field
and tick its Component Parameter box. This will automatically create the parameter ‘Value’ for
you in the Component Properties dialog. Leave the other fields set to zero.
4. Now place the VSS power source, remembering to set the model file parameter Value to –5V.
5. Finally add the Sinusoidal (excitation) Voltage Source, VSIN, also available from the
Simulation Sources. IntLib. Press TAB to edit its properties before placing and change the
Note: Using values like 4k7 for a resistor or 5v5 does not work in Altium Designer. The values
must be 4.7k and 5.5v respectively to function correctly.
Altium Designer allows you to run an array of circuit simulations directly from a schematic. In this
example, we will simulate the output waveforms produced by our Filter circuit.
The simulation can be set up and run using the Simulate menu command or by clicking on the
appropriate button on the Mixed Sim toolbar.
1. With Filter.SchDoc open in the Schematic Editor, select Design » Simulate » Mix Sim to
display the General Setup page of the Analyses Setup dialog.
2. First, we will set up the nodes in the circuit that we want to observe. In the Collect Data For
field, select Node Voltage, Supply Current, Device Current and Power from the list. This
option defines what type of data you want calculated during the simulation run, i.e. it saves
data for the voltage at each node, the current in each supply and the current and power in
each device, Set the SimView Setup to Show Active Signals.
3. In the Available Signals field, double-click on the IN and OUT signal names. As you double-
click on each one, it will move to the Active Signals field.
4. Each individual analysis type is configured on a separate page of the Analyses Setup dialog.
Click on the analysis name to activate the corresponding setup page.
2. Check that the Use Transient Defaults option is disabled, so that the Transient Analysis
parameters can be modified.
3. To specify a 60u simulation window, set the Transient Stop Time field to 60u.
4. Now set the Transient Step Time field to 100n, indicating that the simulation should calculate
a point every 100ns.
5. During simulation, the actual time step is varied automatically to achieve convergence and the
required accuracy. The Maximum Step field limits the variation of the timestep size, so set
the Transient Max Step Time to 200n.
An AC analysis generates output that shows the frequency response of the circuit, calculating the
small-signal AC output variables as a function of frequency. The desired output of an AC small-
signal analysis is usually a transfer function, e.g. voltage gain.
The schematic must contain at least one AC source with a value entered for the AC Magnitude
parameter in its SIM model. We have already set up the parameters of our sinusoidal excitation
source (VSIN) to contain the AC Magnitude value, frequency and amplitude.
1. Make sure the AC Small Signal Analysis checkbox is enabled in the Analyses Setup dialog.
You are now ready to run the enabled analyses. Note that you can also run a simulation without
entering the Analyses Setup dialog every time by clicking on the Run Simulation button on the
Mixed Sim toolbar.
1. Click the OK button at the bottom of the Analyses Setup dialog to run the simulation.
2. If there are no errors in the circuit, a SPICE netlist (*.nsx) is created and passed to the
simulator. Note that the netlist will be regenerated each time a simulation is run.
3. The simulation begins and a simulation data file (*.sdf) will open. The results of each analysis
are shown as a separate chart in the SimData Editor’s Waveform Analysis window. The
Operating Point analysis is performed first to determine the DC bias of the circuit.
4. When the simulation is finished, you should see outputs waveform.
1. In the AC Analysis tab of the Waveform Analyzer window, we will display dB(in), dB(out),
PHASE(in) and PHASE(out).
2. In the Waveform Analyzer window, click on net in. Right-click on the selected net and select
Edit Wave (or select Wave » Edit Wave). The Edit Waveform dialog displays. The selected
wave appears in the Expression field.
3. Select the function from the Complex Functions list, i.e. Magnitude (dB). Click on Create to
see the waveform dB(net_name) on the plot.
4. To create dB(out), right-click on the plot and select Add Wave to Plot. The Add Wave to Plot
dialog displays which works in the same way as the Edit Waveform dialog.
5. Repeat step 4 to create PHASE(in) and PHASE(out) on the second plot by selecting the
Phase(Deg) complex function in the Add Wave to Plot dialog.
1. Click on the net name DB(out) to select the wave in the Waveform Analyzer window.
2. Right-click and select Cursor A. Position cursor A in the low pass section by dragging the
marker.
3. Right-click and select Cursor B. Position cursor B at a point such that B-A=-3 in the
Measurement section of the Sim Data panel.
4. Read off the X value of cursor B in the Measurement Cursors section of the Sim Data panel
and you will find the 3dB point = 20kHz.
Now that we have set up and run some analyses, let’s setup a parameter sweep to see the effect
of varying some of the capacitor/resistor values on the frequency response.
A Parameter Sweep analysis allows you to sweep the value of a device in defined increments,
over a specified range. AC, DC or Transient analyses must also be enabled in order to perform a
Parameter Sweep analysis as the simulator performs multiple passes of each enabled analyses.
This analysis can vary basic component values and model parameters; however subcircuit data is
not varied during the analysis.
1. Click on the Filter.SchDoc tab to make the schematic available in the design window. Select
Design » Simulate » Mixed Sim. Make sure Show Active Signals is selected as the
SIMView Setup in the General Setup page of the Analyses Setup dialog.
2. Click on Parameter Sweep in the Analyses/Options section of the Analyses Setup dialog to
enable this analysis type.
3. Enter the parameter to be swept in the Primary Sweep Variable field. In this example, we will
primary sweep parameter C2, so select it from the drop-down list.
4. To define the range of values for the sweep, set the Primary Start Value to 20p and Primary
Stop Value to –20p. Set the Primary Step Value to define step increments to –10p.
5. Set the Primary Sweep Type option to Relative Values. The values entered in the Primary
Start Value, Primary Stop Value and Primary Step Value fields will be added to the
parameter’s existing or default value.
6. Click on Enable Secondary to add secondary sweep values. When a Secondary parameter
is defined, the Primary parameter is swept for each value of the Secondary parameter. Set up
a secondary sweep for C1 with a Secondary Start Value of –80p and Secondary Stop Value
to 80p. Set the Primary Step Value to define step increments to 80p. Set the Secondary
Sweep Type to Relatives Values.
The Advanced Options page in the Analyses Setup dialog contains a list of internal SPICE
options that can be set to effect the simulation calculations, such as error tolerances and iteration
limits.
To change the value of a SPICE option, e.g. the iteration value for ITL1:
1. Select the variable, e.g. ITL1. Type in the new value in the Value field, or choose the value by
clicking on the scroll arrows that appear.
2. Press Enter, or click in another field, and the Default (Def) option is then disabled.
Note: You could also choose a different integration method from this page, for example, if you
have a circuit design with unexpected high frequency oscillations, you could change the standard
integration method from Trapezoidal to Gear. The Trapezoidal method is relatively fast and
accurate, but tends to oscillate under certain conditions. The Gear methods require longer
simulation times but tend to be more stable. Theoretically, the higher the Gear order, the more
accurate the results but the simulation time increases
You can also perform a simulation directly from a SPICE netlist, allowing you to use the DXP
simulator in conjunction with other schematic capture tools. To do this:
1. Include the netlist in a project file (*.PrjPcb). This allows you to save setup information
between simulation sessions. Setup information is stored in the project file in the same
manner as for a project containing schematics. Note that a project file is automatically added
when you run simulation for the first time from P-CAD. If the netlist is opened as a free
document, setup information will not be stored between sessions of DXP.
2. The DXP simulation engine requires a netlist that includes the component information, design
connectivity, the model data, as well as the setup information. If there is no simulation setup
information already contained in the netlist when you select Simulate » Setup, a new netlist
is created named <original filename>_tmp.nsx. This file contains setup information from the
project file plus the netlist information from the original .nsx file.
If there is simulation information present in the netlist, then the simulation is run directly with no
modifications to the netlist. This is useful for advanced users who want to be able to modify
settings directly in he netlist. Note that you cannot add or configure setup information using the
Analyses Setup dialog if the netlist already includes any setup information.
3. Once you have added a netlist, which has no setup information to a project, you can configure
the analyses by selecting Simulate » Setup.
4. To run a simulation, select Simulate » Run from the menus. The simulation waveforms will
display in a .sdf document.
5. Rename the netlist file so it is not overwritten next time you run a simulation.