Skip to main content
HIL Testing of Control Algorithms for Modular Multi-Level Converters search search close

Learn how to Test Embedded Controllers for Complex Modular Multi-Level Converters

Learn how to

  • Model modular multi-level converters (MMC) in Simulink and Simscape™
  • Build models using the MATLAB® command line 
  • Run Simscape Electrical™ models on real-time target machines
  • Use industry-specific communication protocols such as SPI or Modbus TCP 


Key Benefits

  • Test embedded controllers for MMCs before testing them with MMC prototypes
  • Run complex architectures with over 90 switches at 50 µs
  • Use the Simulink-integrated workflow from desktop to hardware-in-the-loop (HIL) testing



Motivation for Hardware-in-the-loop Testing of Power Electronics Converters

Electrical power systems need to convert power efficiently and reliably. Engineers focus on improving the overall system harmonics and operational integrity of power converters. One approach is to increase the number of power electronic components. Power converters with more components have better availability and can tolerate single component faults better. However, with added complexity comes the need to evaluate more configurations in the early stages of technology development.

Hardware-in-the-loop (HIL) testing enables accelerating and de-risking power electronics controllers testing by:

  • Replacing prototypes and production hardware with digital twins of those and evaluate them using a real-time testing system. 
  • Efficient testing through leveraging test automation and test management solutions like Simulink Test™
  • Using simulations instead of precious power electronics hardware which can break down
  • Evaluating control systems earlier because you can test controllers even if the hardware is not available

 ⮕ Learn more about HIL Testing of Power Electronics

 ⮕ Learn more about Electrical equipment testing with Power HIL

MMC Design in Simulink and Simscape Electrical



A modular multi-level converter connects several half bridges or full bridges in series . 

When connecting the modules in series, you can either phase-shift the PWM signals for each module or level-shift as used here. This reference application uses level-shifting to balance capacitor voltages more easily. This minimizes component degradation and improves the overall quality of the voltage and current response.

As the number of modules in an MMC increases, you can take advantage of the Simulink API in MATLAB to programmatically build your architecture. For example, when you use more cells, leveraging a converter library can help you to model more efficiently and avoid errors when building models manually.  


FFT analysis allows you to assess the harmonic signature.

The system depicted has 8 cells with a carrier frequency that is 10 times the modulation wave frequency.

The 80th harmonic becomes the first significant harmonic.

This is verified in this reference application, and the expected sidebands can be seen.

Note the harmonics outside of the first significant harmonic region are less than 0.5%. 


Real-Time Simulation of System Models


You can prepare system-level models for later HIL testing. The power converter, the grid model and the switching signal generator run at 50us while the current and voltage controller runs at 100us. At this stage, the complete system is simulated on the real-time target machine. Use Simulink Data Inspector (SDI) to inspect signals in real-time.

Simulating the model on the real-time target computer ensures that this complex power converter model with 96 switches can run deterministically at 50us in real-time. These simulation results can be used as a point of comparison for HIL testing 

Controller HIL Testing

Power electronics controls algorithms are typically deployed to embedded microcontrollers, such as the Texas Instrument C2000.

To test this embedded application in real-time, you can set up a hardware in the loop (or HIL) test setup.

The setup contains the C2000 microcontroller as device under test, a real-time simulator that runs a digital twin of the multi-level converter, an SPI protocol interface, and digital/analog links that mimic the interface with the real hardware.


In this example, we show the configurable workflow with a custom SPI implementation and use library driver blocks to interface with the real-time plant simulation. 

You can log signals from the HIL model such as the DC voltages on top and on the bottom the phase voltages and thus compare with the results of the system-level real-time simulation. 

The Author

Manuel Fedou

Manuel Fedou
Application Engineer

Product Highlights

Related Content


Curious how to accelerate control design innovation with a modular controller hardware setup?

Free Workflow Demo

See how Speedgoat can help you in the development of your control design for your application.

Schedule now

Have Questions?

Talk to our experts about your project and application requirements.

Follow Speedgoat LinkedIn