Main Content

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_sender and adaptive_msg_polling_receiver AUTOSAR Adaptive models.

The 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.

open_system('adaptive_msg_sender');

sender_model.png

The 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.

open_system('adaptive_msg_polling_receiver');

rev4.png

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.

pollingrec_ui1.png

  • Select the adaptive_msg_sender application and click Linux Target > Run On Target > Start Application to launch the application on the target.

  • Select the adaptive_msg_polling_receiver application 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.

pollingrec_ui2.png

  • To stop the adaptive_msg_sender application, select it and click Linux Target > Run On Target > Stop Application.

  • To stop the adaptive_msg_polling_receiver application, select it and click Linux Target > Run On Target > Stop Application.

See Also

(Embedded Coder)

Related Topics