> 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/hypersim/model-and-simulation/prepare-the-simulation/run-load-flow-analysis/prepare-the-model-for-load-flow.md).

# Prepare the Model for Load Flow

The **Load\_Flow\.ecf** example is used throughout this procedure to illustrate the load-flow configuration and initialization steps.

Open the example model by selecting **File > Open an Example Model > How To > Load\_Flow\.ecf**.

## Requirements for load flow

Ensure the following conditions are met before running a load flow simulation:

* Build and connect the network completely.
* Make sure all required component parameters are entered correctly.
* For sources and generators, ensure values such as **base voltage** and **impedance** are defined.
* If a voltage or impedance is specified in **per unit**, verify that the corresponding **base power** and **base voltage** are set correctly.
* If transformers are present, ensure bus nominal voltages are defined properly in the **Netlist**.

Once all parameters and connections are configured, the model is ready for load flow execution.

{% hint style="info" %}
When load flow has not yet been run:

* bus **Load Flow Results** tabs show default values
* source and machine **Load Flow** tabs show default initialization values
  {% endhint %}

## Configure the model for load flow

{% stepper %}
{% step %}

### Define the swing bus

Choose one source or generator to act as the **swing bus**. The swing bus is the **bus that balances the system power** by compensating for unknown transmission losses and mismatches between generation and load. It acts as the **reference point for voltage angle** in the network.

In the **Load\_Flow\.ecf** example model, double-click voltage source **VS2**, open the **Load Flow** tab and set:

* **Type** = `Swing`
* **Voltage** = `1 pu`
* **Angle** = `0 deg`

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-0d44e4cb2dd7cb1f790dcdb73e5909ba57c0e5f8%2Fload-flow-swing-bus.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
Only one swing bus is allowed in a network.
{% endhint %}
{% endstep %}

{% step %}

### Configure generator buses

In most cases, generator buses are **PV buses**, because the controller regulates terminal voltage and active power. Therefore, set those buses to **PV**. Also set the **Voltage** and **Active power**.

In the **Load\_Flow\.ecf** example model, double-click synchronous machine **SM1**, open the **Load Flow** tab and set:

* **Type** = `PV`
* **Voltage** = `1 pu`
* **Active power** = `30 MW`

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-bdb5a9dcc4cd59981edb57bd3441baa2ddf0c369%2Fload-flow-generation-buses.png?alt=media" alt=""><figcaption></figcaption></figure>

Configure the other generator buses the same way:

| Block         | Type | V (pu) | P (MW) |
| ------------- | ---- | ------ | ------ |
| SM1           | PV   | 1      | 30     |
| SM2           | PV   | 1      | 30     |
| SM3           | PV   | 1      | 30     |
| VS1           | PV   | 1      | 0      |
| {% endstep %} |      |        |        |

{% step %}

### Define bus nominal voltage levels

The load flow solution requires the **nominal voltage** of each bus. To define these values efficiently, use the **Netlist** rather than editing each bus individually.

In the **HYPERSIM** tab, click **Netlist** in the **Network** section:

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-ef7557e956f280d68eedf802094abd7c5859f24d%2Fnetlist-hypersim-tab.png?alt=media" alt=""><figcaption></figcaption></figure>

#### When transformers are present

Transformers usually define voltage levels across different parts of the network. Their winding voltages are used to infer the connected bus nominal voltages.

In the **Netlist** window, select **Base Voltage** from the **Views** drop-down menu. Check or define:

* **Primary Bus Voltage**
* **Secondary Bus Voltage**
* **Tertiary Bus Voltage**, if applicable

Use the drop-down list to select common voltage levels, or enter the value manually.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-2d6412b86c497d09a2c092a4b92350d32ef36c29%2Fload-flow-transformers.png?alt=media" alt=""><figcaption></figcaption></figure>

If the secondary buses of several transformers are electrically connected, defining one may automatically define the others.

After configuration, return to the schematic and double-click a bus to confirm that its **nominal voltage** is now defined.

#### When no transformers are present

If the network has no transformers, all buses may share the same voltage level.

In the **Netlist** window, select **Load Flow Parameters** from the **Views** dropdown menu and define the **Nominal voltage** for the buses directly.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-497b77b9eed58dbfbc857aa7ce5609606dbccc43%2Fload-flow-bus-load-flow-parameters.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Copy and paste can be used in this view, which is helpful when assigning the same nominal voltage to multiple buses.
{% endhint %}
{% endstep %}

