Main Content

Event Communication Between AUTOSAR Adaptive Applications Using Message Triggering

This example shows how to deploy two AUTOSAR adaptive applications that use events to communicate with each other in message triggering mode.

AUTOSAR Blockset supports Polling mode and event-driven approach to access data.

Event-driven approach is used when an application expects data and response at a trigger of some event or action. Event does not trigger at regular intervals. Event-driven approach provides reaction to a service method faster, but the rate of context switches might be high and non-deterministic. Event-driven approach is more used where there is no real-time requirements. In Simulink we can model event-driven behavior with Export Function style only.

The sender application transmits the data of a sine wave periodically based on the sample time. The receiver application checks the message availability from the other application when ever the message triggering is invoked and receives messages when they are available.

Open the Models

This example uses the adaptive_msg_sender and adaptive_msg_event_driven_receiver AUTOSAR Adaptive models.

The adaptive_msg_sender model sends the data of a sine wave and uses arn are log block to log the data using ara::log messages.

open_system('adaptive_msg_sender');
Warning: Unrecognized function or variable 'CloneDetectionUI.internal.CloneDetectionPerspective.register'.

sender_model.png

The adaptive_msg_event_driven_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_event_driven_receiver');
Warning: Unrecognized function or variable 'CloneDetectionUI.internal.CloneDetectionPerspective.register'.

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

eventdriven_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_event_driven_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.

eventdriven_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_event_driven_receiver application, select it and click Linux Target > Run On Target > Stop Application.

See Also

(Embedded Coder)

Related Topics