Skip to main content
Advancing Electrification with Real-Time Testing search search close


This recorded webinar presents how you can leverage real-time solutions to accelerate renewable energy integration and electric vehicle developments. By using comprehensible examples, this webinar highlights how you can leverage Speedgoat solutions to facilitate the development, testing and validation of your innovations with hardware prototypes: from controlling and tuning a high-voltage DC converter to verifying the operation of an actual grid-tied inverter against a virtual power grid.

This webinar covers real-time applications in power electronics, electric motor control, power system, as well as in energy and power management. With multi-core CPUs, Simulink-programmable FPGAs, communication protocols, and a wide range of input/output (I/O) interfaces, Speedgoat real-time solutions can deploy Simulink-based models in real-time to run in the MHz range, interface with industrial equipment, and provide power interfaces from a few watts to megawatts.


Specific topics that will be covered include: 

  • Control development and testing of high-voltage DC  
  • Test and verification of embedded controls for a grid-tied solar inverter
  • Real-time simulation of transmission and distribution networks
  • Onboard power systems: electric vehicles and all electric ships
  • Energy storage: testing of fuel cells and battery management systems 

Video Transcript

Hi, my name is Carlos Villegas. I am the Electrification Industry Manager at Speedgoat.

In this webinar, we will present how to advance electrification using real-time testing: from renewable energy integration to the development of battery electric vehicles.

This webinar provides a general overview of how you could use real-time testing for your developments in electrical systems and power electronics. While I will not go in details for each topic, you will receive a list of links for resources like videos, webpages, and real-time-ready Simulink files to go deeper in the topic of your interest.

We have the following agenda. After presenting the benefits of real-time testing, we’ll introduce the unified real-time testing platform composed of Simulink and Speedgoat hardware. We’ll then present the electrification megatrend and three growth segments: power electronics, power systems and power & energy management. We’ll go deeper in each of the growth segments via demos showing the advantages of using real-time testing We’ll cover high-voltage DC transmission and renewable energy integration with a focus on grid-tied inverter development. Afterwards, we’ll discuss power systems with examples for the electric grid and electric vehicles. Finally, we’ll cover the development of battery and fuel cell energy storage. 

So, we’ll cover many topics during this webinar, but I’ll emphasize on the following three key takeaways:
First, that you can use Simulink and Speedgoat hardware as a unified platform for developing power electronics converters, electric motors, energy management and power systems controls

Second, that real-time testing is a key step between desktop simulation and embedded code generation for developing electrical systems

And third, that you can use hardware-in-the-loop simulation together with test automation to thoroughly test both embedded controllers and electrical components for normal and fault operating conditions

To show the benefits of real-time testing, let’s say our joint task is to develop, test and implement new electrical components.

It could be electric powertrains for electric cars, a grid tied inverter, aerospace controls systems or a mobile device.

We need to address the requirement to make more efficient and often also more complex systems; and we seek to do it faster and better.

In particular, these questions arise:

How do you swiftly iterate over product designs?

How do you safely test your equipment?

You should be focused, on the design and testing of controllers for complex system dynamics.

You should not be constrained by the infrastructure to do that 

So, let’s look at how you can benefit from model-based system engineering and from early design up until field deployment.

This timeline represents a MBD path – without iterations – with the objective of showing you how controls development and testing benefit from real-time testing.

With Model-based design and real-time testing you can go from early designs through all the iterations and test cases via flexible and powerful prototypes.

It is not only about rapid controller prototyping

or Hardware-in-the-loop testing. Today's systems are way more diverse.

So, we’ll touch base on use cases such as field-oriented control autotuning, power hardware-in-the-loop, or the emulation of components like resolvers or battery cells

Your workflows may deviate slightly, but we are pretty sure that you’d agree on the following three main motivations for real-time based controller prototyping.

Test early to prove that your algorithms work in real-world dynamics.

You may find better trade-offs and tweak performance.

The unified workflow provides a path from desktop simulation to automate testing with flexible and powerful hardware.

