The internal behavior of an AUTOSAR software component is implemented by a set of runnable entities (runnables). A runnable is a sequence of operations provided by the component that can be started by the run-time environment (RTE). The component configures an event to activate each runnable – for example, a timing event, data received, a client request, a mode change, component startup or shutdown, or a trigger.
In Simulink®, you can configure these types of AUTOSAR events.
|Sender-receiver (S-R) communication||Configure Events for Runnable Activation|
|Sender-receiver (S-R) communication||Configure AUTOSAR Receiver Port for DataReceiveErrorEvent|
|External trigger event communication||Configure Receiver for AUTOSAR External Trigger Event Communication|
|Activation of initialization runnable||Configure AUTOSAR Initialization Runnable (R4.1)|
|Mode-switch (M-S) communication||Configure AUTOSAR Mode-Switch Communication|
|Client-server (C-S) communication||Configure AUTOSAR Client-Server Communication|
|Periodic activation of runnable||Configure AUTOSAR TimingEvent for Periodic Runnable|
To configure an AUTOSAR runnable in Simulink:
Open a model that is configured for AUTOSAR code generation. This example uses
a writable copy of the example model
In the model, create or identify a root-level Simulink subsystem or function that implements a sequence of operations.
The subsystem or function must generate an entry-point function in C code. In
autosar_swc, the subsystem SS1 generates rate-based model
Create or identify an AUTOSAR runnable to which to map the Simulink entry point function. Open the AUTOSAR Dictionary. Expand
AtomicComponents, expand the component, and select the
Runnables view. If you need to create a new AUTOSAR
runnable, click the plus sign. The model
the periodic runnable
Select the row containing the runnable and configure its properties, including
name and symbol. The AUTOSAR runnable symbol-name that you specify is exported
in ARXML descriptions and C code. For an AUTOSAR server
runnable, set the runnable property
to designate whether to enforce concurrency constraints. For nonserver
canBeInvokedConcurrently set to
false. For more information, see Concurrency Constraints for AUTOSAR Server Runnables.
Configure an event to activate the runnable. Go to the Events pane for the selected runnable. If you need to create an event, click Add Event. Enter an event name and set the event type.
The steps to configure an event depend on the type of event. If the event relies on a communication interface, such as data received (sender-receiver) or client request (client-server), you must first configure the communication interface before configuring the event.
In the model
autosar_swc, the periodic runnable
Runnable_1s is activated by a
Map the Simulink entry-point function to the AUTOSAR runnable. Open the Code
Mappings editor and select the Functions tab. For model
autosar_swc, select the periodic function with a 1s
sample time and map it to AUTOSAR runnable
To see the results of AUTOSAR runnable and event configuration in ARXML descriptions and C code, build the model.
If an AUTOSAR software component model contains multiple runnables, you can configure the order in which runnables execute. For more information, see Configure AUTOSAR Runnable Execution Order.