> 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/example-models/ephasorsim-example-models/powerfactory-input-file-and-fmus-transmission-system.md).

# PowerFactory Input File and FMUs (Transmission System)

## Description

The **PowerFactory Input File and FMUs (Transmission System)** example can be created by starting a new RT‑LAB project. From the menu bar, select **File > New > RT‑LAB Project**. Enter a name and location for your project, then click **Next**. From the available templates list, navigate to **ePHASORsim** and select **phasor19\_PF\_FMU**, then click **Finish**.

This example demonstrates an import of a PowerFactory model. Composite power plants (ElmComp) in the PowerFactory model are mapped to ePHASORSIM GenUnit FMUs. In order to import a PowerFactory model into the ePHASORSIM solver, the user must first export the model in the DGS-XML format from PowerFactory's database. The export from PowerFactory is configured by an export definition file which must be first imported into PowerFactory.

The file phasor19\_PF\_FMU.PFD originates from the IEEE 39-bus benchmark system. It is used as the test case for this example. Figure below shows the single line diagram of the system which consists of 49 buses, 22 transformers, 34 lines, 19 loads and 10 machines.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-bb59fb22d6f73fab73a6dc5cf28f436be15e2cf5%2Fphasor19_PF_FMU_page-0001.jpg?alt=media" alt=""><figcaption><p>Single line diagram of modified IEEE 39-bus benchmark system</p></figcaption></figure>

Each generator is a standard machine model, which might be connected to an exciter, a power system stabilizer (PSS) or a turbine-governor. Table below lists all the components within each generation unit connected to different buses.

<table data-search="false"><thead><tr><th width="49.5999755859375">Bus</th><th width="80">Rotor Type</th><th width="80">Exciter</th><th width="80">PSS</th><th width="89.5999755859375">Governor</th><th>YAML Mapping File</th><th>FMU Model Identifier</th></tr></thead><tbody><tr><td>40</td><td>Round</td><td>EXST1</td><td>PSS2A</td><td>GAST2A</td><td>Plant_G_01.yaml</td><td>GENROU_EXST1_PSS2A_GAST2A</td></tr><tr><td>41</td><td>Round</td><td></td><td></td><td></td><td>Plant_G_02.yaml</td><td>GENROU</td></tr><tr><td>42</td><td>Round</td><td>IEEEX1</td><td>IEEEST</td><td>IEEEG1</td><td>Plant_G_03.yaml</td><td>GENROU_IEEEX1_IEEEST_IEEEG1</td></tr><tr><td>43</td><td>Salient</td><td>IEEET1</td><td></td><td>IEESGO</td><td>Plant_G_04.yaml</td><td>GENSAL_IEEET1_IEESGO</td></tr><tr><td>44</td><td>Round</td><td>EXAC1</td><td></td><td>IEEEG1</td><td>Plant_G_05.yaml</td><td>GENROU_EXAC1_IEEEG1</td></tr><tr><td>45</td><td>Round</td><td>ESST1A</td><td></td><td>IEE2ST</td><td>Plant_G_06.yaml</td><td>GENROU_ESST1A_IEE2ST</td></tr><tr><td>46</td><td>Round</td><td>ESAC5A</td><td></td><td>GAST</td><td>Plant_G_07.yaml</td><td>GENROU_ESAC5A_GAST</td></tr><tr><td>47</td><td>Round</td><td>EXST1</td><td>STAB3</td><td>IEESGO</td><td>Plant_G_08.yaml</td><td>GENROU_EXST1_STAB3_IEESGO</td></tr><tr><td>48</td><td>Round</td><td>EXAC4</td><td>STAB1</td><td>GAST</td><td>Plant_G_09.yaml</td><td>GENROU_EXAC4_STAB1_GAST</td></tr><tr><td>49</td><td>Round</td><td>EXPIC1</td><td>IEE2ST</td><td>TGOV1</td><td>Plant_G_10.yaml</td><td>GENROU_EXPIC1_IEE2ST_TGOV1</td></tr></tbody></table>

* The FMU of each generation unit is already built and placed in the FMU folder in the directory of the model.
* The mapping of composite components (ElmComp) in the PowerFactory model to ePHASORSIM GenUnit FMUs, is defined by user-provided [YAML](https://en.wikipedia.org/wiki/YAML) mapping files. These must be placed in a folder named mappings alongside the Simulink model.
* Composite components (ElmComp) which should be mapped to GenUnits by YAML mapping files, must be annotated in PowerFactory by adding the following line into the component description (desc attribute) in PowerFactory:

{% code overflow="wrap" lineNumbers="true" %}

```
OPAL-Mapping: Custom
```

{% endcode %}

In addition to the exported **PowerFactory DGS \*.xml file** the user needs to provide an Excel template containing the "Pins" page which defines I/O signals of the ePHASORSIM solver block to monitor, control, and change the parameters of the system.

## Requirements

* MATLAB R2019b and later
* OpalOne for Unified Database (UDB)

## Simulation and results

The execution mode for this demo is **Power-flow and dynamic simulation**; thus, the simulation begins with power-flow and continues until t = 1s when a three-phase-to-ground fault is applied on "Bus 02" and it is cleared after 80ms.

{% file src="/files/4KzObKg9GGnpCsdK6tdH" %}

In "Pins" page of the Excel file the following outgoing and incoming ports are defined:

<details>

<summary>Outgoing pins (measurements)</summary>

* Voltage magnitude (p.u.) at generator buses
* Voltage angle (degree) at generator buses
* Speed deviation (p.u.) for generator "G 02" at "Bus 41"

</details>

<details>

<summary>Incoming pins (control commands)</summary>

* Three-phase-to-ground fault command on "Bus 02"

</details>


---

# 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/example-models/ephasorsim-example-models/powerfactory-input-file-and-fmus-transmission-system.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.
