CallWhatsApp

What Is Model-Based Development? Model Based Design in Plain Words

10 min read · · Updated

What Is Model-Based Development? Model Based Design in Plain Words
In this guide · 8 parts
  1. What is model-based development?
  2. The V-cycle: how MBD fits into automotive development
  3. Simulink, Stateflow and code generation
  4. An automotive example: a radiator fan controller
  5. MBD software you will hear about
  6. Where MBD is used, and why companies use it
  7. How to start learning MBD
  8. Questions technicians ask

Model-based development (MBD) uses models to design and test a system. In automotive work, engineers commonly build the controller as a model in MATLAB and Simulink, test it in simulation, and then generate the C code for the ECU from that model; Simulink and automatic code generation are common options, not requirements. "Model-based design" is the same idea: MathWorks uses that name, and most engineers use the two terms interchangeably. The main gain is that you can find logic mistakes earlier, within the cases covered by the model and tests.

What is model-based development?

In traditional embedded work, an engineer reads the requirements and writes C code by hand. Hand-written software can also be tested on a PC before hardware is available. MBD adds an executable model that can be tested during design, while the requirements are still being worked out.

In MBD, the model is the main thing you work on. You build two kinds of model:

  • The controller model: the logic that will become the ECU software. For example, "if coolant temperature is above a limit, switch the fan on."
  • The plant model: a simulation of the thing being controlled, such as the engine, the battery or the vehicle. "Plant" is the control engineers' word for it.

You connect the two, run the simulation, and check whether the controller does what the requirement says. When it does, a code generator can turn the controller model into C code. The same model is used for design, testing and code, which is why people say "design first, code later".

Model-based development: requirements, model, simulation, code generation and testing linked around one model

Model-based design vs model-based development

For most purposes these mean the same thing. "Model-Based Design" is the name MathWorks uses for its Simulink workflow, so you will see it in MATLAB documentation and job adverts. "Model-based development" is the more general term used by automotive companies and in standards. One related term is different: MBSE (model-based systems engineering) uses languages such as SysML to describe the architecture of a whole system, its parts and how they connect, rather than the control logic inside one ECU.

The V-cycle: how MBD fits into automotive development

Automotive software is usually developed along the V-model, or V-cycle. Picture the letter V.

  • Left side, going down: vehicle requirements → system design → software design → implementation. You go from "what the car must do" to the detail of each function.
  • Bottom: the code itself. In MBD this is often generated from the model.
  • Right side, going up: unit testing → software integration → system testing → vehicle validation. Each test level checks the matching level on the left.

MBD makes the left side testable. Because the design is a model you can run, you can test it as you build it, instead of waiting for the right side of the V.

MBD workflow from requirement capture through modelling, MIL, SIL, PIL and HIL testing to code deployment on the ECU

MIL, SIL, PIL and HIL in plain words

These four "in-the-loop" tests are the heart of MBD. Each one replaces a bit more of the simulation with the real thing.

TestWhat runsWhat it checks
MIL (model-in-the-loop)Controller model and plant model, both in Simulink on a PCThe logic does what the requirement says, for the tested cases
SIL (software-in-the-loop)Generated C code, compiled and run on the PC, against the plant modelThe code behaves the same as the model
PIL (processor-in-the-loop)Generated code running on the real target microcontrollerThe code works on the real chip, with its timing and number formats
HIL (hardware-in-the-loop)The real ECU, connected to a real-time simulator that pretends to be the vehicleThe finished ECU works with real wiring, signals and faults

A common step in SIL is the back-to-back test: feed the same inputs to the model and to the generated code and check that the outputs match. In HIL, the simulator produces the sensor signals the ECU expects and reads its outputs, so you can test dangerous cases, such as a sensor wire breaking at high speed, on a bench. Companies such as dSPACE and Vector make widely used HIL and network test tools.

MATLAB is the base program. Simulink runs inside it and is where you build models from blocks joined by signal lines: gains, sums, integrators, lookup tables, switches. If you have seen a block diagram in a control systems textbook, a Simulink model looks much like it.

Stateflow adds state machines. A state machine suits a controller that has modes, such as Off, Starting, Running and Fault, and rules for moving between them. Many ECU functions mix both: Simulink blocks for the maths, Stateflow for the modes.

Code generation turns the model into C code. Embedded Coder from MathWorks and TargetLink from dSPACE are two tools you will meet often in automotive work. Teams usually check the generated code against MISRA C, a set of C coding rules for safety-related systems, with static analysis tools such as Polyspace.

An automotive example: a radiator fan controller

