within SPICELib.analyses;
model OP
extends src.ANALYSES.OP;
annotation (
Window(
x=0.03,
y=0.02,
width=0.24,
height=0.45,
library=1,
autolayout=1),
Documentation(info="
OP - Bias point calculation
To calculate the DC response of an analog circuit,
SPICELib removes time from the circuit.
This is done by treating all capacitors as open circuits,
all inductors as shorts, and using only the DC values of voltage
and current sources.
The bias point is calculated for any analysis.
However, additional information is reported when the Bias Point
analysis is made. The following information is reported to
the dslog.txt file:
- a list of all analog node voltages
- the currents of all voltage sources and their total power
- a list of small-signal parameters for all devices
Bias point calculation is the most problematic step from the numerical
point of view. The nonlinear equations which describe the circuit's
static behavior must be solved.
SPICELib provides four alterative algorithms for solving the circuit
static model (see Table 1). The SOLVE_STATIC parameter determines which
of the four algorithms to use.
Table 1. Algorithms for solving the circuit static model.
| SOLVE_STATIC=0 |
Static model iteration
The solution of the circuit static model is left in hands of the modeling
environment (for instance, Dymola). SPICELib has two symbols to provide
an initial guess for Newton-Raphson algorithm: NODESET1 and NODESET2.
|
| SOLVE_STATIC=1 |
Static model ramping
The static value of the independent sources is ramped by
SPICELib from zero up to their target values.
The clamping voltages of the IC symbols and the capacitor IC
property are also adequately ramped.
The value of the parameter TIME_SCALE determines the time length
of the ramping. |
| SOLVE_STATIC=2 |
GMIN stepping
GMIN stepping attemps to find a solution for the static model
(with power supplies at 100%) by starting with a large value of
GMIN, initially 1e10 times the nominal value.
If a solution is found at this setting, SPICELib reduces
GMIN by a factor of 10 and tries again. This continues until either
GMIN is back to the nominal value, or a repeating cycle fails to converge.
|
| SOLVE_STATIC=3 |
Dynamic model ramping
The initial condition to iterate the static model is obtained by simulating
the large-signal model. A transient analysis is performed: all sources are ramped
up from zero to the desired initial value and this value is held
for some time to allow the circuit to stabilise. Then, the
voltage values calculated from this transient analysis are used as initial
conditions for solving the static model.
|
Note:
The algorithms static model iteration,
static model ramping, and
GMIN stepping are supported by PSpice.
PSpice first tries to solve the static model of the circuit using the
Newton-Raphson algorithm. If a solution is not found and GMIN
stepping is enabled, then GMIN algorithm is applied. If it also
fails or it is not enabled, then \"static model ramping\" is
applied.
The algorithm dynamic model ramping is proposed in
\"Cellier F.E. (1991): Continuous System Modeling. Springer-Verlag\".
"),
Icon(
Rectangle(extent=[-90, -50; 60, 35], style(thickness= 2, color=3)),
Line(points=[-90, 35; -60, 50],style(thickness=2, color=3)),
Line(points=[60, 35; 90, 50],style(thickness=2, color=3)),
Line(points=[-60, 50; 90, 50],style(thickness=2, color=3)),
Line(points=[90, -35; 90, 50],style(thickness=2, color=3)),
Line(points=[60, -50; 90, -35],style(thickness=2, color=3)),
Text(extent=[-90, -50; 60, 35], string=".OP",style(color=1))
));
end OP;
model AC
extends src.ANALYSES.AC;
annotation (
Window(
x=0.03,
y=0.02,
width=0.24,
height=0.45,
library=1,
autolayout=1),
Documentation(info="
AC sweep - Frequency response of the circuit
AC sweep is a frequency response analysis. SPICELib calculates
the small-signal response of the circuit to a combination of inputs
by transforming it around the bias point and treating it as a linear
circuit.
- Nonlinear devices are transformed to linear circuits about
their bias point value before SPICELib runs the linear
(small-signal) analysis.
- Because AC sweep analysis is a linear analysis, it only considers
the gain and the phase response of the circuit; it does not limit voltages
or currents.
The best way to use AC sweep analysis is to set the source magnitude to one.
This way, the measured output equals the gain, relative to the input source,
at that output.
Setting up an AC analysis
To run an AC sweep analysis, you need to place and connect one or more
independent sources and then set the AC magnitude and phase for each source.
Each independent source in your circuit contains its own AC specification
for magnitude and phase.
The parameters defining the frequency sweep are shown in Table 1.
Table 1. Parameters.
| TYPE_AC_SWEEP |
It defines the frequency sweep type:
- TYPE_AC_SWEEP=0 - Linear.
- TYPE_AC_SWEEP=1 - Logarithmically by decades.
|
| POINTS_NUMBER |
Number of sweep points:
- TYPE_AC_SWEEP=0 - Total number of points.
- TYPE_AC_SWEEP=1 - Total number of points per decade.
|
| START_FREQUENCY |
Starting frequency for the sweep.
|
| END_FREQUENCY |
Ending frequency for the sweep.
|
"),
Icon(
Rectangle(extent=[-90, -50; 60, 35], style(thickness= 2, color=3)),
Line(points=[-90, 35; -60, 50],style(thickness=2, color=3)),
Line(points=[60, 35; 90, 50],style(thickness=2, color=3)),
Line(points=[-60, 50; 90, 50],style(thickness=2, color=3)),
Line(points=[90, -35; 90, 50],style(thickness=2, color=3)),
Line(points=[60, -50; 90, -35],style(thickness=2, color=3)),
Text(extent=[-90, -50; 60, 35], string=".AC",style(color=1))
));
end AC;
model TRAN
extends src.ANALYSES.TRAN;
annotation (
Window(
x=0.03,
y=0.02,
width=0.24,
height=0.45,
library=1,
autolayout=1),
Documentation(info="
TRAN - Transient analysis
The Transient response analysis causes the response of the circuit
to be calculated from TIME=0 to a specified time (see the
note below). During a transient analysis, any or all of the independent
sources may have time-varying values.
The parameters defining the transient analysis are shown in Table 1.
Table 1. Parameters
| TSTOP |
Length of the transient simulation. |
| SKIPBP |
SKIPBP=false
The transient analysis does its own calculation of a bias point to start
with, using the same technique as described for Bias Point. This is necessary
because the initial values of the sources can be different from their DC
values.
Two equivalent procedures are provided to specify the analysis initial
conditions: the IC symbols and the IC property.
SKIPBP=true
The bias point calculation is skipped and the simulation proceeds directly
with transient analysis at TIME=0.
The large-signal circuit state is initialised to the IC-property corresponding
values.
Devices with IC property defined start
with the specified voltage or current value; however, all other such devices
have an initial voltage or current of zero. IC symbols are ignored.
|
Simulation time during transient analysis
When the transient simulation is started, the value of Modelica
variable time is different from zero. For this reason, a
variable is defined to measure the transient simulation time:
TIME.
"),
Icon(
Rectangle(extent=[-90, -50; 60, 35], style(thickness= 2, color=3)),
Line(points=[-90, 35; -60, 50],style(thickness=2, color=3)),
Line(points=[60, 35; 90, 50],style(thickness=2, color=3)),
Line(points=[-60, 50; 90, 50],style(thickness=2, color=3)),
Line(points=[90, -35; 90, 50],style(thickness=2, color=3)),
Line(points=[60, -50; 90, -35],style(thickness=2, color=3)),
Text(extent=[-90, -50; 60, 35], string=".TRAN",style(color=1))
));
end TRAN;