Simulink Compiler Workflow Overview
Simulink®
Compiler™ lets you share simulations as standalone applications. Simulink
Compiler extends the capabilities of MATLAB®
Compiler to allow Simulink
sim
command and associated Simulink functions in the deployed script or application. For more information about
MATLAB
Compiler, see MATLAB
Compiler documentation.
The application users who use these deployed applications are not expected to interact with the Simulink model directly. The Simulink user provides the application user with a tool that allows them to explore task-specific scenarios without looking at the underlying model that represents the dynamic system. The application users can change model parameters and simulation inputs, and record and analyze simulation outputs.
To develop an application, the Simulink user:
Prepares the Simulink model to be compatible with Simulink Compiler, such as checking that the model simulates correctly in rapid accelerator mode. For limitations of rapid accelerator mode and Simulink Compiler, see Simulink Compiler Limitations.
Note
For information on toolboxes supported by Simulink Compiler, see Toolboxes Supported by Simulink Compiler.
Creates an application that simulates the model using the
sim
command, in a script or an App designer app.Configures the script or the app for deployment by using
simulink.compiler.configureForDeployment
function. Thesimulink.compiler.configureForDeployment
function adapts the model to run in Rapid Accelerator mode.Creates a standalone application using the
mcc
command or thedeploytool
app.Shares the standalone application.
To use the application, the application user:
Installs MATLAB Runtime environment for the deployed application.
Uses the deployed application.
The following Simulink functions and classes are deployable:
Functions:
Classes:
Simulation Pacing in Rapid Accelerator Mode
Using simulation pacing in rapid accelerator mode allows you to use simulation pacing with the deployed standalone executables. You can slow down the simulation of your deployed executable to better visualize simulations and understand system behavior.
To use simulation pacing in rapid accelerator mode, or in the deployed executable, you
can use the parameter EnablePacing
. To use pacing for a model with the
name modelName
, use
this:
% Enable pacing set_param('modelName','EnablePacing','on') %Set pacing rate set_param('modelName','PacingRate',2)
Simulation pacing is turned off by default. The EnablePacing
and the
PacingRate
parameters are saved with the model. Use of neither
parameters dirties the model. PacingRate
must be a non-zero positive
integer.
If the model contains a Simulation Pacer block (Aerospace Blockset™), Simulink gives a warning during simulation in the Diagnostic Viewer or the MATLAB prompt. Simulation pacing takes place according to the
EnablePacing
and PacingRate
parameters
configuration. The simulation pace set on Simulation Pacer block is
ignored.
Limitations
Simulation pacing is supported in command-line simulations and deployed mode only. In rapid accelerator mode, simulation pacing is not supported in the menu options in the Simulink Editor.
See Also
simulink.compiler.configureForDeployment
| simulink.compiler.genapp
| Simulink.SimulationInput
| mcc
| deploytool
| sim