Custom Modeling with Symbolically-Defined Devices
This section presents a powerful capability of Advanced Design System: the ability to create a user-defined nonlinear component which can simulate both the large-signal and small-signal behavior of a nonlinear device, without the use of source code.
The symbolically-defined device (SDD) is an equation-based component that enables you to quickly and easily define custom, non-linear components. These components are multi-port devices that can be modeled directly on a schematic. You define an SDD by specifying equations that relate port currents, port voltages, and their derivatives. Equations can also reference the current flowing in another device. Once a model is defined, it can be used with any circuit simulator in Advanced Design System. Derivatives are automatically calculated during the simulation.
Before the SDD, the techniques that were available for modeling nonlinear devices were either limited or cumbersome. One technique was to model the device equations using discrete components-usually resistors, capacitors, inductors, and controlled sources. Since most simulators restrict these devices to be linear, this approach could be used to model only the small-signal (AC) behavior of the nonlinear device, and you could not achieve an accurate DC simulation or harmonic balance simulation. A second approach would be to use measured data, typically S-parameters, to model the device, but this approach, too, modeled only small-signal behavior.
The only technique previously available to develop a model that simulated both the large-signal and small-signal behavior of a nonlinear device required writing source code, which was a lengthy task. For example, a typical BJT model would require over 4500 lines of code, and could take an experienced engineer well over a month to write and debug. There also is the requirement that the simulator be linked to your compiled code.
By comparison, the SDD offers a simple, fast way to develop and modify complex models. Equations can be modified easily, and simulation results can be compared to measured data within Advanced Design System.
The SDD can also model high-level circuit blocks such as mixers or amplifiers. By using a single, high-level component instead of a subcircuit of low-level devices, simulations run more quickly. If second- and third-order effects of low-level subcircuits need to be analyzed, the SDD can be modified to develop a more comprehensive implementation of the circuit.
The examples in this section start with a simple nonlinear resistor, then more complex devices, like the Gummel-Poon charge-storage model of the bipolar junction transistor, are described. With the techniques used to develop these models, you can develop your own, custom, nonlinear components.
This section has the following sections:
- Writing SDD Equations explains how to write the equations that define an SDD.
- Adding an SDD to a Schematic describes how to add an SDD to a schematic and enter equations.
- SDD Examples show how to use SDDs to define a wide range of nonlinear circuit components.
- Modified Nodal Analysis is a discussion of modified nodal analysis and branch equations.
- Error Messages lists SDD error messages and their meaning.
Detailed knowledge of microwave and RF circuit theory and of building and analyzing circuits using Advanced Design System is assumed.
Writing SDD Equations
The symbolically-defined device is represented on the circuit schematic as an n -port device, with up to 10 ports. The equations that specify the voltage and current of a port are defined as functions of other voltages and currents. An example of a 2-port SDD is shown here.
The schematic symbol for a two-port SDD
Port Variables
For each port on the SDD, there are voltage and current port variables. A variable begins with an underscore, followed by v (for voltage) or i (for current), and the port number. For example, current and voltage variables for port one are _i1
and _v1
, respectively. You can rename variables to better suit the device being modeled. In text, v n and i n are used to refer to _vn
and _in
.
By convention, a positive port current flows into the terminal marked +.
Defining Constitutive Relationships with Equations
A well-defined n port is described by n equations, called constitutive relationships, that relate the n port currents and the n port voltages. For linear devices, the constitutive relationships are often specified in the frequency domain (for example, as admittances), but since the SDD is used to model nonlinear devices, its constitutive relationships are specified in the time domain.
The constitutive relationships may be specified in either explicit or implicit representations.
Explicit Representation
With the explicit representation, the current at port k is specified as a function of port voltages:
An example of an explicit equation is:
In this example, the current at port 1 is calculated by dividing the voltage at port 1 by 50.
Note
Each port of the SDD must have at least one equation. For an unused port n, apply the equation I[ n,0] = 0.0 (an open circuit) to the unused port.
Note
Although not often utilized in standard circuit models, the explicit equation defining the ik port current can actually be a function of any of the port voltages and any of the other port currents for ports that are defined with implicit equations. Since port k is being defined with an explicit equation, the ik port variable is not available and so cannot be used to implicitly define ik.
Implicit Representation
The implicit representation uses an implicit relationship between any of the port currents and any of the port voltages:
An example of an implicit equation is:
This equation is part of the Gummel-Poon example.
If you want to use the current variable ( _in ) of a port in another equation, you must define the port using an implicit equation.
A procedure for how to enter equations is in the section Adding an SDD to a Schematic.
Explicit Versus Implicit Representations
The explicit representation is a voltage-controlled representation and can implement only voltage-controlled expressions. The implicit representation has no such restriction. It can model equations that are voltage-controlled, current-controlled, or use some other control.
Although implicit equations have no restrictions, explicit equations are more "natural" and more efficient. The explicit representation is more natural simply because many models are expressed in the voltage-controlled form i = f(v). The corresponding implicit equation is i - f(v) = 0, which is less intuitive.
Explicit equations use standard nodal analysis, that is, the sum of the currents entering and exiting a node equal zero. Implicit equations use modified nodal analysis, which adds a branch equation and makes i k available as a variable. For more information on modified modal analysis, refer to the section Modified Nodal Analysis.
The explicit representation is more efficient during a simulation because it is a voltage-controlled representation and, therefore, does not create any new variables in the modified nodal equations. With implicit equations, for every port that uses an implicit representation, the port current is appended to the list of branch currents and the port equation is appended to the modified nodal analysis equations. The result is a larger system of equations with a larger number of unknowns (for a discussion of modified nodal analysis and branch equations, see the section Modified Nodal Analysis).
In general, you should use the implicit representation only when the explicit representation is insufficient. For example, for a given port n, the port current variable _in can be used in other equation s only if port n is defined with an implicit equation.
Continuity
Many of the circuit-solving algorithms used by the simulator are based on the Newton-Raphson algorithm. Consequently, constitutive relationships should conform to the following:
- The functions must be continuous with respect to v and i.
- Ideally, the functions should be differentiable with respect to v and i, but it is not required.
- It is desirable if the derivatives are continuous with respect to v and i, but this is not necessary, for example, a step discontinuity in the derivative is often acceptable.
An example where these considerations are important is piecewise-defined devices where the constitutive relationship changes depending on the region of operation. The constitutive relationships should be carefully pieced together to ensure continuous derivatives at the region boundaries. An example is given in Full Model Diode, with Capacitance and Resistance.
Although continuous derivatives are not required, if a constitutive relationship does not have continuous derivatives, the simulator may have trouble converging, even at low power levels. If you are having convergence problems with an SDD, the continuity of derivatives is the first thing to check.
Weighting Functions
A weighting function is a frequency-dependent expression used to scale the spectrum of a port current.Weighting functions are evaluated in the frequency domain.
There are two predefined weighting functions. Weighting function 0 is defined to be identically one. It is used when no weighting is desired. Weighting function 1 is defined as jw and is used when a time derivative is desired.
You can define other weighting functions, starting with the number 2. Weighting functions must be defined in the frequency domain. Weighting functions can, for example, correspond to time delay or to a low-pass or high-pass filter. An example of a time delay weighting function is:
Be aware that the SDD will be evaluated at DC, so a user-defined weighting function should be well behaved at jω=0. For example, you might want to use a weighting function of 1/jω to perform time integration, but this will cause a divide-by-zero error at DC.
For information on how to enter weighting functions as part of an SDD definition, refer to Defining a Weighting Function.
Weighting Function Example
To understand how the weighting functions are used, this example outlines the steps taken to evaluate the port current of an SDD during a harmonic balance simulation.
For simplicity, consider a one-port SDD with an explicit representation for port one:
I[1,1] = f(_v1)
where f is some nonlinear function.
During a harmonic balance simulation, the simulator supplies the SDD with the spectrum V1(ω) of the port voltage and asks the SDD for the spectrum I1(ω) of the corresponding port current. To evaluate the current, the SDD performs four steps:
- Perform an inverse Fourier transform on the voltage spectrum V1(ω) to obtain a (sampled) time waveform v1(t).
- Evaluate the nonlinearity f point by point along the time waveform. The result is the (sampled) time waveform .
- Perform a Fourier transform on the time waveform to obtain its spectrum .
-
Scale the components of this spectrum using the weighting function to obtain the spectrum
of the port current.Note
The nonlinearity is evaluated in the time domain. The weighting function is evaluated in the frequency domain.
Since multiplication by jω in the frequency domain is equivalent to time differentiation in the time domain, in this example, the current is:
Controlling Currents
Not only can the equations for an SDD be written in terms of its own port voltages and currents, an SDD can also be set up to reference the current flowing in another device. The devices that can be referenced are limited to either voltage sources or current probes in the same network. For instructions on how to define a controlling current, refer to the section Defining a Controlling Current. An example appears in Controlling Current, Instantaneous Power.
Specifying More than One Equation for a Port
It is possible to specify more than one expression for a port, but they must be either all implicit or all explicit expressions. And, each port must have at least one equation. When more than one expression is given for a port, the SDD calculates a separate spectrum for each expression. Each spectrum is weighted by the weighting function specified for that expression. The SDD then sums up the individual spectra to get the final spectrum. Explicit and implicit examples follow.
Explicit Cases
The two SDD equations
I[1,0] = f1(_v1)
I[1,0] = f2(_v1)
and
I[1,0] = f1(_v1) + f2(_v1)
are equivalent and implement
The SDD equations
I[1,0] = f1(_v1)
I[1,1] = f2(_v1)
implement
Implicit Cases
The two SDD equations
F[1,0] = f1(_v1, _i1)
F[1,0] = f2(_v1, _i1)
and
F[1,0] = f1(_v1, i1) + f2(_v1, _i1)
are equivalent and implement
In the case of an implicit representation, if there is only one expression for a port or, equivalently, more than one expression for a port but all the expressions use the same weighting function, do not use a weighting function other than 0. To see this, assume that in the previous example the weighting function is not weighting function number 0 but is the user-defined function H(ω). Then in the frequency domain, the implicit equation becomes
which is equivalent to
Here, upper-case letters are used to indicate frequency-domain values, and this assumes that the weighting function does not evaluate to zero at a frequency of interest.
You would want to use a weighting function other than 0 with an implicit representation when two or more expressions are used for a port and different weighting functions are used by the expressions. For example, the SDD equations in this example:
F[1,0] = f1(_v1,_i1)
F[1,1] = f2(_v1, _i1)
implement
Using an SDD to Generate Noise
An SDD generates noise in all four types of noise analysis: linear (AC and S-parameter), harmonic balance (mixer and phase noise), transient noise, and Circuit Envelope noise. If you want to add 1/f noise to a current source, consider using a standard current noise source and set its value with an equation so it is a function of frequency:
In = 1e-12 + 1e-6/(freq+1)
In the denominator, the 1 is added so that the equation is not divided by zero when freq=0.
Summary
- The SDD is an n -port device.
- For port n, the voltage is denoted
_vn
. The current is denoted_in
. Positive current flows into the terminal marked+
. - The explicit representation is useful for voltage-controlled nonlinearities:
- The implicit representation is useful for the general nonlinearity:
- Weighting functions are used to give a frequency weighting to a spectrum. Weighting function number 0 corresponds to no (that is, unity) weighting. Weighting function number 1 corresponds to jω and is used to implement a time derivative.
- SDD equations can reference the current flowing in voltage sources or current probes in the same network.
- When more than one expression is given for a port, each expression is evaluated, converted into a spectrum, and weighted separately from the others. The resulting spectra are added together to get the final spectrum.
- An SDD generates noise in all four types of noise analysis.
Adding an SDD to a Schematic
SDDs can be added to a schematic in the same way as other components are added and connected to a circuit. This section describes the mechanics of adding an SDD component to a schematic and defining it.
To add an SDD:
- From the Component Palette List, choose Eqn-based Nonlinear.
- Select the SDD with the desired number of ports, add it to the schematic, and return to select mode.
- Double-click the SDD symbol to edit the component.
- The equations that define the SDD are entered as parameters in the Select Parameters list. The left side of an equation identifies the type of equation, the port it is applied to, and the weighting function. Select the equation you want to edit. (Note the buttons below the list to add, cut, and paste equations as necessary.)
- Under Parameter Entry Mode, specify the type of equation: implicit, or explicit. For more information on the types of equations, refer to the section Defining Constitutive Relationships with Equations.
- In the Port field, enter the number of the port that you want the equation to apply to.
- In the Weight field, enter the weighting function that you want to use. Predefined weighting functions are 0 (the equation is multiplied by 1) and 1 (the equation is multiplied by jw ). For more information on weighting functions, refer to the section Weighting Functions. For information on the procedure for adding a different weighting function to an SDD, refer to the section Defining a Weighting Function.
- In the Formula field, enter the equation. For long equations, click More for a larger entry area.
- Click Apply to update the equation.
- Add and edit other equations for other ports as desired.
- Click OK to accept the changes and dismiss the dialog box.
Defining a Controlling Current
The equations for an SDD can be written in terms of the current flowing in another device. For example, you can use the current flowing through a voltage source as part of an SDD equation. You can specify only the current through devices that are either voltage sources or current probes as control currents, and they must be in the same network as the SDD. To specify a current as a control current, you enter the instance name of the device in the C[] parameter of the SDD. For example, to use the current flowing through a voltage source called SRC1, you would set the current parameter C[1] to SRC1. The SDD equations use the variable _c1 to refer to this current.
To define a controlling current:
- Double-click the SDD component to open the Edit Component dialog box.
- Select C[1]= in the Select Parameters list.
- Choose String and Reference as the parameter entry mode; File based should not be used. In the C[Repeated] field, type the instance name of the device.
An example of a parameter definition is shown here. - To add another controlling current, select C[1] and click Add. The parameter C[2] appears in the parameter list. You can define this parameter for another current.
- Click Apply to update the SDD definition.
- To use the controlling current in an equation, type c _n in your SDD equation, for example, _v2 + _v1*_c1.
- Click OK to accept the changes and dismiss the dialog box.
Defining a Weighting Function
A weighting function is a frequency-dependent expression that is used to scale the spectrum of a port current. Weighting functions are evaluated in the frequency domain. Predefined weighting functions are 0 (the equation is multiplied by 1) and 1 (the equation is multiplied by jw ). You can define your own weighting functions.
To define a weighting function:
- Double-click the SDD component to open the Edit Component dialog box.
- Select any equation in the Select Parameters list.
- Click Add. The new equation is automatically selected.
- From the Parameter Entry Mode list, choose Weighting. Note that an H appears on the left side of the equation to denote it is a weighting function.
- In the Weight field, enter a value greater than 1. Each weighting function must have a unique value.
- In the Formula field, enter the weighting function.
- Click Apply to update the SDD definition.
- Click OK to accept the changes and dismiss the dialog box.
SDD Examples
This section offers the following detailed examples that show how to use symbolically-defined devices to define a wide range of nonlinear circuit components. The examples include:
- Nonlinear Resistor
- Ideal Amplifier Block
- Ideal Mixer
- Nonlinear Capacitors
- Full Model Diode, with Capacitance and Resistance
- Nonlinear Inductors
- Controlling Current, Instantaneous Power
- Gummel-Poon BJT
You can find most of these examples in the software under the Examples directory in this location:
Tutorial/SDD_Examples_prj/networks
Nonlinear Resistor
This section describes how to use SDDs nonlinear resistors with a cubic nonlinearity example. This example is under the Examples directory in the following location:
Tutorials/SDD_Examples_prj/networks/Cubic.dsn
The nonlinear two-terminal resistor with constitutive relationship
exhibits a negative resistance for small v, and is widely used in the study of oscillation theory. This two-terminal device can be modeled using a one-port SDD, shown below. Since this is a voltage-controlled resistor, the SDD is defined using an explicit equation.
With this setup, note the following points:
- This constitutive relationship specifies the current of port 1, and it is written as a function of the voltage at port 1.
- The Weight field is set to 0 to indicate that the weighting function is identically 1.
Results of DC and harmonic balance simulations on this component are shown in the following figure.
Simulation Results For the Nonlinear Cubic Resistor
The data displays show:
- A DC plot of current versus voltage showing the cubic nature of the resistor.
- The spectrum of the resistor current when a 1MHz, 3 V sinusoidal waveform is applied across the resistor. Note that the fundamental and the third harmonic are the only non-zero terms.
- Current versus time with the same waveform applied at the input.
Ideal Amplifier Block
This example is under the Examples directory in the following location:
Tutorials/SDD_Examples_prj/networks/NonlinearAmp.dsn
A simple large-signal model for the gain of an ideal amplifier block can be expressed as
where:
- vi is the input voltage
- vo is the output voltage
- Vs is the power supply voltage
- A is the gain in the linear region
This relationship has the characteristics that the gain is A for small vi , and that vo saturates at ±Vs , as shown in the following figure (a).
The amplifier is a two-port device, so one more equation is required to specify the constitutive relationship. In the case of the following figure (a), where the ideal amplifier has infinite input resistance and zero output resistance, you could use the above equation and the equation
to define the constitutive relationship.To model the amplifier as shown in the following figure (b), with finite input resistance Ri and non-zero output resistance Ro, the equations will be different. The SDD in this example is based on this model.
Equivalent Circuit Model for an Ideal Saturating Amplifier
Current through the input resistance Ri can be expressed as:
You could use this equation directly as the equation for port 1, but then it would be impossible to set Ri=
. So, rewrite the explicit equation for port 1 using input conductance Gi instead:For port 2, the non-zero output resistance Ro is included in the model by adding a term to the equation
to account for the voltage drop across the output resistance:Note
We can use the port 2 current in this equation because the equation for port 2 is an implicit equation. Recall that when the equation for port n is implicit, the simulator appends the current through port n to the list of unknowns and, therefore, the value of _in is available.
This model of an ideal amplifier as two-port SDD with the mixture of explicit and implicit equations is shown below.
Note the following points:
- There are several parameters whose values are set by the user then passed to the device: G i (input conductance), A (gain), V s (saturated output voltage), and R o (output resistance).
- _v1, _v2, and _i2 are assigned to variables ( vi, vo, and io, respectively), and the variables are used in the SDD equations.
- The final form of the implicit equation for port 2 is written so that it equates to zero.
The SDD is simulated in the design TestAmp.dsn. DC and harmonic balance simulation results are shown in the following figure.
- The first plot is a DC plot of vo versus vi.
- The second plot is harmonic balance results showing output power and gain as the amplifier saturates.
Simulation Results for the Ideal Saturating Amplifier
Ideal Mixer
This example is under the Examples directory in the following location:
Tutorials/SDD_Examples_prj/networks/IdealMixer.dsn
The equivalent circuit for an ideal mixer is shown in the following figure.
Equivalent Circuit for an Ideal Mixer
The ideal mixer is a three-port device, so three equations are required to define its constitutive relationship. Based on the circuit above, the following three equations can be used to represent the current at each port:
irf = vrf /Z
ilo = vlo /Z
iif = (vif − vrf vlo )/Z
These equations are voltage-controlled and can be implemented using explicit SDD equations. The SDD is shown next.
In this setup _v1, _v2, and _v3 were used in the equations. Each port has a named node, so the voltages will appear in the data display.
RF-LO-IF Example
An RF input of 1V at 3 GHz and an LO input of 1V at 4 GHZ yields an IF output of 0.25V at 1 GHz and 7 GHz, provided the IF output is matched (terminated in Z). The one scaling down by a factor of two comes from the ideal mixing process, while the other comes from the voltage being split over the two Zs.
The following figure shows the results of a transient analysis simulation of the mixer. It shows the amplitude modulation effects in the time waveform of vif. For this simulation, vrf is a sinusoid at 100 MHz with a DC offset, and vlo is a sinusoid at 2 GHz.
Simulation Results for the Ideal Mixer
Nonlinear Capacitors
So far, all of the examples have dealt with nonlinear resistors. This section describes nonlinear capacitors.
A nonlinear, voltage-controlled capacitor is defined in terms of its charge-voltage, or q - v, relationship
For example, the q - v relationship for a linear two-terminal capacitor is
which, when differentiated with respect to time, yields the more familiar capacitor equation
To use the SDD to model a nonlinear voltage-controlled capacitor, note that given a nonlinear charge Q(v), the current is
This is a voltage-controlled expression for the current. It differs from the constitutive relationship of a voltage-controlled resistor because it contains a time derivative.
The time derivative is implemented in the SDD by specifying weighting function number 1. Weighting function number 1 is predefined as j ω which is the frequency-domain version of the time derivative.
Obtaining Charge From Capacitance
Often the equation for a nonlinear capacitor is specified not in terms of charge, but in terms of a nonlinear capacitance C(v) where
Given this representation, the charge function is obtained by integrating the capacitance
where we have explicitly included the arbitrary constant of integration Q0.
If for some reason, the charge cannot be calculated, then the alternative technique presented in Alternative Implementation of a Capacitor can be used to implement the capacitor.
Multi-port Capacitors
A nonlinear voltage-controlled two-port capacitor is usually defined by a capacitance matrix
The capacitor currents are given by
The charge for a two-port capacitance is defined as the function Q(v1,v2) such that C(v1, v2) is the derivative (that is, Jacobian) of Q(v1,v2). It follows that Q(v1,v2) exists if and only if
and
If Q(v1,v2) does not exist, then the technique presented in Alternative Implementation of a Capacitor can be used to implement the capacitor.
Full Model Diode, with Capacitance and Resistance
This example is under the Examples directory in the following location:
Tutorials/SDD_Examples_prj/networks/SDD_Diode.dsn
Capacitance. The junction capacitance of a reverse-biased pn diode may be written as
The subscript r signifies reverse bias.
To develop this expression into an equation that can be used in an SDD, you integrate Cr(v) with respect to v to get an expression for the charge:
where the arbitrary constant of integration is chosen so that Qr(Vo) = 0.
There is a limitation to this equation because it is valid only for v < Vo. Though it is useful in applications where the diode is always reverse biased (for example, a varactor diode), it is not suitable for a general harmonic-balance analysis (or a DC analysis, for that matter) where the bias voltage may exceed Vo.
A better diode model has the charge model extended into the forward-biased region, plus resistance. Capacitance is described next, followed by resistance and the SDD implementation. Besides yielding a valuable result, this example also highlights some useful techniques for ensuring the continuity of charge and its derivative.
To increase the range of operation of the model, you can extend the capacitance into the region v > Vo using a linear extrapolation. To do this, choose α such that 0 < α <1.
Let the previous Cr (v) equation be valid for v < αVo, and for v < αVo use
where:
- C' r (v) is the derivative of Cr(v) with respect to v
- The subscript f signifies forward bias
- Cf is a linear extension of Cr that matches the value and slope of Cr at v = α Vo
This definition of Cf ensures that, when joined with Cr, the capacitance and its derivative are continuous. The boundary between reverse and forward bias is chosen to be αVo instead of Vo because the slope of Cr at Vo is infinite.
The next step is to integrate Cf (v) to obtain
where the constant of integration is chosen so that Qf(αVo) = Qr(αVo). This equation can be rewritten as
The overall expression for the junction charge is given as
Note
Q(v) and its derivatives are guaranteed continuous due to the definition of Cf(v) and due to the choice of the constant of integration for Qf(v).
Resistance. The equation for the resistive behavior of a pn junction is the ideal diode equation
Thus, total diode current has two components, one from the ideal diode equation and one from the charge. This is handled in the SDD by specifying two equations for the current of port one, one using weighting function number 0 and the other using weighting function number 1.
Implementation. The SDD implementation is shown next.
Note the following points:
- The current in the diode is based on two SDD equations:
- The first equation models the resistive behavior of the diode. It uses expressions listed in the Var Eqn component under Current equations. These include the variables max_exp, max_arg, the function exp_soft(x), and the variable Vt. They determine what value Is is multiplied by. exp_soft is the soft exponential function and is used to prevent overflow problems when taking the exponent of a large number. It is the same as a normal exponential except it becomes a linear extrapolation when its argument is such that the normal exponential would exceed max_exp.
- The second equation models the charge. It uses the expressions listed in the Var Eqn component under Charge equations. The value of _v1 is passed to the function Q(v), where it is evaluated and the result is returned to the SDD. There are several parameters with user-defined values, which also enter into the calculations: Is (), Co (), Vo (), and alpha () (these value are passed from TestDiode.dsn ).
- A weighting function is used in the second SDD equation. It is important to understand how the weighting function is used by the SDD and is reviewed here.
- The spectrum for the port voltage _v1 is inverse Fourier transformed into the time domain.
- The constitutive relation (in this case, -2*C0*sqrt(V0*(V0-vv) ) is evaluated point-by-point in the time domain.
- The resulting waveform (which is the charge for port one) is Fourier transformed into the frequency domain.
- The weighting function (in this case, jw ) is applied in the frequency domain. The result is the spectrum of the port current _i1.
- When two explicit equations are specified for a single port, the SDD calculates a spectrum representing the (weighted) result of the first equation, calculates a spectrum representing the (weighted) result of the second equation, and then sums the two spectra to get the final spectrum for the port current.
The SDD is simulated in the design TestDiode.dsn. This design uses the diode capacitance as the C in an RC circuit. It also allows the independent adjustment of the diode bias voltage. The following figure shows the frequency response of the RC circuit as the bias voltage is varied fro -1 to 2 V.
Full Varactor Diode Model Results with C0 = 1 pF, V0 = 0.65V, and α = 0.7
Nonlinear Inductors
A nonlinear current-controlled inductor is defined in terms of its flux-current, or φ -i, relationship
For example, the φ-i relationship for a linear two-terminal inductor is
which, when differentiated with respect to time, yields the more familiar inductor equation
To model a current-controlled nonlinear inductor, differentiate
with respect to time to obtain
which can be rewritten as
This expression can be implemented using an implicit representation.
For example, the SDD implementation for the nonlinear inductor specified by
is
Note
This is a good example of a case when using weighting functions with the implicit representation makes sense.
Note that Advanced Design System also includes a built-in nonlinear inductor ( NonlinL ) available from the Eqn Based-Nonlinear component palette.
Obtaining Flux From Inductance
Often the equation for a nonlinear inductor is specified not in terms of flux, but in terms of a nonlinear inductance L(i) where
Given this representation, the flux function is obtained by integrating the inductance
where we have explicitly included the arbitrary constant of integration φ0.
Controlling Current, Instantaneous Power
This example is under the Examples directory in the following location:
Tutorials/SDD_Examples_prj/networks/RemCC.dsn
This example illustrates how to use a current as part of an SDD equation, where the current is from another device in the circuit. For more background on controlling currents and how to implement them, refer to Controlling Currents and Defining a Controlling Current.
In this example, an SDD is used to calculate the instantaneous power dissipated through resistor R1. The circuit containing R1 is shown here.
Making the power calculation requires both the voltage across R1 and the current through R1. These values are supplied to the SDD in the following manner:
- The voltage across R1, labeled Vdd, is applied to port 1 of the SDD. Note that the current at this port is set to zero.
- The current through R1 is specified by using the current through the voltage source Vdds, and reversing polarity. Recall that only the current through either a voltage source or current probe can be used as a controlling current. The instance name of the component is used to specify the controlling current, as shown in the SDD illustration. In a more complex circuit, you might consider adding a current probe.
- Although the equation to find power dissipated in R1 is simply Vdd* -_c1, it must be written in a form that is suitable for the SDD. The first step is to substitute _v1 for Vdd. Then note that if:
_v2 = -_v1*_c1
_v2 + _v1*_c1
Gummel-Poon BJT
This example is under the Examples directory in the following location:Tutorials/SDD_Examples_prj/networks/GumPoon.dsn
Equivalent Circuit Model for the Gummel-Poon BJT
Note
The Gummel-Poon model shown here is only an illustrative example of SDD. For a Gummel-Poon BJT model that is fully tested and qualified, please use the Devices-BJT component palette in Advanced Design System.
Current Equations
Capacitance Equations
Adding the Nonlinear Base Resistance
In the full Gummel-Poon model, the base resistance Rbb is a nonlinear resistance that depends on ib. When the base resistance is nonlinear, it cannot be modeled by a discrete resistor-it must be included in the SDD equations.
The constitutive relationships are:
Adding the Split Base-Collector Charge
Now that the nonlinear base resistance has been modeled, adding the split base-collector capacitance is straight-forward. First, modify the equation for Qb2 to account for Xcjc. Second, insert the equation for Qb1. Finally, add the time derivative of Qb1 to ib and subtract it from ic:
SDD Implementation
This implemented SDD is under the Examples directory in the following location:
Tutorials/SDD_Examples_prj/networks/GumPoon.dsn
For optimal viewing, you should open the design. The components and equations are shown below.
Note the following points.
- Each port has two equations, one for the current and one for the charge.
- The capacitance equations were integrated to obtain charge equations:
- The integration is simplified for the first term of Cbe since the first term is a partial derivative, the integration and partial derivative effectively cancel.
- The integration is simplified for the first term in Cbc since the first term is an exponential, and integration of an exponential is another exponential.
- The other charges are similar in form to the charge given earlier in the section, Full Model Diode, with Capacitance and Resistance.
- The diode() and charge() functions are used to make the equations more readable and to eliminate the duplication of common expressions.
- Except for one difference, the SDD BJT presented here is identical to the compiled BJT model built-in to the simulator (in the simulator, the values of Vje and Vjc are adjusted to reflect the bandgap characteristics of silicon).
- The SDD BJT uses about 55 equations. The built-in BJT model requires over 4500 lines of C code.
- The SDD BJT was written in about one day, and debugged in about one day. The built-in BJT model required about two weeks to write and another two weeks to debug.
Examples Summary
- A voltage-controlled nonlinear resistor is described by its i-v relation
- A two-terminal voltage-controlled nonlinear resistor i = I(v) is implemented by
I[1,0] = _v1 - A general nonlinear resistor is described by an implicit i-v relation
- A general two-terminal nonlinear resistor f(i,v) = 0 is implemented by
I[1,0] = f(_i1, _v1) - A voltage-controlled nonlinear capacitor is described by its q-v relation
- A two-terminal voltage-controlled nonlinear capacitor q = Q(v) is implemented by
I[1,1] = Q(_v1) - A two-terminal voltage-controlled device with resistance i = I(v) and charge q = Q(v) is implemented by
I{[1,0] = I(_v1)
I[1,1] = Q(_v1) - If a capacitor is specified by a nonlinear capacitance C(v) where
then the corresponding charge is given by
where Qo is the arbitrary constant of integration. - A current-controlled nonlinear inductor is described by its φ-i relation
_
_ * A two-terminal current-controlled nonlinear inductor φ = Φ(i) is implemented by
I[1,0] = _v1
I[1,1] = -phi(_i1) - If an inductor is specified by a nonlinear inductance L(i) where
then the corresponding flux is given by
where Φo is the arbitrary constant of integration. - SDD models are easier to write and debug than compiled models, but they are less efficient during a simulation.
Modified Nodal Analysis
Advanced Design System uses nodal analysis to form the circuit equations. Nodal analysis is based on Kirchoff's current law (KCL) which states that for each node, the sum of the currents incident to the node is zero.
Suppose a circuit has n+1 nodes and b branches. Let i be the vector of branch currents. Then KCL can be expressed by the equation
Ai = 0
where A is an n x b matrix called the node incidence matrix. The entries in A are given by
In nodal analysis, KCL is not applied to the ground node (such an equation yields no independent information) which explains why A has only n rows. If all the devices in the circuit are voltage controlled, that is, if the port currents of each device are completely determined by the port voltages of that device, then the branch current vector i can be written as
i = g(v)
where v represents the vector of n node voltages and g is a map from IRn to IRb. Substituting this equation into the KCL equation yields the node analysis equation
G(v) = 0
where G is a map from IRn to IRn defined by G(v)= Ag(v).
When a circuit contains devices that are not voltage controlled (a voltage source or an inductor, for example), it is impossible to write KCL in terms of the node voltages alone-some additional variables must be used. In modified nodal analysis, the branch currents of the non-voltage-controlled devices are retained as variables. Thus KCL can be written as
where ib is the vector of the nb branch currents of the non-voltage-controlled devices and G is a map from!modbuild-06-1-102.gif!
1 to IRn. Since there are now n equations in n+nb unknowns, nb additional equations must be appended to the node equations. These additional equations are the constitutive relationships of the nb non-voltage-controlled branches
The resulting augmented nodal equations are the modified nodal analysis equations
Alternative Implementation of a Capacitor
Suppose you have a nonlinear capacitance that cannot be integrated to get the corresponding charge function. One example is a capacitance that is table-driven from experimentally obtained data. Another case is a two-port capacitor
where there does not exist a charge Q(v1, v2) such that C(v1, v2) is the Jacobian of Q(v1, v2). In these cases, the capacitor can still be implemented using an SDD. Consider the one-port nonlinear capacitance C(v). By definition,
There is no way to implement this equation directly using an SDD because it involves the product of a derivative. To bypass this problem, create an intermediate variable dv_dt = dv/dt. Then the capacitor is described by the equations
i = C(v) dv_dt
There is one problem with implementing these equations directly. In the frequency domain, the time derivative of v is
dv_dt = j2πfv.
Considering harmonic frequencies, f can be as high as 500 GHz. With such a large value of f, a 1µV change in v produces a 3 MV change in dv_dt. This high sensitivity can cause convergence difficulties for the system. To eliminate the problem, scale by a nominal frequency value of 1 GHz.
fnom = 1GHz
i = C(v) fnom dv_dt
Note that even though i is proportional to fnom dv_dt, i is not overly sensitive to dv_dt because fnom is multiplied by C(v) which is typically on the order of 1/fnom.
The scaled formulation of the capacitance is implemented by the SDD using the following equations:
I[[1,0] = C(v)*f_nom*dv_dt
F[2,0] = −dv_dt
F[2,1] = v/f_nom
and these VAR equations:
v = _v1
dv_dt = _v2
f_nom = 1 GHz
C(v) = 1pf*exp(v)
This SDD can be found in Examples/Tutorials/SDD_Examples_prj as SDD_cap.dsn. An alternate implementation, SDD_cap2.dsn, can also be found in the project.
Error Messages
If an SDD has not been implemented correctly, it will generate errors. The errors will be similar to the ones listed here.
Expression error: [ error __ message ].
An error has occurred while parsing or differentiating an expression.
h[0] and h[1] are predefined.
Weighting functions 0 and 1 have been redefined. This is not allowed.
Illegal state variable `_in'.
_in has been used, but there are not n ports.
Illegal state variable `_vn'.
_vn has been used, but there are not n ports.
Improper frequency dependence in sdd `f' parameters.
One or more of the implicit relationships depends on freq or omega. Frequency dependence is not allowed.
Improper frequency dependence in sdd `i' parameters.
One or more of the explicit relationships depends on
freq
oromega
. Frequency dependence is not allowed.
Port equation cannot be both i and f type.
At least one of the ports has both an explicit and an implicit expression. If more than one expression is used for a port, all expressions for the port must be of the same type, that is, all explicit or all implicit.
Port n is missing a corresponding equation.
No constitutive relationship has been specified for port n.
SYM error: [ error message ].
An error has occurred while evaluating an SDD expression or its derivative. (SYM is the name of the system symbolic expression handler.)