> 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/rt-lab/simulink-blocks-reference/mmc-library/conf_sf.md).

# Conf\_sf

## Description

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-721a9f2f1eed44040def60fd079382ad77cbe6cc%2FMMC_conf_sf_block.png?alt=media" alt=""><figcaption></figcaption></figure>

The **Conf\_sf** (VSC Configuration) block, located in the **MMC/VSC blocks/Conf** library, configures a Voltage Source Converter (VSC) and computes its internal voltages and currents using a switching-function approach suitable for real-time simulation.

As an example, the AC/AC converter below illustrates the implementation of the OPAL VSC model, which consists of three stages: AC/DC, DC/DC, and DC/AC. In this model, each single‑phase converter unit without its capacitor is defined as a sub‑module (SM). Similar to an MMC, the VSC can include different SM types depending on the converter topology.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-046356397867c24f5ba4411321badfe3ac6d9936%2FMMC_conf_sf_diagram1.png?alt=media" alt=""><figcaption></figcaption></figure>

The block supports multi-stage and multi-phase VSCs composed of different submodule (SM) topologies (HB, FB, T-type, NPC, CD) and can include Dual/Multi Active Bridges (DAB/MAB). Internal capacitor voltages computed by this block are used by the [**vlvN**](https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/mmc-library/vlvn.md) block to interact with other circuit components.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-43256c9475c33e4ee939528b54c3313f6714e849%2FMMC_conf_sf_diagram2.png?alt=media" alt=""><figcaption></figcaption></figure>

## Mask parameters

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-5b651be2f7cba523b0a2a963820a412fa282307c%2FMMC_conf_sf_mask.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

<table><thead><tr><th width="136">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>nbSM: number of SM</strong></td><td><p>Total number of submodules in the converter. Must be greater than or equal to the total number of SM configured in the <a href="https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/mmc-library/vsc_param.md"><strong>VSC_Param</strong></a> block. Any difference is treated as disabled SM. This value fixes the I/O dimensions and computational load; choose the smallest feasible value.</p><ul><li>0 &#x3C; nbSM ≤ 50; otherwise: error.</li><li>If 1 &#x3C; nbSM ≤ 50 but non-integer: floors to integer (e.g., 3.6 → 3) with warning.</li></ul></td></tr></tbody></table>

{% tabs %}
{% tab title="Cap" %}

<table><thead><tr><th width="168">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Cap index of SM</strong></td><td><p>Row vector (length = <strong>nbSM</strong>) mapping each SM to a capacitor. Positive index j refers to internal capacitor j; negative index −j refers to external capacitor j. SM sharing the same index connect to the same capacitor.<br>For <strong>N_cin</strong> internal and <strong>N_cex</strong> external capacitors, each element ∈ [−N_cex, −1] ∪ [1, N_cin]; 0 is not allowed.<br><strong>Example:</strong> [1 1 −2 3 −2 −1 2] → 7 SM and 5 capacitors (3 internal, 2 external):</p><ul><li>SM 1 and 2 &#x3C;=> Cap 1 (int) &#x3C;=> 1st int Cap</li><li>SM 3 and 5 &#x3C;=> Cap -2 (ext) &#x3C;=> 2nd ext Cap</li><li>SM 4 &#x3C;=> Cap 3 (int) &#x3C;=> 3rd int Cap</li><li>SM 6 &#x3C;=> Cap -1 (ext) &#x3C;=> 1st ext Cap</li><li>SM 7 &#x3C;=> Cap 2 (int) &#x3C;=> 2nd int Cap</li></ul><p><strong>Parameter Compatibility Check:</strong></p><ul><li>Remove zeros (e.g., [1 0 1] → [1 1]) with warning.</li><li>If length > <strong>nbSM</strong>: trim tail with warning.</li><li>If length &#x3C; <strong>nbSM</strong>: append indices to new internal capacitors in order with warning.</li><li>Out-of-range or skipped indices: reindex in order without gaps (e.g., [10 −2 −3 10.5 11 10.5] → [1 −1 −2 2 3 2]) with warning.</li></ul></td></tr><tr><td><strong>Cap discharge resistor (ohms)</strong></td><td><p>Discharge resistor in parallel with the cell capacitor. All discharge resistors are identical; the block uses the first nonzero value provided.<br><strong>Unit, data type and range:</strong> ohms; positive value or <em>inf</em> (no discharge resistor).<br><strong>Parameter Compatibility Check:</strong></p><ul><li>Zeros are removed; only the first nonzero value is kept (e.g., [0 1e5 1e6] → [1e5]) with warning.</li><li>Empty or all zeros → <em>inf</em> (e.g., [] or [0] → [inf]) with warning.</li></ul></td></tr><tr><td><strong>C1 capacitance vector (F)</strong></td><td><p>Row vector (length = <strong>N_cin</strong>) of internal capacitors’ C1 values. Some topologies have series C1 and C2; others have a single capacitor (C1).<br><strong>Unit, data type and range:</strong> farads; positive values.<br><strong>Parameter Compatibility Check:</strong></p><ul><li>Empty or all zeros → error.</li><li>Remove zeros; take absolute values for negatives with warning.</li><li>If length > <strong>N_cin</strong>: trim tail with warning.</li><li>If length &#x3C; <strong>N_cin</strong>: repeat first element to fill with warning.</li></ul></td></tr><tr><td><strong>C1/C2 ratio vector</strong></td><td><p>Row vector (length = <strong>N_cin</strong>) of C1 over C2 ratios. A value of 0 means no C2 (single capacitor).<br><strong>Unit, data type and range:</strong> unitless; non-negative.<br><strong>Parameter Compatibility Check:</strong></p><ul><li>Negative values converted to absolute with warning.</li><li>Empty or all zeros → all capacitors have only C1 (warning).</li><li>If length > <strong>N_cin</strong>: trim tail with warning.</li><li>If length &#x3C; <strong>N_cin</strong>: repeat first element to fill with warning.</li></ul></td></tr><tr><td><strong>Initial capacitor voltage (V)</strong></td><td><p>Row vector (length = <strong>N_cin</strong>) of initial voltages for internal capacitors. For two-capacitor topologies, C1 and C2 of the same unit share the same initial voltage.<br><strong>Unit, data type and range:</strong> volts; any real value.<br><strong>Parameter Compatibility Check:</strong></p><ul><li>If length > <strong>N_cin</strong>: trim tail with warning.</li><li>If length &#x3C; <strong>N_cin</strong>: append zeros with warning.</li></ul></td></tr></tbody></table>
{% endtab %}

