• Control Systems
January 2, 2024

Model Based Design for simplicity, convenience and efficiency

What is MBD? Is MBD too complex for my problem? Will MBD take too much time and slow down our development process? How does Model-based Testing (MBT) accelerate the testing process? Is it a good idea to consider MBT or simulations test results accurate? Do I need MiL, SiL or HiL testing for my system? This post will cover most of the questions regarding MBD and MBT and its feasibility with some use cases.

Let us start by talking about Model-based design and why it is a simpler and a faster way of development compared with logic-based approaches.

One of the most common misperceptions of MBD is that it is too complex and time consuming to implement and requires a specialist to maintain. On the contrary, the time to market is shown to reduce if one would choose the MBD approach over the classical way of working. Deciding to develop your product utilizing the MBD approach gives your company much more than just optimal control.

The primary goal of MBD is to reduce development time and hardware costs and improve the quality of deliveries. Another great advantage of using the MBD approach is to reduce hardware-dependencies as much as you can. By developing the application software of your system in MBD, you can more easily migrate your application to an entirely new hardware by switching the code-generation target. Another, maybe a bit more unexpected advantage of MBD is that it provides a visual representation of the system which can be easily read and understood, unlike a code-based system. This allows quick onboarding of new employees to understand and interact with your system. This further gets highlighted when working with system and architecture design. This model can also be used to market the product/system with ease, with the help of animated visualizations and simulations of the actual product that shows the working of the product/system in real-time, in the simplest way possible.

Simulation enables specification discrepancies and modeling errors to be found immediately, rather than later in the design cycle. To optimize the overall software development process, automatic code generation can be added to reduce any manual implementation steps and to help further reduce the overall time to market. The MBD approach allows a designer to move from model creation to simulation using model-in-loop (MiL), followed by code generation, software-in-loop (SiL) and hardware-in-loop (HiL). All steps are made in a controlled fashion that allows changes in system settings without a complete redesign of the system or risk of spoiling any hardware.


With the MBD approach, system-level models are used to evaluate design concepts before building and testing physical hardware. There are embedded coding tools available that generate C/C++ code from control system models to enable direct deployment of control algorithms on embedded control platforms. These tools enable a model-based design process where control algorithms can be designed and fully tested on a simulation platform before the final hardware test. The key to building a successful MBD platform is partitioning the system model and embedded software code. Once the MBD platform is tested using a known algorithm and system, new algorithms can be developed and safely tested on the simulation platform at the extreme limits of system operation. This can be done at different levels by performing model-in-the-loop and hardware-in-the-loop tests depending on the application.

Everything becomes more clear with an example. Let’s say you’re planning to implement a new function.

In the classic way of development, the design cycle starts with an idea or requirements for the function, and the R&D Engineers start developing the system after some analysis and implementing its code. They need to develop a full first version of the function before they go to the next step, which is testing it on hardware. Once they’ve done that, data analysis must be performed to decide if the system behavior was as expected. If not, according to the outcome from the tests, changes must be made to the implemented code. This process also includes time for debugging and waiting for tests to run, which can take several hours depending on the domain and application.

Now, consider the same process using MBD. In this approach, the developers can continuously test and analyze their function during the time they are developing it. This way, the developers can swiftly find errors at an early stage, such as in a subfunction, not having to wait on slow dynamics from the real world. In some industries, such as the HVAC industry, the dynamics of system is slow and one test can take hours, while simulating that is done within seconds. You also have a more controlled environment, making the debugging incredibly much easier than in reality.  And as electrification is on the rise in the present time, in automotive industry, it is very important to have a fault-proof motor control algorithm before testing it with an expensive motor or it can cost a huge amount for replacing damaged motors. The developers can utilize all signals that you may not be able to measure in reality using a sensor. Once they’ve passed all their tests in simulation, you can verify that it works on hardware as well, reducing time spent on hardware testing and data analyzation significantly. Before testing the system with actual hardware, MBD also allows us to run real-time tests that save the risk of damaging the hardware if the system does not react as planned. As mentioned before, in the automotive industry, it is very common to test extreme conditions for an electric motor controller with real-time testing environment rather than testing on the actual motor.


Model-based testing (MBT) is a testing method where the run-time behavior of ’software under test’ is checked against predictions made by a model (in simulations). Model-based testing describes how a system behaves in response to an action (determined by a model). Supply action, and check if the system responds as expected. A model is an abstraction of the real-world function, in some cases, it can be considered as a digital twin of a system depending on the complexity of the model. MBT allows the software developers and testers to only focus on the models that need to be created around system requirements/specifications.

Hardware-In-the-Loop (HiL) testing helps you test your control system/algorithm on microcontroller units (MCUs) or Electronic Control Units (ECUs) that control the actual hardware (plant). This has become a part of the embedded software verification and validation process. ECU software is tested by running the controller with a real-time simulation of the entire system that is designed to be controlled, with actual signals exchanged between the ECU and the simulator. This technology is extensively used in the aerospace, automotive and rail transportation industries.

The benefits of using HiL testing are manifold:

  • the ECU can be tested even before the actual hardware that it will control (for example, an engine, motor or transmission) is built or available.
  • the risk of damaging the plant is eliminated thus reducing cost and risk.
  • fault conditions can easily be created.
  • the ECU can be tested with the plant running in off-design conditions.

HiL testing has been very successfully used for testing mechanical systems which require system models to run at sample rates of around 1 KHz, significantly reducing ECU development and testing time. However, HIL systems for testing controllers for electric drives, which are being increasingly used in automobiles and aircraft, need to simulate much faster dynamics. Simulating these faster dynamics requires high-performance hardware, software and development of such models. For ensuring the accuracy of the test simulation of an electric drive, high-fidelity motor models are required. Basic models are only sufficient for testing control performance in nominal ranges but for comprehensive testing of safety-critical transportation applications, requires simulating complex nonlinear effects of the system.

Using MBD has been proven to reduce development time and cost for most of the projects. With the increase in MBD platforms, cross-platform compatibility has been increasing as well. MBD is used in multiple industries and fields like automation, electrical, UAVs, fluid dynamics, mechanical and much more.