> 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-smart-inverters/gfm-reference-generation-three-phase.md).

# GFM Reference Generation Three Phase

## Description

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-3a871f87908b71a400df8dcec5970946eda5edb3%2FCSI_GFM_ref_generation_3P_block.png?alt=media" alt="" width="359"><figcaption></figcaption></figure>

The **GFM Reference Generation Three Phase** block, located in the **Control Smart Inverters library**, produces the reference control signal that drives a three-phase, two-level grid-forming (GFM) inverter. Its output can connect directly to a three-phase two-level inverter modeled as an “average model (Uref-controlled)”. If the inverter is modeled with “switching devices,” use an intermediate Pulse Width Modulation (PWM) block.

The block conditions the d–q control signal from upstream controllers based on the inverter’s nominal input DC and output AC voltages and the selected modulation index. It limits the peak value of the control signal, compensates for phase-angle deviation caused by a sample-time mismatch between Powergui and this block, and aligns the final phase angle with the cosine-based Park transformation used in the Signal Conditioning block.

{% hint style="danger" %}
This block requires a valid license on both the simulator and the workstation with the feature SMART INVERTER enabled.
{% endhint %}

Operation overview:

1. Based on the measured DC voltage and nominal AC voltage of the inverter, the modulation index (MI) is calculated.
2. The reference d-q coordinate control signal, received at the input, is updated based on the MI. The calculation is as follows: $$V\_{dq} = \frac{V\_{dq,ref}}{MI}$$
3. The amplitude and phase of the per phase voltage reference $(x={a,b,c})$ is calculated from the updated d-q coordinate reference control signal as follows:

$$
V\_x = \sqrt{V\_d^2 + V\_q^2} \\
\\
θ\_x = atan(\frac{V\_q }{ V\_d})
$$

4. The final control signal is generated as follows:

$$
v\_{refa} = V\_a · sin(ωt + θ\_a + θ\_x + θ\_{shift} + θ\_{correction})\\
v\_{refb} = V\_b · sin(ωt − \frac{2π}{3} + θ\_b + θ\_x + θ\_{shift} + θ\_{correction}) \\
v\_{refc} = V\_c · sin(ωt + \frac{2π}{3} + θ\_c + θ\_x + θ\_{shift} + θ\_{correction})
$$

Where, $θ\_{shift} = \frac{π}{2}$ as cosine-based Park transformation is adopted in the Signal Conditioning block and $θ\_{correction}$ is the correction angle, arising due to the sample time mismatch.

## Mask parameters

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

| Parameter                     | Description                                                                                    | Variable & Constraints               |
| ----------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------ |
| **Nominal Operating Voltage** | Nominal RMS line-to-line AC voltage of the grid-forming converter (V, Vrms, L-L)               | V\_base\_ref\_gen unconstrained      |
| **Nominal Frequency**         | Nominal operating frequency of the grid-forming converter (Hz)                                 | f\_nom\_ref\_gen unconstrained       |
| **Maximum Modulation Index**  | Maximum modulation index of the control signal; sets the peak value of the control signal (pu) | max\_modulation\_index unconstrained |
| **Nominal DC voltage**        | Nominal input DC voltage of the inverter (V)                                                   | Vdc\_nom unconstrained               |

## Inputs

| Input        | Description                                                                                                       |
| ------------ | ----------------------------------------------------------------------------------------------------------------- |
| **wt**       | Angle variation with time, synchronized to zero crossings of the fundamental (positive sequence) of phase A (rad) |
| **Vdqref**   | D-axis and Q-axis reference control voltage (pu)                                                                  |
| **Vdc (pu)** | Measured DC voltage (pu)                                                                                          |

## Outputs

| Output   | Description                   |
| -------- | ----------------------------- |
| **Uref** | Reference control signal (pu) |

## Signals available for monitoring and external I/O connections (via sensors form)

All block inputs and outputs are available as signals for monitoring and for external I/O connections.

## Intellectual Property and Acknowledgements

{% hint style="danger" %}

## **Intellectual Property Disclaimer**

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

{% hint style="info" %}

## Acknowledgements <a href="#acknowledgements" id="acknowledgements"></a>

The development of the <code class="expression">page.vars.block\_name</code> block in the Smart Inverter Control Library is a contribution of CanmetENERGY at Natural Resource Canada.
{% 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/library-blocks-reference/control-smart-inverters/gfm-reference-generation-three-phase.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.
