summaryrefslogtreecommitdiffstats
path: root/test/samples/w3c/microwave-02.scxml
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2012-09-08 23:26:39 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2012-09-08 23:26:39 (GMT)
commitaa6c3a1257a29cc5bcf8b94893732ee553f27582 (patch)
tree625adb1a353a17ffed2c7e0bac686d705aaec93f /test/samples/w3c/microwave-02.scxml
downloaduscxml-aa6c3a1257a29cc5bcf8b94893732ee553f27582.zip
uscxml-aa6c3a1257a29cc5bcf8b94893732ee553f27582.tar.gz
uscxml-aa6c3a1257a29cc5bcf8b94893732ee553f27582.tar.bz2
Initial upload
Still somewhat quirky to build but fairly feature complete
Diffstat (limited to 'test/samples/w3c/microwave-02.scxml')
-rw-r--r--test/samples/w3c/microwave-02.scxml63
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 &gt;= 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>