Browse Source

Microwave example: added alternative allowing to run it with the door opened.

Joeri Exelmans 5 years ago
parent
commit
86acc97f37

+ 6 - 2
examples/microwave/GUI.py

@@ -45,7 +45,8 @@ class GUI(Frame):
 
         self.imgClosedOff = PhotoImage(file="./small_closed_off.png")
         self.imgClosedOn = PhotoImage(file="./small_closed_on.png")
-        self.imgOpened = PhotoImage(file="./small_opened.png")
+        self.imgOpenedOff = PhotoImage(file="./small_opened_off.png")
+        self.imgOpenedOn = PhotoImage(file="./small_opened_on.png")
 
         # state
         self.doorOpened = False
@@ -126,7 +127,10 @@ class GUI(Frame):
 
     def refresh_background(self):
         if self.doorOpened:
-            self.canvas.itemconfig(self.background, image=self.imgOpened)
+            if self.running:
+                self.canvas.itemconfig(self.background, image=self.imgOpenedOn)
+            else:
+                self.canvas.itemconfig(self.background, image=self.imgOpenedOff)
         else:
             if self.running:
                 self.canvas.itemconfig(self.background, image=self.imgClosedOn)

+ 72 - 0
examples/microwave/models/model_01_flat_nodoor.xml

@@ -0,0 +1,72 @@
+<single_instance_cd>
+  <delta>1 ms</delta>
+  <statechart>
+    <semantics
+      big_step_maximality="take_many"
+      combo_step_maximality="take_one"
+      input_event_lifeline="first_combo_step"
+      hierarchical_priority="source_parent"
+      orthogonal_priority="explicit"
+      same_source_priority="explicit"
+      />
+    <datamodel>
+      time = 0;
+      checkStartTime = func {
+        if (time == 0) time = 30;
+      };
+    </datamodel>
+    <inport name="in">
+      <event name="start"/>
+      <event name="stop"/>
+      <event name="increase_time"/>
+      <event name="door_opened"/>
+      <event name="door_closed"/>
+    </inport>
+    <outport name="out">
+      <event name="micro_on"/>
+      <event name="micro_off"/>
+      <event name="set_time"/>
+      <event name="ping"/>
+    </outport>
+    <root initial="NotRunning">
+      <state id="Running">
+        <onentry> <raise port="out" event="micro_on"/> </onentry>
+        <onexit> <raise port="out" event="micro_off"/> </onexit>
+        <transition port="in" event="stop" target="../NotRunning"/>
+        <transition after="1 s" target=".">
+          <code> time -= 1; </code>
+          <raise port="out" event="set_time">
+            <param expr="time"/>
+          </raise>
+        </transition>
+        <transition port="in" event="increase_time" target=".">
+          <code> time += 10; </code>
+            <raise port="out" event="set_time">
+              <param expr="time"/>
+            </raise>
+        </transition>
+        <transition cond="time == 0" target="../NotRunning"/>
+      </state>
+      <state id="NotRunning">
+        <transition port="in" event="start" target="../Running">
+          <code> checkStartTime(); </code>
+          <raise port="out" event="set_time">
+            <param expr="time"/>
+          </raise>
+        </transition>
+        <transition port="in" event="stop" target=".">
+          <code> time = 0; </code>
+          <raise port="out" event="set_time">
+            <param expr="time"/>
+          </raise>
+        </transition>
+        <transition port="in" event="increase_time" target=".">
+          <code> time += 10; </code>
+            <raise port="out" event="set_time">
+              <param expr="time"/>
+            </raise>
+        </transition>
+      </state>
+    </root>
+  </statechart>
+</single_instance_cd>

+ 85 - 0
examples/microwave/models/model_01_flat_nodoor_priorities.svg

