> 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/traveling-wave-protection-frequency-dependent-line.md).

# Traveling-Wave Protection - Frequency Dependent Line

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

The **Traveling-Wave Protection - Frequency Dependent Line** model illustrates the use of the frequency dependent line (FD Line) developed in schematic editor software and solved using the eHS solver. This example is based on OPAL-RT's real-time simulator utilizing the FPGA to simulate the behavior of a frequency dependent line in real-time. One RT-LAB model and one Schematic Editor model is provided to illustrate the exchange of information between the controller and plant.

The model represents a 150km three phase frequency dependent line with three phase voltage sources at both ends. The phase of the left and right voltage sources can be controlled via the **phase** block in the console. Three controllable faults to ground are placed at different points on phase A of the line. One at **75km**, one at **100km** and one at **125km**. Each fault location, duration and frequency are configurable via the **Fault Control** block in the console. Voltage and current measurements are placed at the begin, end and each fault location along the line for each phase.

## Detailed explanation

The RT-LAB model consists of a master subsystem (i.e. "sm\_computation") and a console subsystem (i.e. "sc\_user\_interface").

* The **master subsystem** 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-dc39886d27b7424d95968eb6aa00b4f3cf23f0ff%2Fehs-model-travelwave-1.png?alt=media" alt=""><figcaption></figcaption></figure>

* The **console subsystem** is used to control set points, such as the magnitude, the frequency, the phase of source voltage and fault control during real-time simulation. Users can also monitor voltages and currents of the frequency dependent lineat 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-1926a0c5a47346febbfe127c804460c0cd68700c%2Fehs-model-travelwave-2.png?alt=media" alt=""><figcaption></figcaption></figure>

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

* **“Amplitude”**: This sets the amplitude of the AC voltage source;
* **“Frequency”**: This sets the frequency of the AC voltage source;
* **“Phase”**: This sets the phase of the AC voltage source;
* **“Fault control”**: This sets the fault state

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.

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

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.

## Requirements <a href="#requirements" id="requirements"></a>

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-b9cc0de2d48b21fa1f9ddfda0af1352bb6487a8c%2Fehs-model-travelwave-4.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>>TW Protection**.
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. All the variables required for the model are defined in the “**initFrequencyDependentLine.m**” file that is automatically loaded during simulation.

<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>

{% hint style="info" %}
In S-Function workflow, example models support any chassis. You can contextualize your example model by selecting the chassis in the Chassis selection block.
{% endhint %}

### Run the model

During real-time execution;

1. Set the **AC voltage sources**' amplitude, frequency and phase parameters for the simulation.
2. Set the **fault control options** to set the repetitive fault’s location, duration and time between faults.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-ff9610aaab385fd91020af0465dbf5d00d63663a%2Fehs-model-travelwave-5.png?alt=media" alt=""><figcaption><p>Frequency dependent line measurements at the start of the line at steady state with no fault</p></figcaption></figure>

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-aaa99daba01cdb09df4b93d03d401eb3d9c75562%2Fehs-model-travelwave-6.png?alt=media" alt=""><figcaption><p>Frequency dependent line measurements at the start of the line during a fault on phase 1 (yellow)</p></figcaption></figure>


---

# 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/traveling-wave-protection-frequency-dependent-line.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.
