> 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/ehs-example-models/energy-example-models/line-model-comparison.md).

# Line Model Comparison

## Description <a href="#description" id="description"></a>

The **Line Model Comparison** example model illustrates the use of lines developed in schematic editor software, namely the **PI section line**, the **constant parameter (CP)** line and the **frequency dependent (FD) line**, and solved using the eHS solver. This model is based on OPAL-RT’s real-time simulator utilizing FPGA to simulate the lines behavior in real-time. One RT-LAB model and one Schematic Editor model are provided.

## Detailed explanation

The RT-LAB model consists of a master subsystem (i.e. "SM\_Master") and a console subsystem (i.e. "SC\_Console").

* The **master subsystem**, as presented in following figure, has power network interface ("eHS\_SE\_SFunction\_Drivers")

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-3578bde09e098c47bc263f6a050430e74c02f1c4%2Fehs-model-lines-3.png?alt=media" alt=""><figcaption></figcaption></figure>

* The **console subsystem** shown in figure below is used to control set voltage level and fault control during real-time simulation. Users can also monitor voltages and currents of the pi lines, constant parameter line and frequency dependent line at any point during the simulation.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-ea352f6165a2997edfa5619e3669cad49990331d%2Fehs-model-lines-4.png?alt=media" alt=""><figcaption></figcaption></figure>

For this example the role of each set points are as following:

* “Vsource”: This sets the amplitude of the AC voltage sources;
* “EnergizeLines”: This sets the voltage sources to Vsource for an acquisition when this value is different than 0.

The **"eHS\_SE\_SFunction\_Drivers" solver** solves the power network built using schematic editor software during the real time simulation. The circuit built in schematic editor can be edited or viewed by choosing the edit option available in the solver block.

When the model is compiled in Simulink, the configuration of the eHS solver will be generated according to the schematic editor circuit characteristics. Elements will be put into matrices and stored in .mat files that will be transferred into the solver when the model is run from the RT-LAB interface. Matrices are generated during model compilation in RT-LAB.

The model represents one one-phase 5 km PI line, one 5 km three-phase CP line and one 5 km three-phase FD line. All lines are powered by the same ideal voltages sources. Voltage measurements are placed at the begin and end of phase A of the lines. Current measurement are placed only at the beginning of phase A of the lines. Electrical model in Schematic Editor is illustrated 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-c0b63ca46b13d95705ded125d2a0cfae793f4b34%2Fehs-model-lines-1.png?alt=media" alt=""><figcaption></figcaption></figure>

### Pi model

The PI model is an RLC approximation of the transmission line that is exact only at one specified frequency. A line can be modeled by several PI sections in series, which helps to emulate traveling wave effects; however, since parameters are define for 1 fix frequency, this model is less accurate during fast transient. The application of the PI model is only adequate for steady-state purposes. Table presents the PI Line parameters used in this example model.

| Parameter                 | Value   | Unit |
| ------------------------- | ------- | ---- |
| **Number of PI sections** | 4       | -    |
| **Frequency**             | 60      | Hz   |
| **Resistance**            | 0.1070  | Ω/km |
| **Inductance**            | 1.58e-3 | H/km |
| **Capacitance**           | 11.7e-9 | F/km |
| **Line length**           | 5       | km   |

### **Constant parameter (CP) model** <a href="#constant-parameter-cp-model" id="constant-parameter-cp-model"></a>

The constant parameter (CP) model, also known as Bergeron model \[1], uses the traveling wave method to model a transmission line. This model is characterized by an ideal transfer function of traveling wave to which resistive losses are added, \[1]. The CP model requires a small computational burden. However, since the propagation (traveling wave) modes cannot be properly represented at high frequencies, the CP model is only recommended for modeling lines in analysis of problems with limited frequency dispersion. Table 2 presents the CP Line parameters used in this example model.

