| Stateflow | ![]() |
www.kxcad.net Home > CAE Software Index > MATLAB Index >
Simulink can wake up a Stateflow chart by
Sampling the chart at a specified or inherited rate
Using a signal as a trigger
Using one Stateflow chart to drive the activity of another
A signal trigger works best for the Air Controller chart because it needs to monitor the temperature of the physical plant at regular intervals. To meet this requirement, you will use a periodic signal to trigger the chart. The source is a square wave signal called CLOCK, provided by a Signal Builder block in the Simulink model, described in How the Stateflow Chart Works with the Simulink Model. To harness the signal, you will set up an edge trigger event in Stateflow that wakes the chart at the rising or falling edge of CLOCK.
The rationale for using an edge trigger in this case is that it uses the regularity and frequency of the signal to wake up the chart. When using edge triggers, it is important to note that there can be a delay from the time the trigger occurs to the time the chart begins executing. This is because an edge trigger causes the chart to execute at the beginning of the next simulation time step, regardless of when the edge trigger actually occurred during the previous time step. The Air Controller can tolerate this delay, as long as the edge occurs frequently enough. (For more information about triggering Stateflow charts, see Implementing Simulink Update Interfaces in the online Stateflow User's Guide documentation.)
Recall that you already defined one edge-triggered event, SWITCH, to guard the transitions between PowerOff and PowerOn. You will now define a second edge-triggered event, CLOCK, to wake up the chart.
| Triggering a Stateflow Chart | Implementing the Triggers | ![]() |
© 1984-2007 The MathWorks, Inc. Terms of Use Patents Trademarks Acknowledgments