AWS Community Day CPH - Three problems of Terraform
Modelling and Simulation Concepts
1. Outline
- Structural Modeling
- Analog Behavioral Modeling
Modelling and Simulation Concepts - Hierarchical simulation
- Ideal Switches
KTH/IMIT/LECS/ARusu
Structural and Functional Modeling
Describing the circuits using circuit elements, like resistors,
Modeling and Simulation inductors, capacitors, diodes, transistors, for which there is a direct
correspondence with the physical components from the printed
circuit board or from an integrated circuit, is based on a structural
Structural Modeling – semiconductor devices (nonlinear representation (structural modeling based on describing the
elements) physical structure of the circuit element by means of a set of
Functional Modeling – any linear/nonlinear elements model parameters described with .MODEL).
(devices or integrated circuits) For simulating the complex circuit elements (like OpAmp) is used
the method of functional (behavioral) description which consists
Hierarchical Simulation – high level circuits (high of grouping more components in a block, by the criteria of the
complexity) function that it generates (for example: gain function, integration
function, derivative function, NAND function, NOR function etc).
The SPICE description of the block will then be an equivalent
circuit that generates the same function as the implementation at
component level (SPICE primitives). This functional model may be
built with less physical elements and specific SPICE elements for
functional description, like the controlled sources (especially those
from Analog Behavioral Modeling) and ideal switches.
The simulation time for the functional models is considerably The hierarchical simulation using subcircuits (.SUBCKT)
shorter than the time needed for simulating the circuit
described at the physic level of used components in physical
assembling. For modeling at high level (describing complex circuits) it is
In SPICE exists the possibility of defining and using recommended hierarchical method, assured by the capacity
subnetworks or blocks that functionally describe various of PSPICE of describing and repeated calling of subcircuits.
circuits (OpAmp, filter, comparator, bistable, etc.), by the In hierarchical description, different blocks can be described
subcircuits (described by .SUBCKT, the body of the at different levels of precision. The simplest representation of
subcircuit .ENDS). a given block function is the ideal model (i.e. ideal OpAmp as
The most general and powerful modeling concept is the a gain function, described by a controlled source). For the
macromodeling. simulation with sufficient precision and an adequate
Macromodels put together functional elements (as controlled convergence, were elaborated more complex models, based
sources) for describing some elements with precise nonlinear on using of some pure functional models which gives the
models of other elements (as diodes, transistors). In this way relation input/output of the circuit, reproducing the
we obtain a simple circuit - the macromodel, with which we characteristics of the circuit. In this models we put together
obtain the original circuit behavior and a short time of the primitives PSPICE and ABM functions (defined with the
simulation. Boyle who described the first macromodel of
controlled sources).
OpAmp applied this concept for the first time.
1
2. Remarks:
* A circuit block which appears more than once in a circuit or Example: OpAmp 741 Subcircuit
more and consists of SPICE primitives is defined as a subcircuit * connections: | non-inverting input
and is accessed as an individual component. * | | inverting input
* Between the .MODEL and .SUBCKT definitions have the * | | | positive power supply
following similarity: while .MODEL defines a set of model
parameters that are to be used in common by all the devices that * | | | | negative power supply
access it, .SUBCKT represents the topology of a circuit that, by * | | | | | output
its terminals or external nodes, can be connected anywhere and .subckt uA741 1 2 3 4 5
anytime in the external circuit.
c1 11 12 8.661E-12
* The number of hierarchical levels which can be defined by
using the .SUBCKT definition, is unlimited (a subcircuit may c2 6 7 30.00E-12
contain another subcircuit, except for a circular one). dc 5 53 dy
* After the hierarchy of a circuit has been defined, the designer de 54 5 dy
must choose different detail and precision levels for each
hierarchical block, the same as in the case of choosing the dlp 90 91 dx
transistors’ models (more simple or more complex, function of dln 92 90 dx
the specified model parameters for representing the various dp 4 3 dx
secondary effects).
egnd 99 0 poly(2),(3,0),(4,0) 0 .5 .5
fb 7 99 poly(5) vb vc ve vlp vln ro1 8 5 50
+0 10.61E6 -1E3 1E3 10E6 -10E6 ro2 7 99 100
ga 6 0 11 12 188.5E-6 rp 3 4 18.16E3
gcm 0 6 10 99 5.961E-9 vb 9 0 dc 0
iee 10 4 dc 15.16E-6 vc 3 53 dc 1
hlim 90 0 vlim 1K ve 54 4 dc 1
q1 11 2 13 qx vlim 7 8 dc 0
q2 12 1 14 qx vlp 91 0 dc 40
r2 6 9 100.0E3 vln 0 92 dc 40
rc1 3 11 5.305E3 .model dx D(Is=800.0E-18 Rs=1)
rc2 3 12 5.305E3 .model dy D(Is=800.00E-18 Rs=1m Cjo=10p)
re1 13 10 1.836E3 .model qx NPN(Is=800.0E-18 Bf=93.75)
re2 14 10 1.836E3 .ends
ree 10 99 13.19E6
Functional Modeling:
Controlled Sources
Analog Behavioral Modeling Using Controlled Sources
In PSPICE there exists the next models for controlled source:
The real subcircuits describe the function generated by a · Voltage controlled voltage source (E):
circuit block using several SPICE primitives, of which the Linear: Vout=E(Vin)
basic ones are the linear controlled sources, the nonlinear Non-linear: Vout=E(Vin1, Vin2,…, Vink)
(polynomial) ones and the controlled sources using the
· Current controlled current source (F):
analog behavioral modeling. Unlike the structural models,
the functional (behavioral) models generate the same function Linear: Iout=F(Iin)
as the block it represents, using only few controlled sources Non-linear: Iout=F(Iin1, Iin2, …, Iink)
within a circuit whose topology is different from the original · Voltage controlled current source (G):
one. Using the properties of the controlled sources, along the Linear: Iout=G(Vin)
years in SPICE there have been developed different
Non-linear: Iout=G(Vin1, Vin2, …, Vink)
functional models which afterwards stood at the basis of
elaborating the macromodels for all the components and the · Current controlled voltage source (H):
physical circuits ( analogue, digital and mixed analogue- Linear: Vout=H(Iin)
digital IC). Non-linear: Vout=H(Iin1, Iin2,…, Iink)
2
3. Observations:
The input of a voltage-controlled source has infinite
impedance, which produce a null current. To avoid the
errors of type floating nodes, we can put in series with
the controlled source very high resistance (usually
E1 F1 G1 H1 very high value 1MEGohm)
+ +
+ + For the current controlled sources (F and H) the input
- -
- - is a voltage source of which current controls the
EPOLY FPOLY GPOLY HPOLY controlled source.
Linear <Xout>=<Xin><gain>
Examples:
Nonlinear (polynomial)
Linear:
<Xout>=f(<Xin1>,…,<Xink>)
E1 (6, 0) (11,12) 188.5E-6 ; V(6,0)=v(11,12)*(188.5e-6)
Defined by a polynomial function of dimension k, POLY(k)
given by the polynomial coefficients P0,P1,P2,…,Pk; k can GIee (20,7),(24,0) 1.0 ; I(Giee)=v(24,0)*1
be: 1,2,… Nonlinear:
The polynomial function of dimension 3(when the control is Egnd 99 0 poly(2) (3,0),(4,0) 0 .5 .5
given by three sources), POLY(3) is: *v(99,0)=0+0.5*v(3,0)+0.5*v(4,0)
Xout=f(X1,X2,X3)= P0+ Fb 7 99 poly(5) vb vc ve vlp vln
+P1X1+P2X2+P3X3+ +0 10.61E6 -1E3 1E3 10E6 -10E6
Hvref 22 7 POLY(1) Vmon 7.15 0.01
+P4X21+P5X1X2+P6X1X3+P7X22+P8X2X3+P9X23+
*v(22,7)=7.15+0.01*I(Vmon)
+P10X31+P11X21X2+…
Analog Behavioral Modeling Implementation
Analog Behavioral Modeling (ABM)
Transfer functions fall into two broad categories: :
The Analog Behavioral Modeling feature allows for flexible Modeling Non-linear (and linear), Instantaneous
descriptions of electronic components in terms of a transfer Relationships – these models enforce a direct
function. In other words, a mathematical relationship is used response to the output at each moment in time:
to model a circuit segment instead of designing the circuit - mathematical expressions (VALUE)
segment component by component.
ABM functions are applicable only at voltage controlled
- lookup table (TABLE)
sources: E,G. Frequency-Domain Device Modeling – these
The input-output relation: models are characterized by output that depends on
<Xout>=f(<Xin>) the current input as well as the input history:
is described by a transfer function using the analog behavior - Laplace transform (LAPLACE)
modeling.
- frequency response table (FREQ)
3
4. Lookup Tables
Mathematical Expressions ETABLE and GTABLE – the transfer function is described by a
EVALUE and GVALUE - the transfer function is written as a table with values (<input>, <output>)
Example:
mathematical expression in standard format.
E_demod_Comparator 59 0
Examples: +TABLE { V(11, 0) } ( (-1uv,0.2v) (1uv,3.5v) )
E_opamp_ideal out 0 VALUE {(2e+5)*v(inp,inn)} G_diode a k TABLE {V(a,k)}
E_Test_VCO_EVCO 53 0 +(-4.71,100m) (-4.7, 10m) (-3,10n) (0,0) (0.2, 1p)
+(0.4, 1n) (0.6,0.1m) (0.7, 0.5m) (0.8,1m)
+VALUE { SIN(6.28*1E6*TIME*V(19, 0)) }
Laplace Transforms
Note that the VALUE controlling function is the recommended ELAPLACE and GLAPLACE – the transfer function is described
alternative to the POLY form. by a function Laplace Transform (in s)
ESUM and GSUM, EMULT and GMULT – realize the sum Example:
function respectively multiplication between the two inputs. ELP 7 0 LAPLACE {v(6)}
Examples: +{1/(1+0.001*s)}
G_lossy 1 2 LAPLACE {V(in)}
E_Test_Summer 47 0 VALUE {V(84,0)+V(104,0)} +{exp(-sqrt(C*s*(R+L*s)))}
E_Test_Multiplicator 5 0 VALUE {V(3,0)*V(7,0)} EHP 2 3 LAPLACE {V(4)}
+{(1+0.01*s)/(1+0.001*s)}
Example:
R1 1k E1 R2
Frequency Response Tables IN+
OUT+
1k
V2
EFREQ and GFREQ – the transfer function is described by R3IN-
OUT-
a table with the frequency response (<freq>, <amplitude 1meg
ELAPLACE
[db]>, <phase [degrees]>) 0 V(%IN+, %IN-)
Example: {(1-0.01*s)/(0.001*s*s)}
EBP 5 7 FREQ {V(3)}
100GV
+(0, -80, -180)
+(1k,-3,0)
+(10k, 0, 0)
50GV
+(100k,-3,0)
+(1meg,-80,+180)
0V
1.0uHz 100uHz 1.0Hz 10KHz
V(R2:1)
Frequency
Ideal Switches
Ideal Switches
The available switch device types are:
Ideal switches are implemented to allow circuit connections Voltage-Controlled Switch (S)
to be changed during simulation. The switches may be Current-Controlled Switch (W)
voltage or current controlled. To create a time controlled S3 SW+ SW- CTRL+ CTRL- SBREAK
switch, simply connect the switch control nodes to a voltage .MODEL SBREAK VSWITCH (RON=1ROFF=1E+6 VON=1 VOFF=0)
source with the appropriate voltage vs. time values. W1 SW+ SW- VCTRLI WBREAK
The switch is not “ideal” because it has a finite “on” .MODEL WBREAK ISWITCH (RON=1 ROFF=1E+6 ION=1E-3 IOFF=0)
resistance and “off” resistance , and changes smoothly
S3
between the two as its control voltage changes. This behavior +
+
is important to allow PSpice to find a continuous set of - -
out
solutions to the circuit being simulated. In practice, the “on” Sbreak
in
resistance may be made very small compared to their other
W1
circuit impedances, and the “off” resistance may be made +
very large compared to the other circuit impedances. ctrl
-
Wbreak
4