This unique combination allows you to worry less when testing!

Ultimately, you can be more innovative, expose design flaws earlier and shorten time to market.

But we know, you rarely design controllers independently and from scratch. Typically, you take into account existing infrastructure.

Frontloading verification and validation tasks commonly is the main motivation for HIL testing.

It may be that the hardware prototype is not available, or you gradually integrate components.

You want to resolve design flaws and test edge cases in a safe environment.

What do you need for HIL Testing then? –

Certainly, a platform that runs your plant in deterministic manner while being connected to sensor and actuators,

And that would allow for plug & play interfacing and test automation.

Ultimately, this will help you deliver embedded software faster with lower risk.

Adding a high-end power amplifier, connect an actual power component to your virtual plant. This is called power hardware-in-the-loop. Typical applications include connecting an inverter to a virtual grid or an electric powertrain to a virtual EV motor.

After going through the benefits of real-time testing, let’s briefly present the unified real-time testing platform

The real-time simulation and testing platform by Speedgoat and MathWorks simplifies your workflow and let‘s you design and test better controllers faster.

You can innovate and you are not constrained by embedded testing environments or with hassles of integrating solutions.

Benefit from a plug-and-play real-time solution that shields you from interoperability issues.

Experience the unity of simulation and testing with real-time target hardware, all directly from MATLAB and Simulink.

The seamlessly integrated solution is composed of two main components.

The first one, is Simulink Real-Time, the solution for real-time test and simulation from within MATLAB and Simulink.

It comes with several host capabilities that allow you to easily create, control and monitor your real-time applications, and serves as your real-time operating system.

The second component is powerful and scalable Speedgoat real-time target computer equipped with I/O.

The real-time application created from your Simulink model runs on it together with the Simulink real-time operating system.

Allow me to illustrate the workflow of going from desktop to real-time simulation and testing, right from your Simulink, with an illustrative example.

Simulink and Speedgoat hardware provide 3 key enablers:

First, you benefit from a unified platform that enables you end-to-end development and testing of controls. The integrated workflows from MATLAB and Simulink allow you worry-free experimentation leveraging the instrument and logging capabilities, and also to use test automation for your verification and certification tasks.

Second, enablers that are more but certainly no exclusively targeted for controller development and controls prototyping. These will be highlighted with orange color.

Third, hardware-in-the-loop testing. Our integrated and scalable HIL solutions enable you to run simulation of your digital twins in full-deterministic manner.

The unified real-time platform can be easily explained with an example. Let’s suppose you are working on a control function for an electric vehicle.

You and your team have been designing, specifying, and sizing new software and hardware components based on a full vehicle simulation. The vehicle model is comprised of both Simulink components for the vehicle controls, as well multidomain physical Simscape components for high fidelity simulation of the vehicle plant including battery, electric motor, and thermal cooling systems.

Regarding your control algorithm, for instance, you have may have been using this model to rapidly tune controller performance and assess design.

In a next step, you may want to validate and verify the controller functions for execution on embedded controllers. With Speedgoat and MathWorks unified platform, this is certainly possible, and you can remain in the exact same MATLAB and Simulink environment.

Let’s go through the few steps to enable real-time execution:

You start configuring a target machine in the Simulink Real-Time App. Under the hood, code generation is optimized for Simulink Real-Time engine and a fixed step solver is set. Both settings ensure that your model is running in deterministic manner on Speedgoat hardware.

You can rapidly connect to our Speedgoat target computer

And click on Run on Target Button

This will automatically build a real-time application from your model, download and run it on the Speedgoat target computer. The Simulink instrumentation and logging capabilities remain available for you to experiment in real-time.

To test the new embedded controllers, in addition to having your model handling real-time dynamics, you need it to be able to interface with your brand-new embedded controller through real-time capable I/O and specific protocols.

This is so you can stimulate your controller with different inputs and assess functional behavior by monitoring its behavior.

You can see here that I am using system variants to manage different interfaces. This can be used for both control and HIL testing. This is a good practice in case you like to keep a single model for different development stages and easily switch back and forth between offline and real-time execution simulation.

