> 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/pe-add-on-simulink/simulation-control-monitoring-and-logging/tune-switch-conductance-gs.md).

# Tune Switch Conductance (Gs)

## eHS Solver Theory

The **eHS Solver** uses **Modified Nodal Analysis** to generate a conductance matrix that, when solved, returns the voltage at each node of the circuit and the current in each branch. The conductance matrix of the circuit is generated independently from the state of the switches, and therefore does not need to be recomputed when a switch is opened or closed during the simulation. This is achieved through the implementation of the Pejovic method, which represents each [**Switch**](https://www.opal-rt.com/docs/pe-add-on-simulink/model-and-simulation/add-and-configure-a-circuit-model-to-the-system-definition/switches-section.md) component as an impedance — where a conducting switch is represented as an inductor and an open switch is represented as a capacitor.

The inductors and capacitors are further simplified using **Backwards Euler discretization**, and their equivalent circuits become a current source with a shunt resistance.

<figure><img src="https://2999842053-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe9Kk9pJCHht2LLBSxPap%2Fuploads%2FcQxaGaYCf0y76TJFOXK4%2Fd1c75fec-7eb7-48ae-b3c8-80cb0fe8c024.png?alt=media&amp;token=4ce1674e-26ab-4102-baf3-26a2fe4ec7b4" alt=""><figcaption></figcaption></figure>

## Understand Gs

For the conductance matrix to remain constant throughout switching events, the following equations, which define the Switch Conductance (Gs), must remain true:

$$
G\_s = h / L = C / h \\\[8pt]
$$

where h is the simulation time step of the circuit. When building the nodal matrix, Gs is defined for each switch, typically within a range of 0.001 to 10. It determines the value of the inductance and the capacitance representing the switch in conducting and non-conducting states.

Equations relating L and C with Gs and h:

$$
L = h / G\_s \\\[8pt]

C = h \cdot G\_s \\\[8pt]
$$

For example, for a time step of 100 ns and a Gs of 1, the switch will be represented by the following values:

$$
L = h / G\_s = 100,nH \\\[8pt]

C = h \cdot G\_s = 100,nF \\\[8pt]
$$

## Select Gs value

The Gs value for each switch depends on:

* Topology of the circuit
* Circuit parameters including Base Power, Source Current(s), Source Voltage(s), Duty Cycle, Load Current(s), Load Voltage(s)

A typical good approximation for Gs is:

$$
G\_s = \frac{I\_{max}}{V\_{max}} \\\[8pt]
$$

where Imax is the maximum current flowing outside the converter and Vmax is the maximum voltage at the arm middle point.

Example: in the Two Level Arm circuit below, Imax is 64 A (signal Y02\_Iac) and Vmax is 100 V (signal Y01\_Vac), therefore the optimal value for Gs is 0.64.

<figure><img src="https://2999842053-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe9Kk9pJCHht2LLBSxPap%2Fuploads%2FRjJsbKXvQeozSQ4l6g6e%2Fd10b6419-3381-4d81-b323-e03da175a434.png?alt=media&amp;token=74b6beab-fe0e-4f99-98d8-a2927f1ef597" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2999842053-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe9Kk9pJCHht2LLBSxPap%2Fuploads%2F7nxMYBRlNA2xhvOJejgR%2Fafd8d2a1-c713-4074-84d8-a216d4b08172.png?alt=media&amp;token=93496eab-ff4c-4daf-a52a-12a7b90203e2" alt=""><figcaption></figcaption></figure>

### Sample Gs values

Below are sample recommended Gs values for a Two-level NPC Inverter with RL Load and Back EMF (single phase or three-phase).

<figure><img src="https://2999842053-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe9Kk9pJCHht2LLBSxPap%2Fuploads%2Fhhuph3t5glLuAOewuTdA%2F306cb63f-1f7a-4a30-bc57-34866862c863.png?alt=media&amp;token=1cc5aec5-e95f-4727-9033-8f8b317672e3" alt=""><figcaption></figcaption></figure>

| DC Source Voltage (V) | Load Current RMS (A) |   Gs   |
| :-------------------: | :------------------: | :----: |
|        **100**        |          20          |   0.2  |
|        **240**        |          80          | 0.3333 |
|        **500**        |          280         |  0.56  |

{% hint style="info" %}
When using the two-level and three-level bridge blocks in the circuit model, eHS will use the first switch's conductance to characterize all switches in the bridge.
{% endhint %}

For additional assistance tuning the Gs values, please contact [**OPAL-RT Technical Support**](http://www.opal-rt.com/contact-technical-support/).


---

# 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/pe-add-on-simulink/simulation-control-monitoring-and-logging/tune-switch-conductance-gs.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.