{% tab title="DAB" %}

<table><thead><tr><th width="172">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>DAB/MAB index of SM (same dimension as nbSM; 0 for non-DAB/MAB SM)</strong></td><td><p>Row vector (length = <strong>nbSM</strong>) mapping SM to DAB/MAB groups. Value j (>0): SM connected positively to DAB/MAB j. Value −j: connected negatively. Value 0: SM connected to an interface node (must be set in “Interface-Node index of SM”).<br>For <strong>N_MAB</strong> DAB/MAB groups, each element ∈ [−N_MAB, N_MAB].<br><strong>Example:</strong> <strong>nbSM</strong> = 7; [0 1 −1 2 −2 0 0] → 4 SM connected to two DAB groups; 3 SM connected to interface nodes.</p><ul><li>DAB 1 &#x3C;=> SM [2] positively &#x26; SM [3] negatively;</li><li>DAB 2 &#x3C;=> SM [4] positively &#x26; SM [5] negatively;</li></ul><p><strong>Parameter Compatibility Check:</strong></p><ul><li>Each DAB/MAB must have at least two SM: one positive and one negative (error if violated).</li><li>Length > <strong>nbSM</strong>: trim tail with warning.</li><li>Length &#x3C; <strong>nbSM</strong>: append zeros with warning.</li><li>Out-of-range or skipped indices: reindex in order without gaps (e.g., [0 3 −3 2 −2] → [0 2 −2 1 −1]) with warning.</li></ul></td></tr><tr><td><strong>DAB/MAB winding index (same dimension/sequence as non-0 element in DAB/MAB index</strong>)</td><td><p>Row vector aligned to the nonzero elements of “DAB/MAB index of SM”. Value j (1–5) assigns the transformer winding number used by that DAB/MAB-connected SM.<br><strong>Parameter Compatibility Check:</strong></p><ul><li>Remove zeros; convert negatives to absolute values with warning.</li><li>If more nonzeros than in DAB/MAB index: trim tail with warning.</li><li>If fewer nonzeros: fill using default winding assignment based on DAB/MAB index (with warning). Series connection uses winding 5 as needed.</li><li>Skipped indices: reindex to remove gaps (e.g., [2 1 4] → [2 1 3]) with warning.</li><li>Empty or 0: auto-fill by default mapping with warning.</li><li>Values > 5 replaced by 5 if no skipped index exists (warning).</li></ul></td></tr><tr><td><strong>Voltage rating of DAB/MAB SM (V)</strong></td><td><p>Row vector (length = <strong>N_smD</strong>) of output voltage ratings for DAB/MAB-connected SM. The sum of ratings on the same winding equals that winding’s nominal voltage.<br><strong>Unit, data type and range:</strong> volts; positive values.<br><strong>Parameter Compatibility Check:</strong></p><ul><li>Remove zeros; convert negatives to absolute values with warning.</li><li>Length &#x3C; N_smD: error.</li><li>Length > N_smD: trim tail with warning.</li></ul></td></tr><tr><td><strong>Inductor of DAB/MAB SM (H)</strong></td><td><p>Row vector (length = <strong>N_smD</strong>) of series inductances placed between each DAB/MAB-connected SM and its transformer winding (can represent discrete inductors, transformer leakage, or both). If multiple SM connect to one winding, count the inductor only once.<br><strong>Unit, data type and range:</strong> henry; non-negative (at least one inductor must be present in each DAB/MAB circuit).<br><strong>Parameter Compatibility Check:</strong></p><ul><li>Convert negatives to absolute values with warning.</li><li>Length > <strong>N_smD</strong>: trim tail with warning.</li><li>Length &#x3C; <strong>N_smD</strong>: append zeros with warning.</li><li>Each DAB/MAB must include at least one inductor overall; otherwise: error.</li></ul></td></tr><tr><td><strong>Resistor of DAB/MAB SM (Ohms)</strong></td><td><p>Row vector (length = <strong>N_smD</strong>) of series resistances placed between each DAB/MAB-connected SM and its transformer winding. This resistor is in series with the inductor defined above.<br><strong>Unit, data type and range:</strong> ohms; non-negative.<br><strong>Parameter Compatibility Check:</strong></p><ul><li>Convert negatives to absolute values with warning.</li><li>Length > <strong>N_smD</strong>: trim tail with warning.</li><li>Length &#x3C; <strong>N_smD</strong>: append zeros with warning.</li></ul></td></tr><tr><td><strong>DAB/MAB frequency (Hz) (same dimension/sequence as DAB/MAB number)</strong></td><td><p>Row vector of nominal operating frequencies for each DAB/MAB transformer.<br><strong>Unit, data type and range:</strong> hertz.<br><strong>Parameter Compatibility Check:</strong></p><ul><li>At least one value must be provided; otherwise: error.</li><li>Convert negatives to absolute values; if fewer values than DAB/MAB count, fill missing entries with the absolute value of the first element (warning).</li></ul></td></tr><tr><td><strong>Magnetization inductor of DAB/MAB (H) (same dimension/sequence as DAB/MAB number)</strong></td><td><p>Row vector of magnetization inductors for each DAB/MAB transformer. Use 0 or [] to ignore the magnetization branch.<br><strong>Unit, data type and range:</strong> henry.<br><strong>Parameter Compatibility Check:</strong></p><ul><li>Remove zeros; convert negatives to absolute values with warning.</li><li>If more than DAB/MAB count: trim tail with warning.</li><li>If fewer than DAB/MAB count: fill with the first nonzero value with warning.</li></ul></td></tr></tbody></table>
{% endtab %}