Implementing the controller interfaces is also very simple: With the Speedgoat I/O Blockset Simulink integration, you can for instance implement communication via CAN or many other protocols with simple drag and drop of blocks or by directly calling in I/O functionality from within Simulink canvas.

No matter whether you are prototyping control strategies or testing controllers against your digital twins, seamless connectivity shouldn't be a hurdle for you.

We are supporting key protocols from all industries including DNP3 and IEC61850.

More than 200 I/O modules are available and ensure that your workflows remain un-interrupted.

Let’s look at connectivity also from another angle, independent of just protocols.

I/O also means access to sensors and actuators. For example, measure quadrature encoder signal for rapid controls prototyping or emulate a resolver for HIL testing

PWM signal generation and capture such as for motor controls is an example that requires high frequencies and ultra-low latency.

Also think about several real-time systems with multi-core CPUs and several FPGAs sharing computational load and operating synchronously.

A key enabler for your seamless development workflow is the stress-free IO configuration.

I/O and hardware of any kind is represented by Simulink blocks.

Placing them in your model and configuring I/O or protocols is done within Simulink.

Speedgoat offers two types of FPGAs: Configurable ones and Simulink-programmable ones

Configurable FPGAs allow you to use high frequency I/O and lots of protocols without FPGA programming knowledge.

There are many code modules represented by Simulink driver blocks.

And you can configure your FGPA on the fly and directly from Simulink.  Speedgoat provides different configuration files so that you can get the best performance out of the IO module for dedicated applications.

FPGAs can also be used to schedule execution of subsystems, the entire real-time application, and as said before individual I/O modules, or even to synchronize multiple target computers.

Programmable FPGAs allow you to outsource both, parts of your algorithm and signal I/O to the FPGA using the HDL Coder workflow from within Simulink.

Speedgoat provides you with ready-to-program I/O and protocol driver blocks. So, it doesn’t necessarily become more complicated,

because you can leverage and start rapidly using hardware proven example models.

Ultimately, you have more flexibility for your advanced use-cases.

Several FPGA IO modules allow using both workflows

So, it’s possible to start simple with the configurable workflow and evolve to the programmable one as you go.

Regardless of the workflow, Speedgoat FPGAs work like any other I/O module and can be reconfigured.

Allow me to share a concrete example about FPGA-enabled data acquisition, namely a success story by our customer TAE Technologies.

TAE Technologies focusses on clean fusion energy. Their fusion reactor named Norman handles hot plasma of around 30 Million degrees Celsius. A challenge is keeping the plasma well-centered in the reactor which requires state of the art feedback control techniques.

Controls require magnetic field data from about 400 sensors to be logged and stored at 2.5 MHZ. 4 data acquisition and two compute systems that communicate using fiber optical, multi-gigabit transceivers and Aurora, allowing for super-fast and deterministic data transfer while meeting best in class IO latency

To develop controls, TAE relies on Speedgoat programmable FPGA IO modules, HDL coder from MathWorks and of course Simulink.

Let’s discuss our main topic : the electrification trend.

We live in a world dependent on electricity and that dependency is only growing. At the same time, greenhouse gases are trapping heat and warming the planet. Ambitious global goals support CO2 emission reductions for core economic sectors including transportation, electricity generation, transmission and distribution, industrial production, and buildings.

At the same time, digitalization, automation and autonomous systems dramatically change the way goods and services are sourced, produced, delivered, and consumed, significantly impacting requirements for the overall electrification infrastructure.

As a result, we see faster than ever adoption of new power electronics, power systems, and power management technologies, not only improving energy efficiency and storage, but also enabling the competitive use of sustainable energy sources.

To assess the impact of real-time systems in the electrification megatrend, we can consider three different growth segments: power electronics and motor control design, power systems analysis and control design; and energy and power management.

All areas driven by market and technology developments. For example, the augmenting adoption of renewables and the use of power electronics for electric transportation is driving the power electronics growth. The decreasing costs of power-rich batteries is also driving growth in the energy and power management segment.

