Use rapid control prototyping to test a design with a minimal physical system plant model.
Create a Simulink® or Stateflow® model.
Create block diagrams in Simulink by dragging blocks to your model. If possible, set model and block parameters to use a fixed-step solver and specify a sample time compatible with the real-time requirements of your model.
Simulate the model as a non-real-time application.
Simulink uses a computed time vector to step the model. After computing the outputs for a given time value, Simulink immediately repeats the computation for the next time value until it reaches the stop time.
Because the computed time vector is not connected to a physical clock, the outputs are calculated as fast as your computer can run. The elapsed time of the simulation can differ significantly from the elapsed time of the real system.
You can log simulation results for later comparison.
Configure the development and target computers.
Configure the communication method between the development and target computers.
Configure the development and target computers using:
Prepare the model for real-time execution.
Set the model Configuration Parameters to values compatible with real-time execution:
In the Code Generation pane,
set System target file to
In the Solver pane:
Set Type to
Set Fixed-step size to a step size compatible with the real-time requirements of your model.
Add Simulink Real-Time™ I/O blocks representing your I/O boards. If you have a custom I/O board, create a custom driver block representing the board. See Add I/O Blocks to Simulink Model.
To visualize the simulation results, add real-time scope blocks. See Add Simulink Real-Time Scope Block.
Configure the build environment.
To create a real-time application that runs on the target computer, configure the build environment. The environment includes Simulink Coder™ options, Simulink Real-Time build options, and C compiler options.
Connect to hardware under test.
Install I/O modules in the target computer and connect the modules to the hardware under test.
Restart the target computer.
Restart the target computer with the Simulink Real-Time real-time kernel using:
Target computer restart button.
Build and download the real-time application.
Build and download the real-time application using:
Execute the real-time application.
Execute the real-time application under command from the development computer or by restarting the target computer in standalone mode.
The Simulink Real-Time software uses real-time resources on the target computer. Based on your sample rate, the Simulink Real-Time software uses interrupts to step the model at the sample rate. With each new interrupt, the real-time application computes the block outputs from your model.
Create real-time scopes and Simulink Real-Time Explorer instruments. Use them to acquire and display signal data from the real-time application.
Scopes created by real-time scope blocks acquire data according to Simulink sample time rules. Scopes can gather data at the top level or in an enabled or triggered subsystem. Scopes created dynamically (from the MATLAB® Command Window or the API) sample at the base rate, irrespective of the sample time of their signals.
To create instrument panels, use Simulink Real-Time Explorer to create instrument panels. You can drag graphical instruments to the instrument panels, and drag signals to the instruments to display signal data.
Visualize signals using:
Tune observable model parameters such as time delays, input and output amplitudes, and input and output frequencies.
Note: Simulink Real-Time does not support parameters of multiword data types.
Tune parameters using:
Prepare regression and stress tests.
Write MATLAB scripts that perform parameter sweep and extreme-value testing in a repeatable manner, accumulating results as known good data for later use.