Model / Software in-the-Loop Example Code
This example code was developed using MATLAB R2022b, and all information provided below pertains specifically to executing the project with this version. While the project is generally compatible with both newer and older MATLAB releases, users should consult the MathWorks website for detailed hardware requirements applicable to other versions.
Overview
In software-defined vehicles (SDVs), the complexity of embedded software demands robust development methodologies. Model-Based Design (MBD) offers a structured approach where control algorithms and system logic are developed using high-level graphical models. These models enable early simulation, formal verification, and automatic code generation for embedded targets. Engineers can then transition to hardware-in-the-loop (HIL) testing and continuous integration, ensuring that algorithms meet functional safety and performance requirements before deployment in production. This approach accelerates development cycles, improves traceability, and reduces integration risks in multi-domain automotive systems.
This demo project showcases the use of a model-based framework for the design and functional validation of an ADAS Cruise Control software application.
System Requirements
Note: These requirements come from MathWorks for running MATLAB R2022b.
Hardware Component | Details | Notes |
---|---|---|
Operating system | - Windows 11 - Windows 10 (version 20H2 or higher) - Windows Server 2019 or 2022 | |
Processor | - Minimum: Any Intel or AMD x86-64 processor - Recommended: Intel or AMD x86-64 processor with four logical cores and AVX2 instruction set support | Future MATLAB releases will require AVX2 support |
RAM | - Minimum: 4 GB - Recommended: 8 GB or more - For Polyspace: 4 GB per core is recommended | |
Hard disk | - 4.0 GB for MATLAB only - 5–8 GB for a typical installation - 31.5 GB for full installation (all products) | SSD strongly recommended for performance |
Graphics card | - No specific GPU required - Recommended: Hardware-accelerated graphics card supporting OpenGL 3.3 with 1 GB GPU memory - For GPU acceleration (e.g., with Parallel Computing Toolbox): - Requires a GPU with supported compute capability (typically NVIDIA) |
Software Components | Goal |
---|---|
- MATLAB R2022b - Simulink | Project Execution |
- MATLAB R2022b - Simulink - MATLAB Coder - Simulink Coder - VeriStand Model Generation Add-on | Project Execution and Model Compilation for NI Real-time Targets |
Software Setup
Install MATLAB Simulink
Before installing MATLAB, verify the compatibility between MATLAB Simulink and NI VeriStand. This step ensures a seamless transition from the model-based simulation environment to the hardware-in-the-loop (HIL) simulation setup. Once compatibility is confirmed, download MATLAB from the MathWorks website and begin the installation process.
During installation, ensure that all required components are selected, including MATLAB Coder and Simulink Coder. These components are critical for compiling Simulink models to run on NI Real-Time Targets.
Setup the Compilation Environment
To compile Simulink models and execute them on NI Real-Time Targets, you need to set up the appropriate compilation environment.
Refer to the “Setting up the Compiler for the NI HIL Real-time Platform” section in the SDV HIL Reference Design Guide for detailed instructions. This guide will help you install and configure the VeriStand Model Generation Add-on for MATLAB. For additional information, visit the VeriStand Model Generation Support for Simulink.
The VeriStand Model Generation Add-on can be downloaded for free directly from the MATLAB Add-on Explorer.