> 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/model-and-simulation/phasor-domain-with-ephasorsim/integrate-a-power-system-model-to-ephasorsim/include-fmu-components/model-fmus/single-controller-fmu-templates.md).

# Single Controller FMU Templates

## Introduction <a href="#overview" id="overview"></a>

**Single Controller FMU Templates** are standardized Modelica wrappers that allow individual power system components to be exported as FMUs (Functional Mock-up Units) for use inside the ePHASORSIM solver.

In the **Libraries Browser**, expand the `ePHASORSIM` package (or one of its subpackages, such as `Controllers`, `Exciters`, `Governors`, or `Machines`) and select an appropriate template as the starting point for your model.

Each FMU type is identified by a `partType` parameter that tells the solver how to handle the component:

| Name (partType)        | Description                                                                                                                                                                                                                                                                                                 |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **GenUnit (`1`)**      | <p>Machine + all controllers bundled into a single FMU. Self-contained black box; the solver only exchanges bus voltage/current at the network interface.<br><br>Other devices such as Induction Machines, Renewable Energy, FACTS and HVDC lines are implemented as GenUnit (<code>partType=1</code>).</p> |
| **Machine (`2`)**      | Standalone machine FMU. Controller signals (EFD, PMECH, TRIP, etc.) are routed externally by the solver. Bus voltage/current exchanged via `p.vr`/`p.vi`.                                                                                                                                                   |
| **Exciter (`3`)**      | Excitation system FMU. Paired at runtime with a machine by the solver.                                                                                                                                                                                                                                      |
| **Stabilizer (`4`)**   | Power system stabilizer FMU. Paired at runtime with an exciter and machine.                                                                                                                                                                                                                                 |
| **Governor (`5`)**     | Turbine-governor FMU. Paired at runtime with a machine by the solver.                                                                                                                                                                                                                                       |
| **UnderLimiter (`6`)** | Under excitation limiter FMU.                                                                                                                                                                                                                                                                               |
| **OverLimiter (`7`)**  | Over excitation limiter FMU.                                                                                                                                                                                                                                                                                |

The controllers listed on this page must be modeled based on the templates described above. The routing of control signals between machine and controllers is **hard-wired by the ePHASORSIM solver**. For custom control structures or routing, use a full GenUnit FMU (partType=1).

## Standalone machine (partType=2) <a href="#id-2.-standalone-machine-template-parttype-2" id="id-2.-standalone-machine-template-parttype-2"></a>

Standalone machine FMUs expose the synchronous machine as a separate component. The ePHASORSIM solver handles the coupling between the machine and its controllers (excitation systems, turbine-governors, stabilizers) externally.

### Supported machines <a href="#id-2.1-supported-machines" id="id-2.1-supported-machines"></a>

| Category                           | Models         |
| ---------------------------------- | -------------- |
| Synchronous Machine (round rotor)  | GENROU, GENROE |
| Synchronous Machine (salient pole) | GENSAL, GENSAE |
| Synchronous Machine (classical)    | GENCLS         |

### Bus Interface — PwPinFMU connector <a href="#id-2.2-bus-interface-pwpinfmu-connector" id="id-2.2-bus-interface-pwpinfmu-connector"></a>

The bus voltage/current interface uses a special `PwPinFMU` connector (not the standard `PwPin`) to avoid FMI export issues with Modelica `flow` variables. Internally, the wrapper uses the `PIN2INOUT` composition pattern to bridge between the FMU boundary and the machine's standard `PwPin` port.

| Pin Name | Pin Type | Description                           |
| -------- | -------- | ------------------------------------- |
| `p.vr`   | Input    | Bus voltage, real component (pu)      |
| `p.vi`   | Input    | Bus voltage, imaginary component (pu) |
| `p.ir`   | Output   | Bus current, real component (pu)      |
| `p.ii`   | Output   | Bus current, imaginary component (pu) |

**Why PwPinFMU instead of PwPin?** The standard PwPin connector uses Modelica flow variables for current. When a model containing flow variables is exported as an FMI 1.0 FMU, the Modelica compiler may apply optimizations (alias elimination, constant folding of unconnected flows) that remove or hide the bus interface variables from the exported FMU description. The PwPinFMU connector declares voltage as explicit input Real and current as plain Real, ensuring all bus interface variables are preserved with the correct causality in the exported FMU.

