next up previous contents index
Next: Variable Expansion in Input Up: Input Format Previous: Numeric Values   Contents   Index


Units

Immediately following the number and multiplier is an optional units string. The units string is composed of the concatenation character `#', unit specification abbreviations as listed with the settype command (see 4.7.15), digit exponents, and possibly a separation character `_' (underscore). Giving the settype command without arguments will list the unit abbreviations known to WRspice.

The units string must start with a letter, or the concatenation or separation character followed by a letter, or two concatenation characters followed by a letter. The string consists of a sequence of abbreviations, each optionally followed by a digit exponent. If the concatenation character appears within the string, the abbreviations that follow provide denominator units. The same applies for the separation character, only denominator units follow. The concatenation or separation character in this context is logically equivalent to `/'.

The initial concatenation character is almost always optional. It is needed when there would be possible misinterpretation, for example 1.0F is dimensionless 1e-15, whereas 1.0#F is 1.0 farads. If the initial concatenation character is immedaiately followed by another concatenation character, then all dimensions that follow are denominator units.

Some Examples:

1.0#F#M2 1 farad per square meter
1.0#F_M2 1 farad per square meter
1.0F_M2 1e-15 per square meter
1.0##S 1 Hz
1.0_S 1 Hz
1.2#uA#S 1.2 microamps per second
1.2#uA_S 1.2 microamps per second
1.2uA_S 1.2 microamps per second
1.2#A_S 1.2 amps per second
1.2A_S 1.2 aHz (attohertz)
1.2uVS 1.2 microvolt-seconds

All multipliers and unit abbreviations are case-insensitive, but by convention we use lower case for the multiplier and upper case for the first letter of the unit abbreviation.

If the unit specifier contains an unrecognized character or abbreviation, it is ignored, and the number is dimensionless.

Internal representations of numbers carry along the unit specifier, which will appear in output, and will propagate through calculations. Thus, for example, a number specified in volts, divided by a number specified in ohms, would yield a number whose specification is amps.

It is possible to use a different concatenation character. If the variable units_catchar is set to a string consisting of a single punctuation character, then this character becomes the xoncatenation character. Similarly, if the variable units_sepchar is set to a string consisting of a single punctuation character, then this character becomes the separation character.


next up previous contents index
Next: Variable Expansion in Input Up: Input Format Previous: Numeric Values   Contents   Index
Stephen R. Whiteley 2022-09-18