Control States in Charts Enabled by Function-Call Input Events
In a Simulink® model, when a Stateflow® chart is enabled by a function-call input event, you can control the state of the chart by setting the States When Enabling chart property. This property determines the values of states and data when the input event reenables the chart:
Held— Maintain most recent values of the states and data.
Reset— Revert to the initial values of the states and data.
For new charts, the default setting is
Held. For more information, see Activate a Stateflow Chart by Sending Input Events.
Example of a Chart Enabled by a Function-Call Input Event
In this model, the
Caller chart uses the event
E to wake up and execute the
Caller chart contains two states,
B. When you bind the output event
E in state
The temporal logic operator after changes the active state every ten time steps, so the
Callee chart is repeatedly enabled and disabled.
Callee chart contains two states,
D. Each time that the chart executes, the output data
y increments by one. The state
C is initially active. After one time step, the value of
y is positive and the chart takes the transition to state
Chart Simulation When Property Is
Callee chart, the States When Enabling property is set to
Held. During simulation, when the function-call input event reenables the chart at times and , state
D stays active and output
y maintains its most recent value.
Chart Simulation When Property is
Callee chart, change the States When Enabling property to
Reset. During simulation, when the function-call input event reenables the chart at times and , state
C becomes active and output
y reverts to its initial value of zero.