Automating the integration with the Runtime Environment (RTE) Scheduler

Rational Rhapsody supports the automation of integrating models with runnable entities through the use of automation policies. You can use these policies to automate the creation and implementation of active operations regarding their access and activation definitions. When set up, this task is done during code generation by analyzing the content of the Rhapsody implementation block (RIMB) class.

About this task

In an AR3x_BMT project, for a statechart with data-related events, when you generate code Rhapsody automatically creates the active operations and the access and activation elements for a RIMB according to the events, triggered operations, or both that exist in the RIMB.

The automation is for the attributes for the RIMB that match the format <p>_<x> (where p is the port name, and x is the attribute for the port interface). The automation is done during code generation and used by the code generation.

How the automation works

For each attribute on the RIMB, an active operation is automatically added. The active operation can have either a periodic or data_received_event activation policy. This policy is controlled by the CG::Attribute::PeriodicRead property. The period for a periodic active operation policy is defined by the CG::Attribute::ReadInterval property. The active operation has access to the referenced port and attribute (matching the attribute <p>_<x> name). You can define the data reception processing policy for an attribute by setting the CG::Attribute::DataReceptionProcessingPolicy property. By default, this property is set to ByModel, which means the attribute is handled according to the model. If there is a trigger operation associated with the attribute, processing happens immediately. If there is a reception associated with the attribute, it is added to a queue.

Procedure

  1. Create a Rhapsody implementation block (RIMB) receiver interface and add attributes to it.
  2. Create a RIMB sender interface and add attributes to it.
  3. Create a RIMB.
  4. Add RIMB receiver ports and sender ports to the RIMB. You must type them with the interfaces from steps 1 and 2.
  5. Add attributes for the RIMB that references a RIMB receiver port or sender port. Use this naming convention: Attribute for RIMB named <p>_<x> should match attribute x on the port p.
  6. Draw your statechart. You can use events or triggered operations in the statechart that matches the RIMB attributes to get the automation performed. The match is by name: Associating a trigger operation or a reception to an attribute is done by name: ev<p>_<x> to match an attribute by the name <p>_<x>.
  7. Generate code (select Code > Generate > name of configuration). Rhapsody automatically creates the active operations and RIMB access and activate elements. (Behind the scenes, the tool populates the Access & Activation tab [on the Features window for the RIMB], though this data is discarded by the end of the code generation.)

Example

The following figure shows generated code with automatically generated active operations.


Feedback