@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.40.1 (20161225.0304)
+ -->
+<!-- Title: priorities Pages: 1 -->
+<svg width="666pt" height="260pt"
+ viewBox="0.00 0.00 666.02 260.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 256)">
+<title>priorities</title>
+<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-256 662.0213,-256 662.0213,4 -4,4"/>
+<!-- 0. stop / Running&#45;&gt;NotRunning -->
+<g id="node1" class="node">
+<title>0. stop / Running&#45;&gt;NotRunning</title>
+<ellipse fill="none" stroke="#000000" cx="151.4366" cy="-234" rx="124.2781" ry="18"/>
+<text text-anchor="middle" x="151.4366" y="-230.3" font-family="Times,serif" font-size="14.00" fill="#000000">0. stop / Running&#45;&gt;NotRunning</text>
+</g>
+<!-- 1. after(1 s) / Running&#45;&gt;Running -->
+<g id="node2" class="node">
+<title>1. after(1 s) / Running&#45;&gt;Running</title>
+<ellipse fill="none" stroke="#000000" cx="151.4366" cy="-162" rx="128.0773" ry="18"/>
+<text text-anchor="middle" x="151.4366" y="-158.3" font-family="Times,serif" font-size="14.00" fill="#000000">1. after(1 s) / Running&#45;&gt;Running</text>
+</g>
+<!-- 0. stop / Running&#45;&gt;NotRunning&#45;&gt;1. after(1 s) / Running&#45;&gt;Running -->
+<g id="edge1" class="edge">
+<title>0. stop / Running&#45;&gt;NotRunning&#45;&gt;1. after(1 s) / Running&#45;&gt;Running</title>
+<path fill="none" stroke="#00ff00" d="M151.4366,-215.8314C151.4366,-208.131 151.4366,-198.9743 151.4366,-190.4166"/>
+<polygon fill="#00ff00" stroke="#00ff00" points="154.9367,-190.4132 151.4366,-180.4133 147.9367,-190.4133 154.9367,-190.4132"/>
+</g>
+<!-- 2. increase_time / Running&#45;&gt;Running -->
+<g id="node3" class="node">
+<title>2. increase_time / Running&#45;&gt;Running</title>
+<ellipse fill="none" stroke="#000000" cx="151.4366" cy="-90" rx="145.6742" ry="18"/>
+<text text-anchor="middle" x="151.4366" y="-86.3" font-family="Times,serif" font-size="14.00" fill="#000000">2. increase_time / Running&#45;&gt;Running</text>
+</g>
+<!-- 1. after(1 s) / Running&#45;&gt;Running&#45;&gt;2. increase_time / Running&#45;&gt;Running -->
+<g id="edge2" class="edge">
+<title>1. after(1 s) / Running&#45;&gt;Running&#45;&gt;2. increase_time / Running&#45;&gt;Running</title>
+<path fill="none" stroke="#00ff00" d="M151.4366,-143.8314C151.4366,-136.131 151.4366,-126.9743 151.4366,-118.4166"/>
+<polygon fill="#00ff00" stroke="#00ff00" points="154.9367,-118.4132 151.4366,-108.4133 147.9367,-118.4133 154.9367,-118.4132"/>
+</g>
+<!-- 3. [time == 0] / Running&#45;&gt;NotRunning -->
+<g id="node4" class="node">
+<title>3. [time == 0] / Running&#45;&gt;NotRunning</title>
+<ellipse fill="none" stroke="#000000" cx="151.4366" cy="-18" rx="151.3732" ry="18"/>
+<text text-anchor="middle" x="151.4366" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">3. [time == 0] / Running&#45;&gt;NotRunning</text>
+</g>
+<!-- 2. increase_time / Running&#45;&gt;Running&#45;&gt;3. [time == 0] / Running&#45;&gt;NotRunning -->
+<g id="edge3" class="edge">
+<title>2. increase_time / Running&#45;&gt;Running&#45;&gt;3. [time == 0] / Running&#45;&gt;NotRunning</title>
+<path fill="none" stroke="#00ff00" d="M151.4366,-71.8314C151.4366,-64.131 151.4366,-54.9743 151.4366,-46.4166"/>
+<polygon fill="#00ff00" stroke="#00ff00" points="154.9367,-46.4132 151.4366,-36.4133 147.9367,-46.4133 154.9367,-46.4132"/>
+</g>
+<!-- 4. start / NotRunning&#45;&gt;Running -->
+<g id="node5" class="node">
+<title>4. start / NotRunning&#45;&gt;Running</title>
+<ellipse fill="none" stroke="#000000" cx="486.4366" cy="-234" rx="124.2781" ry="18"/>
+<text text-anchor="middle" x="486.4366" y="-230.3" font-family="Times,serif" font-size="14.00" fill="#000000">4. start / NotRunning&#45;&gt;Running</text>
+</g>
+<!-- 5. stop / NotRunning&#45;&gt;NotRunning -->
+<g id="node6" class="node">
+<title>5. stop / NotRunning&#45;&gt;NotRunning</title>
+<ellipse fill="none" stroke="#000000" cx="486.4366" cy="-162" rx="137.2758" ry="18"/>
+<text text-anchor="middle" x="486.4366" y="-158.3" font-family="Times,serif" font-size="14.00" fill="#000000">5. stop / NotRunning&#45;&gt;NotRunning</text>
+</g>
+<!-- 4. start / NotRunning&#45;&gt;Running&#45;&gt;5. stop / NotRunning&#45;&gt;NotRunning -->
+<g id="edge4" class="edge">
+<title>4. start / NotRunning&#45;&gt;Running&#45;&gt;5. stop / NotRunning&#45;&gt;NotRunning</title>
+<path fill="none" stroke="#00ff00" d="M486.4366,-215.8314C486.4366,-208.131 486.4366,-198.9743 486.4366,-190.4166"/>
+<polygon fill="#00ff00" stroke="#00ff00" points="489.9367,-190.4132 486.4366,-180.4133 482.9367,-190.4133 489.9367,-190.4132"/>
+</g>
+<!-- 6. increase_time / NotRunning&#45;&gt;NotRunning -->
+<g id="node7" class="node">
+<title>6. increase_time / NotRunning&#45;&gt;NotRunning</title>
+<ellipse fill="none" stroke="#000000" cx="486.4366" cy="-90" rx="171.6696" ry="18"/>
+<text text-anchor="middle" x="486.4366" y="-86.3" font-family="Times,serif" font-size="14.00" fill="#000000">6. increase_time / NotRunning&#45;&gt;NotRunning</text>
+</g>
+<!-- 5. stop / NotRunning&#45;&gt;NotRunning&#45;&gt;6. increase_time / NotRunning&#45;&gt;NotRunning -->
+<g id="edge5" class="edge">
+<title>5. stop / NotRunning&#45;&gt;NotRunning&#45;&gt;6. increase_time / NotRunning&#45;&gt;NotRunning</title>
+<path fill="none" stroke="#00ff00" d="M486.4366,-143.8314C486.4366,-136.131 486.4366,-126.9743 486.4366,-118.4166"/>
+<polygon fill="#00ff00" stroke="#00ff00" points="489.9367,-118.4132 486.4366,-108.4133 482.9367,-118.4133 489.9367,-118.4132"/>
+</g>
+</g>
+</svg>

