Tran Functions

There are several built-in source functions, which are based on and extend the source specifications in SPICE2. These generally produce time-dependent output for use in transient analysis. For brevity, these functions are referred to as ``tran functions''.

The tran functions are listed in the table below. If parameters other than source amplitudes are omitted, default values will be assumed. The tran functions, which require multiple space or comma separated arguments in a particular order, are:

expexponential specification texpexponential specification gaussgaussian noise specification tgaussgaussian noise specification interpinterpolation specification pulsepulse specification gpulsegaussian pulse specification pwlpiecewise-linear specification sffmsingle frequency fm specification amamplitude modulated specification sinsinusoidal specification tsinsinusoidal specification spulsesinusoidal pulse specification tablereference to a .tablespecification

The the `texp`, `tgauss`, and `tsin` are aliases to `exp`, `gauss`, and `sin` tran functions that avoid possible
ambiguity with math functions of the same name.

Unlike the math functions, the tran functions have variable-length argument lists. If arguments are omitted, default values are assumed.

The tran functions are most often used to specify voltage/current
source output, however in * WRspice* these can be used in general
expressions. The

Although the `sin` and `exp` functions are generally
distinguishable except for one unlikely case, with the additional
arguments to the `gauss` function for HSPICE compatibility in
* WRspice* release 3.0.0, the problem is more acute.

It may be necessary to edit legacy * WRspice* input files to avoid
this problem.

That being said, new intelligence has been added to differentiate between the two species. As in older releases, the argument count will in many cases resolve ambiguity.

First of all, to guarantee that the tran functions are used in an
expression, they can be called by the synonym names `tsin`, `texp`, and `tgauss`.

If `sin`, `exp`, or `gauss` use white-space delimiting in
the argument list, then they will be called as tran functions. The
math functions always use commas to separate arguments. Commas are
also legal argument separators in tran functions, but (perhaps) are
not as frequently used. If comma argument separators are used, the
math functions are assumed.

Note that almost all math functions (whith the exception of `gauss` and a few others) take a single complex vector argument. It is
possible to give these functions multiple comma-separated
``arguments'', but in evaluation these are collapsed by evaluation of
the comma operator:

So,a,b = (a + j*b)

In earlier * WRspice* releases,

sin(a,b)comma delimiter implies mathsin(a b)space delimiter implies tran

If ambiguity occurs in a function specification for a voltage or current source, the tran function is favored if the specification is ambiguous.

The tran functions implicitly use time as an independent variable, and
generally return 0 in dc analysis. Exceptions are the `pwl` and
`interp` forms, which implicitly use the value of ```x`''
which is context-specific. In dependent sources, this is the
controlling value of the source rather than time. The `table`
function takes its input directly from the second argument.

The tran functions can also be used in regular vector expressions. They generate a vector corresponding to the current scale, which must exist, be real, and monotonically increasing. The length of the returned vector is equal to the length of the scale.

For example:

(do a tran analysis to establish a reasonable scale)The construct can be used like any other token in a regular vector expression.let a = pulse(0 1 10n 10n 10n 20n)plot a(plots a pulse waveform)

The tran functions (other than `table` and `interp`) take
constant expressions as arguments. The argument list consists of
comma or space separated expressions. Arguments are parsed as
follows:

- The outer parentheses, if these exist, are stripped from the list.
can recognize most instances where parentheses are not included, since these are optional in standard SPICE syntax for the tran functions.*WRspice* - Commas that are not enclosed in parentheses or square brackets are converted to spaces.
- Minus signs (`
`-`') that are not enclosed in parentheses or square brackets, and are not followed by white space, and are preceded by white space, are assumed to be the start of a new token (argument). An expression termination character (semicolon) is added to the end of the previous argument. - The string is parsed into individual expression units, which are the arguments. The separation is determined by context.

There is no provision for a unary ``+`', thus, `func(a, +b)` is
taken as `func(a+b)`. Parenthesis can be added to enforce
precedence. The minus sign handling implies that `func(a, -b)` and
`func(a -b)` are taken as `func((a), (-b))`, whereas
`f(a-b), f(a- b), f(a - b)`, etc are taken as `func((a)-(b))`.

In addition to the built-in functions, expressions used in sources can
include user defined functions, which must have been defined
previously with the **define** command. These may be useful for
encapsulating the tran functions.

- Example:
`define mypulse(delay, width) pulse(0 1 delay 1n 1n width)`

...

v1 1 0 mypulse(5n, 10n)

Recall that a line in the deck starting with ```*@`" will be
executed before the deck is parsed.

title line

*@define mypulse(delay, width) pulse(0 1 delay 1n 1n width)

v1 1 0 mypulse(5n, 10n)

r1 1 0 100

.end

The following paragraphs describe the tran functions in detail.

- Exponential
- Gaussian Random
- Interpolation
- Pulse
- Gaussian Pulse
- Piecewise Linear
- Single-Frequency FM
- Amplitude Modulation
- Sinusoidal
- Sinusoidal Pulse
- Table Reference