This example shows the essential elements of a possible control implementation for a grid-tied three-phase nine-level Modular Multilevel Converter consisting of 24 submodules (Figure 1). The control is meant to be implemented with three B-Box RCP units, using the automated code generation process (ACG). The selected control approach is inspired from [1], which is one of the simplest possible control approaches including the complete closed-loop control of all state variables.

The related Simulink files contain not only the control implementation but also a model of the plant. Hence, these files can be simultaneously used for simulation and automated code generation purposes. The utilized parameters correspond to the Lite MMC bundle (Figure 2). As such, this example is also meant to serve as a ready-made template for any control developments intended on this hardware.

 Figure 1: Electrical scheme of the considered system                              Figure 2: Reference prototyping hardware


The complete simulation and control files are contained in:

The init.m file is automatically called at the beginning of the simulation or code generation process (using the Init callback of the *.slx file).
All Simulink sheets are commented on so that their operation can be easily understood.

Minimum requirements:

  • Imperix ACG SDK or newer.
  • MATLAB Simulink R2017b or newer.
  • Plexim PLECS VIEWER 4.4.2 or newer (free).

Principles of operation

The control implementation is largely inspired from [1], which is a key reference regarding the control of MMC with carrier-based modulation. Two minor differences are however present – and somewhat recommended – between [1] and this example:

  • The arm-level vertical energy balancing is not achieved indirectly through the so-called averaging control, but instead is done explicitly by an associated controller, acting on the AC-side converter reference. This approach offers a better decoupling of the cell- and arm-level balancing mechanisms and allows to improve the cell-level dynamics.
    On the other hand, the corresponding energy exchanges remain related to the AC side of each phase leg, which means that they may lead to slight asymmetries in the grid currents during the balancing transients. Alternative approaches exist, typically altering the circulating currents in such a way that the total DC is unchanged. A recommended reference on this topic is [2].
  • The DC-side dynamics are improved by feed-forwarding the AC-side active power into the DC-side current control. This facilitates the control of the total embedded energy, i.e. overall average capacitor voltage. More subtle approaches can be used, which are typically relevant in case of operation under unbalanced grid conditions, or single-phase systems.

Figure 3: Top-level scheme of the implemented control strategy.

Hardware and software configuration

The configuration of all analog inputs for all B-Boxes is entirely contained within the ADC subsystem (Fig. 4), where all the ADC configuration blocks are conveniently grouped.

Figure 4: Content of the ADC subsystem, including all ADC configuration blocks

Similarly, for each phase, the associated subsystem (Fig. 5) contains the carrier-based modulators linked to each submodule, which are phase-shifted according to the desired modulation pattern. Each modulator is here directly fed by a local voltage controller, responsible for maintaining the appropriate charge level inside the submodule capacitors(s).

Figure 5: Content of each phase-related subsystem

Important comments

  • Several controllers are sharing the same parameters (Kp, Ki), which are implemented as global variables using memory read and write blocks. This translates into so-called Simulink global signals, which are visible throughout a Simulink model. More subtle approaches are possible.
  • There is no start-up/shut-down procedure implemented in the Simulink files. When needed, such mechanisms can be implemented, for instance using Stateflow. However, for complex projects, a control implementation using C/C++ may be preferable.
  • It is strongly advised to use Simulink's sample time highlighting options to control the exact execution rate of each block. These options are conveniently available from the menu Display >> Sample Time >> Colors. Indeed, inappropriate execution rates are a common source of mismatch between simulation and the actual real-time control implementation.

Illustrative simulation results

Figure 6 shows some simulation results from the presented example:

Figure 6: Excerpt of the simulation results, showing a complete power reversal at t=0.4s.


[1] M. Hagiwara, H. Akagi, "Control and Experiment of Pulsewidth-Modulated Modular Multilevel Converters," in IEEE Transactions on Power Electronics, Vol.24, July 2009.

[2] P. Münch, D. Görges, M. Izák and S. Liu, “Integrated current control, energy control and energy balancing of Modular Converters,” in Proc. IECON Conference, Phoenix, 2010.