Main Content

MMC-STATCOM Model running in Real-Time (Discrete)

This example demonstrates the use of Decoupling Line blocks to run the MMC Grid STATCOM example in real-time


This example is based on the MMC-STATCOM connected to a 735 kV Transmission System example. In order to simulate this network in real-time, we separated it into three electrically disconnected subsystems using the decoupling line method. The QUE-STAT transmission line (that connects the STATCOM device to the South Network subsystem) and the CHM-SAG transmission line (that connects the North Network subsystem to the South Network subsystem) are good places to decouple the network. The technique consists of using two Decoupling Line blocks to replace each Distributed Parameters Line block.

  1. We used the Line Decoupler App to automatically replaces and correctly sets up the two selected lines with equivalent Decoupling Line blocks.

  2. We moved the CHM-SAG Send block in the North Network subsystem and the CHM-SAG Receive block in the South Network subsystem. We moved the QUE-STAT Send block in the South Network subsystem and the QUE-STAT Receive block in the STATCOM subsystem.

  3. We selected the Show send and receive ports options of the four Decoupling Line blocks and connect the four blocks to Inport and Outport blocks in each subsystem

  4. We put a Powergui block with Simulation Type set to Discrete and Sample time set to 50e-6 seconds in each subsystem.

  5. We connected the Send an Receive signals together, from one subsystem to the other, to transmit voltage and current information appropriately.

In order to run this model in concurrent execution we did the following steps:

  1. Using the Subsystems & Reference model tool of Simulink we converted the three subsystems into referenced models

  2. In the Configuration Parameters of the example and of the three referenced models, we specified a Fixed-step discrete (no continuous states) solver, and we selected Allow tasks to execute concurrently on target and Automatically handle rate transition for data transfer options

  3. In the Configure Tasks option of the example we defined 3 Periodic tasks: Task0, Task1, and Task2, each with a Period value set to: Ts

  4. In the Tasks and Mapping section we associated the Task0 to the North Network block, the Task1 to the South Network block, and the Task2 to the STATCOM block.

  5. In the Data Transfer Options we set the Periodic signals to: Ensure deterministic transfer (maximum delay).

cs = getActiveConfigSet(model);
stf = 'slrt.tlc';
tmf = 'slrt_default_tmf';
mc = 'make_rtw';
set_param(cs, 'TemplateMakefile', tmf)
set_param(cs, 'MakeCommand', mc)
set_param(model, 'GenCodeOnly', 'off')
Simulink.architecture.config(model, 'Convert');