These three growth segments of the electrification megatrend have an impact on many industries and even our daily life.

Power Systems Analysis and Power Systems Control Design cover the electric grid infrastructure: from traditional sources and microgrids, to renewables, energy storage and FACTS or Flexible Alternating Current Transmission System.

Power Systems looks at the analysis and control from a system level.

And it also covers electrical transportation including trains, ships, airplanes and cars as vehicles can also be seen as a type of microgrid.

When we look at a component level, we can consider the segments for Power Electronics and Motor Control Design as well as Energy and Power Management. Here we consider the development of inverters, motors, and batteries for example.

At a component level, electrification also covers consumer products like computers and also medical products like ventilators for respiratory support.

Through this view, which we call the electrification landscape, we can see the granularity of the technology areas across different industries.

Let us continue with real-time testing applications for the power electronics area

Starting with power electronics, we will go through the three market segments to talk about the benefits of real-time testing.

In general, power electronic converters and their associated digital controllers are an interface between a power source and a load. Like controlling an electric motor or generator, charging a battery, or converting three-phase voltage into high-voltage DC for transmission over long distances.

The control of electric motors and generators are a typical application of power electronics. For example, wind turbine generators require power converters to provide grid compliant electricity for the power grid; or electric vehicles require power converters to adjust the DC power from battery packs into 3-phase power for the electric motors providing traction.

Real-time testing addresses a few challenges for electric motor control development:

A key challenge is writing C and HDL code for microprocessors and FPGAs by hand is error prone. Especially when you work in a team and you need to maintain it and upgrade it. As a result, software errors are oftentimes found late in the project only. At this stage, resulting hardware redesigns might become required, competitive time-to-market worsens, and delivery dates need to be rescheduled.

The unified platform of Simulink Real-Time and Speedgoat provide

Automatic code generation from Simulink with readily available sensor interfaces and communication protocols. The protocol stack and signal processing is configured from Simulink. The same Simulink model can be later reused for code certification. And the Modular real-time systems allow very fast iteration, at any time – ideal for R&D

Developing and verifying complex control algorithms can be challenging as R&D stages typically require much datalogging and tuning. This also can cause delays as, instead of focusing in the key innovations of your product, you need to manually setup sensor interfaces like to resolvers or encoders, and even deal with different communication protocol stacks.

Rapid control prototyping provides a power control testing platform with on-the-fly datalogging and tuning for controllers. Rapid control prototyping is ideal to rapidly verify and validate designs. Tune and see real-time results from Simulink or a custom graphical user interface. You can also reduce manual tuning of controls as, thanks for the use of powerful multi-core processors, the automatic tuning of PID loops and even field-oriented control loops, in a controlled manner directly with your hardware.

Validation and verification of your final controller also presents challenges like having to wait for hardware availability. That may be for your embedded control platform or the power converter. And once you start testing, deal with different software platforms for test automation, and getting your code certified to ISO 26262, IEC 62304, or other standards

Finally, it is possible to emulate your plant using hardware in the loop testing. You can not only start testing before your power converter is available, but you can also test your virtual plant in extreme conditions without risking the real motor inverters. Or even using power HIL to test actual motor inverters with virtual motors using power interfaces of a few watts or megawatts.

Real-time testing supports new developments for electrification as an integral part of Model-Based Design.

Let’s see how real-time testing integrates into the development process for a power electronics or electric motor control design application.

For control development the journey typically starts by defining requirements and simulating both plant and controller in a desktop environment.

Then once an initial control design is ready, our customers move into controller prototyping on a real-time target computer.

Before connecting to your hardware prototype and potentially damaging it, you would employ HIL testing using another real-time target machine mimicking the I/O of your prototype running the same plant models that you are designing in the desktop.

For your workflow, there is no impact because Simulink is your central development platforms. So, you have no constraints for your design iterations.

Before connecting your precious hardware to the embedded controller there are two testing tasks that you would want to conduct.

