|
@@ -1,27 +1 @@
|
|
|
-/ evalST
|
|
|
-/ pass the data generated
|
|
|
-/ by the compiled function
|
|
|
-/ to evalST to get an
|
|
|
-/ action that can be called
|
|
|
-
|
|
|
-// condition vec, actions vec, transition table, table args
|
|
|
-evalST: {[c;a;t;args] eidx:*&c[args]; ts: t[0;eidx]; (a[ts[0]];ts[1])};
|
|
|
-
|
|
|
-/ Actions
|
|
|
-A1: {[] "fan low"};
|
|
|
-A2: {[] "fan med"};
|
|
|
-A3: {[] "fan hig"};
|
|
|
-A4: {[] "heat on"};
|
|
|
-A5: {[] "acpw on"};
|
|
|
-A6: {[] "allp of"};
|
|
|
-
|
|
|
-c: {[args] T:args[0]; isOff:args[1]; (isOff;T<18;T<22;T<26;T<30;T>30)};
|
|
|
-a: (A1;A2;A3;A4;A5;A6);
|
|
|
-t: (((0N;1);(4;5);(1;2);(2;3);(3;4);(5;6));((6;1);(4;5);(0N;2);(2;3);(3;4);(5;6));((6;1);(4;5);(1;2);(0N;3);(3;4);(5;6));((6;1);(4;5);(1;2);(2;3);(0N;4);(5;6));((6;1);(0N;5);(1;2);(2;3);(3;4);(5;6));((6;1);(4;5);(1;2);(2;3);(3;4);(0N;6)));
|
|
|
-s: ("Off";"FanLow";"FanMedium";"FanHigh";"Heating";"Cooling");
|
|
|
-at: (`i;`i;`i); / T, isOff, current state - see c
|
|
|
-
|
|
|
-state: 0;
|
|
|
-(action;state): evalST[c;a;t;(20;0;state)];
|
|
|
-:action
|
|
|
-:s[state]
|
|
|
+evalST: {[args] (c;a;t;args):args; eidx:*&c[args]; ts: t[0;eidx]; (a[ts[0]];ts[1])};
|