{% step %}

### Configure other blocks for load flow

Blocks that support load flow include a **Load Flow** tab in their parameters.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-96aebcfaddd470e7c5a8ec412754f0f5d06affa3%2Fload-flow-component-parameters.png?alt=media" alt=""><figcaption></figcaption></figure>

1. Select the bus type (**PV**, **PQ**, or **Swing**) associated with the component and specify **two of the four variables** must be specified: ***P***<sub>***i***</sub>, ***Q***<sub>***i***</sub>, ***V***<sub>***i***</sub> and ***θ***<sub>***i***</sub>. The remaining two variables are solved by the load flow algorithm.
2. Define the allowable range for reactive power via the **Q minimum limit** and **Q maximum limit** parameters. These limits are enforced only if **Use Qmin and Qmax limits** is enabled in the **Load Flow** options.

Blocks have different behavior in load flow:

<table data-search="false"><thead><tr><th width="170">Block</th><th>Load Flow Behavior</th></tr></thead><tbody><tr><td><strong>Network Induction Machines</strong></td><td>Initialized at synchronous speed with no mechanical load. Only stator losses and magnetizing impedance are considered. Mechanical load is not represented. Can be replaced by a <strong>Load Flow Equivalent</strong> if needed.</td></tr><tr><td><strong>Network Transformers</strong></td><td>Contribute through winding impedance (used in the admittance matrix) and winding voltages (which define bus nominal voltages).</td></tr><tr><td><strong>Network Lines and Cables</strong></td><td>Load flow uses the positive-sequence parameters of constant parameter lines and PI-section lines.</td></tr><tr><td><strong>Network Loads</strong></td><td><strong>Dynamic loads</strong> and <strong>harmonic loads</strong> are modeled as <strong>PQ bus</strong> using P0 (active power) and Q0 (reactive power), and behave as a constant power load in load flow, regardless of np and nq.<br>The <strong>PQ load with Load-Flow</strong> is similar to the <strong>Dynamic Load</strong>, but are applied in load flow. For example, if np = 2 and nq =2, the load is a constant-impedance load; if np = 0, nq = 0, it is a constant-power load.<br>The <strong>Arc Furnace</strong> is not considered in load flow analysis.</td></tr><tr><td><strong>Network RLC</strong></td><td>Contribute to the admittance matrix. Even if defined using P and Q, they behave as constant impedances. The resistance value of the R nonlinear is calculated based on the nonlinear characteristic and the base voltage of the bus it is connected. Not included in the <strong>Load summary</strong>, but appear in the <strong>Shunt impedance summary</strong>.</td></tr><tr><td><strong>Control Exciters</strong></td><td>Control exciters can use load flow results automatically for initialization. To do so, set <strong>W0</strong> to <code>SM1.wo</code> where <code>SM1</code> is the associated synchronous machine. The HYPERSIM simulation option <strong>Set Initial Conditions</strong> must be <strong>checked</strong> for the automatic initialization to work properly. This ensures that the exciter starts from the generator steady-state values.</td></tr><tr><td><strong>Control Governers</strong></td><td>Control governors can use load flow results automatically for initialization. To do so, set <strong>Ifd0</strong> to <code>SM1.IfdInit</code> and <strong>Efd0</strong> to <code>SM1.EfdInit</code> where <code>SM1</code> is the associated synchronous machine. The HYPERSIM simulation option <strong>Set Initial Conditions</strong> must be <strong>checked</strong> for the automatic initialization to work properly. This ensures that the governor starts from the generator steady-state speed.</td></tr></tbody></table>
{% endstep %}

{% step %}

### Use Load flow equivalent blocks (optional)

The **Load flow equivalent** block, located in the **Network Tools** library, is used when a block influencing power flow is **not supported** by the load flow algorithm. In such cases, place a **Load Flow Equivalent** block next to the unsupported block and define the **active (P)** and **reactive (Q)** power values that should be considered by the load flow algorithm to compute the network steady-state.

* When PQ values are positives, the block acts as a **source**.
* When PQ values are positives, the blockacts as a **load**

For more details, refer to the [Load flow equivalent](https://www.opal-rt.com/docs/hypersim/library-blocks-reference/network-tools/load-flow-equivalent.md) block documentation.
{% endstep %}
{% endstepper %}


---

# 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/hypersim/model-and-simulation/prepare-the-simulation/run-load-flow-analysis/prepare-the-model-for-load-flow.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.
