Download Stateflow User's Guide

Transcript
11
Building Targets
between state A and state B, the sequence of execution that takes place when
state A is active is expressed by the following pseudocode:
If (c1) {
if(c2) {
a2;
exit A;
a1;
enter B;
}
}
Because condition actions are evaluated when their guarding condition is
true and transition actions are evaluated when the transition is actually
taken, condition action a2 is executed prior to transition action a1. This
violates the apparent graphical sequence of executing a1 then a2. In this
case, the preceding diagram is flagged for an error during build time. As a
remedy, the user can change a1 and a2 to be both condition or transition
actions.
Compilation Error Messages
If compilation errors indicate the existence of undeclared identifiers, verify
that variable expressions in state, condition, and transition actions are defined.
Consider, for example, an action language expression such as a=b+c. In
addition to entering this expression in the Stateflow diagram, you must create
data objects for a, b, and c using the Explorer. If the data objects are not
defined, the parser assumes that these unknown variables are defined in the
Custom code portion of the target (which is included at the beginning of the
generated code). This is why the error messages are encountered at compile
time and not at code generation time.
11-36