< Previous | Next >

Lesson 2: Implementing AUTOSAR SW/C’s

To implement an atomic software component (SWC) type in Rhapsody®, you must first define the Rational® Rhapsody implementation blocks (RIMBs), and then instantiate them as parts under the software component type.
You can implement AUTOSAR SW/C’s in two ways:
  1. Direct definition of AUTOSAR InternalBehavior and Implementation sections:
    • Define the various AR Internal Behavior, Implementation and Code sections
    • Develop XFiles and the RunnableEntities implementation Code with Rhapsody
  2. Leverage Rhapsody Implementation Blocks:
    • Define Rhapsody Implementation Blocks (RIMBs) in ARBMT
    • Instantiate a RIMB to get RIMBO, typed by RIMB, as a part of an atomic SWC type, and connect the ports of the RIMBO to the ports of the SWC type via AR-to-Rhapsody delegation connectors
    • Generate code and AUTOSAR related artifacts for the application such as Internal behavior, Implementation, ARXML and C/H Files. You can right-click in the browser on the SWC, and select Create AR-SWC Implementation Object (RIMBO) to use the tool automation for the creation, instantiation and linking of the AR SWC ports with the RIMBO Ports.
    • Rhapsody can automate some aspects of generating a RIMB-based implementation:
      • You can right-click in the browser on the SWC, and select Create AR-SWC Implementation Object (RIMBO) to use the tool automation for the creation, instantiation, and linking of the AR SWC ports with the RIMBO Ports.

converter

  1. Create a Rational Rhapsody implementation block by using either of these methods:
    • Right-click in the browser on the SWC, and select Create AR-SWC Implementation Object (RIMBO) . See appendix A for the description of that function.
    • 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 Add New > AR3x_BMT > RIMB.
  2. Define the general features for a Rational Rhapsody implementation block. For example, in the RIMB window, in the Access & Activation tab, define the values for your project to create the behavior of the SWC type.
    In the LightManager project, the Active Element has an Activation value of Periodic. The Active Element digitalPushedDispatcher has a value Asynchrous.
    Note: For details about the automatic creation of a RIMBO, see the online Help topic "Automatic RIMBO creation".

    converter

  3. You can describe the behavior of the RIMB statechart by using the auto generated helper function.

    converter

  4. To implement the ActiveOperations of the RIMB, right click on the operation to open the Properties window, and select the Implementation tab. The following image shows an example of how you can set the ActiveOperations behavior.

    converter

    1. Right-click a RIMB implementation block and select Add New > AR3x_BMT > ActiveOperation.
      • Specify the activation policy for the active operation. Just as when you defined a RIMBimplementation block, you must specify the activation for the active operation. On the General tab for the active operation, in the Policy field, select either Asynchronous or Periodic.
        • If you select Asynchronous, define the actual activation policy on the Access & Activation tab.
        • If you select Periodic, specify the period, offset, and duration in the Activation section of the General tab.
      • If needed, select Guarded. When this check box is selected, this field specifies 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.”
Note: To see in detail the characteristics of the Rational Rhapsody implementation blocks (RIMBs), the Access & Activation tab elements, or how to add implementation block (RIMB) interfaces, see the topics "Defining characteristics of Rational Rhapsody implementation blocks (RIMBs)", "Specifying access and activation policy for asynchronous active elements" and "Adding Rhapsody implementation block (RIMB) interfaces".

For this tutorial, for example for the LightsManager sample, the following images show how the generated AR artifacts are driven from the Acces&Activation table.

converter

The generated helper functions will look like in the following image:

converter

You can see an example of the results of the AUTOSAR SW/C’s implementation in the following image:

Note: Related information:Automatic RIMBO creation
< Previous | Next >

Feedback