> 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/library-blocks-reference/control-miscellaneous/comtrade-playback.md).

# COMTRADE Playback

## Description

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-d8b81f47ffe76825dd05ba781134f6e3130ae1d1%2Fimage%20(936).png?alt=media" alt="" width="186"><figcaption></figcaption></figure>

The **COMTRADE Playback** block, located in the **Control Miscellaneous** library, is used to play back waveforms to validate control and protection equipment of power grids. It outputs arbitrary analog and digital waveforms originating from COMTRADE files. It accepts playback of COMTRADE files in binary or ASCII format compliant with IEEE C37.111-1991 or C37.111-1997.

**COMTRADE** (Common Format for Transient Data Exchange) is an IEEE standard for exchanging digital data from transient phenomena such as power grid faults, test cases, or simulation cases. Because the format is widespread, waveforms can come from sources such as:

* a recorder (protection relay, measuring device);
* a digital or analog network simulator;
* signal processing software (e.g., SCOPEVIEW, SPECTRUM);
* any other device or software exporting digital signals in COMTRADE format.

## Mask parameters

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

{% tabs %}
{% tab title="General" %}

<table><thead><tr><th width="219.4000244140625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>File directory</strong></td><td>The location of the CONTRADE <em>.cfg</em> and .dat files.<br>Them Activate Load File, the signal in the file will be loaded in the analog/digital output page</td></tr><tr><td><strong>Playback control</strong></td><td>2 options Stop /Play<br>if needed, enable the start/stop button for emergencies;</td></tr><tr><td><strong>Operation mode</strong></td><td>Select either Steady state or Transient.<br></td></tr><tr><td><strong>Trigger mode</strong></td><td>Select the type of synchronization either Internal with the current HYPERSIM® POW or External with an analog signal or a logic command signal (rising front).</td></tr><tr><td><strong>Number of prefault cycles</strong></td><td>Specify the number of cycles before fault injection (steady state cycle).</td></tr><tr><td><strong>Number of post fault cycles</strong></td><td>Specify the number of cycles after fault injection (steady state cycle).</td></tr><tr><td><strong>Frequency mode</strong></td><td>Choose either Selected channel (1-32) or Fixed value.</td></tr><tr><td><strong>Fixed value frequency</strong></td><td>If Selected Fixed value, the frequency value</td></tr><tr><td><strong>Channel number for frequency measurement</strong></td><td>If Selected channel, select which channel to measure.</td></tr></tbody></table>

{% hint style="danger" %}
For good practice, it is recommended to first move this file in the project directory.\
By convention, **a&#x20;*****.dat*****&#x20;file with the same name should be located next to the&#x20;*****cfg*****&#x20;file.**
{% endhint %}

{% hint style="info" %}
When using **the steady-state mode**, make sure the signals have at least two steady-state cycles at is beginning.
{% endhint %}
{% endtab %}

{% tab title="Analog" %}

<table><thead><tr><th width="220.20001220703125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Channel</strong></td><td>Specify the analog channel to map.<br>32 channels available</td></tr><tr><td><strong>Gain</strong></td><td>Specify the gain to apply to the channel.</td></tr><tr><td><strong>Enable/Disable</strong></td><td>Enable or disable the channel.</td></tr></tbody></table>
{% endtab %}

{% tab title="Digital" %}

<table><thead><tr><th width="219.4000244140625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Channel</strong></td><td>Specify the digital channel to map.<br>32 channels available</td></tr><tr><td><strong>Gain</strong></td><td>Specify the gain to apply to the channel.</td></tr><tr><td><strong>Enable/Disable</strong></td><td>Enable or disable the channel.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

**In transient mode**, the signals are played back entirely.

**In steady-state mode**, the software automatically detects a permanent cycle at the beginning of each analog signal and plays back this cycle indefinitely. For digital output, the software takes the first point as reference and plays back this point indefinitely.

* The Prefault and Postfault fields allow users to specify the number of steady-state cycles to add at the beginning (Prefault) (before the fault or the transient phenomenon) and the end of the wave forms (Postfault).
* A parameter allows users to select from a list of analog signals the reference signal used to measure the first steady-state cycle or to set the frequency.
* In the internal playback mode, there is no playback synchronization in the steady-state mode.

There is no steady-state detection for digital output.

The output rate of signals to playback is based on the execution step of the HYPERSIM<sup>®</sup> simulation (TimeStep parameters). Hence, if the TimeStep is different from the wave form rate, a resampling\
of the original wave forms will take place. The software interpolates or decimalizes the original signal. In both cases, a message warns the user.

{% hint style="info" %}
**Users can launch ScopeView to execute a resampling** of their COMTRADE file, according to their needs, in order to playback the file using the same rate as with HYPERSIM<sup>®</sup>.
{% endhint %}

## Inputs

<table><thead><tr><th width="220.4000244140625">Input</th><th>Description</th></tr></thead><tbody><tr><td><strong>T</strong></td><td>Trigger input for External synchronization. When it changes from 0 to 1 (rising edge), transient mode starts immediately.</td></tr></tbody></table>

## Outputs

<table><thead><tr><th width="220.39996337890625">Output</th><th>Description</th></tr></thead><tbody><tr><td><strong>Aout</strong></td><td>Analog outputs (up to 32 D/A channels) playing back the selected analog signals.</td></tr><tr><td><strong>Dout</strong></td><td>Logical outputs (up to 32 channels) playing back the selected digital signals.</td></tr></tbody></table>


---

# 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/library-blocks-reference/control-miscellaneous/comtrade-playback.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.
