> 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/simulink-blocks-reference/rt-events-library/rte-frequency-meter.md).

# RTE Frequency Meter

## Description

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

The **RTE Frequency Meter** block, located in the **RT-EVENTS/Signal Attributes** library, measures the frequency and duty cycle of its input signals. The duty cycle is the ratio of the time the signal is High (T<sub>on</sub>) to the signal period.

Frequency and duty cycle can be measured between consecutive rising edges or consecutive falling edges, as defined by the *Measurement between consecutive* parameter. When Rising is selected, each measurement starts and ends on a rising edge. When Falling is selected, it starts and ends on a falling edge.

The **Minimum frequency parameter** defines behavior at very low frequencies. If no edges are detected for a duration longer than the corresponding period, both frequency and duty cycle are set to zero.

When the input frequency is lower than the *Minimum frequency* and the input changes between Low and High, the duty cycle switches between 0 and 1 only if the input remains in the same state for a time longer than the minimum-frequency period.

**Depending on the&#x20;*****Edge type for detection of minimum frequency*****&#x20;and&#x20;*****Measurement between consecutive*****&#x20;settings, the reference time t**<sub>**x**</sub>**&#x20;from which the inactive period is computed is:**

* When the edge type for detection is Either, t<sub>x</sub> is the time of the last event of any type (rising or falling).
* When the edge type for detection is Automatic and measurement is between rising edges, t<sub>x</sub> is the time of the last rising edge.
* When the edge type for detection is Automatic and measurement is between falling edges, t<sub>x</sub> is the time of the last falling edge.

In some systems, this behavior can cause issues. The [**RTE Period Meter** ](https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/rt-events-library/rte-period-meter.md)block uses a different algorithm to handle the duty cycle when the frequency is lower than the minimum frequency.

## Mask parameters

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

<table><thead><tr><th width="256.4000244140625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Measurement between consecutive</strong></td><td>Selects whether period and frequency are measured between consecutive rising edges or consecutive falling edges.</td></tr><tr><td><strong>Initial duty cycle</strong></td><td>Sets the initial duty cycle. When Automatic is selected, the block sets the value based on the current state (Low or High) of the input signals. Otherwise, the initial duty cycle is 0 or 1.</td></tr><tr><td><strong>Minimum frequency</strong></td><td>When the input signal frequency is lower than this value, the frequency is 0 and the duty cycle is set to 0 or 1 depending on the current state (Low or High) of the input signal.</td></tr><tr><td><strong>Edge type for detection of minimum frequency</strong></td><td>Selects the edge type used to determine whether the minimum-frequency condition has been reached. When Either is selected, the inactive period is computed from the time of the last event (rising or falling).<br>When Automatic is selected, the edge used depends on <em>Measurement between consecutive</em>: from the last rising edge for Rising, or from the last falling edge for Falling.</td></tr></tbody></table>

## Inputs

| **Input**               | **Description**                 |
| ----------------------- | ------------------------------- |
| **Input (RTE Boolean)** | RTE Boolean signals to measure. |

## Outputs

| **Output**              | **Description**                  |
| ----------------------- | -------------------------------- |
| **Frequency (Double)**  | Signal frequencies in Hz.        |
| **Duty Cycle (Double)** | Duty cycle in the range \[0..1]. |

## Characteristics and limitations

| Direct Feedthrough | Yes                           |
| ------------------ | ----------------------------- |
| Sample time        | Inherited and fixed discrete. |
| Work Offline       | Yes                           |
| Dimensionalized    | Yes                           |


---

# 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/simulink-blocks-reference/rt-events-library/rte-frequency-meter.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.
