Tech, ExplainedCloud platforms and developer tools
Product

Model-based design

The braking control drawn, simulated, then turned into code.

BEFORE ITAFTER ITModel-based designMathWorksPARTNumericalcomputing environment+COVERSBlock diagramsSimulationCode generationRequirement linksSimulation software (CAE)↗ DIGITAL MANUFACTURINGprovidesphysicalmodelsEngine calibration tools↗ AUTOMOTIVE TECHNOLOGYprovidestest datareceivesgeneratedcodeMicrocontroller (MCU)↗ ANALOG AND EMBEDDED CHIPSsends codefor checksStatic analysis forsafety-critical coderuns thecode onReal-time operatingsystem (RTOS)BEFORE ITAFTER ITModel-based designMathWorksPARTNumericalcomputing environment+COVERSBlock diagramsSimulationCodegenerationRequirementlinksSimulationsoftware (CAE)↗ DIGITALMANUFACTURINGprovidesphysicalmodelsEnginecalibration tools↗ AUTOMOTIVETECHNOLOGYprovidestest datareceivesgeneratedcodeMicrocontroller(MCU)↗ ANALOG ANDEMBEDDED CHIPSsends codefor checksStatic analysisforsafety-criticalcoderuns thecode onReal-timeoperatingsystem (RTOS)BEFORE ITSimulation software (CAE)↗ DIGITAL MANUFACTURING↓ provides physical modelsEngine calibration tools↗ AUTOMOTIVE TECHNOLOGY↓ provides test dataModel-based designMathWorksNumerical computing environment+Block diagramsSimulationCode generationRequirement linksAFTER IT↓ receives generated codeMicrocontroller (MCU)↗ ANALOG AND EMBEDDED CHIPS↓ sends code for checksStatic analysis for safety-critical code↓ runs the code onReal-time operating system (RTOS)
In model-based design, a Hosur engineer draws the battery cooling control as blocks, simulates 200 rides against a model of the battery, and has the tool generate the code for the microcontroller.
opens a page inside this one a page in the same scene a page in another scene a concept page a label only, with no page

Model-based design is a way of building the control software for a machine by drawing it as a model, testing the model in simulation, and having a tool turn the model into the code that runs on the machine's controller. A controller is the small computer that operates one part of a machine, such as a car's brakes or an aircraft's wing flaps. Model-based design is used for cars, aircraft, trains, power grids and industrial machines.

A model here is a diagram of connected blocks. Each block does one thing: it reads a sensor, adds two numbers, compares a value with a limit, or switches an output on. Lines between the blocks carry values from one block to the next. The model has two halves. The controller model is the logic that will become software. The plant model imitates the machine being controlled, such as a battery that heats up. In control engineering, the machine being controlled is called the plant.

Take, for example, an engineer at an electric two-wheeler maker in Hosur. She is building the control for the battery's cooling pump. The rule is this: if the battery's temperature rises above 40 °C, run the pump, faster as the temperature rises, but never so fast that the pump itself drains the battery. She draws this rule as blocks. Then she adds a plant model of the battery pack, which heats up as the scooter draws current.

Next, she simulates. She runs a 30-minute ride in heavy traffic on a 42 °C afternoon. The simulation takes a few seconds. The graph shows that the battery reaches 47 °C, above its safe limit of 45 °C. She changes one setting so that the pump starts sooner, and runs the ride again. Now the battery stays below 44 °C. She repeats this for 200 different rides: hills, rain, a full load, a nearly empty battery.

When the model behaves correctly, the tool generates code in the C language from it. The code runs every 100 milliseconds on the microcontroller inside the battery management system. The same 200 rides are then run against the generated code on a computer. This checks that the code behaves exactly like the model.

Why work this way? Mistakes are found in a simulation, not on a test track. And each requirement can be linked to the block that meets it and the test that proves it. This record is what a safety assessor asks for, as the page on safety certification explains. The generated code still passes through static analysis, and it runs under the device's real-time operating system.

The modelling tool sits on top of a numerical computing environment, where engineers write the maths and analyse the test data. The physics inside a plant model can come from simulation software (CAE).

Tech, Explained is a part of ingrid.fyi. Every page explains one piece of technology in plain words.