Creating a runnable manager

A runnable manager is the container for runnable operations that activate execution managers. You can create an external scheduler to call the runnable operations. This capability lets you define an execution scheme independent of the model composition structure. This capability is available for Rhapsody® projects created with the MicroC profile.

About this task

The role of the runnable manager is to assemble runnable operations in your model, as well as to represent the C source file in which runnable operations are generated. A runnable operation can select instances of execution managers and specify the execution order for the execution managers.

The runnable operations and the Initialize function are API functions for an external scheduler. You can write an external scheduler, an external main() function, that activates execution managers but without having any hierarchical order for the execution managers. The external scheduler calls the runnable operations, as well as the Initialize function.

Procedure

  1. Create a project with the MicroC profile and add artifacts for it as you would typically do (for example, add packages, classes, and objects). Or open an existing project created with this profile.
  2. To create a runnable manager, create a package. For example, you might name it RunnableManagerPkg.
  3. Add a runnable manager to the package you created. Right-click the package and select Add New > MicroC > RunnableManager. For example, you might name it RM1.
  4. Add a runnable operation to your runnable manager. Right-click, your runnable manager and select Add New > MicroC > RunnableOperation. For example, you might name it RO1.
  5. Double-click your runnable operation to open its Features window, and on the Activate tab, you can do the following steps:
    1. On the Add New row, click ... to add an instance of an execution manager to the runnable operation. Use the browser on the Execution Manager Instance Reference window to select an object you want the execution manager to execute.
    2. When you have more than one execution manager, use the Move Item Up and Move Item Down buttons Move Item Up and Move Item Down buttons to specify the order that your execution managers are to run, as shown in the following figure.
      Activate tab
  6. Click OK.

Results

When you generate code, the execution managers run in the order specified. In the generated code, the body of a runnable operation is composed of a series of function calls to the doExecute() functions of the execution managers that were selected on the Activate tab, according to the specified order.

Another role of the runnable manager is to generate an Initialize function that initializes all the packages that aggregate any of the execution managers that all the runnable operations activate.