The model accepts, for compatibility with other simulation software, either SW or VSWITCH.

.MODEL <model name> SW [model parameters]
.MODEL <model name> VSWITCH [model parameters]

The model contains both the parameters used in SPICE3 that those used in PSPICE. The switching voltage can be specified by the pair of parameters VT and VH or by the pair of parameters VON and VOFF.

The switch is not quite ideal, in that the resistance can not change from 0 to infinity, but must always have a finite positive value. By proper selection of the on and off resistances, they can be effectively zero and infinity in comparison to other circuit elements.

The use of an ideal element that is highly nonlinear such as a switch can cause large discontinuities to occur in the circuit node voltages. A rapid change such as that associated with a switch changing state can cause numerical roundoff or tolerance problems leading to erroneous results or timestep difficulties. The user of switches can improve the situation by taking the following steps:

First, it is wise to set ideal switch impedances just high or low enough to be negligible with respect to other circuit elements. Using switch impedances that are close to "ideal" in all cases aggravates the problem of discontinuities mentioned above. Of course, when modeling real devices such as MOSFETS, the on resistance should be adjusted to a realistic level depending on the size of the device being modeled.

If a wide range of ON to OFF resistance must be used in the switches (ROFF/RON >1e+12), then the tolerance on errors allowed during transient analysis should be decreased by using the .OPTIONS control line and specifying TRTOL to be less than the default value of 7.0. When switches are placed around capacitors, then the option CHGTOL should also be reduced. Suggested values for these two options are 1.0 and 1e-16 respectively. These changes inform SPICE3 to be more careful around the switch points so that no errors are made due to the rapid change in the circuit.

See the .OPTIONS control line for a description of GMIN, its default value results in an off-resistance of 1.0e+12 ohms

Parameters of the model SW (SPICE3)

Parameter Description Default Units
VT threshold voltage 0 V
VH hysteresis voltage 0 V
RON on resistance 1 Ω
ROFF off resistance 1/GMIN Ω

In the model SW, the switch is characterized by a phenomenon of hysteresis. It switches to the ON state when the control voltage is greater than the value VT+VH, while passing in the OFF state when the control voltage is less than VT-VH.

Parameters of the model VSWITCH (PSPICE)

Parameter Description Default Units
VON control voltage for on state 1 V
VOFF control voltage for off state 0 V
RON on resistance 1 Ω
ROFF off resistance 1/GMIN Ω

The VSWITCH model defines the on/off resistance and the on/off control voltage thresholds. This switch has a finite on resistance and off resistance, and it changes smoothly between the two as its control voltage changes. This behavior is important because it allows Spice to find a continuous set of solutions for the simulation. You can make the on resistance very small in relation to the other circuit impedances, and you can make the off resistance very large in relation to the other circuit impedances.



See also

Voltage-controlled Switch