VSW - Voltage Controlled Switch Model
Model Kind
Switch
Model Sub-Kind
Voltage-Controlled
SPICE Prefix
S
SPICE Netlist Template Format
@DESIGNATOR %3 %4 %1 %2 @MODEL &"INITIAL CONDITION"
Parameters (definable at component level)
The following component-level parameters are definable for this model type and are listed on the Parameters tab of the Sim Model dialog. To access this dialog, simply double-click on the entry for the simulation model link in the Models region of the Component Properties dialog.
Initial Condition | the starting point for the switch, either open (OFF) or closed (ON). |
Parameters (definable within model file)
The following is a list of parameters that can be stored in the associated model file:
VT | threshold voltage (in Volts). (Default = 0). |
VH | hysteresis voltage (in Volts). (Default = 0). |
RON | ON resistance (in Ohms). (Default = 1). |
ROFF | OFF resistance (in Ohms). (Default = 1/GMIN). GMIN is an advanced SPICE option that sets the minimum conductance (maximum resistance) of any device in the circuit. It is specified on the Spice Options page of the Analyses Setup dialog and its default value is 1.0e-12 (mhos). |
Notes
- The model allows an almost ideal switch to be described. With careful selection of the ON and OFF resistances, they can effectively be seen as zero and infinity respectively, in comparison with other elements in the circuit.
- The use of an ideal, highly non-linear element such as a switch can cause large discontinuities to occur in the circuit node voltages. The rapid state change caused by opening and closing a switch can cause numerical round off or tolerance problems, leading to time step difficulties, or erroneous results. When using switches, take the following precautions:
- Set switch impedances (
RON
andROFF
) just high or low enough to be negligible with respect to other elements. - When modeling real devices such as MOSFETS, set the on resistance to a realistic level for the size of the device being modeled.
- If a wide range of ON to OFF resistance must be used (
ROFF/RON >1e+12
), then the error tolerance during transient analysis should be decreased. Set theTRTOL
parameter on the Spice Options page of the Analyses Setup dialog to1
. - When a switch is placed around a capacitor, then the
CHGTOL
parameter should also be reduced (try1e-16
).
- The link to the required model file (
*.mdl
) is specified on the Model Kind tab of the Sim Model dialog. The Model Name is used in the netlist to reference this file. - Where a parameter has an indicated default (as part of the SPICE model definition), that default will be used if no value is specifically entered. The default should be applicable to most simulations. Generally you do not need to change this value.
- The simulation-ready voltage controlled switch component (
VSW
) can be found in the Simulation Special Function integrated library (\Library\Simulation\Simulation Special Function.IntLib
).
Examples
Consider the voltage controlled switch in the above image, with the following characteristics:
- Pin1 (positive controlling node) is connected to net
IN
- Pin2 (negative controlling node) is connected to net
GND
- Pin3 (positive output node) is connected to net
NetRLY1_4
(pin 4 of RLY1). - Pin4 (negative output node) is connected to net
IN
- Designator is
S1
- Initial Condition of switch is
OFF
(open contact). - The linked simulation model file is
VSW.mdl
.
The entries in the SPICE netlist would be:
*Schematic Netlist:
S1 NetRLY1_4 IN IN 0 VSW OFF
.
.
*Models and Subcircuit:
.MODEL VSW SW()
The SPICE engine would use the value for the Initial Condition specified on the Parameters tab of the Sim Model dialog. As there are no parameter values specified in the model file, the engine will use the default values for all other parameters.
PSpice Support
To make this device model compatible with PSpice, the following additional model parameters are supported and can be entered into a linked model file (*.mdl
) for the device:
VOFF | control voltage for OFF state (in Volts). (Default = 0). |
VON | control voltage for ON state (in Volts). (Default = 1). |
Where a parameter has an indicated default, that default will be used if no value is specifically entered.
The format for the PSpice model file is:
.MODEL ModelName VSWITCH(Model Parameters),
where
- ModelName is the name of the model, the link to which is specified on the Model Kind tab of the Sim Model dialog. This name is used in the netlist (@MODEL) to reference the required model in the linked model file.
- Model Parameters are a list of supported parameters for the model, entered with values as required.
For an example of using a PSpice-compatible voltage-controlled switch model in a simulation, refer to the example project PSpice Switch.PrjPCB.