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
Description
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.
We used the Line Decoupler App to automatically replaces and correctly sets up the two selected lines with equivalent Decoupling Line blocks.
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.
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
We put a Powergui block with Simulation Type set to Discrete and Sample time set to 50e-6 seconds in each subsystem.
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:
Using the Subsystems & Reference model tool of Simulink we converted the three subsystems into referenced models
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
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
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.
In the Data Transfer Options we set the Periodic signals to: Ensure deterministic transfer (maximum delay).
set_param(model,'StopTime','inf') cs = getActiveConfigSet(model); stf = 'slrt.tlc'; tmf = 'slrt_default_tmf'; mc = 'make_rtw'; switchTarget(cs,stf,[]) set_param(cs, 'TemplateMakefile', tmf) set_param(cs, 'MakeCommand', mc) set_param(model, 'GenCodeOnly', 'off')
Simulink.architecture.config(model, 'Convert'); Simulink.architecture.importAndSelect(model,'Multicore'); Simulink.architecture.get_param(model,'ArchitectureName');
set_param(model,'RL32LogTETModifier','on')
set_param(model,'SaveOutput','off') set_param(model,'SaveTime','off') set_param(model,'ReturnWorkspaceOutputs','off') set_param(model,'SaveState','off') set_param(model,'SaveFinalState','off') set_param(model,'SignalLogging','off') set_param(model,'DSMLogging','off') set_param(model,'LoggingToFile','off') set_param(model,'SignalLogging','off')