+ 87 - 0
examples/microwave/models/model_02_hierarchical_door.xml

@@ -0,0 +1,87 @@
+<single_instance_cd>
+  <delta>1 ms</delta>
+  <statechart>
+    <semantics
+      big_step_maximality="take_many"
+      combo_step_maximality="take_one"
+      input_event_lifeline="first_combo_step"
+      hierarchical_priority="source_parent"
+      orthogonal_priority="explicit"
+      same_source_priority="explicit"
+      />
+    <datamodel>
+      time = 0;
+      checkStartTime = func {
+        if (time == 0) time = 30;
+      };
+    </datamodel>
+    <inport name="in">
+      <event name="start"/>
+      <event name="stop"/>
+      <event name="increase_time"/>
+      <event name="door_opened"/>
+      <event name="door_closed"/>
+    </inport>
+    <outport name="out">
+      <event name="micro_on"/>
+      <event name="micro_off"/>
+      <event name="set_time"/>
+      <event name="ping"/>
+    </outport>
+    <root initial="DoorClosed">
+      <state id="DoorClosed" initial="NotRunning">
+        <transition port="in" event="door_opened" target="../DoorOpen"/>
+        <state id="Running">
+          <onentry> <raise port="out" event="micro_on"/> </onentry>
+          <onexit> <raise port="out" event="micro_off"/> </onexit>
+          <transition port="in" event="stop" target="../NotRunning"/>
+          <transition after="1 s" target=".">
+            <code> time -= 1; </code>
+            <raise port="out" event="set_time">
+              <param expr="time"/>
+            </raise>
+          </transition>
+          <transition cond="time == 0" target="../NotRunning"/>
+
+          <transition port="in" event="increase_time" target=".">
+            <code> time += 10; </code>
+              <raise port="out" event="set_time">
+                <param expr="time"/>
+              </raise>
+          </transition>
+
+        </state>
+        <state id="NotRunning">
+          <transition port="in" event="start" target="../Running">
+            <code> checkStartTime(); </code>
+            <raise port="out" event="set_time">
+              <param expr="time"/>
+            </raise>
+          </transition>
+          <transition port="in" event="stop" target=".">
+            <code> time = 0; </code>
+            <raise port="out" event="set_time">
+              <param expr="time"/>
+            </raise>
+          </transition>
+
+          <transition port="in" event="increase_time" target=".">
+            <code> time += 10; </code>
+              <raise port="out" event="set_time">
+                <param expr="time"/>
+              </raise>
+          </transition>
+        </state>
+      </state>
+      <state id="DoorOpen">
+        <transition port="in" event="door_closed" target="../DoorClosed"/>
+        <transition port="in" event="increase_time" target=".">
+          <code> time += 10; </code>
+            <raise port="out" event="set_time">
+              <param expr="time"/>
+            </raise>
+        </transition>
+      </state>
+    </root>
+  </statechart>
+</single_instance_cd>

