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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* autogenerated from "macros/Branching/SWITCH2.sci" */
function SWITCH2() {
SWITCH2.prototype.define = function SWITCH2() {
var in1 = [[-1],[1],[-1]];
var ipar = [0];
this.nzz = 1;
var rpar = 0;
this.model = scicos_model();
this.model.sim = list(new ScilabString(["switch2"]), new ScilabDouble([4]));
this.model.in = new ScilabDouble(in1);
this.model.out = new ScilabDouble([-1]);
this.model.ipar = new ScilabDouble(ipar);
this.model.rpar = new ScilabDouble([rpar]);
this.model.nzcross = new ScilabDouble([this.nzz]);
this.model.nmode = new ScilabDouble([1]);
this.model.blocktype = new ScilabString(["c"]);
this.model.dep_ut = new ScilabDouble([true,false]);
this.exprs = [[string(ipar)],[string(rpar)],[string(this.nzz)]];
this.gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"SWITCH2\",sz(1),sz(2));"]);
this.x = new standard_define(new ScilabDouble([2,2]),this.model,this.exprs,this.gr_i);
return new BasicBlock(this.x);
}
SWITCH2.prototype.details = function SWITCH2() {
return this.x;
}
SWITCH2.prototype.get = function SWITCH2() {
var options = {
rule:["pass first input if: u2>=a (0), u2>a (1), u2~=a (2)",this.rule],
thra:["threshold a",this.thra],
nzz:["use zero crossing: yes (1), no (0)",this.nzz],
}
return options;
}
SWITCH2.prototype.set = function SWITCH2() {
this.rule = parseFloat(arguments[0]["rule"])
this.thra = arguments[0]["thra"]
this.nzz = parseFloat(arguments[0]["nzz"])
this.exprs = arguments[0]["exprs"]
this.exprs = this.graphics.exprs;
while (true) {
[ok,this.rule,this.thra,this.nzz,this.exprs] = scicos_getvalue("Set parameters",["pass first input if: u2>=a (0), u2>a (1), u2~=a (2)","threshold a","use zero crossing: yes (1), no (0)"],list("vec",1,"vec",1,"vec",1),this.exprs);
if (!ok) {
break;
}
this.rule = int(this.rule);
if ((this.rule<0)) {
this.rule = 0;
}
if ((this.rule>2)) {
this.rule = 2;
}
this.graphics.exprs = new ScilabDouble([this.exprs]);
this.model.ipar = new ScilabDouble([this.rule]);
this.model.rpar = new ScilabDouble([this.thra]);
if (this.nzz!=0) {
this.model.nmode = new ScilabDouble([1]);
this.model.nzcross = new ScilabDouble([1]);
} else {
this.model.nmode = new ScilabDouble([0]);
this.model.nzcross = new ScilabDouble([0]);
}
this.x.graphics = this.graphics;
this.x.model = this.model;
break;
}
return new BasicBlock(this.x);
}
}
|