Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec-tests / tests / automata / microwave.lus @ cab90631

History | View | Annotate | Download (922 Bytes)

1
node microwave_basic (start, clear: bool; door_closed: bool; steps_to_cook: int) returns (mode: int);
2
var steps_remaining: int;
3
let
4
  automaton microwave_automaton
5
  state SETUP :
6
  let
7
    mode = 1;
8
    steps_remaining = steps_to_cook;
9
  tel until start && steps_to_remaining > 0 restart RUNNING
10
  
11
  state RUNNING :
12
  let
13
    automaton microwave_running
14
    state RUNNING_ENTRY :
15
    unless door_closed restart COOKING
16
    unless not door_closed restart SUSPENDED
17
    let
18
      -- nothing is computed
19
      mode = 1; -- but this assign is transient and invisible
20
    tel
21
    
22
    state COOKING :
23
    unless clear || not door_closed restart SUSPENDED
24
    let
25
      mode = 2;
26
      steps_remaining = pre steps_remaining - 1;
27
    tel
28

    
29
    state SUSPENDED :
30
    unless start && door_closed restart COOKING
31
    unless clear restart SETUP
32
    let
33
      mode = 3;
34
    tel
35
  tel
36
  until steps_remaining <= 0 restart SETUP
37
  
38
tel