{% tab title="Node" %}

<table><thead><tr><th width="181">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Interface-Node index of SM (same dimension as nbSM; 0 for SM connecting to DAB or MAB)</strong></td><td><p>Row vector (length = <strong>nbSM</strong>) mapping SM to interface nodes. Value j (>0): SM connected to interface node j. Value 0: SM connected internally to a DAB/MAB (must be set in “DAB/MAB index of SM”). Each SM must connect to exactly one: either a DAB/MAB or an interface node.<br>For N_node interface nodes, each element ∈ [0, N_node].<br><strong>Example:</strong> <strong>nbSM</strong> = 7; “DAB/MAB index of SM” = [0 1 −1 2 −2 0 0]; “Interface-Node index of SM” = [1 0 0 0 0 2 1]:</p><ul><li>DAB 1 &#x3C;=> SM [2] positively &#x26; SM [3] negatively;</li><li>DAB 2 &#x3C;=> SM [4] positively &#x26; SM [5] negatively;</li><li>Node 1 &#x3C;=> SM [1 7];</li><li>Node 2 &#x3C;=> SM [6];</li></ul><p><strong>Parameter Compatibility Check:</strong></p><ul><li>Conflict resolution: for each SM, exactly one of the two indices (DAB/MAB vs. Interface-Node) must be nonzero after checks. If conflicts exist, “DAB/MAB index of SM” prevails; nonzero interface-node indices are remapped in order to remaining non-DAB/MAB SM (warning).</li><li>More nonzeros than N_node: trim tail with warning.</li><li>Fewer nonzeros than N_node: assign remaining non-DAB/MAB SM to new interface nodes in order with warning.</li><li>Out-of-range or skipped indices: reindex in order without gaps with warning.</li></ul></td></tr><tr><td><strong>Node voltage reference point for SM Group 1/2/3</strong></td><td><p>Sets the voltage reference for interface-node voltages. SM within the same group must use the same option.<br><strong>Options:</strong></p><ul><li>Midpoint of the two dc capacitors (use only when two dc capacitors exist and the midpoint is grounded).</li><li>Negative dc bus (use for most cases, including series-connected MMC SM, single-capacitor SM, or when the negative dc bus is grounded).</li></ul></td></tr></tbody></table>
{% endtab %}

