Products & Services Solutions Academia Support User Community Company

Learn more about Real-Time Workshop Embedded Coder   

Creating a Connectivity Configuration for a Target

What Is a PIL Connectivity Configuration?

You can use PIL connectivity configurations and the target connectivity API to customize PIL to work with any target environment.

Use a connectivity configuration to define:

You can use the API to integrate third party tools for:

A particular connectivity configuration name is associated with a single connectivity API implementation. Many different connectivity configurations can coexist and be available for use with PIL simulations. You register each connectivity configuration to Simulink by creating an sl_customization.m file and placing it on the MATLAB path.

To run a PIL simulation, the software must first determine which of the available connectivity configurations to use. The software looks for a connectivity configuration that is compatible with the model under test. If the software finds multiple or no compatible connectivity configurations, you see an error message describing how to resolve the problem.

You can use any of the following connectivity configuration options:

Overview of the Target Connectivity API

Target Connectivity API Components

The following diagram shows what functions the Target Connectivity API components perform:

Communications rtiostream API

The communications part of the target connectivity API builds upon the rtiostream API, described in this section.

You can use the rtiostream API to implement a communication channel to enable exchange of data between different processes. This communication channel is required to enable processor-in-the-loop (PIL) on a new target.

PIL requires a host-target communications channel. This communications channel comprises separate driver code running on each of the host and target. The rtiostream API defines the signature of both target-side and host-side functions that must be implemented by this driver code.

The API is independent of the physical layer that sends the data. Possible physical layers include RS232, Ethernet, or Controller Area Network (CAN).

A full rtiostream implementation requires both host-side and target-side drivers. Real-Time Workshop software includes host-side drivers for the default TCP/IP implementation (all platforms) as well as a Windows only version for serial communications. To use the TCP/IP rtiostream communications channel, you must provide, or obtain from a third party, target-specific TCP/IP device drivers. You must also do this if you require serial communications. For other communication channels and platforms, there is no default implementation provided by Real-Time Workshop software. You must provide both the host-side and the target-side drivers.

The rtiostream API comprises the following functions:

You can use rtiostream_wrapper to test the rtiostream shared library methods from M-code.

To see how the rtiostream functions fit into the workflow of creating a connectivity implementation, see the next section, Creating a Connectivity API Implementation.

Creating a Connectivity API Implementation

To create a target connectivity API implementation, you must create a subclass of rtw.connectivity.Config.

For all the classes, methods, and functions in the Target Connectivity API, see the following reference section: Processor-in-the-Loop in the Real-Time Workshop Embedded Coder Function Reference.

Registering a Connectivity API Implementation

Register the new connectivity API implementation to Simulink as a connectivity configuration, by creating or adding to an sl_customization.m file. By doing this, you also define the set of Simulink models that the new connectivity configuration is compatible with.

For details, see rtw.connectivity.ConfigRegistry in the Real-Time Workshop Embedded Coder Function Reference.

Demos of the Target Connectivity API

For step-by-step examples, see the following demos:

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS