Event Communication Between AUTOSAR Adaptive Applications Using Message Polling
This example shows how to deploy two AUTOSAR adaptive applications that use events to communicate with each other in message polling mode.
AUTOSAR Blockset supports Polling mode and event-driven approach to access data.
Polling mode is used when an application is expecting data at regular intervals and use the data for further processing. Polling mode is needed by the real-time applications to avoid unnecessary context switches. The cyclic activation might be driven by a real-time timer, which assures a minimal jitter. In Simulink we can model polling behaviour with Rate-based or Export Function style.
The sender application transmits the data of a sine wave periodically based on the sample time. The receiver application periodically checks the message availability from the other application in polling mode and receives messages when they are available.
Open the Models
This example uses the
adaptive_msg_polling_receiver AUTOSAR Adaptive models.
adaptive_msg_sender model sends the data of a sine wave and uses an ara log block to log the data using ara::log messages.
adaptive_msg_polling_receiver model receives the data of a sine wave and uses an ara log block to log the received data using ara::log messages.
Deploy the Models
Open the Linux Runtime Manager application by clicking Apps > Linux Runtime Manager from the model toolstrip.
Connect to a Linux target computer by following instructions in Setup Linux Target Computer (Embedded Coder).
Deploy both the models on Linux target computer by following instructions in Build Simulink Model and Deploy Application (Embedded Coder).
After you deploy the applications, the Linux Runtime Manager app displays them in the Targets Tree pane.
adaptive_msg_senderapplication and click Linux Target > Run On Target > Start Application to launch the application on the target.
adaptive_msg_polling_receiverapplication and click Linux Target > Run On Target > Start Application to launch the application on the target.
The app displays ara::log messages that the deployed applications generate in the Log Viewer pane, which indicates that the applications are communicating.
To stop the
adaptive_msg_senderapplication, select it and click Linux Target > Run On Target > Stop Application.
To stop the
adaptive_msg_polling_receiverapplication, select it and click Linux Target > Run On Target > Stop Application.
deployApplicationPackage (Embedded Coder)