<table><thead><tr><th width="223.888916015625">Parameter</th><th width="370.77783203125">Value</th><th width="143.1025390625">Unit</th></tr></thead><tbody><tr><td><strong>Line length</strong></td><td>5</td><td>km</td></tr><tr><td><strong>Frequency</strong></td><td>60</td><td>Hz</td></tr><tr><td><strong>Resistance (Matrix)</strong></td><td><span class="math">\begin{bmatrix} 0.1071 &#x26; 0.09729 &#x26; 0.9499 \\ 0.09729 &#x26; 0.1071 &#x26; 0.09729 \\ 0.9499 &#x26; 0.09729 &#x26; 0.1071 \end{bmatrix}</span></td><td>Ω/km</td></tr><tr><td><strong>Inductance (Matrix)</strong></td><td><span class="math">\begin{bmatrix} 1.58\mathrm{e}{-3} &#x26; 750\mathrm{e}{-6} &#x26; 620\mathrm{e}{-6}\\ 750\mathrm{e}{-6} &#x26; 1.58\mathrm{e}{-3} &#x26; 750\mathrm{e}{-6} \\ 620\mathrm{e}{-6} &#x26; 750\mathrm{e}{-6} &#x26; 1.58\mathrm{e}{-3} \end{bmatrix}</span></td><td>H/km</td></tr><tr><td><strong>Capacitance (Matrix)</strong></td><td><span class="math">\begin{bmatrix} 11.7\mathrm{e}{-9} &#x26; -2.13\mathrm{e}{-9} &#x26; -0.58\mathrm{e}{-9}\\ -2.13\mathrm{e}{-9} &#x26; 11.7\mathrm{e}{-9} &#x26; -2.13\mathrm{e}{-9} \\ -0.58\mathrm{e}{-9} &#x26; -2.13\mathrm{e}{-9} &#x26; 11.7\mathrm{e}{-9} \end{bmatrix}</span></td><td>F/km</td></tr></tbody></table>

### Frequency-dependent (FD) line model (Modal-type)

The FD-line model is based on modal decomposition techniques \[2]. This model improves the frequency response of CP line by correctly fitting the surge impedance and propagation functions for each mode. This model provides accurate representations for a large class of lines. However, its accuracy is restricted to aerial lines with symmetric or nearly symmetric configurations. The reason for this is that the FD-line model uses a constant modal transformation matrix, evaluated at a fixed frequency, which is an inaccurate assumption for unbalanced systems. Please note that cables are always unbalanced since the capacitance to ground from inner wire and outer wire cannot be equal. Therefore, this FD model-domain approach should not be used to simulate cables. In this present example model, parameters are provided through a .pun file named lineFD5km.pun.

<table><thead><tr><th width="134.33331298828125">Line</th><th width="306">Advantages</th><th width="307.21356201171875">Disadvantages</th></tr></thead><tbody><tr><td><strong>PI</strong></td><td>Simple model</td><td>Only adequate for steady state analysis. Cannot be used as a decoupled element in the network.</td></tr><tr><td><strong>Constant Parameter</strong></td><td>It can emulate the traveling wave effects in transients, for example during faults. Can be used as a decoupling element in parallel simulations.</td><td>Surge impedance and traveling wave (propagation) function are only valid at one frequency. Typically, high‐frequency damping is neglected in this model.</td></tr><tr><td><strong>Frequency Dependent</strong></td><td>Accurate representation of frequency-dependent parameters for balanced lines. Relatively fast model. Can be used as a decoupling element in parallel simulations.</td><td>Restricted to aerial lines with symmetric or nearly symmetric configurations. Not applicable for cables.</td></tr></tbody></table>

## Requirements

The RT-LAB, Schematic Editor/Unified Database and eFPGASIM toolboxes must be installed on the host and target computers in order to run this example model properly. Please refer to the product documentation for details on version compatibility.

This project has been created with a Versal Board that is connected to another Chassis through PCI-Express. That’s why the Board Index setup in the OpCtrl block has a specific value:

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-f0e26285aedaf93686cf180f429f5ec30657a4f5%2Fehs-model-lines-2.png?alt=media" alt=""><figcaption></figcaption></figure>

## Simulation and results

In order to run the example, follow the procedure below:

1. If eFPGASIM is installed, add the example project to RT-LAB by selecting **File>>New>>RT-LAB Project>>eFPGASIM>>Schematic\_Editor\_Workflow>>Energy>>Line Model Comparison**.
2. Compile the RT Model by clicking on **Build** in RT-LAB.
3. Once the model has been successfully built, **Load** and **Execute** the model in RT-LAB in order to begin the real-time simulation.
4. Once the real-time model and the eHS are running, observe the results of the eHS simulation by opening the **measurements** subsystem in the Simulink Console.

## Setup and Connections <a href="#setup-and-connections" id="setup-and-connections"></a>

