Skip to main content

FPGA-Based HIL Testing of Grid-Side Converters

Use an integrated workflow to test grid-side converters safely without requiring physical prototypes.

Learn How To

  • Model grid tied converters in Simulink and Simscape
  • Synthesize and validate phase-locked loop (PLL) and current control algorithms
  • Generate HDL code from the inverter model and simulate on an FPGA
  • Stream data from an FPGA to the CPU using direct memory access (DMA)
  • Analyze current ripples in Simulation Data Inspector
  • Test hardware and firmware for all operating conditions

Key Benefits

  • Test grid-side converters safely without physical prototypes
  • Reach simulation time steps below 1μs and a resolution of PWM switching signals as low as 4ns
  • Simulate switching dynamics for switching frequencies up to hundreds of kHz in real time
  • Use an integrated workflow from design to real-time testing and verification
  • Ensure compliance of grid code regulations

The Challenges of Grid-Side Converters

Usage of grid-side converters (GSC) has increased with the electrification trend. GSCs are used to interface an AC grid with a DC network. Typical applications are wind and solar power generation, grid-connected electric vehicles, or motor control regenerative drives. GSCs usually combine multiples algorithms such as phase-locked-loop (PLL), cascaded controllers, and pulse-width-modulation (PWM). This complexity can make controllers challenging to test and troubleshoot.

Furthermore, some GSCs need to perform in scenarios such as weak grid conditions, grid harmonics, grid faults, grid outage, and islanding. Such scenarios are difficult and costly to test with a traditional test bench. Hardware-in-the-loop (HIL) testing can speed up and automate the testing process. Compliance with grid code and regulations requires running different operational tests to ensure the safety of the power converter's integration in the grid, for example, to ensure fault ride through.


Made for SimulinkPassenger Vechiles fixed-wing inverter Electric motor

Solar plant

Wind power


Electric motor

Power Electronics Real-Time Simulation with Speedgoat Programmable FPGA


Set up a HIL test bench with Simulink and Speedgoat to safely validate power converter controls without the need for hardware prototypes. This allows you to test all operational conditions, including fault conditions, without the risk of damaging expensive hardware.

You can test interfaces to the microcontroller such as PWM signals and analog measurements or interfaces with equipment like PLCs through I/O protocols such as SPI, I2C, or EtherCat. Data streaming from an FPGA-based simulation to the CPU and host computer allow you to monitor or log the signals in real-time with a resolution below 1us. You can easily debug your controller, analyze power conversion quality, and even observe high-frequency switching harmonics. With test scripting and automation, you can automate HIL testing and ensure grid-code compliance at every design iteration.

From Desktop to Real-Time

This example model consists of a three-phase two-level voltage source converter connected to a low voltage grid modeled in Simscape. The connection is made through an LC filter. A circuit breaker allows to disconnect and connect the converter with the grid. There is a low voltage load on the grid side and a transformer connecting to the medium voltage grid.

In the first step, the model is used to validate the closed-loop control by desktop simulation. The controller consists of a phase-locked loop for grid synchronization and PI current control in the synchronous reference frame.

In a second step, the model can be deployed to the real-time platform for HIL testing of the embedded controller. The plant model is deployed to a Simulink programmable FPGA I/O module to achieve a simulation time step of 1us. The PWM signals can be captured with an increased resolution by modeling the converter using the sub-cycle averaging method. A maximum resolution of 4ns is possible, allowing to simulate state of the art power converters with switching frequencies above 100kHz. The switching frequency of this example is 20kHz.

Hardware-in-the-Loop Setup

The workflow allows to extend Simscape networks with custom Simulink components and run everything together on an FPGA. The Simscape to HDL and HDL Coder workflow advisor guide you through the automated process of generating a Simulink Real-Time model and configuration file for the FPGA. The generated model can directly be deployed to the real-time platform with one click out of Simulink. The FPGA is automatically configured and can be interfaced by the driver blocks of the Speedgoat HDL Coder Integration package. The necessary driver blocks are embedded in the Simulink Real-Time model by HDL Coder.

Various interfaces to connect to the real-world embedded controller are provided by Speedgoat and can easily be mapped in the HDL Coder Workflow Advisor. The PWM control signals for the grid-tied inverter are mapped to digital I/O pins of the IO334. The analog I/O is used to feedback the grid voltages and inverter phase currents to the control unit.
Simulink Real-Time and Speedgoat hardware's close integration allows interfacing the real-time model online for parameter tuning and signal visualization. Signals from the FPGA plant model can be streamed to the CPU and host computer and visualized in real-time in the Simulation Data Inspector (SDI). Alternatively, signals can be logged on the SSD of the real-time target machine. The streaming interface allows visualizing high-frequency effects such as switching harmonics. The phase voltages and currents are logged in SDI. By zooming, you can see the current ripples with a signal resolution of 1MHz.



The Authors

Matthias Schiesser

Matthias Schiesser
FPGA Development Engineer

Manuel Fedou

Manuel Fedou
Senior Application Engineer Electrification

Product Highlights

Speedgoat Products

Related Content

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

Request a free
workflow demo

Have Questions?

Talk to our experts about your application requirements.