> 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/converters/buck-converter.md).

# Buck Converter

## Description

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

The **Buck Converter** bloc&#x6B;**,** located in the **OPAL-RT SPS Software/Power Electronics** library, implements a buck power converter. You can choose from four model types:

* **Switching devices** — The converter is modeled with IGBT/diode pairs controlled by firing pulses produced by a PWM generator. This model provides the most accurate simulation results.
* **Switching function** — The converter is modeled by a switching-function model. The switches are replaced with two voltage sources and two diodes on the AC side and with two current sources on the DC side. The converter is controlled by firing pulses produced by a PWM generator (0/1 signals) or by firing pulses averaged over a specified period (PWM averaging: signals between 0 and 1). Both modes of operation produce harmonics normally generated by a PWM-controlled converter and also correctly simulate rectifying operation as well as blanking time. This model type is well-suited for real-time simulation.
* **Average model (D-controlled)** — The converter is modeled using a switching-function model directly controlled by the duty cycle signal (0 < D < 1). A PWM generator is not required.
* **Average model (D-controlled, no rectifier mode)** — The block uses the voltage source directly controlled by the reference voltage to model the converter. The model does not require a PWM generator and does not simulate the rectifier mode. This setting provides the fastest simulations. When doing real-time simulation, use the Switching function setting with the firing pulses averaged, or the Average model (D-controlled) or Average model (D-controlled, no rectifier mode) settings.

## Ports

#### Input

<table data-header-hidden><thead><tr><th width="318"></th><th></th></tr></thead><tbody><tr><td><strong>BL</strong> - Input to block firing pulses Scalar</td><td>Input port to block all firing pulses to the converter. To block all firing pulses to the converter, apply a signal value of 1 to this port.</td></tr><tr><td><strong>g</strong> — Signal to control converter Scalar</td><td><p>The firing pulse signal to control the converter.</p><p><strong>Dependencies</strong> To enable this port, set <strong>Model type</strong> to Switching devices or Switching function.</p></td></tr><tr><td><strong>D</strong> — Signal to control converter Scalar in the range [0,1]</td><td><p>The duty cycle signal (a value between 0 and 1) used to control the converter.</p><p><strong>Dependencies</strong> To enable this port, set <strong>Model type</strong> to Average model (D-controlled).</p></td></tr></tbody></table>

#### Conserving

<table data-header-hidden><thead><tr><th width="326"></th><th></th></tr></thead><tbody><tr><td><strong>+</strong> — Positive terminal SPS electrical</td><td>SPS electrical conserving port associated with the converter's positive terminal.</td></tr><tr><td><strong>–</strong> — Negative terminal SPS electrical</td><td>SPS electrical conserving port associated with the converter's negative terminal.</td></tr><tr><td><strong>1</strong> — Output electrical terminal SPS electrical</td><td>SPS electrical conserving port associated with the converter's output electrical terminal.</td></tr></tbody></table>

### Parameters

<table data-header-hidden><thead><tr><th width="336"></th><th></th></tr></thead><tbody><tr><td><strong>Model type</strong> — Block model type<br>Switching devices (default) | Switching function | Average model (D-controlled) | Average model (D-controlled, no rectifier mode)</td><td>Specify the model type for the block to use.</td></tr><tr><td><strong>Device on-state resistance (Ohms)</strong> — Initial device resistance<br>1e-3 (default) | positive scalar</td><td>Internal resistance of the switching devices, in ohms. #### Dependencies To enable this parameter, set <strong>Model type</strong> to Switching devices.</td></tr><tr><td><strong>Snubber resistance (Ohms)</strong> — Resistance for snubber<br>1e6 (default) | positive scalar</td><td>The snubber resistance, in ohms. Set the snubber resistance to inf to eliminate the snubbers. #### Dependencies To enable this parameter, set <strong>Model type</strong> to Switching devices.</td></tr><tr><td><strong>Snubber capacitance (F)</strong> — Capacitance for snubber<br>inf (default) | nonnegative scalar</td><td>The snubber capacitance, in farads. Set the snubber capacitance to 0 to eliminate the snubbers. #### Dependencies To enable this parameter, set <strong>Model type</strong> to Switching devices.</td></tr><tr><td><strong>Forward voltages [Device Vf (V), Diode Vfd (V)]</strong> — Device and diode forward voltage<br>[0,0] (default) | two-element vector</td><td>The forward voltage of the switching device and of the diode, in volts. #### Dependencies To enable this parameter, set <strong>Model type</strong> to Switching devices.</td></tr><tr><td><strong>Diode on-state resistance (Ohms)</strong> — Internal resistance of diodes<br>1e-3 (default) | positive scalar</td><td>Internal resistance of the diodes, in ohms. #### Dependencies To enable this parameter, set <strong>Model type</strong> to Switching function or Average model (D-controlled).</td></tr><tr><td><strong>Diode snubber resistance (Ohms)</strong> — Snubber resistance of diodes<br>1e6 (default) | positive scalar</td><td>The snubber resistance, in ohms. Set the snubber resistance to inf to eliminate the snubbers. This parameter is available only when you set the <strong>Model type</strong> parameter to Switching function or Average model (D-controlled). #### Dependencies To enable this parameter, set <strong>Model type</strong> to Switching function or Average model (D-controlled).</td></tr><tr><td><strong>Diode snubber capacitance (F)</strong> — Snubber capacitance of diodes<br>inf (default) | nonnegative scalar</td><td>The snubber capacitance, in farads. Set the snubber capacitance to 0 to eliminate the snubbers. #### Dependencies To enable this parameter, set <strong>Model type</strong> to Switching function or Average model (D-controlled).</td></tr><tr><td><strong>Diode forward voltage (V)</strong> — Forward voltage across diode<br>1e-3 (default) | nonnegative scalar</td><td>Forward voltage, in volts, across the diode when it is conducting. #### Dependencies To enable this parameter, set <strong>Model type</strong> to Switching function or Average model (D-controlled).</td></tr><tr><td><strong>Current source snubber resistance (Ohms)</strong> — Snubber resistance across two sources<br>inf (default) | positive scalar</td><td>The snubber resistance across the two current sources, in ohms. Set the snubber resistance to inf to eliminate the snubbers. #### Dependencies To enable this parameter, set <strong>Model type</strong> to Switching function or Average model (D-controlled).</td></tr><tr><td><strong>DC side snubber resistance (Ohms)</strong> — Snubber resistance across current sources<br>inf (default) | positive scalar</td><td>Snubber resistance across the two current sources, in ohms. Set the snubber resistance to inf to eliminate the snubbers. #### Dependencies To enable this parameter, set <strong>Model type</strong> to Switching function, Average model (D-controlled), or Average model (No rectifier mode).</td></tr><tr><td><strong>AC side source resistance (Ohms)</strong> — Source resistance on AC side<br>1e-3 (default) | positive scalar</td><td>Source resistance on the AC side, in ohms. Set the snubber resistance to inf to eliminate the snubbers. #### Dependencies To enable this parameter, set <strong>Model type</strong> to Average model (No rectifier mode).</td></tr></tbody></table>


---

# 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/converters/buck-converter.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.
