> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/smart-power-simulation-software-sps/blocks-functions-tools/power-converters/switches/ideal-switch.md).

# Ideal Switch

## Description

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-eb5477b9c2b5f3c6f80de81a47945e69e369d56a%2Fideal_switch_block.png?alt=media" alt=""><figcaption></figcaption></figure>

The **Ideal Switch** bloc&#x6B;**,** located in the **OPAL-RT SPS Software/Power Electronics** library, 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.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-087712786f4b8b195810cfba408fd8cfb56143a0%2Fideal_switch_model.png?alt=media" alt=""><figcaption></figcaption></figure>

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).

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-d06559b01f5e11468b9d215b1036760928468eec%2Fideal-switch_snubber.png?alt=media" alt=""><figcaption></figcaption></figure>

## Ports

### Input

<table data-header-hidden><thead><tr><th width="271"></th><th></th></tr></thead><tbody><tr><td><p><strong>g</strong> — Switch control signal</p><p>Simulink signal</p></td><td>Simulink signal to control the opening and closing of the switch.</td></tr></tbody></table>

### Output

<table data-header-hidden><thead><tr><th width="285"></th><th></th></tr></thead><tbody><tr><td><p><strong>m</strong> — Switch output</p><p>Simulink signal</p></td><td><p>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.</p><p><strong>Dependencies</strong></p><p>To enable this port, select the <strong>Show measurement port</strong> parameter.</p><ul><li>Ideal switch current — Units: A</li><li>Ideal switch voltage — Units: V</li></ul><p>Dependencies: To enable this port, select the <strong>Show measurement port</strong> parameter.</p></td></tr></tbody></table>

### Conserving

<table data-header-hidden><thead><tr><th width="300"></th><th></th></tr></thead><tbody><tr><td><p><strong>1</strong> — Ideal switch terminal 1</p><p>SPS electrical</p></td><td>SPS electrical conserving port associated with the terminal 1 of the ideal switch.</td></tr><tr><td><p><strong>2</strong> — Ideal switch terminal 2</p><p>SPS electrical</p></td><td>SPS electrical conserving port associated with the terminal 2 of the ideal switch.</td></tr></tbody></table>

## Parameters

<table data-header-hidden><thead><tr><th width="311"></th><th></th></tr></thead><tbody><tr><td><p><strong>Internal resistance Ron</strong> — Internal resistance of the switch device</p><p>0.001 (default) | positive scalar</p></td><td>Internal resistance of the switch device, in ohms (Ω). The <strong>Internal resistance Ron</strong> parameter cannot be set to 0.</td></tr><tr><td><p><strong>Initial state</strong> — Initial state of block</p><p>0 (default) | nonnegative scalar</p></td><td>Initial state of the Ideal Switch block. The initial status of the Ideal Switch block is taken into account in the steady-state calculation.</td></tr><tr><td><p><strong>Snubber resistance Rs</strong> — Snubber resistance</p><p>1e5 (default) | nonnegative scalar</p></td><td>Snubber resistance, in ohms (Ω). Default is 1e5. Set the <strong>Snubber resistance Rs</strong> parameter to inf to eliminate the snubber from the model.</td></tr><tr><td><p><strong>Snubber capacitance Cs</strong> — Snubber capacitance</p><p>inf (default) | nonnegative scalar</p></td><td>Snubber capacitance in farads (F). Default is inf. Set the <strong>Snubber capacitance Cs</strong> parameter to 0 to eliminate the snubber, or to inf to get a resistive snubber.</td></tr><tr><td><p><strong>Show measurement port</strong> — Option to show measurement port</p><p>on (default) | off</p></td><td>If you select this parameter, the Ideal Switch block exposes a Simulink output port that returns the ideal switch current and voltage.</td></tr></tbody></table>

## Assumptions and Limitations

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.

## Examples

The power\_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.

## References <a href="#references" id="references"></a>

\[1] Mohan, N., T.M. Undeland, and W\.P. Robbins, *Power Electronics: Converters, Applications, and Design*, John Wiley & Sons, Inc., New York, 1995.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/smart-power-simulation-software-sps/blocks-functions-tools/power-converters/switches/ideal-switch.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
