Stateflow User's Guide Previous page   Next Page

The Bang-Bang Boiler Demo

A good model to use in furthering your study of Stateflow is the Bang-Bang Boiler demo model. This model retains the basic structure of the Stateflow diagrams used in the Getting Started guide, but adds more levels of control with other Stateflow features.

Access the Stateflow demo model Bang-Bang Boiler as follows:

  1. In the MATLAB window, from the Help menu, select Demos.
  1. The Help window appears with the Demos topic list displayed in the left pane.

  1. Expand the Simulink node.
  2. Expand the Stateflow node.
  3. Expand the Examples node.
  4. Double-click the Bang-Bang Control Using Temporal Logic node to open the sf_boiler model.
  1. A Simulink model window opens along with a Stateflow diagram and a Scope window. The model has the following appearance:

    The structure of this model is similar to the model you constructed in Controlling a Physical Plant. Note the following about this model:

  1. Double-click to the Bang-Bang Controller block to bring focus to its Stateflow diagram, as shown.

The Stateflow diagram for the Bang-Bang Controller block is very similar to the diagram you build in Creating Subcharts to Add More Substates. The diagram has two states at the top level, On and Off. In addition, the state On is a subchart containing other states. Also, the diagram includes the definition of three graphical functions that are called in the Stateflow diagram.

The Bang-Bang Controller Stateflow diagram also introduces you to the following new features:

  1. Double-click the box Heater to ungroup it and double-click the subchart On to open it, as shown.

  1. Be sure to simulate the Bang-Bang Temperature Control Model to watch the preceding features execute.

Previous page  Controlling a Physical Plant Where to Go from Here Next page

© 1994-2005 The MathWorks, Inc.