Here is a small function that shows the whole flow. The numbers are only for the example.

  1. Requirement: switch the radiator fan on when coolant temperature goes above 98 °C, and off when it falls below 92 °C. Switch it on at once if the coolant sensor fails.
  2. Controller model: a Stateflow chart with two states, FanOff and FanOn. The gap between 98 and 92 is called hysteresis. It stops the fan clicking on and off every second around one temperature.
  3. Plant model: a simple Simulink model of the engine heating the coolant and the radiator cooling it, faster when the fan runs.
  4. MIL: run a test where the engine works hard, then idles. Check the fan switches at the right temperatures. Then simulate a broken sensor and check the fan comes on.
  5. SIL and PIL: generate the code, run the same tests on the PC and then on the microcontroller, and compare results with the model.
  6. HIL: flash the ECU, connect it to the simulator, and test with real signals, including a sensor short to ground.

Real ECU functions such as idle speed control, battery charge limits or brake control are much bigger, but they follow the same steps.

MBD software you will hear about

Common model-based development tools: Simulink, Stateflow, Embedded Coder, TargetLink, Polyspace, CANoe and dSPACE HIL

  • Simulink: modelling and simulation.
  • Stateflow: state machines and mode logic.
  • Embedded Coder: production C code from Simulink models.
  • TargetLink: dSPACE's production code generator.
  • Polyspace: static analysis of the code, including MISRA C checks.
  • Vector CANoe and CANalyzer: testing the ECU's CAN and other network communication.
  • dSPACE HIL systems: real-time simulators for hardware-in-the-loop tests.

For a longer comparison, see the main model-based development tools.

Where MBD is used, and why companies use it

Battery Lab result: LFP and NMC charge curves compared

Try this free

Battery Lab

Compare NMC and LFP cells in your browser and inspect the result.

Try free

Carmakers and their suppliers use MBD for engine control, battery management systems in EVs, gearbox control, ABS and braking, power steering and driver assistance functions. It is also common in aerospace, rail and robotics.

  • Earlier testing: logic mistakes can be found in MIL and SIL on a PC, before the target hardware is ready, within the cases the tests cover.
  • Traceability: each requirement can be linked to a part of the model and to the tests that check it. Functional safety work under ISO 26262 asks for this kind of traceability.
  • Reuse: a tested model can be reused across vehicle variants by changing its calibration values.
  • A shared language: a block diagram is often easier for software, electrical and mechanical engineers to discuss than long C files.

MBD has costs too: tool licences are expensive, and models need the same discipline as code, with reviews, version control and modelling rules. A model is only as good as the cases it was tested with. Read more in MBD vs traditional coding.

How to start learning MBD

  1. MATLAB basics: variables, arrays, scripts and plotting.
  2. Control basics: what feedback is, and how a PID controller works. You do not need heavy maths to begin.
  3. Simulink: build small models: a car speeding up against drag, a tank filling with water, a motor speed loop.
  4. Stateflow: model something with modes, such as a turn indicator or the fan controller above.
  5. Code generation and testing: generate code from a small model and run a SIL back-to-back test.
  6. Embedded C: learn enough C to read and debug what the generator produces.

Our step-by-step guide on how to begin model-based design using Simulink takes you through your first models, and the Simulink introduction covers the basics of the tool. Reynlab's Model-Based Development course lasts 2 months and costs ₹94,400. See the Model-Based Development course page for details.

Questions technicians ask

What is model based development?

Model-based development is a way of building control software by creating a model of the controller and the system it controls, testing that model in simulation, and often generating the code from it. It is widely used for automotive ECUs, where it lets engineers find logic mistakes earlier, within the cases the model and tests cover.

Is model-based design the same as model-based development?

Yes, in practice. Model-Based Design is the name MathWorks uses for its MATLAB and Simulink workflow, and model-based development is the broader industry term. Both mean designing and testing with executable models. MBSE is different: it describes system architecture rather than control logic.

What is MBD software?

MBD software is the set of tools used for modelling, simulation, code generation and testing. Common ones in automotive work are MATLAB, Simulink and Stateflow for models, Embedded Coder or TargetLink for code, Polyspace for code checks, and dSPACE or Vector tools for HIL and network testing.

Do I need MATLAB for MBD?

Not always, but MATLAB and Simulink are widely used in automotive MBD and often appear in job adverts. Simulink runs on MATLAB. Other tools, such as SCADE, are used by some teams.

What is the difference between MIL, SIL and HIL?

MIL tests the model on a PC, SIL tests the generated code on a PC, and HIL tests the real ECU connected to a real-time vehicle simulator. Each step brings the test closer to the real car. PIL sits between SIL and HIL and runs the code on the target chip.

Can engineering students learn MBD?

Yes. Students from mechanical, electrical, electronics and instrumentation branches can all learn it. You need MATLAB basics, a little control theory and some C. Build small models yourself and test them against simple requirements.