The first one being, HIL testing with the code running on the embedded target. The second one is another controller prototyping step involving a real-time target connected to the hardware prototype to for example fine-tune the controller. At the end of this agile and safety-oriented workflow hardware and embedded controller can be put into service.

Let’s have a look at a demo for an demo for electric motor control including Speedgoat and MathWorks products. We use a Baseline real-time target machine with a Simulink-programmable FPGA, a 3-phase inverter and a brushless DC motor.

With this demo using models with Simulink, Simscape Electrical and the motor control Blockset, you can quickly get started with field-oriented control, parameter estimation, rapid control prototyping and even HIL testing.

In addition, to the challenges already mentioned for controlling electric motors and generators, power converters have other challenges like the use of high switching frequencies, control of modular multi-level converters and having safe testing conditions. Real-time testing with Speedgoat hardware enables control and simulation of wideband gap semiconductors with closed-loop bandwidths of 2 MHz, high-speed analog I/Os and switching dynamics supporting up to 200 kHz switching. Furthermore, MMCs may be controlled using fiber optic links and emulated for HIL testing with tens of modules per target computer. All while staying in the unified test platform with Simulink and Simscape Electrical.

Let’s have a look at a customer example, in this case Supergrid Institute in France, who leveraged a Speedgoat systems to develop a new high voltage, high power DC-DC converter with rapid control prototyping.

This DC-DC converter shall support efficient DC transmission in supergrids, requires switching frequencies of 20kHz, and uses silicon carbide transistors.

In summary, a prototype dual active bridge was built and tested within one year using real-time systems from Speedgoat.

It is compact, can handle powers of 100kW at 1kV voltage and has an efficiency of 98%.

For testing and tuning the controller, a Speedgoat Performance machine served as flexible and powerful control unit.

The controller was deployed to Speedgoat multi-core CPUs and Simulink-programmable FPGAs. By using RCP, they were able to commission their expensive prototype without any issues.

As an example, let us consider the power converter to connect solar panels to the power grid. For example, let’s consider a grid-tied inverter. We start by creating a model of the electrical system in Simulink and Simscape Electrical. The same model used for control design in desktop simulation will be later reused for real-time testing.

The model we are using includes a solar array with more than 600 panels this array is connected to a two-level 3-phase inverter via a DC link.  the inverter is connected to the grid via a relay.

Using rapid control prototyping, you can easily implement controllers at different levels of fidelity and test with your hardware. From MPPT controls at millisecond range to PWM switching at tens or hundreds of kHz.

Once we have controller ready, we can use hardware in the loop. In this case, the same plant model from Simscape Electrical can be deployed to target machine. In this way, we test our controller against a virtual plant using the same interfaces it would have with the actual power converter.

Here we have a typical setup using a microcontroller as an embedded control. We can test it against a virtual grid-tied inverter running in a Speedgoat multi-core CPU or FPGA, depending of the required level of fidelity. If you are interested on switching effects, you would run in the FPGA for switching frequencies up to 200 kHz.

Here we have the Simulink model ready for real-time testing. We also have a scope connected to two PWM signals, the voltage in green and the inverter current in orange at the bottom. The HIL setup with the Speedgoat target computer, the microcontroller and the picoscope is also depicted below.

We had initially designed the controller in desktop simulation. As the controller was implemented in the microcontroller, for real-time testing we replace the controller with Speedgoat driver blocks to interface to the electrical signals.

On the left in green the analog and SPI outputs running, on the right in red the PWM capture running

The green corresponds to the controller sample time, and the red blocks run at the same sample time as the electrical model at 30 kHz

We then deploy to the target with automatic code generation

The HIL setup includes the microcontroller, a picoscope and a Performance real-time target machine from Speedgoat

We start the simulation. First the controller synchronizes the model to the grid. After 10 seconds we connect to the grid so and generating solar power to the grid with the MPPT.  We can see the orange current plot changes as the irradiance changes

As a final topic, let’s discuss the real-time applications for power & energy management.

