Select menu
. This displays:You may specify an equation that defines an output voltage or current in terms of any number of input voltages and currents. Input voltages are specified in the form V(a) or V(a,b) where a and b may be any arbitrary name of your choice. Input currents are specified in the form I(a). On completion, SIMetrix will generate a schematic symbol complete with the input voltages and/or currents that you reference in the equation. There is no need to specify how many input voltages and currents you wish to use. SIMetrix will automatically determine this from the equation.
As well as input voltage and currents, you can also reference the output voltage or current in your equation. A single ended output voltage is accessed using V(out) while a differential output voltage is accessed using V(outp,outn). If you specify an output voltage, you may also access the current flowing through it using I(out).
In the example above, the expression shown - V(vina,vinb)*I(iin) - multiplies a voltage and current together. This could be used to monitor the power in a two terminal device as shown in the following schematic.:
In the above, ARB1 is the device created from the Non-linear Transfer Function menu. ARB1-OUTP will carry a voltage equal to the power dissipation in R1.
In this topic:
The expression entered defines the output of the device in terms of its inputs. Expressions generally comprise the following elements:
Circuit variables allow the expression to reference input voltages and currents.
Voltages are of the form:
V(node_name1)
V(node_name1, node_name2)
Where node_name1 and node_name2 are input connections.The second form above returns the difference between the voltages on node_name1 and node_name2. The special names out, outp and outn may be used to access the voltage on the output. Use out for the single ended output configuration and outp and/or outn for the differential output configuration.
Currents are of the form:
I(source_name)
Where source_name is the name of an input current. For output voltage configurations, you can use I(out) to access the output current of the device itself. For example
100*I(OUT)
Implements a 100 ohm resistor for a device configured with a differential output voltage.
The expression may use any number of parameters. These can be local or global. Local parameters are defined in the Local parameters edit box on the right hand side. Global parameters must defined within the schematic, usually in the F11 window.
To enter local parameters, enter one or more definitions in the form name=expression in the Local parameters edit box. expression may be a constant or an expression referring to other local or global parameters. expression may not contain circuit variables. (E.g. V(in1)). Comment lines may be entered and must start with a '*'.
A number of parameter names are assigned by the simulator. These are:
Parameter name | Description |
TIME | Resolves to time for transient analysis. Resolves to 0 otherwise including during the pseudo transient operation point algorithm |
TEMP | Resolves to current circuit temperature in Celsius |
HERTZ | Resolves to frequency during AC sweep and zero in other analysis modes |
PTARAMP | Resolves to value of ramp during pseudo transient operating point algorithm. Otherwise this value resolves to 1. |
Apart from simple numeric values, arbitrary expressions may also contain the following built-in constants:
Constant name | Value | Description |
PI | 3.14159265358979323846 | ???MATH???\pi???MATH??? |
E | 2.71828182845904523536 | e |
TRUE | 1.0 | |
FALSE | 0.0 | |
ECHARGE | 1.6021918e-19 | Charge on an electron in coulombs |
BOLTZ | 1.3806226e-23 | Boltzmann's constant |
These are listed below and are listed in order of precedence. Precedence controls the order of evaluation. So 3*4 + 5*6 = (3*4) + (5*6) = 42 and 3+4*5+6 = 3 + (4*5) + 6 = 29 as '*' has higher precedence than '+'.
Operator | Description |
~ ! - | Digital NOT, Logical NOT, Unary minus |
^ or ** | Raise to power. |
* / | Multiply, divide |
+ - | Plus, minus |
>= <=, > < | Comparison operators |
== != or <> | Equal, not equal |
& | Digital AND (see below) |
| | Digital OR (see below) |
&& | Logical AND |
|| | Logical OR |
test ? true_expr : false_expr | Ternary conditional expression (see below) |
These are Boolean in nature either accepting or returning Boolean values or both. A Boolean value is either TRUE or FALSE. FALSE is defined as equal to zero and TRUE is defined as not equal to zero. So, the comparison and equality operators return 1.0 if the result of the operation is true otherwise they return 0.0.
The arguments to equality operators should always be expressions that can be guaranteed to have an exact value e.g. a Boolean expression or the return value from functions such as SGN. The == operator, for example, will return TRUE only if both arguments are exactly equal. So the following should never be used:
v(n1)==5.5
v(n1) may not ever be exactly 5.0. It may be 5.4999999999 or 5.50000000001 but only by chance will it be 5.5.
These operators are intended to be used with the IF() function described in Ternary Conditional Expression.
These are the operators '&', '|' and '~'. These are now considered to be obsolete and may not be supported in future versions of SIMetrix. These operators implement logic operations in the analog domain and are continuous in nature.
This is of the form:
test_expression ? true_expression : false_expression
The value returned will be true_expression if test_expression resolves to a non-zero value, otherwise the return value will be false_expression. This is functionally the same as the IF() function described in the functions table below.
Function | Description |
ABS(x) | ???MATH???|x|???MATH??? |
ACOS(x), ARCCOS(x) | ???MATH???\cos^{-1}(x)???MATH??? |
ACOSH(x) | ???MATH???\cosh^{-1}(x)???MATH??? |
ASIN(x), ARCSIN(x) | ???MATH???\sin^{-1}(x)???MATH??? |
ASINH(x) | ???MATH???\sinh^{-1}(x)???MATH??? |
ATAN(x), ARCTAN(x) | ???MATH???\tan^{-1}(x)???MATH??? |
ATAN2(x,y) | ???MATH???\tan^{-1}(x/y)???MATH???. Valid if y=0 |
ATANH(x) | ???MATH???\tanh^{-1}(x)???MATH??? |
COS(x) | ???MATH???\cos(x)???MATH??? |
COSH(x) | ???MATH???\cosh(x)???MATH??? |
DDT(x) | ???MATH???dx/dt???MATH??? |
EXP(x) | ???MATH???e^{x}???MATH??? |
FLOOR(x), INT(x) | Next lowest integer of ???MATH???x???MATH???. |
IF(cond, x, y[, maxslew]) | if cond is TRUE ???MATH???result=x???MATH??? else ???MATH???result=y???MATH???. If ???MATH???maxslew>0???MATH??? the rate of change of the result will be slew rate controlled. See IF() Function. |
IFF(cond, x, y[, maxslew]) | As IF(cond, x, y, maxslew) |
LIMIT(x, lo, hi) | if ???MATH???x<lo???MATH??? ???MATH???result=lo???MATH??? else if ???MATH???x>hi???MATH??? ???MATH???result=hi???MATH??? else ???MATH???result=x???MATH??? |
LIMITS(x, lo, hi, sharp) | As LIMIT but with smoothed corners. The 'sharp' parameter defines the abruptness of the transition. A higher number gives a sharper response. LIMITS gives better convergence than LIMIT. See LIMITS() Function. below |
LN(x) | ???MATH???\ln(x)???MATH??? If ???MATH???x<10^{-100}???MATH??? ???MATH???result=-230.2585093???MATH??? |
LNCOSH(x) | ???MATH???\ln(\cosh(x))???MATH??? = ???MATH???\int \tanh(x) dx???MATH??? |
LOG(x) | ???MATH???log_{10}(x)???MATH???. If ???MATH???x<10^{-100}???MATH??? ???MATH???result=-100???MATH??? |
LOG10(x) | ???MATH???log_{10}(x)???MATH???. If ???MATH???x<10^{-100}???MATH??? ???MATH???result=-100???MATH??? |
MAX(x, y) | Returns larger of ???MATH???x???MATH??? and ???MATH???y???MATH??? |
MIN(x,y) | Returns smaller of ???MATH???x???MATH??? and ???MATH???y???MATH??? |
PWR(x,y) | ???MATH???x^y???MATH??? |
PWRS(x,y) | ???MATH???x>=0???MATH???: ???MATH???x^y???MATH???, ???MATH???x<0???MATH???: ???MATH???-x^y???MATH??? |
SDT(x) | ???MATH???\int x dt???MATH??? |
SGN(X) | ???MATH???x>0???MATH???: 1, ???MATH???x<0???MATH???: -1, ???MATH???x=0???MATH???: 0 |
SIN(x) | ???MATH???\sin(x)???MATH??? |
SINH(x) | ???MATH???\sinh(x)???MATH??? |
SQRT(x) | ???MATH???x>=0???MATH???: ???MATH???\sqrt{x}???MATH???, ???MATH???x<0???MATH???: ???MATH???\sqrt{-x}???MATH??? |
STP(x) | ???MATH???x<=0???MATH???: 0, ???MATH???x>0???MATH???: 1 |
TABLE(x,xy_pairs) | lookup table. Refer to Lookup tables |
TABLEX(x,xy_pairs) | Same as TABLE except end points extrapolated. Refer to Lookup tables |
TAN(x) | ???MATH???\tan(x)???MATH??? |
TANH(x) | ???MATH???\tanh(x)???MATH??? |
U(x) | as STP(x) |
URAMP(x) | ???MATH???x<0???MATH???: 0, ???MATH???x>=0???MATH???: ???MATH???x???MATH??? |
The following functions return a randomly generated value when running a Monte Carlo analysis. They can be used to define component tolerances.
Name | Distribution | Lot? |
DISTRIBUTION | User defined distribution | No |
DISTRIBUTIONL | User defined distribution | Yes |
UD | Alias for DISTRIBUTION() | No |
UDL | Alias for DISTRIBUTIONL() | Yes |
GAUSS | Gaussian | No |
GAUSSL | Gaussian | Yes |
GAUSSTRUNC | Truncated Gaussian | No |
GAUSSTRUNCL | Truncated Gaussian | Yes |
UNIF | Uniform | No |
UNIFL | Uniform | Yes |
WC | Worst case | No |
WCL | Worst case | Yes |
GAUSSE | Gaussian logarithmic | No |
GAUSSEL | Gaussian logarithmic | Yes |
UNIFE | Uniform logarithmic | No |
UNIFEL | Uniform logarithmic | Yes |
WCE | Worst case logarithmic | No |
WCEL | Worst case logarithmic | Yes |
A full discussion on the use of Monte Carlo distribution functions is given in Simulator Reference Manual/Monte Carlo, Sensitivity and Worst-case/Specifying Tolerances.
IF(condition, true-value, false-value[, max-slew])The result is:
if condition is non-zero, result is true-value, else result is false-value.
If max-slew is present and greater than zero, the result will be slew-rate limited in both positive and negative directions to the value of max-slew.
In some situations, for example if true-value and false-value are constants, the result of this function will be discontinuous when condition changes state. This can lead to non-convergence as there is no lower bound on the time-step. In these cases a max-slew parameter can be included. This will limit the slew rate so providing a controlled transition from the true-value to the false-value and vice-versa.
If the simulator setting .OPTIONS DISCONTINUOUSIFSLEWRATE=max-slew, is provided, SIMetrix will automatically apply a max-slew parameter to all occurrences of the IF() function if both true-value and false-value are constants. This provides a convenient way of resolving convergence issues with third-party models that make extensive use of discontinuous if expressions. Note that the DISCONTINUOUSIFSLEWRATE option is also applied to conditional expressions using the C-style condition ? true-value : false-value syntax.
LIMITS(x, low, high, sharp)The LIMITS() function is similar to LIMIT but provides a smooth response at the corners which leads to better convergence behaviour. The behaviour is shown below
The LIMITS function follows this equation:
LIMITS(x, low, high, sharp) = ???MATH???0.5*((\ln(\cosh(v1))-\ln(\cosh(v2)))/v3 +(low+high))???MATH???
Method 1 |
Syntax in form: TABLE[xy_pairs](input_expression).
|
||||
Method 2 |
Syntax in form: TABLE(input_expression, xy_pairs).
|
||||
Method 3 |
Syntax in form: TABLEX(input_expression, xy_pairs).
|
Method 1 is more efficient at handling large tables (hundreds of values). However, method 2 is generally more flexible and is the recommended choice for most applications. Method 2 is also compatible with other simulators whereas method 1 is proprietary to SIMetrix.
For an example see Table Lookup Example
The following arbitrary source definition implements a soft limiting function
table[-10, -5, -5, -4, -4, -3.5, -3, -3, 3, 3, 4, 3.5, 5, 4, 10, 5](v(N1))
TABLE(v(N1), -10, -5, -5, -4, -4, -3.5, -3, -3, 3, 3, 4, 3.5, 5, 4, 10, 5)
TABLEX(v(N1), -10, -5, -5, -4, -4, -3.5, -3, -3, 3, 3, 4, 3.5, 5, 4, 10, 5)
The resulting transfer functions are illustrated in the following picture:
If you have SIMetrix Pro or SIMetrix Elite you may select the Compile to binary using Verilog-A option. This will build a definition of the device using the Verilog-A language then compile it to a binary DLL. This process takes place when you run the simulation. The benefit of using Verilog-A is that there is a wider range of functions available and for complex definitions there will also be a performance benefit. Refer to the Verilog-A Manual for details of available functions.
◄ Introduction | Laplace Transfer Function ▶ |