1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <single_instance_cd>
- <!-- "Syntactic"-variant with "Choice" state, modeled as non-stable state -->
- <delta>1 ms</delta>
- <statechart>
- <semantics
- big_step_maximality="syntactic"
- input_event_lifeline="whole"
- same_source_priority="explicit"
- />
- <datamodel>
- import GUI;
- time = 0;
- checkStartTime = func {
- if (time == 0) {
- time = 30;
- display_time(time);
- }
- };
- </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="bell"/>
- </outport>
- <root initial="NotRunning">
- <state id="Running" initial="Running">
- <onentry> <raise port="out" event="micro_on"/> </onentry>
- <onexit> <raise port="out" event="micro_off"/> </onexit>
- <transition port="in" event="stop" target="../NotRunning"/>
- <state id="Running" stable="true">
- <transition after="1 s" target="../Choice">
- <code> time -= 1; display_time(time); </code>
- </transition>
- <transition port="in" event="increase_time" target=".">
- <code> time += 10; display_time(time); </code>
- </transition>
- </state>
- <state id="Choice">
- <transition cond="time > 0" target="../Running"/>
- <transition cond="time == 0" target="/NotRunning">
- <raise port="out" event="bell"/>
- </transition>
- </state>
- </state>
- <state id="NotRunning" stable="true">
- <transition port="in" event="start" target="../Running">
- <code> checkStartTime(); </code>
- </transition>
- <transition port="in" event="stop" target=".">
- <code> time = 0; display_time(time); </code>
- </transition>
- <transition port="in" event="increase_time" target=".">
- <code> time += 10; display_time(time); </code>
- </transition>
- </state>
- </root>
- </statechart>
- </single_instance_cd>
|