### Controller routing pins <a href="#id-2.3-controller-routing-pins" id="id-2.3-controller-routing-pins"></a>

The solver routes these signals between the standalone machine FMU and its assigned controller(s).

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

| Pin Name       | Pin Type | Description                                                              | Connects To                                                        |
| -------------- | -------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------ |
| `TRIP`         | Input    | Trip signal                                                              | OpalRT Interface Pin                                               |
| `EFD`          | Input    | Exciter output EFD (pu)                                                  | EFD of Exciter, or EFD0 of itself (when no exciter)                |
| `PMECH`        | Input    | Turbine output PMECH (pu)                                                | PMECH of TurbineGovernor, or PMECH0 of itself (when no governor)   |
| `EFD0`         | Output   | Initial EFD value (pu)                                                   | EFD0 of Exciter                                                    |
| `PMECH0`       | Output   | Initial PMECH value (pu)                                                 | PMECH0 of TurbineGovernor                                          |
| `XADIFD`       | Output   | Field current (pu)                                                       | XADIFD of Exciter                                                  |
| `VI[1..4]`     | Output   | Machine voltage and current in rectangular form (pu): `[vr, vi, ir, ii]` | VI of Exciter, Stabilizer, TurbineGovernor                         |
| `AccPower`     | Output   | Accelerating power (pu on MBASE)                                         | PSS\_AUX\[2] and PSS\_AUX2\[2] of Stabilizer                       |
| `MBASE`        | Output   | Machine base power (MVA)                                                 | MBASE of TurbineGovernor                                           |
| `SLIP`         | Output   | Machine slip (pu)                                                        | PSS\_AUX\[1], PSS\_AUX2\[1] of Stabilizer; SLIP of TurbineGovernor |
| `EX_AUX[1..4]` | Output   | Exciter auxiliary signals                                                | EX\_AUX of Exciter                                                 |
| `ETERM0`       | Output   | Initial terminal voltage (pu)                                            | ETERM0 of Exciter                                                  |

### Monitoring outputs <a href="#id-2.4-monitoring-outputs" id="id-2.4-monitoring-outputs"></a>

These are internal machine variables exposed as flat `RealOutput` for data acquisition and backward compatibility with GenUnit data paths:

| Pin Name | Description                       | Available On                   |
| -------- | --------------------------------- | ------------------------------ |
| `ANGLE`  | Rotor angle (rad)                 | All machines                   |
| `TELEC`  | Electrical torque (pu)            | All machines                   |
| `EFD1`   | Field voltage after trip logic    | GENROU, GENROE, GENSAL, GENSAE |
| `PMECH1` | Mechanical power after trip logic | All machines                   |
| `PELEC`  | Electrical active power (pu)      | All machines                   |

`EFD1` is not available on GENCLS because the field voltage is a `protected` variable in the classical machine model.

### Machine-specific parameters <a href="#id-2.5-machine-specific-parameters" id="id-2.5-machine-specific-parameters"></a>

All machines share the following general parameters:

| Parameter  | Description                                         |
| ---------- | --------------------------------------------------- |
| `P_gen`    | Bus active power (MW)                               |
| `Q_gen`    | Bus reactive power (MVAR)                           |
| `Vt_abs`   | Bus voltage magnitude (pu)                          |
| `Vt_ang`   | Bus voltage angle (deg)                             |
| `partType` | Component type (always `2` for standalone machines) |

## Exciter (partType=3) <a href="#id-3.-exciter-template-parttype-3" id="id-3.-exciter-template-parttype-3"></a>

Excitation system FMUs receive machine state information and produce the field voltage (EFD) signal.

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

