     Next: Special Vectors Up: Plots, Vectors and Expressions Previous: Vector Creation and Assignment   Contents   Index

## Analysis Vectors and Access Mapping

The vectors actually produced depend on the type of analysis, but the most common output is the node voltage. Node voltages are denoted by vectors of the form v(N), where N is a name representing the node. Although the notation looks like a function call, the construct actually refers to a vector, and may be used in expressions whenever a vector is syntactically expected. Another common form is name#branch, which represents the ``branch'' current through voltage sources and inductors. The SPICE algorithm adds a term to the matrix for these elements, which represents the current flowing through the device. As there is a specific matrix element for the current for these devices, the value is available as an output variable. The name is the name of the voltage source or inductor.

For compatibility with SPICE2, several mappings and equivalences are provided. When referencing node voltages, one can reference a node by name (e.g. v(6) or v(input)). These are string names of the produced vectors. In addition, one can use the SPICE2 form for the argument inside the parentheses of the node voltage construct. This is (node1 [,node2]), where if both node1 and node2 are given, the vector represents the voltage difference between nodes node1 and node2. For example, v(1,2) is equivalent to v(1) - v(2). The v() construct in the case of two arguments is like a function.

Additionally, the construct i(name) is internally mapped to name#branch, and the two notations can be used interchangeably. The name is the name of a voltage source or inductor.

Additional mappings familiar from SPICE2 are also recognized in WRspice. In addition to v and i, the following are recognized for node voltages. These are most useful for complex vectors as are produced in ac analysis.

vm
This computes the magnitude, by mapping to the mag vector function. The following forms are equivalent:
vm(a) = mag(v(a))
vm(a,b) = mag(v(a) - v(b))

vp
This computes the phase, by mapping to the ph vector function. The following forms are equivalent:
vp(a) = ph(v(a))
vp(a,b) = ph(v(a) - v(b))

vr
This computes the real part, by mapping to the re vector function. The following forms are equivalent:
vr(a) = re(v(a))
vr(a,b) = re(v(a) - v(b))

vi
This computes the imaginary part, by mapping to the im vector function. The following forms are equivalent:
vi(a) = im(v(a))
vi(a,b) = im(v(a) - v(b))

vdb
This computes the decibel value (20*log10), by mapping to the db vector function. The following forms are equivalent:
vdb(a) = db(v(a))
vdb(a,b) = db(v(a) - v(b))

Similar constructs are available for the current vectors of voltage sources and inductors. In these constructs, the single argument is always the name of a ``branch'' device, either a voltage source or inductor.

img
This computes the magnitude, by mapping to the mag vector function. The following forms are equivalent:
img(vx) = mag(vx#branch)
Note that this name differs from the SPICE2 ``im'' to avoid a clash with the im() vector function in WRspice.

ip
This computes the phase, by mapping to the ph vector function. The following forms are equivalent:
ip(vx) = ph(vx#branch)

ir
This computes the real part, by mapping to the re vector function. The following forms are equivalent:
ir(vx) = re(vx#branch)

ii
This computes the imaginary part, by mapping to the im vector function. The following forms are equivalent:
ii(vx) = im(vx#branch)

idb
This computes the decibel value (20*log10), by mapping to the db vector function. The following forms are equivalent:
vdb(vx) = db(vx#branch)

There is one additional mapping available, p(devname), which returns the instantaneous power of a device devname. This can be applied to any device that has a readable ``p'' parameter defined, which is true for most devices. The show command can be used to list available device parameters. This is particularly useful for sources, as it returns the power supplied to the circuit. For non-dissipative elements, it represents the stored power.

This is a mapping to the special vector @devname[p] (see below). Thus, the special vector data must be available for this form to be used successfully, meaning that in analysis, as with other special vectors representing device parameters, the vector must be explicitly saved with the save command or in a .save line. However, if this form is used in a .measure line, the needed vector will be saved automatically. This is also true if the form is used in one of the ``runops'' as listed with the status command.     Next: Special Vectors Up: Plots, Vectors and Expressions Previous: Vector Creation and Assignment   Contents   Index
Stephen R. Whiteley 2019-06-03