-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstate.smc
47 lines (39 loc) · 1.45 KB
/
state.smc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
initial,
OFF {
OFF_CLOSE: _temperature=25,
OFF_OPEN;
},
ON {
ON_IDLE,
ON_OPEN : _temperature=25,
ACTIVE {
ON_ACTIVE_BOIL : _temperature=25+((Date.now()-_start)/1000)*1.25,
ON_ACTIVE_KEEP : _temperature=100;
};
# _water-=sec*10
ON_IDLE => ON_IDLE [color="blue"] : dispense(sec:number);
ON_IDLE => ON_OPEN [color="red"] : open();
# _start=Date.now()
ON_IDLE => ON_ACTIVE_BOIL [color="black"] : "_water>=10";
ON_IDLE => OFF_CLOSE [color="gray"] : plugOff();
# _water+=water
ON_OPEN => ON_OPEN [color="darkgreen"] : fill(water:number) ;
ON_OPEN => ON_IDLE [color="purple"] : close();
ON_OPEN => OFF_OPEN [color="gray"] : plugOff();
ACTIVE => ON_OPEN [color="red"] : open();
ACTIVE => OFF_CLOSE [color="gray"] : plugOff();
ON_ACTIVE_BOIL => ON_ACTIVE_KEEP [color="black"] : "_temperature>=100";
# _water-=sec*10
ON_ACTIVE_KEEP => ON_ACTIVE_KEEP [color="blue"] : dispense(sec:number);
# _start=Date.now()
ON_ACTIVE_KEEP => ON_ACTIVE_BOIL [color="orange"] : reboil();
ON_ACTIVE_KEEP => ON_IDLE [color="black"] : "_water<10";
};
# _water=0
initial => OFF_CLOSE;
# _water += water
OFF_OPEN => OFF_OPEN [color="darkgreen"] : fill(water:number);
OFF_OPEN => OFF_CLOSE [color="purple"] : close();
OFF_OPEN => ON_OPEN [color="pink"] : plugIn();
OFF_CLOSE => OFF_OPEN [color="red"] : open();
OFF_CLOSE => ON_IDLE [color="pink"] : plugIn();