The challenges for power systems simulations include modelling grids. For example, models with short transmission lines may be difficult to decouple. Also have models with different levels of fidelity and interfacing them.

Real-time testing, we can do both manual and automatic partitioning, concurrent execution in multiple cores and multiple target computers, and partition by level of fidelity.

Other challenges are interfacing the real-time simulation to other components with interfaces like communication protocols, or even power amplifiers for power interface.

Real-time solutions provide off the shelf I/O interfaces, communication protocols as well as DNP3 and IEC61850 compatibility. And there is a wide range of power interfaces that can interface to a Speedgoat target computer.

Depending on the application you can perform phasor simulation and electromagnetic transient simulation.

As an example of, let us take this IEEE European Test Feeder, having the following attributes:

906 three-phase buses (2718 nodes) and 55 loads

Let’s segment the model to allow concurrent execution on multicore CPU.

Segmenting the model allows larger models to be built more efficiently. Time savings are made in both model construction and compilation.

Model segmentation also facilitates data replay through sub-segments and provides a more efficient route to Simulink Real-Time.

Segmenting the model introduces algebraic loops which must be broken. This means there will be small transients introduced into a segmented system response compared to the full model. We can however mitigate this effect.

We can also define how concurrent execution will be setting up the different tasks on the real-time target machine.

We can generate code from the Simulink and Simscape electrical network and build the model to run on the real-time target.

Because of the size of the network, this requires several minutes, using distributed computing for generating code from different referenced models.

At the end, a model file is generated which can be used to deploy to a target.

Now we can deploy the real time application to the real-time target machine, in this case from MATLAB command line. Then we can start the real-time execution. Let’s open the SDI where simulation results are streamed. We can observe the results of the phasor simulation and inspect different voltages and currents.

You can use MATLAB scripts to automatically build the network.

IEEE network data are parsed by MATLAB scripts that generate the Simulink model.

Here you can see a visual demonstration of how such a network can be built. Of course, this also can be automated without any visual representation.

Here is how the IEEE 123 network looks when completed. It is an EMT model.

Now, as we have already mentioned, our goal is to interface real-time simulations to hardware devices like relays, controllers, or inverters. If we are testing a grid controller, you could use industrial protocols such as EtherCAT, Modbus, DNP3, and IEC61850. We can also perform time synchronization with PTP IEEE 1588 or even IRIG using GPS for systems that are not close to each other.

Another way to interface power system simulations is Power HIL. Our Power HIL solutions offer you some great value ads for real-time simulation. Run your systems at different levels of fidelity depending on what matters. Bigger time steps to oversee the system level, or higher resolution to optimize details of the system component controls. I/O modules and connectors are available to tackle shortest round-trip times while keeping ultra-low latency.

A typical setup for Power HIL could look like that. It is comprised of a power amplifier in between a device under test like the 3-phase power part of a solar plant and the HIL simulator. Amplifier and Speedgoat real-time target machine are connected through a high-bandwidth fiber optic connection.

Speedgoat and MathWorks offer you complete solutions for full electric and hybrid vehicle simulation. For instance, using Powertrain and Vehicle Dynamics Blocksets, you can rapidly assess electrified powertrain capabilities

These tools provide you with a great starting point to build great vehicle models with open and well documented reference applications, ranging from multi model Hybrid electric to pure electric vehicle architectures.

The in-built libraries, provide you a quick access to a manifold of components, including electric drives, battery models, electrical machines and electrical motor controls.

These are Simulink-based very fast-running models that you can fully customize and instrument and that are ready for HIL deployment and closed loop simulation with your controls

The same model can be used to support you with different tasks like

Developing and testing energy management supervisory controls

Integrating more detailed battery management systems

Or even design torque vectoring control capabilities

Let’s for instance consider torque vectoring for a full electrical vehicle with two-motor traction system. At any point in time a BMS supervisory control needs to determine the torque or power split between the two available electric motors, which are subject to constraints. 

Constraints include actuator torque and battery current and state of charge.

