Defining RIMB statecharts and their execution

You can describe the behavior of a Rhapsody® implementation block (RIMB) by using a statechart.

About this task

In the Runtime Environment-managed mode, data elements that arrive on AUTOSAR receiver ports transform into triggered operations. When a data element arrives, the Runtime Environment (RTE) calls a corresponding active operation that directly triggers a transition on the statechart. Queuing is done by the Runtime Environment in the level of AUTOSAR data elements. In this mode, only triggered operations that originate from the arrival of AUTOSAR data elements can trigger transitions on the statechart.

In Rhapsody-managed mode, data elements that arrive on AUTOSAR receiver ports transform into Rhapsody events. When a data element arrives, an active operation is called that queues the corresponding event on the event queue for the Rhapsody implementation block. The doExecute command for the implementation block runs and dispatches the events into the statechart one by one, imitating the typical Rhapsody mechanism. This mode involves double queuing: by the Runtime Environment and by Rhapsody.

A RIMB’s statechart may be executed in one of two modes:
  • RTE-managed – in this mode, data elements arriving on AUTOSAR receiver ports are transformed into triggered operations. Whenever a data element arrives, the RTE calls a corresponding active operation which directly triggers a transition on the statechart. The RIMB is not active nor an execution manager, and no RHP event queue exists. Queuing is done by the RTE in the level of AUTOSAR data elements. In this mode, only triggered operations originating from the arrival of AR data elements may trigger transitions on the statechart. Calling RicGEN is not allowed.
  • RHP-managed – in this mode, data elements arriving on AUTOSAR receiver ports are transformed into RHP events. Whenever a data element arrives, an active operation is called which queues the corresponding event on the RIMBO’s event queue. The RIMB needs to be active-periodic and execution manager. Its doExecute runs periodically and dispatches the events into the statechart one by one, imitating the usual RHP mechanism. This involves double queuing by the RTE as well as by RHP.

Defining the statechart of a Rhapsody implementation block (RIMB) in Runtime Environment-managed mode

Procedure

  1. Define the RIMB as “sequential”.
  2. For each attribute, x, on an implementation block receiver port, p, whose arrival triggers a transition, define a triggered operation named evP_x.
  3. Set the access mode of x to Explicit Blocking or Explicit Non-Blocking (that is, not implicit). The access mode is to be typed by a regular C type, not a Rhapsody event.
  4. Create a statechart that uses the triggered operations as transition triggers.
  5. For each such p.x, you can define an active operation to serve as a dispatcher for p.x. The implementation of the active operation is to call receiveAndHandleData_p_x(). This step is the same for Runtime Environment-managed and Rhapsody-managed modes. The difference is the code generated by Rhapsody for receiveAndHandleData_p_x().
  6. Set all the dispatchers for the statechart as Guarded to ensure mutual exclusion between the dispatchers.

Defining the statechart of a Rhapsody implementation block (RIMB) in Rhapsody-managed mode

Procedure

  1. Define the RIMB as “active” with “periodic” execution policy.
  2. Create a statechart with Rhapsody events as transition triggers.
  3. Use those events to type attributes on Rhapsody implementation block receiver interfaces typing ports. If the arrival of AUTOSAR data element x on receiver port p is meant to trigger event ev, type x on the Rhapsody implementation block receiver interface typing p by ev. In contrast with the triggered operations described in the previous set of steps, ev is the name of the event on the statechart, not a name that was created from combining p and x. The binding of ev to p.x is achieved by way of typing x by ev.
  4. For each such p.x, define an active operation to serve as a queuer for p.x. The implementation of the active operation is to call receiveAndHandleEvent_p_x(). This step is the same for Runtime Environment-managed and Rhapsody-managed mode. The difference is the code generated by Rhapsody for receiveAndHandleEvent_p_x().

Feedback