Specification of state transition models - Cs.ioc.ee
Transcript of Specification of state transition models - Cs.ioc.ee
Thermostat. Behaviour table
ThermostatOK
COLDHOT
DeltaT
Table from the book. Daniel Ashlock. Evolutionary Computation for Modeling and Optimization
Thermostat. Finite state machineHOT/conditioner()
HOT/doNothing()
HOT/conditioner()
OK/doNothing()
OK/doNothing()
OK/doNothing()COLD/heater()
COLD/heater()
COLD/doNothing()
Just heatedHeating
CoolingJust cooled
Ready
HOT/doNothing()
COLD/doNothing()
OK/doNothing()HOT/doNothing()
COLD/doNothing()
OK/doNothing()
FSM as natural way to describe some things
● Protocols● Digital logic design● Controllers● Reactive systems● User interface
Tools● Modelica state graph● Simulink stateflow● Yakindu Statechart Tools● Umodel● Unimod● Stateworks● ...
UModel - UML tool for software modeling and application
development
http://www.altova.com/umodel.html
Visual paradigm for UML
http://www.visual-paradigm.com/support/documents/vpumluserguide/94/2579/6714_creatingstat.html
StateWORKS
Modeling Software with Finite State Machines: A Practical Approachhttp://www.stateworks.com/overview/WhatIsStateWORKS/
Stateflow (Simulink). MathWorks
http://www.mathworks.se/videos/introduction-to-stateflow-for-controls-applications-68889.html
Choice● Mealy (actions on transition) or Moore type
(action on states) or both● Actions described as external methods or inside
the FSM specification● Hierarchy of machines or several machines
communicationg with each other● Memory: internal or external variables● Concurrency (time)● Language of events (&&, ||, ==, >, <, !)● Language of actions
Overview
Display
-
21°C
+
Ambienttemperature
t=21°C
Controller
Thermostat
Conditioner Heater
Back to example
DisplayDisplaytempinc()dec()getTemp()
Display
-
21°C
+
+pressed/inc()
-pressed/dec()
-pressed &&+pressed/doNothing()
timer/Ready Change
Ambient AmbienttempdeltaTupdate()getTemp()
Ambient
t=21°CdeltaT
temp
Ready
timer&&(deltaT!=0)/update()
Thermostat. FSMHOT/conditioner()
HOT/doNothing()
HOT/conditioner()
OK/doNothing()
OK/doNothing()
OK/doNothing()COLD/heater()
COLD/heater()
COLD/doNothing()
Just heatedHeating
CoolingJust cooled
Ready
HOT/doNothing()
COLD/doNothing()
OK/doNothing()HOT/doNothing()
COLD/doNothing()
OK/doNothing()
ThermostatOKCOLDHOT
deltaT
Display
-
21°C
+
Ambient
t=21°CdeltaT
Controller
Timer
Timer&&(Display.temp>Ambient.temp)/Thermostat.cmd=COLD
Ready
Timer&&(Display.temp<Ambient.temp)/Thermostat.cmd=HOTTimer&&(Display.temp==Ambient.temp)/Thermostat.cmd=OK
Concurrency (time)????
Interface example. JastAdd-EMF: Attribute Grammars
for Metamodel Semantics
http://code.google.com/a/eclipselabs.org/p/jastemf/wiki/Statemachine