The energy management controller should also attempt to minimize energy consumption and maintain drivability of the vehicle.

To efficiently design and test torque vectoring controls you’ll need a detailed model for the electric powertrain and vehicle dynamics.

For instance in this demo, we demonstrate the impact that torque vectoring has the maneuvering turning radius, ultimately improving vehicle ride handling

For high fidelity hybrid and electric vehicle modeling you can also use Simscape and Simscape Vehicle Templates. Simscape vehicle templates enabled you to easily explore powertrain model architectures for conventional, hybrid, battery electric, and fuel cell vehicles. The tool enables you to create high-fidelity and multidomain physical custom vehicle models tailored to your electrification tasks:

For instance, you can easily switch between single to dual or even multi-wheel drive architectures

and at any time increase fidelity and complexity of the model,

Perhaps you are working on battery system design, and you would like to analyze battery thermal behavior with an activate colling system.

All Simscape vehicle template configurations are compatible with real-time execution using Speedgoat hardware and Simulink Real-Time™.

Adding hardware connectivity and preparing the model for real-time simulation only takes a few clicks.

With the help of Simulink Real-Time you can perform real-time runs of full vehicle models in seconds and start evaluating and comparing new system designs, size components and measure impact of your decisions with detailed real-time analyses. As well test early prototypes or embedded controllers with high-fidelity vehicle digital twins.

For more complex vehicle simulators, you can rely on distributed solutions integrating multiple Speedgoat target computers, interconnected via shared memory or PTP IEEE-1588, and benefit from the know-how and experience of Speedgoat for standardized and highly modular rack solutions.

In the same way as electric vehicles, electric ships and more electric aircrafts also have onboard power systems. In this demo, we present the hardware in the loop testing of the microgrid architecture of a fully electric ship. We will be implementing an industry reference architecture from the electric ship research and development consortium.

The two-zone onboard grid will be deployed to a Speedgoat target computer with 4 cores at 20 kHz. Such model covers not only electrical components but also gas diesel engines, power electronics, batteries, and electric motors. Actually, the microcontroller under test will be controlling a propulsion motor using field-oriented control.

The propulsion motor model is modelled as permanent magnet synchronous machine with an average converter. The field-oriented controller was first designed in desktop simulation. For desktop simulation, analog interfaces and a quadrature encoder emulation was included. In this way, the interfaces to the embedded controller are actual encoder, PWM and analog signals. The speed control matches the expectations.

We can think of a related Success Story from Leonardo DRS. While our previous demo used CPU simulation, Leonardo DRS used Speedgoat FPGAs to perform microsecond scale HIL testing of their shipboard Power electronics systems.

By using HIL testing, Leonard DRS reduced design iterations, reduced costs and saved time and lab space.

As a final topic, let’s discuss the real-time applications for power & energy management.

Real-time testing is also a powerful tool supporting development of battery management systems, fuel cells, pumped storage and other power & energy managements solutions. Typical challenges include the development of BMS algorithms and fuel cell controls and interfacing with different control protocols like CAN or EtherCAT. Rapid control prototyping can be used to address such challenges with off the shelf I/O connectivity and communication protocols.

Other typical challenges include testing of controls and interfaces to power components like battery cells. Thorough testing of control firmware under realistic conditions is not trivial.

End-to-end testing of battery management system is required to make sure that the system behaves as expected. But you may ask about WHY can be the key.

Well, testing a complete charge and discharge cycle for a typical electric vehicle battery pack takes hours.

Reproducing design issues and fault conditions can be difficult and involves safety considerations.

Does it make sense make sense to do this step of testing for every software revision or design iteration.

You can increase the confidence in your design iteration is by testing your BMS controller against a simulated battery pack.

Here we have a battery model with 16 cell modules each with 6 cells connected in series. Each battery cell block models electrical and thermal behavior.

Charge and discharge of the battery pack is modelled and individual cell voltages as well as temperatures are measured and sent to BMS controller.

Next, let's go ahead and execute our battery model in real time. In the target object we can notice, application status, sample time, and other useful debugging information.

