> 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/import-balanced-network-from-cyme.md).

# Import Balanced Network from CYME

## Description

The **Import Balanced Network from CYME** 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 **phasor14\_IEEE9**, then click **Finish**.

This demo shows how to import balanced network data in CYME format. To do so, after choosing Input file format as CYME and defining all required files in "Network data" tab in the solver mask, the "Unbalanced" checkbox should be unchecked as shown.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-9b3c7ed50b2122933f1d47f7b626fa31e8fc39b0%2Fsolver_mask.jpg?alt=media" alt=""><figcaption><p>Deselected "Unbalanced" checkbox.</p></figcaption></figure>

Note that when the **Unbalanced is not checked**, the "Power-flow report" text box is disabled. However, the user can use ePHASORSIM's power-flow solver to initialize the network. To run power-flow before dynamic simulation, the **execution mode** in **Simulation settings tab** should be set to `Power-flow and dynamic simulation`.

**IEEE 9-bus system** is used in in this demo. The single line diagram of this network is shown in figure below.

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

## Requirements

* MATLAB R2020.4 and later

## Simulation and results

Three synchronous generators are connected to buses 1, 2 and 3. Each generator along with its controllers (such as exciter, turbine-governor, power system stabilizer) form a GenUnit. The machines as well as the controllers used to build these GenUnits are shown in Table 1.

| Bus | Machine | Exciter | PSS    | Turbine-Governor |
| --- | ------- | ------- | ------ | ---------------- |
| 1   | GENROU  | EXST1   | PSS2A  | GAST             |
| 2   | GENSAL  | IEEEX1  | STAB1  | HYGOV            |
| 3   | GENROU  | EXPIC1  | IEE2ST | TGOV1            |

These GenUnits are modeled in Modelica and integrated as FMUs. The FMUs are already built and placed in the "FMU" folder in the model directory. Moreover, note that in the mask of solver in **Network data tab**, the checkbox **Use built-in models** is unchecked.

{% 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 %}

The following simulation scenario is demonstrated for this test case:

* At t = 1s, apply a 3-phase-to-ground fault on bus 7
* At t = 1.08s, remove the fault on bus 7
* At t = 15s, trip line between buses 6 and 9

The in-port and out-port configurations are given in **phasor14\_IEEE9.xlsx** file.

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

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

<details>

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

* Vmag: Bus voltage magnitude (p.u.)
* Vang: Bus voltage angle (degrees)
* DELTA: Machine's rotor angle for all synchronous generators (rad)
* SLIP: Machine's speed deviation for all synchronous generators (p.u.)
* PMECH: Generated mechanical power by turbine governors connected to the Machines (p.u.)
* EFD: Machines' field voltage provided by the exciters (p.u.)
* PSS\_OUT: Output signal of all power system stabilizers (p.u.)
* LineCurrent: Current magnitude (p.u.) and angle (deg.) on the sending node for line between buses 6 and 9

</details>

<details>

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

* 3-phase-to-ground fault for bus *7*
* In-service/out-of-service commands for line between buses *6* and *9*

</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/import-balanced-network-from-cyme.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.
