Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Solutions Academia Support User Community Company
spacer spacer spacer spacer spacer spacer

 

Stateflow 7.4

Bang-Bang Control Using Temporal Logic

This demonstration shows how to use Stateflow® to model a bang-bang temperature control system for a boiler. The boiler dynamics are modeled in Simulink® in a boiler plant model.

Contents

The Stateflow chart controls when the boiler is turned on and off. Initially, the boiler is turned off through the use of the turn_boiler graphical function. Every 5 seconds, the boiler's LED flashes, again through the use of a graphical function. After 40 seconds, if the boiler is cold, the boiler is turned on. After 20 seconds, the boiler is turned off once again, and the cycle repeats.

Note the use of absolute time temporal logic to control the transition between the states and to periodically flash the LED. The syntax after(20,sec) means take the transition 20 seconds after the state was entered. Note that the chart does not have an input event called sec. sec is a keyword which can be used in temporal logic operators to specify delay in terms of simulation time rather than occurrences of events.

Since we cannot use the every temporal logic operator with the sec keyword, we use a "workaround" which involves an inner substate called Flash with a self-transition triggered by the condition after(5,sec). This means that the entry action of the Flash substate is performed every 5 seconds.

Simulation Results

Looking at the Simulink scope, we can see that after approximately 450 seconds, the boiler temperature is effectively maintained at the set temperature of 20 degrees Celsius.

Contact sales
Free technical kit
Trial software
E-mail this page

Get Pricing and
Licensing Options