| Contents | Index |
Use rapid prototyping to test a design with a minimal hardware plant model. In the process, you can start accumulating test data for use in later stages of production.
Create a Simulink or Stateflow model.
Create block diagrams in Simulink using simple drag-and-drop operations, and then enter values for block parameters and sample times.
Simulate the model in nonreal time.
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 hardware clock, the outputs are calculated in nonreal time as fast as your computer can run. The time to run a simulation can differ significantly from real time.
You may log simulation results for later comparison.
Configure the host and target environment.
Configure the communication method between the host and target.
Configure the host and target environment using:
Prepare the model for real-time execution.
Set the model parameters to values compatible with real-time execution:
Discretized signal
Fixed-step solver
Sample time compatible with the fixed-step solver
Add xPC Target I/O blocks representing your I/O boards. If you have a custom I/O board, you might need to create a custom driver block representing the board.
Configure the build environment.
Configure the build environment, including Simulink Coder options, xPC Target build options, and C compiler options, to create a target application that runs on the target computer.
At this point, you may configure the target application to run using xPC Target Embedded Option.
Connect to external hardware.
Install I/O boards in the target computer and connect the I/O boards to the hardware against which you want to execute the target application.
Reboot the target computer.
Boot the target computer with the xPC Target real-time kernel using:
Build and download the target application.
Build and download the real-time application using:
Execute the target application in real time.
Execute the target application under command from the host computer or by booting the target computer in Standalone mode using the xPC Target Embedded Option.
The xPC Target software uses real-time resources on the target computer hardware. Based on your selected sample rate, the xPC Target software uses interrupts to step the model at the selected rate. With each new interrupt, the target application computes all the block outputs from your model.
Execute using:
Create xPC Target scopes and use them to acquire and display signal data from the target application.
Scopes created by xPC Target 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.
Note xPC Target does not support normal Simulink Scope blocks in external mode. Instead, use xPC Target Scope blocks. |
Visualize signals using:
Tune observable model parameters such as time delays, input and output amplitudes, and input and output frequencies.
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.
![]() | Basic Workflows | Hardware in the Loop | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |