> 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-microgrid-control-with-smart-inverters.md).

# Grid Forming Microgrid Control with Smart Inverters

## Description

The **GFM Control Smart Inverter** example, located in **File > Open an Example File > Renewable Energy**, compares three grid-forming (GFM) control strategies in an islanded microgrid with two parallel inverters.

The main objective is to demonstrate Droop Control with Double-Loop Inner Control, Droop Control with Single-Loop Inner Control, and Virtual Synchronous Generator (VSG) Control with Double-Loop Inner Control, and to assess their impact on voltage, frequency, and power sharing.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-102cc8bae84b505a2e48564cef39b3e276dbb60c%2Fimage%20(243).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 two three-phase, two-level GFM inverters operating in parallel as distributed generation units (DG1 and DG2). The inverters regulate microgrid voltage and frequency while dispatching active and reactive power to supply the loads. DG2 has twice the capacity of DG1, and both connect to the Point of Interconnection (POI) through distribution lines; loads are connected at the POI.

DG1 is fed by a dispatchable DC source, enabling instantaneous adjustment of active and reactive power in proportion to its nominal capacity under varying operating conditions. The same applies to DG2.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-f43cee150e2855044cef5b03395ba9b35e565470%2Fimage%20(244).png?alt=media" alt=""><figcaption><p>The grid-forming inverter of the Distributed Generation (DG) unit-1</p></figcaption></figure>

The controller is organized into four subsystems:

* GFM Signal Conditioning Three-Phase (GFMSIC): Measures required signals, filters and scales them to per-unit, and transforms them to d–q coordinates.
* GFM Primary Control Three-Phase (GFMPC): Estimates the phase angle and generates references for angular frequency and virtual-source voltage magnitude based on operating conditions.
* GFM Inner Control Loop Three-Phase (GFMICL): Tracks the primary control references and produces the d–q reference control signal.
* GFM Reference Generation Three-Phase (GFMRG): Conditions the reference control signal to match the DG’s nominal DC voltage and the inverter’s operating voltage. In this example, an average two-level three-phase inverter model is used; the reference connects directly to the inverter’s Uref port.

An LC filter at the converter output attenuates switching harmonics. Primary control options are Droop Control and VSG Control. The inner control loop can be configured as Double-Loop or Single-Loop.

## Simulation and results

Scenarios used to exercise the controllers:

* At t = 1.5 s, a new load connects at the POI.
* At t = 3 s, the newly connected load disconnects from the microgrid.

The following three figures depict the measured frequency, voltage and combined dispatch of active and reactive power at POI for three control strategies individually. Across all three control methods—Droop with Double-Loop Inner Control, Droop with Single-Loop Inner Control, and VSG with Double-Loop Inner Control—the controllers respond to load changes by adjusting active and reactive power to stabilize voltage and frequency.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-a15b6f84ff6603166f12931010c65f611333cbfa%2Fimage%20(247).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-8b609f478b4f38379d21e96e903abde52aa2c48b%2Fimage%20(248).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-46dd158672f8254ddb152a9040b05bc274bb4f97%2Fimage%20(249).png?alt=media" alt=""><figcaption></figcaption></figure>

Because no secondary controller is present, steady-state voltage and frequency at the POI deviate from nominal values under load changes. Frequency is a global variable in the microgrid; therefore, active power sharing between DG1 and DG2 is accurate in per-unit. Given that DG2 has twice the capacity of DG1, the absolute active power contribution remains proportional with changing conditions. Voltage is a local variable, and without a virtual impedance loop, reactive power sharing is not accurate; the per-unit reactive power of DG1 and DG2 differs.

The following figures show the comparison of the simulation results of the three control methods. At t = 1.5 s, when the load connects, both DGs detect deviations in voltage and frequency and increase their active and reactive power output. At t = 3 s, when the load disconnects, both DGs reduce their power accordingly. The choice of primary control (droop vs. VSG) and inner loop topology (double loop vs. single loop) leads to distinct dynamic behaviors: droop leverages load-sharing characteristics, whereas VSG emulates synchronous generator inertia.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-2992ab12101fe87a2a4ff22250759fd50c2bf8cc%2Fimage%20(245).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-d77374ffee4b8d4fc435256b2416ce7b83ed54b2%2Fimage%20(246).png?alt=media" alt=""><figcaption></figcaption></figure>

{% 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-microgrid-control-with-smart-inverters.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.