+ 151 - 0
examples/microwave/models/model_02_hierarchical_door_priorities.svg

@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.40.1 (20161225.0304)
+ -->
+<!-- Title: priorities Pages: 1 -->
+<svg width="1048pt" height="332pt"
+ viewBox="0.00 0.00 1048.37 332.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 328)">
+<title>priorities</title>
+<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-328 1044.3749,-328 1044.3749,4 -4,4"/>
+<!-- 1. stop / Running&#45;&gt;NotRunning -->
+<g id="node1" class="node">
+<title>1. stop / Running&#45;&gt;NotRunning</title>
+<ellipse fill="none" stroke="#000000" cx="124.139" cy="-234" rx="124.2781" ry="18"/>
+<text text-anchor="middle" x="124.139" y="-230.3" font-family="Times,serif" font-size="14.00" fill="#000000">1. stop / Running&#45;&gt;NotRunning</text>
+</g>
+<!-- 2. after(1 s) / Running&#45;&gt;Running -->
+<g id="node2" class="node">
+<title>2. after(1 s) / Running&#45;&gt;Running</title>
+<ellipse fill="none" stroke="#000000" cx="158.139" cy="-162" rx="128.0773" ry="18"/>
+<text text-anchor="middle" x="158.139" y="-158.3" font-family="Times,serif" font-size="14.00" fill="#000000">2. after(1 s) / Running&#45;&gt;Running</text>
+</g>
+<!-- 1. stop / Running&#45;&gt;NotRunning&#45;&gt;2. after(1 s) / Running&#45;&gt;Running -->
+<g id="edge1" class="edge">
+<title>1. stop / Running&#45;&gt;NotRunning&#45;&gt;2. after(1 s) / Running&#45;&gt;Running</title>
+<path fill="none" stroke="#00ff00" d="M132.7186,-215.8314C136.4748,-207.8771 140.9647,-198.369 145.1187,-189.5723"/>
+<polygon fill="#00ff00" stroke="#00ff00" points="148.3386,-190.9503 149.4438,-180.4133 142.0088,-187.9612 148.3386,-190.9503"/>
+</g>
+<!-- 3. [time == 0] / Running&#45;&gt;NotRunning -->
+<g id="node3" class="node">
+<title>3. [time == 0] / Running&#45;&gt;NotRunning</title>
+<ellipse fill="none" stroke="#000000" cx="173.139" cy="-90" rx="151.3732" ry="18"/>
+<text text-anchor="middle" x="173.139" y="-86.3" font-family="Times,serif" font-size="14.00" fill="#000000">3. [time == 0] / Running&#45;&gt;NotRunning</text>
+</g>
+<!-- 2. after(1 s) / Running&#45;&gt;Running&#45;&gt;3. [time == 0] / Running&#45;&gt;NotRunning -->
+<g id="edge2" class="edge">
+<title>2. after(1 s) / Running&#45;&gt;Running&#45;&gt;3. [time == 0] / Running&#45;&gt;NotRunning</title>
+<path fill="none" stroke="#00ff00" d="M161.9241,-143.8314C163.5284,-136.131 165.436,-126.9743 167.2189,-118.4166"/>
+<polygon fill="#00ff00" stroke="#00ff00" points="170.6897,-118.9169 169.3029,-108.4133 163.8368,-117.4892 170.6897,-118.9169"/>
+</g>
+<!-- 4. increase_time / Running&#45;&gt;Running -->
+<g id="node4" class="node">
+<title>4. increase_time / Running&#45;&gt;Running</title>
+<ellipse fill="none" stroke="#000000" cx="262.139" cy="-18" rx="145.6742" ry="18"/>
+<text text-anchor="middle" x="262.139" y="-14.3" font-family="Times,serif" font-size="14.00" fill="#000000">4. increase_time / Running&#45;&gt;Running</text>
+</g>
+<!-- 3. [time == 0] / Running&#45;&gt;NotRunning&#45;&gt;4. increase_time / Running&#45;&gt;Running -->
+<g id="edge3" class="edge">
+<title>3. [time == 0] / Running&#45;&gt;NotRunning&#45;&gt;4. increase_time / Running&#45;&gt;Running</title>
+<path fill="none" stroke="#00ff00" d="M195.5974,-71.8314C206.6432,-62.8955 220.1128,-51.9987 232.0367,-42.3524"/>
+<polygon fill="#00ff00" stroke="#00ff00" points="234.4228,-44.924 239.996,-35.9134 230.0202,-39.4818 234.4228,-44.924"/>
+</g>
+<!-- 5. start / NotRunning&#45;&gt;Running -->
+<g id="node5" class="node">
+<title>5. start / NotRunning&#45;&gt;Running</title>
+<ellipse fill="none" stroke="#000000" cx="504.139" cy="-234" rx="124.2781" ry="18"/>
+<text text-anchor="middle" x="504.139" y="-230.3" font-family="Times,serif" font-size="14.00" fill="#000000">5. start / NotRunning&#45;&gt;Running</text>
+</g>
+<!-- 6. stop / NotRunning&#45;&gt;NotRunning -->
+<g id="node6" class="node">
+<title>6. stop / NotRunning&#45;&gt;NotRunning</title>
+<ellipse fill="none" stroke="#000000" cx="529.139" cy="-162" rx="137.2758" ry="18"/>
+<text text-anchor="middle" x="529.139" y="-158.3" font-family="Times,serif" font-size="14.00" fill="#000000">6. stop / NotRunning&#45;&gt;NotRunning</text>
+</g>
+<!-- 5. start / NotRunning&#45;&gt;Running&#45;&gt;6. stop / NotRunning&#45;&gt;NotRunning -->
+<g id="edge4" class="edge">
+<title>5. start / NotRunning&#45;&gt;Running&#45;&gt;6. stop / NotRunning&#45;&gt;NotRunning</title>
+<path fill="none" stroke="#00ff00" d="M510.4475,-215.8314C513.1507,-208.0463 516.3706,-198.7729 519.37,-190.1347"/>
+<polygon fill="#00ff00" stroke="#00ff00" points="522.7717,-191.0081 522.7455,-180.4133 516.1589,-188.7119 522.7717,-191.0081"/>
+</g>
+<!-- 7. increase_time / NotRunning&#45;&gt;NotRunning -->
+<g id="node7" class="node">
+<title>7. increase_time / NotRunning&#45;&gt;NotRunning</title>
+<ellipse fill="none" stroke="#000000" cx="623.139" cy="-90" rx="171.6696" ry="18"/>
+<text text-anchor="middle" x="623.139" y="-86.3" font-family="Times,serif" font-size="14.00" fill="#000000">7. increase_time / NotRunning&#45;&gt;NotRunning</text>
+</g>
+<!-- 6. stop / NotRunning&#45;&gt;NotRunning&#45;&gt;7. increase_time / NotRunning&#45;&gt;NotRunning -->
+<g id="edge5" class="edge">
+<title>6. stop / NotRunning&#45;&gt;NotRunning&#45;&gt;7. increase_time / NotRunning&#45;&gt;NotRunning</title>
+<path fill="none" stroke="#00ff00" d="M552.3749,-144.2022C564.2381,-135.1156 578.8423,-123.9294 591.6966,-114.0836"/>
+<polygon fill="#00ff00" stroke="#00ff00" points="594.034,-116.7019 599.8445,-107.8425 589.7775,-111.1448 594.034,-116.7019"/>
+</g>
+<!-- 8. door_closed / DoorOpen&#45;&gt;DoorClosed -->
+<g id="node8" class="node">
+<title>8. door_closed / DoorOpen&#45;&gt;DoorClosed</title>
+<ellipse fill="none" stroke="#000000" cx="881.139" cy="-306" rx="157.872" ry="18"/>
+<text text-anchor="middle" x="881.139" y="-302.3" font-family="Times,serif" font-size="14.00" fill="#000000">8. door_closed / DoorOpen&#45;&gt;DoorClosed</text>
+</g>
+<!-- 9. increase_time / DoorOpen&#45;&gt;DoorOpen -->
+<g id="node9" class="node">
+<title>9. increase_time / DoorOpen&#45;&gt;DoorOpen</title>
+<ellipse fill="none" stroke="#000000" cx="881.139" cy="-234" rx="159.4721" ry="18"/>
+<text text-anchor="middle" x="881.139" y="-230.3" font-family="Times,serif" font-size="14.00" fill="#000000">9. increase_time / DoorOpen&#45;&gt;DoorOpen</text>
+</g>
+<!-- 8. door_closed / DoorOpen&#45;&gt;DoorClosed&#45;&gt;9. increase_time / DoorOpen&#45;&gt;DoorOpen -->
+<g id="edge6" class="edge">
+<title>8. door_closed / DoorOpen&#45;&gt;DoorClosed&#45;&gt;9. increase_time / DoorOpen&#45;&gt;DoorOpen</title>
+<path fill="none" stroke="#00ff00" d="M881.139,-287.8314C881.139,-280.131 881.139,-270.9743 881.139,-262.4166"/>
+<polygon fill="#00ff00" stroke="#00ff00" points="884.6391,-262.4132 881.139,-252.4133 877.6391,-262.4133 884.6391,-262.4132"/>
+</g>
+<!-- 0. door_opened / DoorClosed&#45;&gt;DoorOpen -->
+<g id="node10" class="node">
+<title>0. door_opened / DoorClosed&#45;&gt;DoorOpen</title>
+<ellipse fill="none" stroke="#000000" cx="352.139" cy="-306" rx="161.3716" ry="18"/>
+<text text-anchor="middle" x="352.139" y="-302.3" font-family="Times,serif" font-size="14.00" fill="#000000">0. door_opened / DoorClosed&#45;&gt;DoorOpen</text>
+</g>
+<!-- 0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;1. stop / Running&#45;&gt;NotRunning -->
+<g id="edge7" class="edge">
+<title>0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;1. stop / Running&#45;&gt;NotRunning</title>
+<path fill="none" stroke="#ff0000" d="M298.3949,-289.0282C264.5794,-278.3496 220.8376,-264.5364 185.639,-253.4211"/>
+<polygon fill="#ff0000" stroke="#ff0000" points="186.5429,-250.0362 175.9531,-250.3624 184.435,-256.7113 186.5429,-250.0362"/>
+</g>
+<!-- 0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;2. after(1 s) / Running&#45;&gt;Running -->
+<g id="edge8" class="edge">
+<title>0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;2. after(1 s) / Running&#45;&gt;Running</title>
+<path fill="none" stroke="#ff0000" d="M335.8242,-287.9756C317.7841,-268.6888 287.2706,-237.917 257.139,-216 240.8412,-204.1454 221.6433,-193.0933 204.5127,-184.1151"/>
+<polygon fill="#ff0000" stroke="#ff0000" points="205.7339,-180.8075 195.24,-179.3486 202.5337,-187.0332 205.7339,-180.8075"/>
+</g>
+<!-- 0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;3. [time == 0] / Running&#45;&gt;NotRunning -->
+<g id="edge9" class="edge">
+<title>0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;3. [time == 0] / Running&#45;&gt;NotRunning</title>
+<path fill="none" stroke="#ff0000" d="M347.701,-287.8744C338.1995,-250.3009 315.1263,-165.6187 295.139,-144 281.5529,-129.3051 263.2404,-118.3782 244.9395,-110.3499"/>
+<polygon fill="#ff0000" stroke="#ff0000" points="246.2661,-107.111 235.6875,-106.5247 243.5915,-113.58 246.2661,-107.111"/>
+</g>
+<!-- 0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;4. increase_time / Running&#45;&gt;Running -->
+<g id="edge10" class="edge">
+<title>0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;4. increase_time / Running&#45;&gt;Running</title>
+<path fill="none" stroke="#ff0000" d="M355.3795,-287.882C361.8063,-246.6199 372.3751,-143.686 333.139,-72 326.5029,-59.8756 315.8642,-49.6417 304.8205,-41.4538"/>
+<polygon fill="#ff0000" stroke="#ff0000" points="306.57,-38.4082 296.3558,-35.5938 302.5856,-44.1636 306.57,-38.4082"/>
+</g>
+<!-- 0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;5. start / NotRunning&#45;&gt;Running -->
+<g id="edge11" class="edge">
+<title>0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;5. start / NotRunning&#45;&gt;Running</title>
+<path fill="none" stroke="#ff0000" d="M389.3224,-288.3868C410.1631,-278.5149 436.3272,-266.1214 458.4135,-255.6594"/>
+<polygon fill="#ff0000" stroke="#ff0000" points="460.063,-258.751 467.602,-251.307 457.0663,-252.4248 460.063,-258.751"/>
+</g>
+<!-- 0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;6. stop / NotRunning&#45;&gt;NotRunning -->
+<g id="edge12" class="edge">
+<title>0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;6. stop / NotRunning&#45;&gt;NotRunning</title>
+<path fill="none" stroke="#ff0000" d="M489.3232,-296.4557C552.435,-288.9207 617.6234,-275.5605 637.139,-252 647.3454,-239.6781 645.5507,-229.6104 637.139,-216 628.0643,-201.3169 613.6544,-190.4927 598.28,-182.5641"/>
+<polygon fill="#ff0000" stroke="#ff0000" points="599.6835,-179.356 589.1494,-178.2232 596.6779,-185.6779 599.6835,-179.356"/>
+</g>
+<!-- 0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;7. increase_time / NotRunning&#45;&gt;NotRunning -->
+<g id="edge13" class="edge">
+<title>0. door_opened / DoorClosed&#45;&gt;DoorOpen&#45;&gt;7. increase_time / NotRunning&#45;&gt;NotRunning</title>
+<path fill="none" stroke="#ff0000" d="M486.7019,-296.0295C555.5666,-288.2463 630.0889,-274.7862 655.139,-252 691.2504,-219.1522 693.3939,-189.2744 675.139,-144 670.7792,-133.1872 663.1037,-123.3298 654.9666,-115.083"/>
+<polygon fill="#ff0000" stroke="#ff0000" points="657.1195,-112.3021 647.4459,-107.981 652.3135,-117.3916 657.1195,-112.3021"/>
+</g>
+</g>
+</svg>