{% tab title="advanced" %}

<table><thead><tr><th width="196">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Inductor integration method</strong></td><td>Discrete integration method for DAB/MAB inductor/transformer current calculation. <strong>Options:</strong> Forward Euler or Trapezoidal.</td></tr><tr><td><strong>time step</strong></td><td>Discrete time step used by the block.<br><strong>Unit, data type and range:</strong> seconds; positive real.</td></tr></tbody></table>
{% endtab %}

{% tab title="message" %}

<table><thead><tr><th width="290">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Showing warning message by ‘Parameter Compatibility Check’</strong></td><td>Controls how compatibility warnings are displayed.</td></tr><tr><td><strong>Showing converter config summary message</strong></td><td>Controls how the converter configuration summary is displayed.</td></tr><tr><td><strong>Summary Message</strong></td><td><p>Select which summaries to include in the configuration summary output.</p><ul><li>Including Capacitor connection summary</li><li>Including DAB connection summary</li><li>Including node connection summary</li><li>Including SM connection summary</li></ul></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

## Inputs

<table><thead><tr><th width="117">Input</th><th>Description</th></tr></thead><tbody><tr><td><strong>In (bus)</strong></td><td><p>Bus input containing:</p><ul><li><strong>g</strong>: five vectors g1–g5 (each length = <strong>N_sm</strong>). Elements ∈ [0, 1] denote gating state or duty ratio for each SM and gate signal.</li><li><strong>Icint_ext</strong>: vectors <strong>Icint1_ext</strong> and <strong>Icint2_ext</strong> (each length = <strong>N_cin</strong>). Charging currents into internal capacitors C1 and C2, in amperes; positive is charging.</li><li><strong>Vcext</strong>: vectors <strong>Vc1ext</strong> and <strong>Vc2ext</strong> (each length = <strong>N_cex</strong>). External capacitor voltages C1 and C2, in volts.</li><li><strong>Ivlv</strong>: vector (length = <strong>N_node</strong>). Interface-node currents, in amperes.</li></ul></td></tr></tbody></table>

## Outputs

<table><thead><tr><th width="119">Output</th><th>Description</th></tr></thead><tbody><tr><td><strong>Out (bus)</strong></td><td><p>Bus output containing:</p><ul><li><strong>Vs</strong>: vectors <strong>Vsp</strong> and <strong>Vsn</strong> (each length = <strong>N_node</strong>). Interface-node voltages for positive and negative directions.</li><li><strong>Vcint</strong>: vectors <strong>Vc1int</strong> and <strong>Vc2int</strong> (each length = <strong>N_cin</strong>). Internal capacitor voltages C1 and C2, in volts.</li><li><strong>Icex</strong>: vectors <strong>Ic1ex</strong> and <strong>Ic2ex</strong> (each length = <strong>N_cex</strong>). Charging currents from converter to external capacitors C1 and C2, in amperes; positive is charging.</li><li><strong>Idab</strong>: DAB/MAB current measurements, in amperes.</li><li><strong>flt</strong>: vectors <strong>flt1</strong> and <strong>flt2</strong> (each length = <strong>N_cin</strong>). Capacitor short-circuit fault indicators for C1 and C2; 1 = fault, 0 = no fault.</li><li><strong>Ismd</strong>: vectors <strong>Ism1d</strong> and <strong>Ism2d</strong> (each length = <strong>N_SM</strong>). SM dc-side currents (C1 and C2), in amperes; positive is charging.</li><li><strong>Ism</strong>: vector (length = <strong>N_SM</strong>). SM ac-side currents, in amperes.</li></ul></td></tr></tbody></table>

## Characteristics and limitations

<table><thead><tr><th width="285">Characteristic</th><th>Value</th></tr></thead><tbody><tr><td>Execution context</td><td>CPU-based real-time simulation with typical time steps of tens of microseconds.</td></tr><tr><td>Maximum switching frequency</td><td>Up to one quarter of the sampling frequency when using the <a href="https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/mmc-library/pwm-gen.md">PWM Gen</a> block. Example: 50 µs time step → up to 5 kHz switching frequency.</td></tr><tr><td>DAB/MAB transformer model</td><td>Ideal transformer with leakage inductance and resistance; magnetizing branch not considered.</td></tr><tr><td>External capacitor fault modeling</td><td>Short-circuit fault of external capacitors is not supported.</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/rt-lab/simulink-blocks-reference/mmc-library/conf_sf.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.
