2 var liba = require("../liba");
3 function assert(expr) {
8 function do_leak_check() {
9 for (const arg of arguments) {
12 if (liba.do_leak_check) {
24 [liba.mf.TRI, NL, NL, NM],
25 [liba.mf.TRI, NL, NM, NS],
26 [liba.mf.TRI, NM, NS, ZO],
27 [liba.mf.TRI, NS, ZO, PS],
28 [liba.mf.TRI, ZO, PS, PM],
29 [liba.mf.TRI, PS, PM, PL],
30 [liba.mf.TRI, PM, PL, PL],
40 [liba.mf.TRI, NL, NL, NM],
41 [liba.mf.TRI, NL, NM, NS],
42 [liba.mf.TRI, NM, NS, ZO],
43 [liba.mf.TRI, NS, ZO, PS],
44 [liba.mf.TRI, ZO, PS, PM],
45 [liba.mf.TRI, PS, PM, PL],
46 [liba.mf.TRI, PM, PL, PL],
56 [NL, NL, NM, NM, NS, ZO, ZO],
57 [NL, NL, NM, NS, NS, ZO, PS],
58 [NM, NM, NM, NS, ZO, PS, PS],
59 [NM, NM, NS, ZO, PS, PM, PM],
60 [NS, NS, ZO, PS, PS, PM, PM],
61 [NS, ZO, PS, PM, PM, PM, PL],
62 [ZO, ZO, PM, PM, PM, PL, PL],
72 [PL, PL, PM, PM, PS, ZO, ZO],
73 [PL, PL, PM, PS, PS, ZO, ZO],
74 [PL, PM, PS, PS, ZO, NS, NS],
75 [PM, PM, PS, ZO, NS, NM, NM],
76 [PM, PS, ZO, NS, NS, NM, NL],
77 [ZO, ZO, NS, NS, NM, NL, NL],
78 [ZO, ZO, NS, NM, NM, NL, NL],
81 [NS, PS, PL, PL, PL, PM, NS],
82 [NS, PS, PL, PM, PM, PS, ZO],
83 [ZO, PS, PM, PM, PS, PS, ZO],
84 [ZO, PS, PS, PS, PS, PS, ZO],
85 [ZO, ZO, ZO, ZO, ZO, ZO, ZO],
86 [NL, NS, NS, NS, NS, NS, NL],
87 [NL, NM, NM, NM, NS, NS, NL],
89 var ctx = new liba.pid_fuzzy();
90 ctx.rule(me, mec, mkp, mki, mkd).set_block(2);
91 ctx.kpid(10, 0.1, 1).op(liba.pid_fuzzy.EQU);
92 console.log(ctx.zero().run(10, 0));
93 console.log(ctx.zero().pos(10, 0));
94 console.log(ctx.zero().inc(10, 0));
95 assert("ctx.kp != undefined");
96 assert("ctx.ki != undefined");
97 assert("ctx.kd != undefined");
98 assert("ctx.summax != undefined");
99 assert("ctx.summin != undefined");
100 assert("ctx.sum != undefined");
101 assert("ctx.outmax != undefined");
102 assert("ctx.outmin != undefined");
103 assert("ctx.out != undefined");
104 assert("ctx.fdb != undefined");
105 assert("ctx.err != undefined");
106 assert("ctx.order != undefined");
107 assert("ctx.block != undefined");