diff options
author | Sunil Shetye | 2018-07-09 11:43:39 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-07-09 12:16:25 +0530 |
commit | 62b1d7dd9183ed75733b44104890586b03818214 (patch) | |
tree | 9859e9ca295df98df945bd5fcccc3a264e8bede1 /js/Branching/SWITCH2_m.js | |
parent | 5c011853630a1b466ef4789d5b600dd530d0a3ec (diff) | |
download | sci2js-62b1d7dd9183ed75733b44104890586b03818214.tar.gz sci2js-62b1d7dd9183ed75733b44104890586b03818214.tar.bz2 sci2js-62b1d7dd9183ed75733b44104890586b03818214.zip |
support ScilabBoolean, ScilabDouble, ScilabString
Diffstat (limited to 'js/Branching/SWITCH2_m.js')
-rw-r--r-- | js/Branching/SWITCH2_m.js | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/js/Branching/SWITCH2_m.js b/js/Branching/SWITCH2_m.js index 6797c0b8..b43d42fd 100644 --- a/js/Branching/SWITCH2_m.js +++ b/js/Branching/SWITCH2_m.js @@ -4,23 +4,23 @@ function SWITCH2_m() { ipar = [0]; this.nzz = 1; rpar = 0; - model = scicos_model(); - model.sim = list("switch2_m",4); - model.in1 = [[-1],[1],[-1]]; - model.in2 = [[-2],[1],[-2]]; - model.intyp = 1; - model.out = -1; - model.out2 = -2; - model.outtyp = 1; - model.ipar = ipar; - model.rpar = rpar; - model.nzcross = this.nzz; - model.nmode = 1; - model.blocktype = "c"; - model.dep_ut = [true,false]; + this.model = scicos_model(); + this.model.sim = list("switch2_m",4); + this.model.in1 = [[-1],[1],[-1]]; + this.model.in2 = [[-2],[1],[-2]]; + this.model.intyp = new ScilabDouble(1); + this.model.out = new ScilabDouble(-1); + this.model.out2 = new ScilabDouble(-2); + this.model.outtyp = new ScilabDouble(1); + this.model.ipar = 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 = [true,false]; exprs = [[sci2exp(1)],[string(ipar)],[string(rpar)],[string(this.nzz)]]; gr_i = []; - this.x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],this.model,exprs,gr_i); return new BasicBlock(this.x); } SWITCH2_m.prototype.details = function SWITCH2_m() { @@ -43,7 +43,7 @@ function SWITCH2_m() { this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; - model = arg1.model; + this.model = arg1.model; while (true) { [ok,this.ot,this.rule,this.thra,this.nzz,exprs] = scicos_getvalue("Set parameters",["Datatype (1=real double 2=complex 3=int32 ...)","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,"vec",1),exprs); if (!ok) { @@ -57,14 +57,14 @@ function SWITCH2_m() { this.rule = 2; } graphics.exprs = exprs; - model.ipar = this.rule; - model.rpar = this.thra; + this.model.ipar = new ScilabDouble(this.rule); + this.model.rpar = new ScilabDouble(this.thra); if (this.nzz!=0) { - model.nmode = 1; - model.nzcross = 1; + this.model.nmode = new ScilabDouble(1); + this.model.nzcross = new ScilabDouble(1); } else { - model.nmode = 0; - model.nzcross = 0; + this.model.nmode = new ScilabDouble(0); + this.model.nzcross = new ScilabDouble(0); } if (((this.ot<1)||(this.ot>8))&&(this.ot!=-1)) { message("Datatype is not supported"); @@ -74,13 +74,13 @@ function SWITCH2_m() { it[1-1] = this.ot; it[2-1] = 1; it[3-1] = this.ot; - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,this.ot),[],[]); + in1 = [this.model.in1,this.model.in2]; + out = [this.model.out,this.model.out2]; + [model,graphics,ok] = set_io(this.model,graphics,list(in1,it),list(out,this.ot),[],[]); } if (ok) { this.x.graphics = graphics; - this.x.model = model; + this.x.model = this.model; break; } } |