> 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/smart-power-simulation-software-sps/example-models/power-transmission-and-distribution/d-statcom.md).

# D STATCOM

This example shows a detailed model of a distribution STATCOM.

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-7d4d75a063dcc92ab6c22bfb5b469c72aad7edf9%2FD_STATCOM_example.png?alt=media" alt=""><figcaption></figcaption></figure>

## Detailed Versus Average Model

When modeling VSC-based energy conversion systems in SPS Software, you can use two types of models, depending on the range of frequencies to be represented: the detailed model and the average model.

**The detailed model (discrete)** such as the one presented in this example. The detailed model includes detailed representation of power electronic IGBT converters. In order to achieve an acceptable accuracy with the 1680 Hz switching frequency used in this example, the model must be discretized at a relatively small time step (5 microseconds). This model is well suited for observing harmonics and control system dynamic performance over relatively short periods of times (typically hundreds of milliseconds to one second).

**The average model (discrete)** such as the one presented in the power\_dstatcom\_avg model in the FACTS library of examples. In this type of model the IGBT Voltage-Sourced Converters (VSC) are represented by equivalent voltage sources generating the AC voltage averaged over one cycle of the switching frequency. This model does not represent harmonics, but the dynamics resulting from control system and power system interaction are preserved. This model allows using much larger time steps (typically 50 microseconds), thus allowing simulations of several seconds.

Alternatively, a third type of model can be used for simulating on larger time frames: the **phasor model**. This type of model is not available for the D-STATCOM, but it is available for the STATCOM, a similar device, in the power\_statcom.mdl model.

## Description

A Distribution Static Synchronous Compensator (D-STATCOM) is used to regulate voltage on a 25-kV distribution network. Two feeders (21 km and 2 km) transmit power to loads connected at buses B2 and B3. A shunt capacitor is used for power factor correction at bus B2. The 600-V load connected to bus B3 through a 25kV/600V transformer represents a plant absorbing continuously changing currents, similar to an arc furnace, thus producing voltage flicker. The variable load current magnitude is modulated at a frequency of 5 Hz so that its apparent power varies approximately between 1 MVA and 5.2 MVA, while keeping a 0.9 lagging power factor. This load variation will allow you to observe the ability of the D-STATCOM to mitigate voltage flicker.

The D-STATCOM regulates bus B3 voltage by absorbing or generating reactive power. This reactive power transfer is done through the leakage reactance of the coupling transformer by generating a secondary voltage in phase with the primary voltage (network side). This voltage is provided by a voltage-sourced PWM inverter. When the secondary voltage is lower than the bus voltage, the D-STATCOM acts like an inductance absorbing reactive power. When the secondary voltage is higher than the bus voltage, the D-STATCOM acts like a capacitor generating reactive power.

The D-STATCOM consists of the following components:

* **a 25kV/1.25kV coupling transformer** which ensures coupling between the PWM inverter and the network.
* **a voltage-sourced PWM inverter** consisting of two IGBT bridges. This twin inverter configuration produces less harmonics than a single bridge, resulting in smaller filters and improved dynamic response. In this case, the inverter modulation frequency is 28\*60=1.68 kHz, so that the first harmonics will be around 3.36 kHz.
* **LC damped filters** connected at the inverter output. Resistances connected in series with capacitors provide a quality factor of 40 at 60 Hz.
* **a 10000-microfarad capacitor** acting as a DC voltage source for the inverter
* **a voltage regulator** that controls voltage at bus B3
* **a PWM pulse generator** using a modulation frequency of 1.68 kHz
* **anti-aliasing filters** used for voltage and current acquisition.

The D-STATCOM controller consists of several functional blocks:

