S01E04: Reduce your Simulink simulation time with “Reference Model”, by Marouane Benaziz

Are you a Simulink user, and do you find that your simulation times are too long? Have you thought about changing part of your model to a referenced model? This is what we did for one of our clients for which we are developing a validation platform for hybrid vehicle control algorithms. The validation of this type of system is costly in terms of computation time because it requires the simulation of several scenarios for different vehicle configurations, which can last several hours or even several days. Here is a solution!

What is a referenced model?

“Model reference” is a Simulink block making it possible to reference one model in another. In our case, we reference the model containing the control algorithm (“Control” block below) in a so-called “parent” model which is the simulation platform.×316.png

When the referenced model is used in “Accelerator” mode, it is compiled once and then reused for all subsequent simulations. As long as the “Control” block is not modified, there is no need to recompile it.

How is a subsystem converted into a referenced model?

The conversion of the subsystem into a referenced model requires several steps to prepare the model so that it respects certain rules. In particular we have:

  • defined the input and output buses of the referenced model,
  • resolved signals passing directly through the “Control” block using “Signal Conversion” blocks,
  • managed the behaviour of the “trigger ports” present in the referenced model,
  • solved the algebraic loops of the platform, following the transition of the “Control” block to the atomic model.

The rules to follow for the conversion are defined in the following page: Convert Subsystems to Referenced Models – MATLAB & Simulink (

Une fois que le modèle référencé est prêt, nous avons écrit un script qui permet de compiler le modèle avec mingw64, puis de compresser les fichiers dans une archive « .zip ». Cela permet de stocker et d’échanger proprement les fichiers du modèle référencé compilé.

Once the referenced model was ready, we wrote a script that made it possible to compile the model with mingw64, and then compress the files into a “.zip” archive. This enables the compiled referenced model files to be stored and shared with other users.

Finally, we launched validation simulations in order to guarantee the strict equality of the simulation results before and after the conversion and to evaluate the simulation time saving obtained.

What are the benefits obtained?

The results we obtained with the “Reference Model” are:

  • the simulation time is divided by 3: a simulation sometimes lasts several hours, this time saving is therefore very significant,
  • the time lost in compiling the “Control” block is largely compensated by the time saved during the simulations,
  • the platform is lighter to handle and opens more quickly: the referenced model is only loaded when necessary,
  • this technique allows a modular approach: it is easy to change control algorithm versions by simply modifying the reference of the “Model Reference” block,
  • the possibility of protecting the control algorithm with Simulink Coder is relevant: it avoids revealing its intellectual property.

We use the referenced model technique on other applications and in particular for the validation of control algorithms for ADAS systems.

For more information on the technical details and subtleties of referenced models, you can contact us and consult the Mathworks page dedicated to this subject, Model References – MATLAB & Simulink (

Consult the full saga

Share this post: