Specifying action sequence order for element parts

You can use MicroC profile to specify the sequence of actions that must be performed for parts of an element.

About this task

You can specify the actions that must be performed for classes, implicit objects and files.

The specification of an execution order for element parts is based on the following two MicroC concepts:

To specify that a model element is executable, create a method called doExecute for that element. You can use the method to specify the actions that must be performed for the element as part of a specific sequence of actions.

Note: If you do not create a doExecute method for an executable element, the program generates an empty doExecute method during code generation.

Each doExecute method must consist of code that performs its calculations and returns, meaning it cannot use any "wait" features provided by the operating system.

You can specify that an element needs to be Executable or an Execution Manager in the Execution Scheme section of the Features window for the element. The Execution Scheme section only appears in the Features window when you are using the MicroC profile.

Note: When you specify an element's concurrency setting as sequential, you can decide whether the element is Executable, and an Execution Manager. However, if you specify an element's concurrency settings as active, the program automatically makes the element an Execution Manager.

Procedure

  1. Create a MicroC project by clicking New button New button, or select File > New to open the New Project window.
  2. In the Project name field, type your project name.
  3. In the In folder field, click Browse to select the folder location for your project.
  4. In the Project Type field, select the MicroC profile, and in the Project Settings select CodeCentric752C.
  5. Click OK. If the specified location does not exist, the product asks whether you want to create the location. Click Yes. The product generates a MicroC project.
  6. Use the Diagram Tools to create or add classes to your model. To assign an execution scheme to your class, highlight the class, right-click and select Features from the drop down list.
    Features window - Execution Scheme check boxes enabled
  7. For an Execution Manager, specify the order of execution for its parts on the Parts tab of the Features window.
    Features window - Parts tab

Results

Note: The package level doExecute method only calls the doExecute methods defined for top-level elements within the package. It does not handle executable elements lower down in the hierarchy that are not associated with an execution manager.

Feedback