Skip to content

Behaviors FAQs

Why is there no return statement generated for my Activity

If you are missing a return statement in your Activity behavior even though you added an object Flow to a "return" ParameterNode you will need to specify a (Flow) Final Node to explicitly end the Activity.

Where are my entry/do/exit actions?

Are you missing entry/do/exit actions which you have defined in your model? If so, it's likely because the code generator handles these actions in a special way because they are not ordinary operations in UML. Their sole purpose is to do one of these two things:

  • Reference another behavior (of a class or interface)
    Entry action Behavior
  • Insert verbatim code in place of the operation
    Entry action Verbatim Code

This means that the code generator will never generate a function for an entry/do/exit action. It also means that you can't use these actions from outside the state, because they themselves don't exist in the generated code.

No enumeration named "Signals" found?

In Embedded Engineer 2.0, a new method of generating the signals enumeration was introduced, to make the signals visible in the model and to allow for customization of the generated enumeration.

A quick introduction can be found in the links below.

How can I prevent Embedded Engineer from changing the name of my Activity?

For operations, you can define an interface from which you implement operations. For these implemented operations, EmbeddedEngineer won't alter the operations name at all, because the interface defines a contract which includes the operations name. In EnterpriseArchitect, you can only implement operations though, and therefore an activity can't be implemented easily.

There is a workaround though:

Operations in EnterpriseArchitect can be bound to behaviors, which includes activities. Therefore you need to do the following:

  1. Define an interface or use an already existing interface with a operation of the expected signature.
  2. Implement this interface in your class, typically adding an operation in the process.
  3. Make sure your activity has the same parameters (matching names and types) and the same return type (exactly equal type, it's recommended to use the same model element as type!) as the operation defined in the interface and implemented in the class containing the activity.
  4. In the properties of the operation, go to Behavior and select your activity.
  5. The generated code for the operation will call the activity, pass the parameters it received, and return the value from the activity.

Can the StateMachine design be exported to MatLab?

At the moment you can either use XMI or C/C++ files to get the design across to other tools. A real matlab statemachine "import/export" has not yet been full developed! But we are engaged in european research project that goes in that direction.

Why is a state transition missing in the generated code?

When generating code for Statemachines such as in the model below the test == 1 transition will be missing from the generated code.

Completion Transition

This is due to the Completion transitions and completion events defined in the UML Superstructure 2.4.1.

UML Superstructure 2.4.1

...A completion transition is a transition originating from a state or an exit point but which does not have an explicit trigger, although it may have a guard defined. .... If the state is a composite state or a submachine state, a completion event is generated if either the submachine or the contained region has reached a final state and the state’s internal activities have been completed. This event is the implicit trigger for a completion transition. ...

Therefore Embedded Engineer will omit the generation of the test == 1 Transition since State1 is still active since State3 was not deactivated/exited.

switch (stm->mainState.activeSubState)
{
    case Class1_StateMachine_State1:
        switch (stm->State1.activeSubState)
        {
        case Class1_StateMachine_State3:
            break;
        default:
            break;
        }
        break;
    case Class1_StateMachine_State2:
        break;
    default:
        break;
}
switch (stm->mainState.activeSubState)
{
    case Class1_StateMachine_State1:
        switch (stm->State1.activeSubState)
        {
        case Class1_StateMachine_State3:
            break;
        default:
            break;
        }
        if (test == 1)
        {
            evConsumed = !0;
            /* From 'State1' to 'State2' */
            stm->mainState.activeSubState = Class1_StateMachine_State2;
        }
        break;
    case Class1_StateMachine_State2:
        break;
    default:
        break;
}

Embedded Engineer will warn the user about this during code generation

Skipped Transition

Solution

To resolve this we reccomend using one of the following solutions:

  • Change the Transition from State1 State2 to State3 State2 Completion Transition
  • Add a Signal to the Transition to be triggered Completion Transition