Processor-in-the-Loop Simulation - MATLAB & Simulink (original) (raw)

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 Manager Verify generated code

Namespaces

target Manage target hardware and build tool information

Classes

expand all

target.AddOn Describe add-on properties for target type (Since R2020b)
target.API Describe API details (Since R2020b)
target.APIImplementation Describe API implementation details (Since R2020b)
target.Board Provide hardware board details (Since R2020b)
target.BuildDependencies Describe C and C++ build dependencies to associate with target hardware (Since R2020b)
target.CommunicationChannel Describe communication channel properties (Since R2020b)
target.CommunicationInterface Describe data I/O details for target hardware (Since R2020b)
target.CommunicationProtocolStack Describe communication protocol parameters (Since R2020b)
target.Connection Base class for target connection properties (Since R2020b)
target.ConnectionProperties Describe target-specific connection properties (Since R2020b)
target.MainFunction Provide C and C++ dependencies for main function of target hardware application (Since R2020b)
target.PILProtocol Describe PIL protocol implementation for target hardware (Since R2020b)
target.Port Describe connection via target hardware port (Since R2021a)
target.PortConnection Describe target connection port (Since R2020b)
target.Processor Provide target processor information
target.RS232Channel Describe serial communication channel (Since R2020b)
target.TargetConnection Provide details about connecting MATLAB computer to target hardware (Since R2020b)
target.TCPChannel Describe TCP communication properties (Since R2020b)
target.Tools Describe properties of tools for target hardware (Since R2020b)
target.UDPChannel Describe UDP communication (Since R2020b)
target.ApplicationStatus Describe status of application on target hardware (Since R2021a)
target.Breakpoint Provide breakpoint details for debugger (Since R2021a)
target.DebugExecutionTool Provide MATLAB service interface for debugger to manage processes on target hardware (Since R2023a)
target.DebugIOTool Debug byte stream I/O tool service interface (Since R2021a)
target.ExecutionService Describe implementation of execution service for target application (Since R2021a)
target.ExecutionTool MATLAB service interface for tool that manages application execution on target hardware (Since R2021a)
target.MATLABDependencies Describe MATLAB class and function dependencies (Since R2021a)
target.ApplicationExecutionTool Capture system command information to run application from MATLAB computer (Since R2020b)
target.Command Capture system command for execution on MATLAB computer (Since R2020b)
target.HostProcessExecutionTool Capture system command information to run target application from MATLAB computer (Since R2020b)
target.SystemCommandExecutionTool Capture system command information to run target application from MATLAB computer (Since R2020b)
target.Function Provide function signature information (Since R2020b)
target.Timer Provide timer details for processor (Since R2020b)

Objects

expand all

rtw.connectivity.ComponentArgs Provide parameters for each target connectivity component
rtw.connectivity.Config Define connectivity implementation that comprises builder, launcher, and communicator components
rtw.connectivity.ConfigRegistry Register connectivity configuration
rtw.connectivity.MakefileBuilder Configure toolchain-based build process
rtw.connectivity.Launcher Control downloading, starting, and resetting of a target application
rtw.connectivity.RtIOStreamHostCommunicator Configure development computer communications with target processor
rtw.pil.RtIOStreamApplicationFramework Configure target-side communications

Functions

expand all

rtIOStreamClose Shut down communications channel
rtIOStreamOpen Initialize communications channel
rtIOStreamRecv Receive data through communication channel
rtIOStreamSend Send data through communication channel
rtiostreamtest Test custom rtiostream interface implementation
rtiostream_wrapper Test rtiostream shared library functions in MATLAB
piltest Verify 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.

Test Generated Code with SIL and PIL Simulations

Test Generated Code with SIL and PIL Simulations

Use software-in-the-loop (SIL) and processor-in-the-loop (PIL) simulations to test numerical equivalence between model components and generated code.

Configure Processor-In-The-Loop (PIL) for a Custom Target

Configure Processor-In-The-Loop (PIL) for a Custom Target

Create target connectivity configuration and run PIL simulation.

Create a Target Communication Channel for Processor-in-the-Loop (PIL) Simulation

Create a Target Communication Channel for Processor-in-the-Loop (PIL) Simulation

Use rtiostream interface to provide a communication channel for PIL simulations.