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

# ePHASORSIM's Basic FMI

## Description

The **ePHASORSIM's Basic FMI** 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 **phasor05\_PSSE\_FMU**, then click **Finish**.

This demo shows how the Modelica-based user defined models work with ePHASORSIM. These models are built based on Modelica's FMU (Functional Mock-up Units) compatible with FMI (Functional Mock-up Interface) Version 1.0 for the purpose of "Model Exchange". To have more information about FMI please check [FMI Standard.](https://fmi-standard.org/)

This feature allows user to create and test the new components either in OpenModelica (Ver. 1.9.1) or Dymola (Ver. 2019) environment, create FMU from the models, and integrate them with the "built-in" library of ePHASORSIM.

The following figure shows the IEEE 39-bus system which is imported from data files in PSS/e format.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-0361134088bcf7ce1f69b63163fa8553bdfdec44%2Fphasor05_PSSE_FMU.jpg?alt=media" alt=""><figcaption><p>IEEE 39-bus network diagram.</p></figcaption></figure>

This table lists the components included in the dynamic file.

<table data-search="false"><thead><tr><th>Bus</th><th>Machine/FACTS</th><th>Exciter</th><th>PSS</th><th>Governor</th></tr></thead><tbody><tr><td>15</td><td>CSTCNT</td><td></td><td></td><td></td></tr><tr><td>18</td><td>CSVGN5</td><td></td><td></td><td></td></tr><tr><td>21</td><td>CSTCNT</td><td></td><td></td><td></td></tr><tr><td>30</td><td>GENROU</td><td>EXST1</td><td></td><td>GAST</td></tr><tr><td>31</td><td>GENROU</td><td>EXST1</td><td></td><td></td></tr><tr><td>32</td><td>GENSAL</td><td>EXST1</td><td>IEEEST</td><td>HYGOV</td></tr><tr><td>33</td><td>GENSAL</td><td>EXST1</td><td></td><td>HYGOV</td></tr><tr><td>34</td><td>GENROU</td><td>EXST1</td><td></td><td>GAST</td></tr><tr><td>35</td><td>GENROU</td><td>EXST1</td><td></td><td>GAST</td></tr><tr><td>36</td><td>GENSAL</td><td>EXST1</td><td></td><td>HYGOV</td></tr><tr><td>37</td><td>GENROU</td><td>SCRX</td><td></td><td>GAST</td></tr><tr><td>38</td><td>GENROU</td><td>EXST1</td><td></td><td></td></tr><tr><td>39</td><td>GENROU</td><td></td><td></td><td></td></tr></tbody></table>

* The FMU of each of these components are already built and placed in the **FMU folder** in the directory of the model.
* The **\*.dyr file** import is limited to items that their FMU models are provided in the FMU folder.
* In the mask of solver in "Network data" tab, the check-box "Use built-in models" is unchecked

The **\*.raw file** import process currently includes the following items:

* Bus
* Load: constant impedance, constant current, and constant power
* Generator
* Branch
* 2-winding transformer
* FACTS

In addition to the PSS/e files the user needs to fill the page "Pins" of the Excel template to monitor, control, and change the parameters of the system.

{% hint style="info" %}
This model is configured to assign core number 2 for the dynamic simulation on a target. The `EPHASOR_THREADS` environment variable can be revised in the Variables tab of RT-LAB GUI to modify this configuration.
{% endhint %}

## Requirements

* MATLAB R2019b and later

## Simulation and results

This model shows that the FACTS devices can regulate the voltages at specified buses in the power system. Two CSTCNTs (Static Condenser) and one CSVGN5 (SVC) are installed at different buses.

The network data and dynamic data are given in **phasor05\_PSSE\_FMU.raw** and **phasor05\_PSSE\_FMU.dyr** files. The in-port and out-port configurations are given in **phasor05\_PSSE\_FMU.xlsx**.

{% file src="/files/obyTaBhV23nwgeaoHOoD" %}

In the "Pins" page of the Excel file the following outgoing and incoming pins are assigned:

<details>

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

* Voltage magnitude and angle at some buses
* Machine's rotor angle for all synchronous generators
* Machine's speed for all synchronous generators
* Excitation voltage for all synchronous generators
* Electrical power for all synchronous generators

</details>

<details>

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

* Voltage reference of CSTCNT on bus\_15\_
* In-service/out-of-service commands for line between buses 5 and 8

</details>

To run the dynamic simulation, the power flow should be performed first. Set 'Execution mode' to 'Power-flow and dynamic simulation'.

For the demo:

* At t = 1 s, the voltage reference of CSTCNT at bus 15 is changed so that the CSTCNT regulates the voltage at bus 15 to 0.95 p.u.
* At t = 5 s, the line between bus 5 and bus 8 will be taken out of service.


---

# 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/phasor05_psse_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.
