> 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/renewable-energy/grid-forming-grid-following-der-interaction.md).

# Grid Forming and grid Following DER Interaction Using Droop Control and Grid Support Functions

## Description

The **GFM–GFL DER Interaction** example, located in **File > Open an Example File > Renewable Energy**, models an islanded microgrid with four distributed generation (DG) units. Three DGs operate in grid-forming (GFM) mode and one in grid-following (GFL) mode.

The objective is to demonstrate primary (droop) and secondary control coordination for voltage and frequency regulation, proportional power sharing among GFM units, and the interaction of GFL grid-support functions with GFM secondary control under load changes.

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

## Requirements

This example model does not require any additional hardware or licenses.

## Detailed explanation

The microgrid consists of four dispatchable inverter-based resources (IBRs) connected in parallel to a 600 V bus named POI\_Bus, which also supplies the loads. All DGs use average two-level, three-phase inverter models for power conversion. The DGs operate in parallel and connected at the point of interconnection (POI) to feed the loads. During operation, the DGs with grid forming control, forms the grid, regulate the voltage and frequency of the microgrid whereas the DG with grid following control follows the phase angle reference and respond according to the voltage and frequency condition at its control terminal. The DGs are required to maintain the voltage and frequency of the islanded microgrid by dispatching the required active and reactive power demanded by the loads.

The high-level block diagram of the example model is depicted in the schematic figure above. In the figure, DG1, DG 2 and DG3, identified as GFM IBRs, are units with grid forming control. A Secondary Controller estimates any deviation of voltage and frequency from the nominal and set the references of voltage and angular frequency for these three DGs. Whereas, DG4, identified as GFL IBR, is a unit with grid following control. All DGs are connected to one 600V bus named POI\_Bus, which is also linked to the loads in the model. The DGs have different name-plate ratings and during operation, they share power proportionally.

The grid-forming inverter of the Distributed Generation (DG1) unit-1 is shown in the following Figure. A dispatchable DC source feeds the GFM inverter; therefore, with varying operating conditions, the DG can instantly adjust its active and reactive power dispatch in proportion to its nominal capacity. For the DG, Inner Control loop type has been chosen to be “Double-Loop Control” and “Droop Control” has been chosen to be the Primary Control method. During operation, to compensate any steady state-error in voltage and frequency at the POI, secondary controller has also been adopted to the GFM based DG control.

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

The controller is divided into four subsystems:

* The first subsystem corresponds to the *Signal Conditioning* unit, which measures the signals of interest, filters and conditions them to per-unit values, and transforms the signals into d-q coordinates, as required by the subsequent controllers.
* The *Primary Control Loop* block estimates the phase angle and angular frequency and generates references for the magnitude of the virtual voltage source according to the system’s operating conditions.
* The *Inner Control Loop* block executes the references set by the Primary Control Loop and generates the reference control signal in d-q coordinate.
* The *Reference Generation* block is used to condition the reference control signal generated by its preceding control block according to the DGs nominal DC voltage and the GFM inverter’s operating voltage.

In this example, an average two-level three phase inverter model has been used; therefore, the reference signal is directly connected to the Uref port of the the inverter. At the output of the two-level converter, an LC filter is used to reduce high-order harmonics generated by the switching dynamics of the conversion process.

The Distributed Generation unit (DG4) with grid following control is shown in the following Figure. Similar to the other DGs, this one is also configured as disposable. Its active and reactive power dispatch is regulated according to the “Frequency-watt (Droop)” and “Voltage-Reactive Power (Volt-Var)” grid support functions, respectively, configured at the *Secondary Control* block. Before the activation of secondary control, active power reference is set to zero for the DG.

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

Based on the functionality, the second controller is divided into four subsystems. The first subsystem corresponds to the *Signal Conditioning* unit, which measures the signals of interest, and conditions them to per-unit values as required by the controller. Consequent to that, the *Secondary Control* block generates the active and reactive power references, necessary to implement the grid support functions presented in the IEEE std. 1547-2018 \[1]. Next, the *Primary Control* block generates the reference signals corresponding to active and reactive components of the output current. At last, the *Wave Reference* block is used to generate the reference signal to drive the two-level converter. In this example, an average converter model is used, and therefore, the reference signal is the duty ratio.

All the DGs are connected with the loads at the Point of Inter-Connection (POI). Connection and disconnection of loads is controlled by a three-phase circuit breaker.

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

*

## Simulation and results

### **System switching actions**

* Loads connect to the POI via a three-phase circuit breaker.
* Dynamic sequence used to assess controller behavior:
  1. t = 10 s: Activate secondary control on DG4 (GFL).
  2. t = 15 s: Activate secondary control on DG1–DG3 (GFM).
  3. t = 20 s: Connect an additional load to the islanded microgrid.
  4. t = 25 s: Disconnect the additional load.

### Results

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

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

At the start, DG1–DG3 operate with droop as the primary control, which enforces proportional power sharing but allows voltage and frequency to deviate from nominal. With no secondary control active, these deviations persist. DG4’s active and reactive power references are initially zero, so it does not dispatch power.

At t = 10 s, DG4’s secondary control activates. It detects the deviations and begins supplying active and reactive power via the Frequency–watt (droop) and Volt–Var functions. Due to its grid-following nature, DG4 mitigates but does not fully restore voltage and frequency to nominal.

At t = 15 s, the secondary controllers on the GFM units (DG1–DG3) activate. They adjust active and reactive power dispatch to eliminate the voltage and frequency deviations. DG4’s Volt–Var function provides no reactive power when the controlled voltage remains within 0.98–1.02 pu. Its Frequency–watt (droop) function has a 0.036 Hz dead band around nominal, so it provides no active power within this range. As the GFM secondary control restores nominal voltage and frequency, DG4’s contributions drop to zero.

At t = 20 s, a new load is connected and then disconnected at t = 25 s. The GFM droop control maintains proportional power sharing among DG1–DG3 during these changes, while their secondary controllers maintain voltage and frequency at nominal.

## References

IEEE, "IEEE Standard for Interconnection and Interoperability of Distributed Energy Resources with Associated Electric Power Systems Interfaces," \_IEEE Std 1547-2018 (Revision of IEEE Std 1547-2003),\_no. doi: 10.1109/IEEESTD.2018.8332112, pp. 1-138, 2018.

{% hint style="danger" %}

## Intellectual Property Disclaimer <a href="#intellectual-property-disclaimer" id="intellectual-property-disclaimer"></a>

**Natural Resources Canada owns all intellectual property rights** in the Smart Inverter Modelling Toolbox software and related products.
{% endhint %}


---

# 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/renewable-energy/grid-forming-grid-following-der-interaction.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.
