Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new
Documentation

Ideal Switch (idealSwitch)

Opens or closes a path when its gate signal goes low or high.

idealSwitch

Component reference · 繁體中文

Group: Switches · Kind: {"kind":"idealSwitch"}

When to use it

Use it for two-way switches driven straight from a signal. Use Relay when a coil matters, or MOSFET when a body diode matters.

Pins

Pin Domain Meaning
p electrical One end; current flows both ways
n electrical The other end
gate signal Signal input; above 0.5 turns it on

Common parameters

  • ron: Resistance when it is on (Default: 1m)
  • roff: Resistance when it is off (Default: 1meg)
  • tdon: Delay before it turns on (Default: 0)
  • tdoff: Delay before it turns off (Default: 0)

Parameters

Key Unit Default Typical range Description
ron Ω 1m Resistance when it is on
roff Ω 1meg Resistance when it is off
vf V 0 Voltage lost while it conducts
device — optional (off) Device name used to look up losses
thermal — optional (off) Where the lost heat goes
eon J 0 Energy lost each time it turns on
eoff J 0 Energy lost each time it turns off
err J 0 Energy lost when the diode recovers
vref V 0 Voltage used to measure those energies
iref A 0 Current used to measure those energies
tc 1/K 0 How on-resistance changes with heat
tj °C 25 Junction temperature for the loss tables
nParallel — 1 Identical devices this one switch stands for: the current is shared, the losses add up, each device keeps its own junction
tjMax °C optional (off) Highest junction temperature allowed; overrides the device's rating
ls H 0 500p – 50n H Unwanted inductance in series with it
coss F 0 10p – 5n F Capacitance across the device
cj F 0 5p – 2n F Extra capacitance across the junction
tdon s 0 1n – 500n s Delay before it turns on
tdoff s 0 1n – 500n s Delay before it turns off
qrr C 0 1n – 5u C Charge released as the diode recovers
trr s 100n 10n – 1u s How long the diode takes to recover
qrrTemp — optional (off) Junction temperature (°C) and factor pairs that scale qrr, from the datasheet's curve
part — optional (off) Part number; the catalogue part number, such as BSC070N10NS5, written on the schematic; information only, not simulated
vRating V optional (off) Voltage rating; the largest blocking voltage of the data sheet's maximum ratings (VDS, VCES, VRRM), written on the schematic; information only, not simulated
iRating A optional (off) Current rating; the continuous current of the data sheet's maximum ratings (ID, IC, IF), written on the schematic; information only, not simulated

Parameter descriptions are in English in both languages.

Use for: Ideal PWM legs · Signal-driven switches · Load steps

Not for: Switches with a body diode → mosfet · Coil-driven contacts → relay

Formulas

Formula Equation Source
Conduction loss P = ron·Irms² Mohan, Undeland & Robbins, Power Electronics, 3rd ed. (2003), ch. 2 (on-state power loss of a switch)
Off-state leakage loss P = V²/roff Mohan, Undeland & Robbins, Power Electronics, 3rd ed. (2003), ch. 2 (off-state leakage of a switch)

Quick check

Inputs:

  • irms: RMS current while on = 5 A
  • ron: On resistance = 1m Ω, ron
  • vblock: Blocking voltage while off = 48 V
  • roff: Off resistance = 1meg Ω, roff

Outputs:

  • pcond: Conduction loss = ron*irms^2 W
  • poff: Off-state loss = vblock^2/roff W

Model logic

  • A gate signal above 0.5 makes it the resistor ron, in both directions with no drop; at or below 0.5, or unconnected, it is the resistor roff.
  • A PWM edge from a control block ends the time step on its instant, so the switch changes state there and not at the next grid point.
  • tdon and tdoff delay the gate signal, ls adds a series inductance, and coss and cj add capacitors across the switch; all default to 0.
  • eon and eoff are booked into the loss report at each transition, scaled by (V/vref)·(I/iref); they do not change the waveforms.

Model

The switch is a resistor ron while the gate is above 0.5 and a resistor roff otherwise, in both current directions and with no voltage drop (vf has no effect). It changes state at the step boundary. The optional ls, coss, cj, tdon and tdoff add a series inductance, parallel capacitances and gate delays.

Common mistakes

  • Two switches of one leg on at the same time connect the rails through ron. Leave dead time between the two gate signals.
  • ron is in ohm, so a tiny value or a prefix slip is flagged. The solver also keeps ron at 1 nohm or above, and a huge roff to ron ratio makes the equations stiff.
  • An unconnected gate keeps the switch off. Opening the switch while an inductor carries current gives a voltage of that current times roff, so add a diode or a snubber.

Problems rules: shoot-through, param.out_of_range

Datasheet and sources

ron comes from the contact or channel resistance, and roff from the leakage at the working voltage. To count losses, set eon, eoff, vref and iref from the switching-energy table, and put the heat sink node name in thermal.

Example

Open the example with the command file.openExample and the name demo:idealSwitch.


Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.