> 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/efpgasim-library/simulink-sps-workflow/switching-function-configuration.md).

# Switching function configuration

## Description

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2FlYcvZL2IMNnD21kWmtPZ%2Fimage.png?alt=media&amp;token=39089242-c5ec-4c91-9d6c-bee4ad9a128d" alt=""><figcaption></figcaption></figure>

The **Switching function configuration** block, located in the **cpuhilios\_lib** library, is used to configure four different switching functions simulated on FPGA. For each switching function, the converter type must be selected, the proper gating signals, and the corresponding measurement.

## Mask parameters

{% columns %}
{% column %}

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2FxaIxBGAEN4nKc8nRSbYl%2Fimage.png?alt=media&amp;token=b6e63b78-14ce-435f-8af5-ba1cff5cc938" alt="" width="507"><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2FzxsorNmZkQxRY8RDjmwK%2Fimage.png?alt=media&amp;token=1af645dd-586d-4888-87b7-e61528c7a0a9" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

{% tabs %}
{% tab title="Converter #n" %}

| Parameter                              | Description                                                                                                                                                                               |
| -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Converter type**                     | This is used to choose which converter topology will be simulated by the switching function.                                                                                              |
| **Gate phase A, B, C**                 | This indicates which digital input will be driving the different gates of the chosen converter. It is a vector of 4 values corresponding to gates g1 to g4 as shown in the picture below. |
| **Vdc+, Vdc-, Ia, Ib, Ic measurement** | These measurements have to correspond to the one in the eHS model.                                                                                                                        |

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fj5PR25AVOBkrfzuIjJ1u%2Fimage.png?alt=media&amp;token=7524ea5c-27e6-47fe-acb0-7cc2e8351ea4" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Configuration" %}

| Parameter                      | Description                                                                                                                                                                                                          |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Controller name**            | Links this block to an OpCtrl block by entering the same 'Controller Name' as specified in the OpCtrl block. The OpCtrl block controls initialization of the settings of one specific FPGA-based card in the system. |
| **LoadIn port number**         | This should reflect the LoadIn port used to configure the Switching function configuration block on the FPGA.                                                                                                        |
| **Signal name list selection** | This value is used to populate the different popup list for the measurement configuration.                                                                                                                           |
| **Sampling time**              | This value is the sampling time of the simulation.                                                                                                                                                                   |
| {% endtab %}                   |                                                                                                                                                                                                                      |
| {% endtabs %}                  |                                                                                                                                                                                                                      |

## Inputs

This block has no input

## Outputs

| Output | Description                                                                                                                                                                                                                     |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Status | <p>Returns the following values:<br>0: No error.<br>-1: Block could not be matched with an OpCtrl block (check the 'controller Name' value), or card initialization problem.<br>-2: Internal memory initialization problem.</p> |

## Characteristics and limitations <a href="#heading-title-text" id="heading-title-text"></a>

| Direct Feedthrough   | N/A |
| -------------------- | --- |
| Discrete sample time | YES |
| XHP support          | YES |
| Work offline         | NO  |


---

# 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/efpgasim-library/simulink-sps-workflow/switching-function-configuration.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.
