For a better experience on dSPACE.com, enable JavaScript in your browser. Thank you!

Lukas Kalinowski, Project Manager, dSPACE Inc.

**Lukas Kalinowski
Project Manager
dSPACE Inc.**

**November 16, 2015: **You might not be aware of it, but if you are reading this Blog, it’s fair to say you already used power electronics today.

Essentially, power electronics is the subject of electronics, specialized in transformation of electronic power sources. Power electronics are present almost everywhere, in electronic devices like personal computers, cell phone chargers and many more.

Looking at the automotive industry, hybrid cars have been around for quite some time. The latest trend that almost all car manufactures are following are fully electric cars. Likewise, the automotive industry is integrating electronic power steering in cars to implement driver assistance systems, targeting full autonomous driving cars.

This increasing demand on power electronics and the related electronic control units (ECU) requires techniques to assure high quality development. Especially if integrated in driver assistance systems and other safety-critical applications where verification of power electronic systems has highest priority.

Hardware in the loop simulation (HIL) has been proven as a standard in the automotive industry, which makes simulation of power electronics a key factor for modern development processes.

For HIL simulation, a plant model is essential to reproduce the behavior of the electrical components in combination with the real electronic control unit. These models must be real-time capable and reflect the real behavior to achieve reliable testing results. There are certainly multiple methods to implement your plant model, but I’d like to focus on how to use SimPowerSystems™ in combination with real-time applications.

Using a model-based approach with SimPowerSystems™, as seen in Figure 1, makes it easy to simulate models offline, since the topology-orientated design helps engineers establish a model by using the electronic parts like transformers, diodes and switches, instead of dealing with the mathematical block-orientated model.

Figure 1: Example of a simple SimPowerSystems™ model

Topology-orientated models take care of transferring the electrical circuit into differential equations and performing the discretization of the equations into matrices, as seen in Figure 2.

Figure 2: SimPowerSystems™ from model to equations

This also means that for each discrete component, like switches or diodes, one differential will be solved for each switching state, as seen in Figure 3. This results in a matrices with total number of 2^n, where n is the total number of switches in the model. For example, a B6 bridge inverter will result in 2^6 = 64 equations.

Figure 3: SimPowerSystems™ discrete components to differential equation per switching state

The issue engineers are facing is to transmogrify these topology-orientated models in a real-time application. For PC-based simulation, good results can be achieved by using variable step solvers or very small, fixed step sizes. Both solver options are negating using these models in a real-time system. Furthermore, SimPowerSystems™ won’t deal with inherited sample times and some blocks need a continuous sample time. Additionally, the matrices are calculated during run-time when the state of switches is updated, which results in issues for high switching frequencies due to limited computation time. This means that SimPowerSystems™ is not real-time capable in general.

Using dSPACE PowerlibRT enables real-time capability with SimPowerSystems™. PowerlibRT is a blockset containing mean value models for power electronics, model caching, model splitting and task handling for SimPowerSystems™ based models.

Due to the limited sampling rates of modern real-time platforms, regular SimPowerSystems™ blocks can only be used for low-switching frequencies, smaller 10kHz and linear parts. For fast-switching frequencies, PowerlibRT includes mean value models for example inverters, which can be connected to the PWM measurement from dSPACE IO-boards like the DS5202-EMH. By doing so, the gate control values from the real electronic control unit (ECU) can be integrated in the loop. PowerlibRT task handling enables triggered tasks, which is a necessity for reading the PWM gate signals of the ECU.

Performance improvements for calculating the amount of matrices during one model step size is achieved with PowerlibRT model caching. This means storing the discretized matrices in the RAM of the real-time processor by storing the calculated model states during compilation of the model. Therefore, no calculation of these states during run-time is needed anymore, which leads to a smaller turnaround time on the real-time processor.

Real-time capability can be further improved with PowerlibRT model splitting, by decoupling the differential equations. Considering the schematic in Figure 4, without the blue PowerlibRT model splitting block, the matrix size would be 2^8 = 256 elements. With model splitting, the matrix size is 2^6+^2 = 68 elements. This results in a serious reduction of storage space for model caching.

Figure 4: PowerlibRT model splitting example

PowerlibRT offers a new way to implement SimPowerSystems™ models on real-time hardware. In combination with dSPACE IO-boards, it can be integrated into a complete HIL environment to perform testing on ECUs.