diff options
Diffstat (limited to 'test/samples/w3c/microwave-02.scxml')
-rw-r--r-- | test/samples/w3c/microwave-02.scxml | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/test/samples/w3c/microwave-02.scxml b/test/samples/w3c/microwave-02.scxml new file mode 100644 index 0000000..a96f1fd --- /dev/null +++ b/test/samples/w3c/microwave-02.scxml @@ -0,0 +1,63 @@ +<?xml version="1.0"?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + datamodel="ecmascript" + initial="oven"> + + <!-- trivial 5 second microwave oven example --> + <!-- using parallel and In() predicate --> + <datamodel> + <data id="cook_time" expr="5"/> + <data id="door_closed" expr="true"/> + <data id="timer" expr="0"/> + </datamodel> + + <parallel id="oven"> + + <!-- this region tracks the microwave state and timer --> + <state id="engine"> + <transition target="off"/> + + <state id="off"> + <!-- off state --> + <transition event="turn.on" target="on"/> + </state> + + <state id="on"> + <transition target="idle"/> + <!-- on/pause state --> + + <transition event="turn.off" target="off"/> + <transition cond="timer >= cook_time" target="off"/> + + <state id="idle"> + <transition cond="In('closed')" target="cooking"/> + </state> + + <state id="cooking"> + <transition cond="In('open')" target="idle"/> + + <!-- a 'time' event is seen once a second --> + <transition event="time"> + <assign location="timer" expr="timer + 1"/> + </transition> + </state> + </state> + </state> + + <!-- this region tracks the microwave door state --> + <state id="door"> + <initial> + <transition target="closed"/> + </initial> + <state id="closed"> + <transition event="door.open" target="open"/> + </state> + <state id="open"> + <transition event="door.close" target="closed"/> + </state> + </state> + + </parallel> + +</scxml> |