Current-controlled Switch Model |
The model accepts, for compatibility with other simulation software, either CSW or ISWITCH.
.MODEL <model name> CSW [model parameters] .MODEL <model name> ISWITCH [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 IT and IH or by the pair of parameters ION and IOFF
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
Parameter | Description | Default | Units |
IT | threshold current | 0 | A |
IH | hysteresis current | 0 | A |
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 current is greater than the value IT+IH, while passing in the OFF state when the control current is less than IT-IH.
Parameter | Description | Default | Units |
ION | control current for on state | 0.001 | A |
IOFF | control current for off state | 0 | A |
RON | on resistance | 1 | Ω |
ROFF | off resistance | 1/GMIN | Ω |
The ISWITCH model defines the on/off resistance and the on/off control current thresholds. This switch has a finite on resistance and off resistance, and it changes smoothly between the two as its control current 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.
.MODEL WMOD CSW ( RON=1 ROFF=1Meg IT=1mA IH=0 )