+ 2 - 3
examples/microwave/model_microwave.xml

@@ -18,6 +18,7 @@
     <inport name="in">
       <event name="start"/>
       <event name="stop"/>
+      <event name="increase_time"/>
       <event name="door_opened"/>
       <event name="door_closed"/>
     </inport>
@@ -42,9 +43,7 @@
                   <param expr="time"/>
                 </raise>
               </transition>
-              <transition cond="time == 0" target="../NotRunning">
-                <raise port="out" event="ping"/>
-              </transition>
+              <transition cond="time == 0" target="../NotRunning"/>
             </state>
             <state id="NotRunning">
               <transition port="in" event="start" target="../Running">

examples/microwave/model_microwave_priorities.svg → examples/microwave/models/model_03_orthogonal_priorities.svg


+ 7 - 1
examples/microwave/run.py

@@ -4,9 +4,15 @@ from sccd.cd.parser.xml import *
 import GUI
 import tkinter
 from tkinter.constants import NO
+import sys
 
 if __name__ == '__main__':
-    cd = load_cd("model_microwave.xml")
+    if len(sys.argv) == 2:
+        model_path = sys.argv[1]
+    else:
+        model_path = "models/model_03_orthogonal.xml"
+
+    cd = load_cd(model_path)
 
     def send_event(event: str):
         eventloop.add_input_now(port="in", event_name=event)

examples/microwave/small_opened.png → examples/microwave/small_opened_off.png


BIN
examples/microwave/small_opened_on.png


+ 7 - 1
src/sccd/statechart/cmd/render_priorities.py

@@ -97,7 +97,13 @@ if __name__ == '__main__':
                         w.write("%s [label=\"\" shape=circle style=filled fixedsize=true width=0.4 height=0.4 fillcolor=\"grey\"];" % label)
                     return label
                 elif isinstance(t, Transition):
-                    return '"'+str(tree.transition_list.index(t)) + ". " + t.source.short_name + "->" + t.target.short_name+'"'
+                    trigger = ""
+                    guard = ""
+                    if t.trigger is not None:
+                        trigger = t.trigger.render()
+                    if t.guard is not None:
+                        guard = "["+t.guard.render()+"]"
+                    return '"'+str(tree.transition_list.index(t)) + ". " + trigger + guard + " / " + t.source.short_name + "->" + t.target.short_name+'"'
             def draw_edges(edges, color):
                 for high, low in edges:
                     w.write("%s -> %s [color=%s];" % (node_label(high), node_label(low), color))