Let's start the execution of application on Target machine. While simulation is progressing, we can observe signals of our interest and tune parameters.

Once it's over, we can check if the target computer was able to execute the model millisecond. By inspecting the target object we can notice here that there was no CPU overload reported during the model execution. An maximum task execution time is well within one millisecond.  

We start with a test model which allows us to simulate battery cells and generate false scenarios. To simulate a fault, we added a switch which allows us to short two cells without physical consequences by just using a toggle switch block.

A controlled current source block is used to simulate the charge or discharge current with the help of a slider block.

To perform diagnostics on cell level we measure voltage between two cell terminals.

The measured cell voltage values are fed into a block that represents the IO991 module which converts these numerical values into electrically isolated voltages, each relating to individual battery cell.

The BMS controller performs diagnostics on cell voltages and generate a false status for overvoltage or undervoltage faults or short circuits between two terminals.

In this case, the BMS controller outputs its status on a digital output port.

We read the status using the digital input port of a block representing an IO133 module to check if the controller logic is performing as per the requirement.

Upon executing this model in real time, we can change the current check for any overvoltage fault any undervoltage fault from the controller. We don't see any fault yet. When we inject a short circuit fault, we can immediately notice the warning light.

Let's look at the results in the simulation data inspector for the whole experiment. We can notice small changes in cell voltages due to change in current. And one of the cell voltages drop significantly as we triggered the fault and see the corresponding change in the fault status.

The battery cell emulator from Speedgoat is designed to accelerate BMS testing. You can source or sink up to 5 amps for each cell; with a maximum output voltage of 6 volts and have up to 192 cells in series. Therefore, when emulating lithium-ion technology, you can emulate a battery pack up of around 800 Vdc at full charge.

You can also include fault insertion and temperature simulation at cell level.  You can use Simulink and Simscape Electrical to model the battery cells and deploy to a Speedgoat real-time system. Each emulated battery cell will have the electrical behavior given by your model dynamics and its interactions with the BMS hardware under test.

For each battery cell you can also have optional modules to emulate temperature sensors for each cell and to test fault conditions like broken wire and short circuit.

Let us conclude with two success stories on power management.

First, let us talk about how Leclanché Energy Storage Solutions is developing the next generation of lithium-ion battery packs for autonomous vehicles. Being unable to properly test and verify new BMS algorithms before operation with real battery packs, Leclanché started using Speedgoat battery cell emulators for hardware in the loop testing of their BMS algorithms. As it is typically required, such tests required also using fault insertion and some a communication protocol like CAN. They were able to thoroughly validate their BMS and state estimation algorithms using Speedgoat real-time solutions; thus reducing test time by around 50% , increasing coverage and finding bugs at an early stage.

The second success story is from Nuvera, a company developing fuel cell technology for commercial vehicles. Their technology uses both fuel cells and lithium-ion batteries, and they use Simulink and Speedgoat hardware for quick iterations in their designs without having to put a real engine at risk. When installed in forklifts, their fuel cell engines should reduce 128 metric tons of CO2 annually

We have covered many topics during this webinar on electrification from system analysis to component level. To conclude, I would like to emphasize our three key takeaways:

First, that you can use Simulink and Speedgoat hardware as a unified platform for developing power electronics converters, electric motors, energy management and power systems controls.

Second, that real-time testing is a key step between desktop simulation and embedded code generation for developing electrical systems.

And third, that you can use hardware-in-the-loop simulation together with test automation to thoroughly test embedded controllers, electrical components, battery management systems or even power system controllers.


The Author

Dr. Carlos Villegas

Dr. Carlos Villegas
Electrification Industry Manager

Related Content

Let us help you to find the right solution for your project


Request a Configuration Proposal

Get a proposal for a real-time target
machine configured to your needs.

Request a proposal

Request a Free Workflow Demo

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

Request a free demo

Have Questions?

Talk to our experts about your project
and application requirements.

Contact us
Follow Speedgoat LinkedIn