| Pin Name       | Pin Type | Description                                          | Connects To                    |
| -------------- | -------- | ---------------------------------------------------- | ------------------------------ |
| `VI[1..4]`     | Input    | Machine voltage and current in rectangular form (pu) | VI of Generator                |
| `ECOMP`        | Output   | Machine terminal voltage (pu)                        | ECOMP of Stabilizer            |
| `XADIFD`       | Input    | Field current (pu)                                   | XADIFD of Generator            |
| `VUEL`         | Input    | Under excitation limiter output                      | VUEL or initial constant value |
| `VOEL`         | Input    | Over excitation limiter output                       | VOEL or initial constant value |
| `VOTHSG`       | Input    | Stabilizer VOTHSG output (pu)                        | VOTHSG of Stabilizer           |
| `dVREF`        | Input    | Change in voltage reference (pu)                     | OpalRT Interface Pin           |
| `EX_AUX[1..4]` | Input    | Exciter auxiliary signals                            | EX\_AUX of Generator           |
| `ETERM0`       | Input    | Initial ETERM value (pu)                             | ETERM0 of Generator            |
| `EFD`          | Output   | Exciter output EFD signal (pu)                       | EFD of Generator               |
| `EFD0`         | Input    | Initial EFD value (pu)                               | EFD0 of Generator              |

**Supported models (37):** AC7B, AC8B, ESAC1A, ESAC2A, ESAC3A, ESAC5A, ESAC6A, ESAC8B, ESDC1A, ESDC2A, ESST1A, ESST3A, ESST4B, EXAC1, EXAC1A, EXAC2, EXAC3, EXAC4, EXDC2, EXPIC1, EXST1, EXST2, EXST3, IEEET1, IEEET2, IEEET3, IEEET5, IEEEX1, IEEEX2, IVOEX, REXSYS, SCRX, SEXS, ST5B, ST6B, ST7B, URST5T

`ECOMP` is not a standard output on all exciter Modelica models. The `SingleExciterFMU` base class adds it with the equation `ECOMP = ETERM`, ensuring the terminal voltage is forwarded to the stabilizer interface.

## Stabilizer (partType=4) <a href="#id-4.-stabilizer-template-parttype-4" id="id-4.-stabilizer-template-parttype-4"></a>

Power system stabilizer FMUs receive machine state information and produce the VOTHSG signal for the excitation system.

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

| Pin Name      | Pin Type | Description                                              | Connects To           |
| ------------- | -------- | -------------------------------------------------------- | --------------------- |
| `ECOMP`       | Input    | Machine terminal voltage (pu)                            | ECOMP of Exciter      |
| `VI[1..4]`    | Input    | 1st input for machine voltage and current (pu)           | VI of Generator       |
| `PSS_AUX[1]`  | Input    | 1st auxiliary input for generator SLIP (pu)              | SLIP of Generator     |
| `PSS_AUX[2]`  | Input    | 1st auxiliary input for accelerating power (pu on MBASE) | AccPower of Generator |
| `VI2[1..4]`   | Input    | 2nd input for machine voltage and current (pu)           | VI of Generator       |
| `PSS_AUX2[1]` | Input    | 2nd auxiliary input for generator SLIP (pu)              | SLIP of Generator     |
| `PSS_AUX2[2]` | Input    | 2nd auxiliary input for accelerating power (pu on MBASE) | AccPower of Generator |
| `VOTHSG`      | Output   | Stabilizer VOTHSG output (pu)                            | VOTHSG of Exciter     |

**Supported models (9):** IEE2ST, IEEEST, PSS2A, PSS2B, PSS3B, ST2CUT, STAB1, STAB3, STAB4

## Turbine-Governor (partType=5) <a href="#id-5.-turbine-governor-template-parttype-5" id="id-5.-turbine-governor-template-parttype-5"></a>

Turbine-governor FMUs receive machine speed and power information and produce the mechanical power (PMECH) signal.

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

| Pin Name   | Pin Type | Description                                          | Connects To          |
| ---------- | -------- | ---------------------------------------------------- | -------------------- |
| `VI[1..4]` | Input    | Machine voltage and current in rectangular form (pu) | VI of Generator      |
| `MBASE`    | Input    | Machine base power (MVA)                             | MBASE of Generator   |
| `SLIP`     | Input    | Machine slip (pu)                                    | SLIP of Generator    |
| `PMECH0`   | Input    | Initial value of PMECH (pu)                          | PMECH0 of Generator  |
| `PMECH`    | Output   | Turbine output PMECH signal (pu)                     | PMECH of Generator   |
| `dGREF`    | Input    | Change in governor reference (pu)                    | OpalRT Interface Pin |

