Main Content

Processor-in-the-Loop Simulation

Test generated code on target processor or simulator

A processor-in-the-loop (PIL) simulation cross-compiles generated source code, and then downloads and runs object code on your target hardware. By comparing normal and PIL simulation results, you can test the numerical equivalence of your model and the generated code. During a PIL simulation, you can collect code coverage and execution-time metrics for the generated code.

A PIL simulation requires a connectivity configuration.

Apps

SIL/PIL ManagerVerify generated code

Namespaces

targetManage target hardware and build tool information

Classes

expand all

target.AddOnDescribe add-on properties for target type (Since R2020b)
target.APIDescribe API details (Since R2020b)
target.APIImplementationDescribe API implementation details (Since R2020b)
target.BoardProvide hardware board details (Since R2020b)
target.BuildDependenciesDescribe C and C++ build dependencies to associate with target hardware (Since R2020b)
target.CommunicationChannelDescribe communication channel properties (Since R2020b)
target.CommunicationInterfaceDescribe data I/O details for target hardware (Since R2020b)
target.CommunicationProtocolStackDescribe communication protocol parameters (Since R2020b)
target.ConnectionBase class for target connection properties (Since R2020b)
target.ConnectionPropertiesDescribe target-specific connection properties (Since R2020b)
target.MainFunctionProvide C and C++ dependencies for main function of target hardware application (Since R2020b)
target.PILProtocolDescribe PIL protocol implementation for target hardware (Since R2020b)
target.PortDescribe connection via target hardware port (Since R2021a)
target.PortConnectionDescribe target connection port (Since R2020b)
target.ProcessorProvide target processor information
target.RS232ChannelDescribe serial communication channel (Since R2020b)
target.TargetConnectionProvide details about connecting MATLAB computer to target hardware (Since R2020b)
target.TCPChannelDescribe TCP communication properties (Since R2020b)
target.ToolsDescribe properties of tools for target hardware (Since R2020b)
target.UDPChannelDescribe UDP communication (Since R2020b)
target.ApplicationStatusDescribe status of application on target hardware (Since R2021a)
target.Breakpoint Provide breakpoint details for debugger (Since R2021a)
target.DebugExecutionToolProvide MATLAB service interface for debugger to manage processes on target hardware (Since R2023a)
target.DebugIOToolDebug byte stream I/O tool service interface (Since R2021a)
target.ExecutionServiceDescribe implementation of execution service for target application (Since R2021a)
target.ExecutionToolMATLAB service interface for tool that manages application execution on target hardware (Since R2021a)
target.MATLABDependenciesDescribe MATLAB class and function dependencies (Since R2021a)
target.ApplicationExecutionToolCapture system command information to run application from MATLAB computer (Since R2020b)
target.CommandCapture system command for execution on MATLAB computer (Since R2020b)
target.HostProcessExecutionToolCapture system command information to run target application from MATLAB computer (Since R2020b)
target.SystemCommandExecutionToolCapture system command information to run target application from MATLAB computer (Since R2020b)
target.FunctionProvide function signature information (Since R2020b)
target.TimerProvide timer details for processor (Since R2020b)

Objects

expand all

rtw.connectivity.ComponentArgsProvide parameters for each target connectivity component
rtw.connectivity.ConfigDefine connectivity implementation that comprises builder, launcher, and communicator components
rtw.connectivity.ConfigRegistryRegister connectivity configuration
rtw.connectivity.MakefileBuilderConfigure toolchain-based build process
rtw.connectivity.LauncherControl downloading, starting, and resetting of a target application
rtw.connectivity.RtIOStreamHostCommunicatorConfigure development computer communications with target processor
rtw.pil.RtIOStreamApplicationFrameworkConfigure target-side communications

Functions

expand all

rtIOStreamCloseShut down communications channel
rtIOStreamOpenInitialize communications channel
rtIOStreamRecvReceive data through communication channel
rtIOStreamSendSend data through communication channel
rtiostreamtestTest custom rtiostream interface implementation
rtiostream_wrapperTest rtiostream shared library functions in MATLAB
piltestVerify custom target connectivity configuration for Simulink PIL simulation

Topics

Troubleshooting

Debug Generated Code During SIL or PIL Simulation

Use a debugger to understand the behavior of generated code.

View SIL and PIL Files in Code Generation Report

Produce a code generation report and static code metrics that cover SIL and PIL files.

Verification of Code Generation Assumptions

The SIL or PIL simulation checks code generation assumptions.

Featured Examples