The Analog Switch is a resistor that varies between specified values of a controlling input voltage or current.
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 specifying the option 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 to be more careful around the switch points so that no errors are made due to the rapid change in the circuit.
Parameters
Parameter | Description | Units | Default |
---|---|---|---|
TYPE | Select the switch model: SPICE3, PSPICE and XSPICE. | XSPICE | |
CNTL_OFF | Control off value. | V or A | 0 |
CNTL_ON | Control on value. | V or A | 1 |
ROFF | Off resistance. | Ohms | 1.0e12 |
RON | On resistance. | Ohms | 1 |
ONOFF | Initial State. The starting point for the switch, either open (OFF) or closed (ON). It only works with SPICE3 and PSPICE models. | OFF | |
LOG | Log/linear switch. It only works with XSPICE model. | Linear | |
LIMIT | Limits the control input between CNTL_ON and CNTL_OFF. It only works with XSPICE model. In the XSPICE model, the input is not internally limited. Therefore, if the controlling signal exceeds the specified OFF state or ON state value, the resistance may become excessively large or excessively small (in the case of logarithmic dependence), or may become negative (in the case of linear dependence). For the experienced user, these excursions may prove valuable for modeling certain devices, but in most cases you are advised to add limiting of controlling input. | TRUE |