/* autogenerated from "macros/Branching/SWITCH2.sci" */ function SWITCH2() { SWITCH2.prototype.define = function SWITCH2() { in1 = [[-1],[1],[-1]]; ipar = [0]; this.nzz = 1; rpar = 0; model = scicos_model(); model.sim = list("switch2",4); model.in1 = in1; model.out = -1; model.ipar = ipar; model.rpar = rpar; model.nzcross = this.nzz; model.nmode = 1; model.blocktype = "c"; model.dep_ut = [true,false]; exprs = [[string(ipar)],[string(rpar)],[string(this.nzz)]]; gr_i = []; this.x = standard_define([2,2],model,exprs,gr_i); return new BasicBlock(this.x); } SWITCH2.prototype.details = function SWITCH2() { return this.x; } SWITCH2.prototype.get = function SWITCH2() { } SWITCH2.prototype.set = function SWITCH2() { this.rule = parseFloat((arguments[0]["rule"])) this.thra = parseFloat((arguments[0]["thra"])) this.nzz = parseFloat((arguments[0]["nzz"])) this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { [ok,this.rule,this.thra,this.nzz,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),exprs); if (!ok) { break; } this.rule = int(this.rule); if ((this.rule<0)) { this.rule = 0; } if ((this.rule>2)) { this.rule = 2; } graphics.exprs = exprs; model.ipar = this.rule; model.rpar = this.thra; if (this.nzz!=0) { model.nmode = 1; model.nzcross = 1; } else { model.nmode = 0; model.nzcross = 0; } this.x.graphics = graphics; this.x.model = model; break; } return new BasicBlock(this.x); } }