Implement ideal switch device
The Ideal Switch block does not correspond to a particular physical device. When used with appropriate switching logic, it can be used to model simplified semiconductor devices such as a GTO or a MOSFET, or even a power circuit breaker with current chopping. The switch is simulated as a resistor Ron in series with a switch controlled by a logical gate signal g.
The Ideal Switch block is fully controlled by the gate signal (g > 0 or g = 0). It has the following characteristics:
Blocks any forward or reverse applied voltage with 0 current flow when g = 0
Conducts any bidirectional current with quasi-zero voltage drop when g > 0
Switches instantaneously between on and off states when triggered
The Ideal Switch block turns on when a positive signal is present at the gate input (g > 0). It turns off when the gate signal equals 0 (g = 0).
The Ideal Switch block also contains a series Rs-Cs snubber circuit that can be connected in parallel with the ideal switch (between nodes 1 and 2).
The internal resistance of the switch device, in ohms (Ω). The Internal resistance Ron parameter cannot be set to 0.
The initial state of the Ideal Switch block. The initial status of the Ideal Switch block is taken into account in the steady-state calculation.
The snubber resistance, in ohms (Ω). Set the Snubber resistance Rs parameter to inf to eliminate the snubber from the model.
The snubber capacitance in farads (F). Set the Snubber capacitance Cs parameter to 0 to eliminate the snubber, or to inf to get a resistive snubber.
If selected, add a Simulink® output to the block returning the ideal switch current and voltage.
Simulink signal to control the opening and closing of the switch.
The Simulink output of the block is a vector containing two signals. You can demultiplex these signals by using the Bus Selector block provided in the Simulink library.
Ideal switch current
Ideal switch voltage
The Ideal Switch block is modeled as a current source. It cannot be connected in series with an inductor, a current source, or an open circuit, unless its snubber circuit is in use.
Use the Powergui block to specify either continuous simulation or discretization of your electrical circuit containing ideal switches. When using a continuous model, the ode23tb solver with a relative tolerance of 1e-4 is recommended for best accuracy and simulation speed.
The power_switchpower_switch example uses the Ideal Switch block to switch an RLC circuit on an AC source (60 Hz). The switch, which is initially closed, is first opened at t = 50 ms (3 cycles) and then reclosed at t = 138 ms (8.25 cycles). The Ideal Switch block has 0.01 ohms resistance and no snubber is used.
Run the simulation and observe the inductor current, the switch current, and the capacitor voltage. Notice the high-frequency overvoltage produced by inductive current chopping. Note also the high switch current spike when the switch is reclosed on the capacitor at maximum source voltage.
 Mohan, N., T.M. Undeland, and W.P. Robbins, Power Electronics: Converters, Applications, and Design, John Wiley & Sons, Inc., New York, 1995.