> 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/examples/facts-and-hvdc/fpga-based-active-power-filter.md).

# FPGA Based Active Power Filter

## Description

The **FPGA-Based Active Power Filter** example, located in **File > Open an Example File > FACTS & HVDC**, demonstrates a two-level shunt active power filter (APF) that mitigates grid current harmonics using hysteresis current control. The system includes two diode rectifiers phase-shifted by 30 degrees; the second rectifier, connected through a Delta–Y transformer and circuit breaker, closes after 10 cycles to transition the load from 6‑pulse to 12‑pulse operation.

The objective is to illustrate APF operation and the resulting harmonic reduction at the source.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-33b4fae67cfd23b798e503fc91c4712994f1f48e%2FFPGA-based-activepowerfilter-model.png?alt=media" alt=""><figcaption></figcaption></figure>

## Requirements

{% hint style="danger" %}
**This example runs only in real time.**
{% endhint %}

This example is configured by default for a Virtex-7 FPGA (OP5607, OP5707), but other firmware are available in the example folder.

To adapt the example for another chassis, see page [Change the Chassis on an HYPERSIM eHS Model](https://www.opal-rt.com/docs/hypersim/model-and-simulation/power-electronics-and-electric-machines-with-ehs/change-the-chassis-of-an-hypersim-ehs-model.md).

## Detailed explanation

The active power filter APF is a static power converter that supplies the harmonic component of the load current so the grid does not provide these harmonics. A typical APF consumes very little active power (approximately equal to resistive losses) and generates the harmonic current at the tuned frequencies.

The model implements a standard two-level shunt APF using an IGBT with an anti-parallel diode. The load consists of two diode rectifiers with a 30-degree phase shift. The second rectifier, connected via a Delta–Y transformer and a circuit breaker, is enabled after 10 cycles to change the load from a 6‑pulse to a 12‑pulse configuration.

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

Control is based on hysteresis current regulation. A three-phase PLL generates a sinusoidal source current reference that is in phase with, and has the same RMS magnitude as, the load current. The error between the measured source current and this reference represents the required harmonic current, which the APF injects at the point of common coupling to prevent harmonic flow from the source.

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

The APF executes at the FPGA time step, while the controller and the rest of the network execute at a CPU time step of 14 microseconds.

## Simulation and results

### Set Up for FPGA Simulation <a href="#set-up-for-fpga-simulation" id="set-up-for-fpga-simulation"></a>

Make sure the FPGA and firmware selected in the OPAL-RT Board section of the I/O Interface Configuration correspond to the available hardware. Note that this example is configured by default for a Virtex-7 FPGA (OP5607, OP5707), but other firmware are available in the example folder.

1. Right click on **FPGA-based circuit** and click on “eHS” and "Load circuit".
2. Optionally change the simulation time step (CPU) to match the hardware capability. The CPU time step is 14 µs for one core by default, and recommended to be 10 µs for 2 cores.

### Run the model

Run the model in real time on a compatible simulator. To visualize results in ScopeView, open the ScopeView window with the template **FPGA-Based\_Active\_Power\_Filter.svt**, and click Play.

#### Scenario 1: 12-pulse rectifier load <a href="#scenario-1-12-pulse-rectifier-load" id="scenario-1-12-pulse-rectifier-load"></a>

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-01c94a09bbd665ebb427b24ecb61e0eca69c497a%2FFPGA-based-activepowerfilter-breakers.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

When the breaker is open, the two loads are connected. In this configuration, the load consists of a dual diode bridge rectifier (operating as a 12‑pulse converter). The results below show the load and source currents along with their harmonic content, obtained using a Fast Fourier Transform (FFT) at a fundamental frequency of 60 Hz.

At lower frequencies, the source current exhibits reduced harmonic distortion compared to the load current—for example, harmonics at 660 Hz are approximately 2.9 times smaller. However, the source current also contains higher-frequency switching harmonics

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-7af61b5482f4006bbe738ab85938f93e4e02c811%2FFPGA-based-activepowerfilter-simul2.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Scenario 2: 6-pulse rectifier load <a href="#scenario-2-6-pulse-rectifier-load" id="scenario-2-6-pulse-rectifier-load"></a>

When the breaker is closed, Load 2 is disconnected, leaving only Load 1 in operation. In this case, the load consists of a single rectifier (functioning as a 6‑pulse converter), resulting in higher-magnitude components in the load current FFT.

At lower frequencies, the source current exhibits significantly lower harmonic content than the load current—for example, harmonics at 300 Hz are approximately 6.1 times smaller. Additionally, the breaker operation introduces a small transient at the beginning of the source current waveform.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-2b07508dd4ea58da59a288c396d6f1d2aee74f8b%2FFPGA-based-activepowerfilter-simul1.png?alt=media" alt=""><figcaption></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/hypersim/examples/facts-and-hvdc/fpga-based-active-power-filter.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.