This model must be run with both the Hardware Synchronized and XHP modes enabled.

<details>

<summary><strong>S-function Workflow</strong></summary>

The **Mezzanine Option block** is an RT-LAB block used in the **S-Function workflow** to configure the settings of the I/O cards for each mezzanine. The available settings depend on the specific type of I/O card.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-f1b6053e49e0affae24fc2d39f5f8bcc8688cd6f%2Fboost-2levelinverter-exmodel-sfunction.png?alt=media" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary><strong>OpalBoard workflow</strong></summary>

[OPAL-RT Board](https://www.opal-rt.com/docs/rt-lab/configure-ios/analog-digital-and-sfp-ios/opal-rt-board-workflow.md) allow the configuration of I/O card settings for each mezzanine.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-2f4eed5a89d21acaca1e8426fce5331e36396a68%2Fboost-2levelinverter-exmodel-opalboard.png?alt=media" alt=""><figcaption></figcaption></figure>

If, for a given I/O mezzanine, this block is not used, then the corresponding settings will be kept at their default values. These default values are dependent on particularities of the bitstream, and they are not guaranteed to be exposed to the user loading their model. Further, the default values populating the Mezzanine Option block do not necessarily correspond to the default settings that will be seen if the Mezzanine Option block is not used.

Note that if a Mezzanine Option block is used, and the choice of mezzanine type is incorrect for the given slot, the model will still load and run. However, there will be errors in the load log in RT-LAB. For example, the following error is observed in the case that slot 1A on the simulator holds an OP5330-3, when we place a Mezzanine Option block that attempts to configure an OP5369 on slot 1A:

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

```
Mezzanine configurator: OP5369 Threshold configuration.
ERROR: OPAL-RT Board: The threshold control register for slot 1A is in an unexpected state. Please reprogram the bitstream.
ERROR: Mezzanine configurator: Threshold configuration failed...
```

{% endcode %}

Further, as documented in the aforementioned RT-LAB page, the block outputs its status: a 0 in the case when the block’s settings have been correctly applied, and a -1 otherwise. For example, in the below model I incorrectly configured one block by giving it the wrong I/O card, and set the other correctly. The result when we load the model reflects this:

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-a4fe002fb70685f86d0a022ad92068069ae7264d%2Fehs-opalboard-block-workflow.png?alt=media" alt="" width="188"><figcaption></figcaption></figure>

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-635a0707a1e24ec9979ba91be578dae9fe0d6dac%2Fehs-opalborad-model-blocks.png?alt=media" alt=""><figcaption></figcaption></figure>

</details>

### Run the model

During real-time execution;

1. Set the **AC voltage sources**' amplitude, Phase parameters for the simulation.
2. Set the **EnergizeLines** to a value different than 0 to energize the line.
3. Execute the acquisition. Results are available to see in real-time in the console or using FPGA Scope in ScopeView. ScopeView template is provided with this example model.

When fault location is set to “No Fault”, the opened lines are energized. Figure below illustrates the current and voltage measurements at the end of each line (phase A for CP and FD lines). In this scenario, voltages for each line are superimposed. As for the currents, they are nearly zero and the dynamics are similar and the differences are due to leakage current from different parasitic capacitances.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-f397115b01b6bdaca97228eddafae5b3812b2bc0%2Fehs-model-lines-5.png?alt=media" alt=""><figcaption></figcaption></figure>

When fault location is set to any location, ex.: location 1, the lines are disconnected. Figure below illustrates the voltage measurements at the end of each line (phase A for CP and FD lines). In this scenario, the lines are abruptly connected as it would be done during energization, which allows to observe and compare measurements for each line reflections of voltage waves.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-3f3b0051cb956404b3823eba922e33a82382da1d%2Fehs-model-lines-5%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

## References <a href="#references" id="references"></a>

1. H. W. Dommel, “Digital computer solution of electromagnetic transients in single and multiphase networks,” IEEE Trans. Power App. Syst., vol. pas-88, pp. 388-99, 04/ 1969.
2. J. R. Marti, "Accurate modelling of frequency-dependent transmission lines in electromagnetic transient simulations," IEEE Trans. Power App. Syst., vol. PAS-101, pp. 147-55, 01/1982.


---

# 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/ehs-example-models/energy-example-models/line-model-comparison.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.