**Supported models (19):** BBGOV1, DEGOV1, GAST, GAST2A, GGOV1, HYGOV, IEEEG1, IEEEG2, IEEEG3, IEESGO, PIDGOV, TGOV1, TGOV3, TGOV5, WEHGOV, WESGOV, WSHYDD, WSHYGP, WSIEG1

Some governor models (e.g., those with load-sharing) expose an additional `PMECH_LP` output. This is a model-specific extension beyond the base template and is harmless — the solver ignores pins it doesn't route.

## Under/Over Excitation Limiter (partType=6, 7) <a href="#id-6.-under-over-excitation-limiter-templates-parttype-6-7" id="id-6.-under-over-excitation-limiter-templates-parttype-6-7"></a>

Excitation limiters are specialized controllers that constrain the exciter's output to protect the machine.

{% hint style="danger" %}
Under/Over Excitation Limiter Templates are experimental.
{% endhint %}

| Category (partType)              | Models         | FMU Wrapper Status                                                  |
| -------------------------------- | -------------- | ------------------------------------------------------------------- |
| **Under Excitation Limiter (6)** | UEL1, UEL2     | No standalone FMU wrapper yet — available inside GenUnit combo FMUs |
| **Over Excitation Limiter (7)**  | MAXEX1, MAXEX2 | No standalone FMU wrapper yet — available inside GenUnit combo FMUs |

## Other Device FMU categories (partType=1) <a href="#id-7.-other-device-fmu-categories-parttype-1" id="id-7.-other-device-fmu-categories-parttype-1"></a>

The following device types use GenUnit-based templates (partType=1) rather than the single-controller template. They are self-contained FMUs that include both device model and grid interface:

| Category          | Template Base                                                   | Models                                |
| ----------------- | --------------------------------------------------------------- | ------------------------------------- |
| Induction Machine | `FMUTemplateInjectionStatus`                                    | CIMTR3, CIMTR3S, CIMTR4               |
| Renewable Energy  | `FMUTemplateInjection`                                          | WT4G1, PVGU1, PVEU1, PANELU1, IRRADU1 |
| FACTS             | `FMUTemplateInjectionVOTHSG` / `FMUTemplateInjectionVOTHSGVRef` | CSTCNT, CSVGN5                        |
| HVDC Lines        | `FMUTemplateTwoPowerPinControl`                                 | CDC4T, CDC6TA                         |

## Pinout Configuration (Excel Template) <a href="#id-8.-pinout-configuration-excel-template" id="id-8.-pinout-configuration-excel-template"></a>

When using standalone machine FMUs (partType=2) in the ePHASORSIM Excel template, the pinout signal paths use **flat names** — not the fully-qualified ModelSet paths used by GenUnit combo FMUs.

| Pin              | GenUnit (partType=1) path                     | Standalone Machine (partType=2) path |
| ---------------- | --------------------------------------------- | ------------------------------------ |
| Bus voltage real | `gen_X_Y/modelSet.bus0.vr`                    | `gen_X_Y/p.vr`                       |
| Bus voltage imag | `gen_X_Y/modelSet.bus0.vi`                    | `gen_X_Y/p.vi`                       |
| EFD              | `gen_X_Y/modelSet.synchronousGenerator.EFD`   | `gen_X_Y/EFD`                        |
| PMECH            | `gen_X_Y/modelSet.synchronousGenerator.PMECH` | `gen_X_Y/PMECH`                      |
| TRIP             | `gen_X_Y/modelSet.synchronousGenerator.TRIP`  | `gen_X_Y/TRIP`                       |
| EFD0             | `gen_X_Y/modelSet.synchronousGenerator.EFD0`  | `gen_X_Y/EFD0`                       |
| SLIP             | `gen_X_Y/modelSet.synchronousGenerator.SLIP`  | `gen_X_Y/SLIP`                       |
| ANGLE            | `gen_X_Y/modelSet.synchronousGenerator.ANGLE` | `gen_X_Y/ANGLE`                      |

When migrating an existing model from GenUnit (partType=1) to standalone machine + separate controllers (partType=2), the pinout **Pins** sheet in the Excel file must be updated to use flat signal paths.


---

# 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/model-and-simulation/phasor-domain-with-ephasorsim/integrate-a-power-system-model-to-ephasorsim/include-fmu-components/model-fmus/single-controller-fmu-templates.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.
