> 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/genunit-fmu.md).

# Model GenUnit FMUs

## Introduction

A **GenUnit** (Generator Unit) combines a single **Current Injector** with its associated **controllers** into a single Modelica-based component.

Every GenUnit must contain:

* Exactly **one Current Injector**
* At least **one Power Pin**

A **Current Injector** represents any component that exchanges electrical power with the network through one or more **Power Pins**. Examples include generators, loads, converter-based resources, and other devices that inject or absorb current.

A **Power Pin** is a connector that carries voltage and current signals between a Modelica component and the ePHASORSIM network. Power Pins are used to connect Modelica-based components to power system buses.

A **Controller** regulates signals associated with a Current Injector. Common examples include exciters, turbine-governors, and power system stabilizers.

A **GenUnit** may consist of only a **Current Injector**, or a **Current Injector** combined with one or more controllers to represent the desired dynamic behavior.

An **Interface Pin** is used to set an input value for the FMU model that is expected to be changed during simulations. A common use case is for signals like **TRIP** for a generator which is specified in the outer scope (**GenUnit** level) of a model.

## Model the GenUnit

{% stepper %}
{% step %}

### Add components to the model

In the **Libraries Browser**, expand the `ePHASORSIM` package (or one of its subpackages, such as `Controllers`, `Exciters`, `Governors`, or `Machines`) and drag and drop the component models directly from the **ePHASORSIM Modelica Library** into your Modelica environment.
{% endstep %}

{% step %}

### Connect the components

Connect the component inputs and outputs to assemble the desired generator unit.
{% endstep %}

{% step %}

### Name components

Component naming requirements depend on the intended integration workflow:

* For **models built with the Excel Template**, use clear and descriptive component names such as `generator`, `exciter`, `governor`, or names matching the implemented model type (for example, `GENSAL` or `EXST1`). Consistent naming simplifies parameter propagation and makes the model easier to understand and maintain.
* If the FMU will be used with a network imported from **PSS®E**, **CYME**, or **PowerFactory**, refer to the corresponding import workflow documentation and naming conventions, as additional naming requirements may apply.
  {% endstep %}

{% step %}

### Define model parameters

Define all model parameters and propagate them to the appropriate subcomponents.
{% endstep %}

{% step %}

### Create the partType parameter

Set `partType = 1` and define it as type `Real`.
{% endstep %}

{% step %}

### Add Power Pins

Add one or more **Power Pins** and connect them to the **Current Injector**. Power Pins must follow the naming convention `bus0`, `bus1`, `bus2`, and so on, where `bus0` identifies the first power-system connection, `bus1` the second, and each subsequent pin follows the same numbering sequence. The **Power Pin** provides the electrical interface between the GenUnit FMU and the ePHASORSIM network.
{% endstep %}

{% step %}

### Save the GenUnit

Save the model using a name that follows the required GenUnit naming convention. Otherwise, the exported FMU filename may be automatically modified during export.

* For **models built with the Excel Template**, the name must be limited to **31 characters**.
* For **imported models**, the GenUnit name must be formed by concatenating the names of its components with underscores (`_`) in the following order: Generator, Exciter, Power System Stabilizer, Turbine Governor, and Maximum Excitation Limiter. For example, a GenUnit built for PSS/E with a `GENSAL` type machine, an `EXST1` type exciter, an `HYGOV` type turbine-governor and a `PSS2A` type power system stabilizer must be named as `GENSAL_EXST1_PSS2A_HYGOV`.
  {% endstep %}
  {% endstepper %}

## GenUnit example

The figure on the right illustrates a typical GenUnit made in OpenModelica. As illustrated, this GenUnit has a salient pole type synchronous type generator (GENSAL) as the current injector device and three controllers which are:

* `HYGOV` (Hydro turbine-governor model)
* `EXST1` (IEEE Type ST1 excitation system)
* `IEEEST` (IEEE stabilizing model)

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


---

# 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/genunit-fmu.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.
