Defining Rhapsody implementation block (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.

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

Procedure

  1. For each attribute, x, on an implementation block receiver port, p, whose arrival triggers a transition, define a triggered operation named evP_x.
  2. 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.
  3. Create a statechart that uses the triggered operations as transition triggers.
  4. 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().
  5. 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. Create a statechart with Rhapsody events as transition triggers.
  2. 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.
  3. 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