Objects that are typed by Rational® Rhapsody® implementation
blocks (RIMBs) can implement atomic software component types.
Procedure
- Create
a Rational Rhapsody implementation block by using either
of these methods:
- For the Rational Rhapsody implementation block
diagram under a package in the ARBMTPackages category,
from the Drawing toolbar, select the Rational Rhapsody implementation
block tool
and click the diagram in the drawing area.
- Under the ARBMTPackages category, right-click
a package and select .
- Define the general features for a Rational Rhapsody implementation
block:
Note: Because Rational Rhapsody implementation blocks
resemble classes, they use many of the same fields on the General tab
of the Features window. The following fields on the General tab
for a Rational Rhapsody implementation block
are either described in respect to Rational Rhapsody implementation blocks
or are specific to the implementation blocks.
- Concurrency: When you define a Rational Rhapsody implementation block, you must
set the Concurrency field to active.
This setting specifies that a runnable is created for each object
typed by this Rational Rhapsody implementation block.
The function for the runnable is to be the doExecute method
of the Rational Rhapsody implementation block.
- If the concurrency is set to “active” then an activation policy
should be specified at the bottom of the dialogue. It determines when
the RTE calls the “doExecute” of the RIMB. The policy field may be
either “asynchronous” or “periodic”. If it is “asynchronous” then
the actual activation policy should be defined in the access &
activation tab, see below. If it is “periodic” then the period and
delay should be specified.
- If the concurrency is set to “sequential” then the RIMB can still
be set to be an execution manager. This means that each object typed
by this RIMB will have an event queue and will manage its statechart
and its parts. However, if it is not active then no runnable will
be created for its “doExecute”, and it is up to user code to call
it.
Any number of active operations can be added to a RIMB. This
is done in the browser via Add New capability.
For each active operation an AUTOSAR runnable will be generated whose
function is the operation. Any behavior inside the RIMB is called
by an active operation, including statechart execution. While an active
operation may be implemented by any code, Rhapsody generates several helper functions
to facilitate the execution of statecharts.
In the feature
dialogue of each active operation an activation policy must be specified.
This is done in exactly the same way as for active RIMBs: the activation
must be either “periodic” or “asynchronous”. If it is “periodic” then
a period and delay should be specified. If it is “asynchronous” then
an activation policy must be defined in the access and activation
tab of the RIMB.
Also in the feature dialogue, a field “Guarded”
may be checked. All guarded active operations will be mutually exclusive.
This is implemented via a dedicated AR exclusive area which all runnables
generated for guarded operations are specified to “run within”.
- Access&Activation: You must specify
an activation policy. This policy determines when the Runtime Environment
(RTE) calls the doExecute method of the Rational Rhapsody implementation
block. In the Policy field, select either Asynchronous or Periodic.
The
access & activation tab is used to:
- Specify the activation policy of asynchronous active elements,
and
- Specify which elements on ports are accessed by which active elements.
Note: : The access mode, implicit or explicit, is specified in
the level of attributes on RIMB interfaces, and not here. Only the
fact of accessing is specified here.
Each asynchronous
active operation, inclusive the RIMB if it is active asynchronous,
must have an activation policy defined in this tab, otherwise it will
never run.
Note: A given active element can have more than one line in the
table. In this case the defined activation policy and access is the
sum of all lines.
- Guarded: In this field, you can specify
that all guarded active operations are to be mutually exclusive. This
action is implemented in a dedicated AUTOSAR-exclusive area that all
runnables that are generated for guarded operations are specified
to “runs within.”
Active operations are central to Rational Rhapsody implementation
blocks. Active operations are translated to AUTOSAR runnables and
are called directly by the Runtime Environment (RTE). They drive the
execution of the implementation. A Rational Rhapsody implementation block
can have whatever a normal class has, including a statechart, attributes,
operations, and other elements. Rational Rhapsody implementation blocks
are defined in the Behavior Modeling Tool (BMT) packages and then
instantiated as objects inside software component types.