4.1  Conditionals

Gnucap behavioral modeling conditionals are an extension of the “AC” and “DC” Spice source parameters.

The extensions ...
  1. There are more choices, including an “else”.

  2. They apply to all elements (primitive components).

  3. Each section can contain functions and options.
The following are available:
AC
AC analysis only.
DC
DC (steady state) value.
OP
OP analysis.
TRAN
Transient analysis.
FOUR
Fourier analysis only.
ELSE
Anything not listed.
ALL
Anything not listed.
A value or function with no conditional keyword is equivalent to ALL. For SPICE compatibility, use only DC, AC, or nothing.

They are interpreted like a “switch” statement. In case of a conflict, the last one applies. A set of precedence rules applies when some keys are missing. It is SPICE compatible to the extent the features overlap.

The following table describes the precedence rules:
OP analysis
OP, DC, ALL, TRAN, 0
DC analysis
DC, ALL, OP, TRAN, 0
Transient analysis
TRAN, ALL, DC, OP, 0
Fourier analysis
FOUR, TRAN, ALL, DC, OP, 0
AC analysis, fixed sources
AC, 0
AC analysis, other elements
AC, ALL, 0

4.1.1  Examples

V12 (1 0) AC 1 DC 3
This voltage source has a value of 1 for AC analysis, 3 for DC. OP, Transient, and Fourier inherit the DC value.

R44 (2 3) OP 1 ELSE 1g
This resistor has a value of 1 ohm for the “OP” analysis, 1 gig-ohm for anything else. This might be useful as the feedback resistor on an op-amp. Set it to 1 ohm to set the operating point, then 1 gig to measure its open loop characteristics, hiding the fact that the op-amp would probably saturate if it was really left open loop.