Non-linear Transfer Function

Select menu Place > Analog Behavioural > Non-linear Transfer Function. 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:

Expression

The expression entered defines the output of the device in terms of its inputs. Expressions generally comprise the following elements:

  • Circuit variables
  • Parameters
  • Constants.
  • Operators
  • Functions
  • Look up tables
These are described in the following sections.

Circuit Variables

Circuit variables allow the expression to reference input voltages and currents.

Voltages are of the form:

V(node_name1)
OR
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.

Parameters

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 '*'.

Built-in Parameters

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.

Constants

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

Operators

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)

Comparison, Equality and Logical Operators

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.

Digital Operators

These are the operators '&', '|' and '~'. These were introduced in old SIMetrix version as a simple means of implementing digital gates in the analog domain. Their function has largely been superseded by gates in the event driven simulator but they are nevertheless still supported.

Although they are used in a digital manner the functions implemented by these operators are continuous in nature. For more information about digital operators refer to: Simulator Reference Manual/Simulator Devices/Using Expressions/Expression Syntax/Digital Operators

Ternary Conditional Expression

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.

Functions

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???

Monte Carlo Distribution Functions

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 Analysis/Specifying Tolerances.

IF() Function

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() Function

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???

Where
  • v1 = sharp/(high-low)*(x-low)
  • v2 = sharp/(high-low)*(x-high)
  • v3 = sharp/(high-low)

Look-up Tables

Expressions may contain any number of look-up tables. This allows a transfer function of a device to be specified according to - say - measured values without having to obtain a mathematical equation. Look-up tables are specified in terms of x, y value pairs which describe a piece-wise linear transfer function. There are three ways to create a lookup table:
Method 1 Syntax in form: TABLE[xy_pairs](input_expression).
xy_pairs A sequence of comma separated pairs of constant values that define the input and output values of the table. For each pair, the first value is the x or input value and the second is the y or output value. Only explicit numeric constants may be used. Even internal constants such as PI may not be used.
input_expression Expression defining the input or x value of the table.
Method 2 Syntax in form: TABLE(input_expression, xy_pairs).
input_expression Expression defining the input or x value of the table.
xy_pairs A sequence of comma separated pairs of values that define the input and output values of the table. For each pair, the first value is the x or input value and the second is the y or output value. Unlike method 1, values do not need to be literal constants and may be expressions containing parameters and circuit variables that reference input voltages and currents.

The TABLE function retains the value of the end point for x values beyond the range of the table. For example, if the last point for the TABLE function is (10,5) then any input greater than 10 will give an output of 5.

If any value references a circuit variable, the expression in which the TABLE function is used must ultimately be evaluated in an arbitrary source
Method 3 Syntax in form: TABLEX(input_expression, xy_pairs).
input_expression Expression defining the input or x value of the table.
xy_pairs Same as method 2 except that out-of-range points are extrapolated from the final segment. See Table Lookup Example

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

Examples

Table Lookup Example

The following arbitrary source definition implements a soft limiting function

Using method 1:
table[-10, -5, -5, -4, -4, -3.5, -3, -3, 3, 3, 4, 3.5, 5, 4, 10, 5](v(N1))
Using method 2:
TABLE(v(N1), -10, -5, -5, -4, -4, -3.5, -3, -3, 3, 3, 4, 3.5, 5, 4, 10, 5)
Using method 3:
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:

Verilog-A Implementation

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.