1 import * as a from "liba.so";
2 function assert(expr) {
15 [a.mf.TRI, NL, NL, NM],
16 [a.mf.TRI, NL, NM, NS],
17 [a.mf.TRI, NM, NS, ZO],
18 [a.mf.TRI, NS, ZO, PS],
19 [a.mf.TRI, ZO, PS, PM],
20 [a.mf.TRI, PS, PM, PL],
21 [a.mf.TRI, PM, PL, PL],
31 [a.mf.TRI, NL, NL, NM],
32 [a.mf.TRI, NL, NM, NS],
33 [a.mf.TRI, NM, NS, ZO],
34 [a.mf.TRI, NS, ZO, PS],
35 [a.mf.TRI, ZO, PS, PM],
36 [a.mf.TRI, PS, PM, PL],
37 [a.mf.TRI, PM, PL, PL],
47 [NL, NL, NM, NM, NS, ZO, ZO],
48 [NL, NL, NM, NS, NS, ZO, PS],
49 [NM, NM, NM, NS, ZO, PS, PS],
50 [NM, NM, NS, ZO, PS, PM, PM],
51 [NS, NS, ZO, PS, PS, PM, PM],
52 [NS, ZO, PS, PM, PM, PM, PL],
53 [ZO, ZO, PM, PM, PM, PL, PL],
63 [PL, PL, PM, PM, PS, ZO, ZO],
64 [PL, PL, PM, PS, PS, ZO, ZO],
65 [PL, PM, PS, PS, ZO, NS, NS],
66 [PM, PM, PS, ZO, NS, NM, NM],
67 [PM, PS, ZO, NS, NS, NM, NL],
68 [ZO, ZO, NS, NS, NM, NL, NL],
69 [ZO, ZO, NS, NM, NM, NL, NL],
72 [NS, PS, PL, PL, PL, PM, NS],
73 [NS, PS, PL, PM, PM, PS, ZO],
74 [ZO, PS, PM, PM, PS, PS, ZO],
75 [ZO, PS, PS, PS, PS, PS, ZO],
76 [ZO, ZO, ZO, ZO, ZO, ZO, ZO],
77 [NL, NS, NS, NS, NS, NS, NL],
78 [NL, NM, NM, NM, NS, NS, NL],
80 var ctx = new a.pid_fuzzy();
81 ctx.rule(me, mec, mkp, mki, mkd);
84 ctx.op(a.pid_fuzzy.EQU);
85 console.log(ctx.run(10, 0));
87 console.log(ctx.pos(10, 0));
89 console.log(ctx.inc(10, 0));
91 assert("ctx.kp != undefined");
92 assert("ctx.ki != undefined");
93 assert("ctx.kd != undefined");
94 assert("ctx.summax != undefined");
95 assert("ctx.summin != undefined");
96 assert("ctx.sum != undefined");
97 assert("ctx.outmax != undefined");
98 assert("ctx.outmin != undefined");
99 assert("ctx.out != undefined");
100 assert("ctx.fdb != undefined");
101 assert("ctx.err != undefined");
102 assert("ctx.order != undefined");
103 assert("ctx.block != undefined");