* **a Phase Locked Loop (PLL)**. The PLL is synchronized to the fundamental of the transformer primary voltages.
* **two measurement systems**. Vmeas and Imeas blocks compute the d-axis and q-axis components of the voltages and currents by executing an abc-dq transformation in the synchronous reference determined by sin(wt) and cos(wt) provided by the PLL.
* **an inner current regulation loop**. This loop consists of two proportional-integral (PI) controllers that control the d-axis and q-axis currents. The controllers outputs are the Vd and Vq voltages that the PWM inverter has to generate. The Vd and Vq voltages are converted into phase voltages Va, Vb, Vc which are used to synthesize the PWM voltages. The Iq reference comes from the outer voltage regulation loop (in automatic mode) or from a reference imposed by Qref (in manual mode). The Id reference comes from the DC-link voltage regulator.
* **an outer voltage regulation loop**. In automatic mode (regulated voltage), a PI controller maintains the primary voltage equal to the reference value defined in the control system dialog box.
* **a DC voltage controller** which keeps the DC link voltage constant to its nominal value (Vdc=2.4 kV).

The electrical circuit is discretized using a sample time Ts=5 microseconds. The controller uses a larger sample time (32\*Ts= 160 microseconds).

## Simulation

### **D-STATCOM dynamic response**

During this test, the variable load will be kept constant and you will observe the dynamic response of a D-STATCOM to step changes in source voltage. Check that the modulation of the Variable Load is not in service (Modulation Timing \[Ton Toff]= \[0.15 1]\*100 > Simulation Stop time). The Programmable Voltage Source block is used to modulate the internal voltage of the 25-kV equivalent. The voltage is first programmed at 1.077 pu in order to keep the D-STATCOM initially floating (B3 voltage=1 pu and reference voltage Vref=1 pu). Three steps are programmed at 0.2 s, 0.3 s, and 0.4 s to successively increase the source voltage by 6%, decrease it by 6% and bring it back to its initial value (1.077 pu).

Start the simulation. Observe on Scope1 the phase A voltage and current waveforms of the D-STATCOM as well as controller signals on Scope2. After a transient lasting approximately 0.15 sec., the steady state is reached. Initially, the source voltage is such that the D-STATCOM is inactive. It does not absorb nor provide reactive power to the network. At t = 0.2 s, the source voltage is increased by 6%. The D-STATCOM compensates for this voltage increase by absorbing reactive power from the network (Q=+2.7 Mvar on trace 2 of Scope2). At t = 0.3 s, the source voltage is decreased by 6% from the value corresponding to Q = 0. The D-STATCOM must generate reactive power to maintain a 1 pu voltage (Q changes from +2.7 MVAR to -2.8 MVAR). Note that when the D-STATCOM changes from inductive to capacitive operation, the modulation index of the PWM inverter is increased from 0.56 to 0.9 (trace 4 of Scope2) which corresponds to a proportional increase in inverter voltage. Reversing of reactive power is very fast, about one cycle, as observed on D-STATCOM current (magenta signal on trace 1 of Scope1).

### **Mitigation of voltage flicker**

During this test, voltage of the Programmable Voltage Source will be kept constant and you will enable modulation of the Variable Load so that you can observe how the D-STATCOM can mitigate voltage flicker. In the Programmable Voltage Source block menu, change the "Time Variation of" parameter to "None". In the Variable Load block menu, set the Modulation Timing parameter to \[Ton Toff]= \[0.15 1] (remove the 100 multiplication factor). Finally, in the D-STATCOM Controller, change the "Mode of operation" parameter to "Q regulation" and make sure that the reactive power reference value Qref (2nd line of parameters) is set to zero. In this mode, the D-STATCOM is floating and performs no voltage correction.

Run the simulation and observe on Scope3 variations of P and Q at bus B3 (1st trace) as well as voltages at buses B1 and B3 (trace 2). Without D-STATCOM, B3 voltage varies between 0.96 pu and 1.04 pu (+/- 4% variation). Now, in the D-STATCOM Controller, change the "Mode of operation" parameter back to "Voltage regulation" and restart simulation. Observe on Scope 3 that voltage fluctuation at bus B3 is now reduced to +/- 0.7 %. The D-STATCOM compensates voltage by injecting a reactive current modulated at 5 Hz (trace 3 of Scope3) and varying between 0.6 pu capacitive when voltage is low and 0.6 pu inductive when voltage is high.

## Command

Example model name: power\_dstatcom\_pwm

{% code lineNumbers="true" %}

```matlab
open('power_dstatcom_pwm')
```

{% endcode %}


---

# 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/smart-power-simulation-software-sps/example-models/power-transmission-and-distribution/d-statcom.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.
