diff options
Diffstat (limited to 'js/Misc')
54 files changed, 984 insertions, 606 deletions
diff --git a/js/Misc/BACKLASH.js b/js/Misc/BACKLASH.js index 3f3b3c3d..e08062fc 100644 --- a/js/Misc/BACKLASH.js +++ b/js/Misc/BACKLASH.js @@ -26,15 +26,15 @@ function BACKLASH() { model = arg1.model; rpar = model.rpar; while (true) { - [ok,ini,gap,zcr,exprs] = scicos_getvalue("Set backlash parameters",[["initial output"],["gap"],["use zero-crossing (0:no, 1:yes)"]],list("vec",1,"vec",1,"vec",1),exprs); + [ok,this.ini,this.gap,this.zcr,exprs] = scicos_getvalue("Set backlash parameters",[["initial output"],["gap"],["use zero-crossing (0:no, 1:yes)"]],list("vec",1,"vec",1,"vec",1),exprs); if (!ok) { break; } if (ok) { graphics.exprs = exprs; - rpar[1-1] = ini; - rpar[2-1] = gap; - if (zcr!=0) { + rpar[1-1] = this.ini; + rpar[2-1] = this.gap; + if (this.zcr!=0) { model.nzcross = 2; } else { model.nzcross = 0; diff --git a/js/Misc/BACKLASH.pickle b/js/Misc/BACKLASH.pickle index 0d1dde24..27a56fa7 100644 --- a/js/Misc/BACKLASH.pickle +++ b/js/Misc/BACKLASH.pickle @@ -4,6 +4,12 @@ p0 ((lp1 S'x' p2 -atp3 -Rp4 +aS'ini' +p3 +aS'zcr' +p4 +aS'gap' +p5 +atp6 +Rp7 .
\ No newline at end of file diff --git a/js/Misc/BOUNCE.js b/js/Misc/BOUNCE.js index a9558881..85fa5460 100644 --- a/js/Misc/BOUNCE.js +++ b/js/Misc/BOUNCE.js @@ -12,28 +12,28 @@ function BOUNCE() { k = k+1; } } - walls = [[0],[5],[0],[5]]; + this.walls = [[0],[5],[0],[5]]; this.x = [[2],[2.5]]; - xd = [[0],[0]]; - y = [[3],[5]]; - yd = [[0],[0]]; - g = 9.81; - C = 0; - rpar1 = ones(n,1); - rpar2 = rpar1; - state = [this.x,xd,y,yd]; + this.xd = [[0],[0]]; + this.y = [[3],[5]]; + this.yd = [[0],[0]]; + this.g = 9.81; + this.C = 0; + this.rpar1 = ones(n,1); + this.rpar2 = this.rpar1; + state = [this.x,this.xd,this.y,this.yd]; state = transpose(state); model = scicos_model(); model.sim = list("bounce_ball",4); model.in1 = []; model.out = [[n],[n]]; model.state = state.slice(); - model.rpar = [[rpar1],[rpar2],[walls],[g],[C]]; + model.rpar = [[this.rpar1],[this.rpar2],[this.walls],[this.g],[this.C]]; model.ipar = ipar; model.nzcross = n*(n-1)/2+4*n; model.blocktype = "c"; model.dep_ut = [false,true]; - exprs = [[strcat(sci2exp(rpar1))],[strcat(sci2exp(rpar2))],[strcat(sci2exp(walls))],[strcat(sci2exp(this.x))],[strcat(sci2exp(xd))],[strcat(sci2exp(y))],[strcat(sci2exp(yd))]]; + exprs = [[strcat(sci2exp(this.rpar1))],[strcat(sci2exp(this.rpar2))],[strcat(sci2exp(this.walls))],[strcat(sci2exp(this.x))],[strcat(sci2exp(this.xd))],[strcat(sci2exp(this.y))],[strcat(sci2exp(this.yd))]]; gr_i = []; this.x = standard_define([3,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -53,28 +53,28 @@ function BOUNCE() { exprs[9-1] = "0"; } while (true) { - [ok,rpar1,rpar2,walls,xt,xd,y,yd,g,C,exprs] = scicos_getvalue(["Set Bounce Block"],[["Mass"],["Radius"],["[xmin,xmax,ymin,ymax]"],["xpos"],["xdpos"],["ypos"],["ydpos"],["g (gravity)"],["C (aerodynamic coeff"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1),exprs); + [ok,this.rpar1,this.rpar2,this.walls,this.xt,this.xd,this.y,this.yd,this.g,this.C,exprs] = scicos_getvalue(["Set Bounce Block"],[["Mass"],["Radius"],["[xmin,xmax,ymin,ymax]"],["xpos"],["xdpos"],["ypos"],["ydpos"],["g (gravity)"],["C (aerodynamic coeff"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1),exprs); if (!ok) { break; } - xt = xt.slice(); - y = y.slice(); - xd = xd.slice(); - yd = yd.slice(); - rpar1 = rpar1.slice(); - rpar2 = rpar2.slice(); - n = size(xt,"*"); - walls = walls.slice(); - if (walls[1-1]>walls[2-1]) { - walls = walls[[2,1]-1]; + this.xt = this.xt.slice(); + this.y = this.y.slice(); + this.xd = this.xd.slice(); + this.yd = this.yd.slice(); + this.rpar1 = this.rpar1.slice(); + this.rpar2 = this.rpar2.slice(); + n = size(this.xt,"*"); + this.walls = this.walls.slice(); + if (this.walls[1-1]>this.walls[2-1]) { + this.walls = this.walls[[2,1]-1]; } - if (walls[3-1]>walls[3-1]) { - walls = walls[[3,4]-1]; + if (this.walls[3-1]>this.walls[3-1]) { + this.walls = this.walls[[3,4]-1]; } - if (n!=size(y,"*")||n!=size(rpar1,"*")||n!=size(rpar2,"*")||n!=size(xd,"*")||n!=size(yd,"*")) { + if (n!=size(this.y,"*")||n!=size(this.rpar1,"*")||n!=size(this.rpar2,"*")||n!=size(this.xd,"*")||n!=size(this.yd,"*")) { message("All vectors must have equal size"); ok = false; - } else if (!(min([[rpar1],[rpar2]])>0)) { + } else if (!(min([[this.rpar1],[this.rpar2]])>0)) { message("Mass and radius must be >0"); ok = false; } @@ -93,9 +93,9 @@ function BOUNCE() { k = k+1; } } - model.rpar = [[rpar1],[rpar2],[walls],[g],[C]]; + model.rpar = [[this.rpar1],[this.rpar2],[this.walls],[this.g],[this.C]]; model.ipar = ipar; - state = [xt,xd,y,yd]; + state = [this.xt,this.xd,this.y,this.yd]; state = transpose(state); model.state = state.slice(); model.nzcross = n*(n-1)/2+4*n; diff --git a/js/Misc/BOUNCE.pickle b/js/Misc/BOUNCE.pickle index 0d1dde24..d2d4ed4e 100644 --- a/js/Misc/BOUNCE.pickle +++ b/js/Misc/BOUNCE.pickle @@ -2,8 +2,26 @@ c__builtin__ set p0 ((lp1 -S'x' +S'C' p2 -atp3 -Rp4 +aS'g' +p3 +aS'yd' +p4 +aS'xd' +p5 +aS'walls' +p6 +aS'rpar1' +p7 +aS'rpar2' +p8 +aS'y' +p9 +aS'x' +p10 +aS'xt' +p11 +atp12 +Rp13 .
\ No newline at end of file diff --git a/js/Misc/BOUNCEXY.js b/js/Misc/BOUNCEXY.js index 694adf68..7e67bc1f 100644 --- a/js/Misc/BOUNCEXY.js +++ b/js/Misc/BOUNCEXY.js @@ -1,14 +1,14 @@ /* autogenerated from "macros/Misc/BOUNCEXY.sci" */ function BOUNCEXY() { BOUNCEXY.prototype.define = function BOUNCEXY() { - win = -1; - imode = 1; - clrs = [[1],[2]]; - siz = [[1],[1]]; - xmin = -5; - xmax = 5; - ymin = 0; - ymax = 15; + this.win = -1; + this.imode = 1; + this.clrs = [[1],[2]]; + this.siz = [[1],[1]]; + this.xmin = -5; + this.xmax = 5; + this.ymin = 0; + this.ymax = 15; model = scicos_model(); model.sim = list("bouncexy",4); model.in1 = [[-1],[-1]]; @@ -16,21 +16,21 @@ function BOUNCEXY() { model.intyp = [[1],[1]]; model.evtin = 1; z = []; - for (i=1;i<=size(clrs,"*");i+=1) { + for (i=1;i<=size(this.clrs,"*");i+=1) { z[6*(i-1)+1-1] = 0; z[6*(i-1)+2-1] = 0; - z[6*(i-1)+3-1] = 2*siz[i-1]; - z[6*(i-1)+4-1] = 2*siz[i-1]; + z[6*(i-1)+3-1] = 2*this.siz[i-1]; + z[6*(i-1)+4-1] = 2*this.siz[i-1]; z[6*(i-1)+5-1] = 0.000; z[6*(i-1)+6-1] = 64.0*360.000; } model.dstate = z; - model.rpar = [[xmin],[xmax],[ymin],[ymax]]; - model.ipar = [[win],[imode],[clrs.slice()]]; + model.rpar = [[this.xmin],[this.xmax],[this.ymin],[this.ymax]]; + model.ipar = [[this.win],[this.imode],[this.clrs.slice()]]; model.blocktype = "d"; model.firing = []; model.dep_ut = [false,false]; - exprs = [[strcat(sci2exp(clrs))],[strcat(sci2exp(siz))],[strcat(sci2exp(win))],[strcat(sci2exp(1))],[strcat(sci2exp(xmin))],[strcat(sci2exp(xmax))],[strcat(sci2exp(ymin))],[strcat(sci2exp(ymax))]]; + exprs = [[strcat(sci2exp(this.clrs))],[strcat(sci2exp(this.siz))],[strcat(sci2exp(this.win))],[strcat(sci2exp(1))],[strcat(sci2exp(this.xmin))],[strcat(sci2exp(this.xmax))],[strcat(sci2exp(this.ymin))],[strcat(sci2exp(this.ymax))]]; gr_i = []; this.x = standard_define([2,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -47,38 +47,38 @@ function BOUNCEXY() { model = arg1.model; dstate = model.dstate; while (true) { - [ok,clrs,siz,win,imode,xmin,xmax,ymin,ymax,exprs] = scicos_getvalue("Set Scope parameters",[["colors"],["radii"],["window number (-1 for automatic)"],["animation mode (0,1)"],["Xmin"],["Xmax"],["Ymin"],["Ymax"]],list("vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + [ok,this.clrs,this.siz,this.win,this.imode,this.xmin,this.xmax,this.ymin,this.ymax,exprs] = scicos_getvalue("Set Scope parameters",[["colors"],["radii"],["window number (-1 for automatic)"],["animation mode (0,1)"],["Xmin"],["Xmax"],["Ymin"],["Ymax"]],list("vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); if (!ok) { break; } mess = []; - if (size(clrs,"*")!=size(siz,"*")) { + if (size(this.clrs,"*")!=size(this.siz,"*")) { mess = [[mess],["colors and radii must have equal size (number of balls)"],[" "]]; ok = false; } - if (win<-1) { + if (this.win<-1) { mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; ok = false; } - if (ymin>=ymax) { + if (this.ymin>=this.ymax) { mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; ok = false; } - if (xmin>=xmax) { + if (this.xmin>=this.xmax) { mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; ok = false; } if (!ok) { message(mess); } else { - rpar = [[xmin],[xmax],[ymin],[ymax]]; - ipar = [[win],[imode],[clrs.slice()]]; + rpar = [[this.xmin],[this.xmax],[this.ymin],[this.ymax]]; + ipar = [[this.win],[this.imode],[this.clrs.slice()]]; z = []; - for (i=1;i<=size(clrs,"*");i+=1) { + for (i=1;i<=size(this.clrs,"*");i+=1) { z[6*(i-1)+1-1] = 0; z[6*(i-1)+2-1] = 0; - z[6*(i-1)+3-1] = 2*siz[i-1]; - z[6*(i-1)+4-1] = 2*siz[i-1]; + z[6*(i-1)+3-1] = 2*this.siz[i-1]; + z[6*(i-1)+4-1] = 2*this.siz[i-1]; z[6*(i-1)+5-1] = 0.000; z[6*(i-1)+6-1] = 64.0*360.000; } diff --git a/js/Misc/BOUNCEXY.pickle b/js/Misc/BOUNCEXY.pickle index 0d1dde24..126d53ae 100644 --- a/js/Misc/BOUNCEXY.pickle +++ b/js/Misc/BOUNCEXY.pickle @@ -2,8 +2,24 @@ c__builtin__ set p0 ((lp1 -S'x' +S'clrs' p2 -atp3 -Rp4 +aS'siz' +p3 +aS'ymax' +p4 +aS'imode' +p5 +aS'xmax' +p6 +aS'win' +p7 +aS'xmin' +p8 +aS'x' +p9 +aS'ymin' +p10 +atp11 +Rp12 .
\ No newline at end of file diff --git a/js/Misc/BPLATFORM.js b/js/Misc/BPLATFORM.js index ec1ad3a7..ed9aa786 100644 --- a/js/Misc/BPLATFORM.js +++ b/js/Misc/BPLATFORM.js @@ -1,19 +1,19 @@ /* autogenerated from "macros/Misc/BPLATFORM.sci" */ function BPLATFORM() { BPLATFORM.prototype.define = function BPLATFORM() { - plen = 2; - csiz = 2; - phi = 0; - xmin = -5; - xmax = 5; - ymin = 0; - ymax = 15; + this.plen = 2; + this.csiz = 2; + this.phi = 0; + this.xmin = -5; + this.xmax = 5; + this.ymin = 0; + this.ymax = 15; model = scicos_model(); model.sim = list("bplatform2",5); model.in1 = [[1],[1]]; model.evtin = 1; model.dstate = 0; - model.rpar = [[plen],[csiz],[phi],[xmin],[xmax],[ymin],[ymax]]; + model.rpar = [[this.plen],[this.csiz],[this.phi],[this.xmin],[this.xmax],[this.ymin],[this.ymax]]; model.blocktype = "d"; model.dep_ut = [false,false]; exprs = string(model.rpar); @@ -33,27 +33,27 @@ function BPLATFORM() { model = arg1.model; dstate = model.dstate; while (true) { - [ok,plen,csiz,phi,xmin,xmax,ymin,ymax,exprs] = scicos_getvalue("Set Scope parameters",[["pendulum length"],["cart size (square side)"],["slope"],["Xmin"],["Xmax"],["Ymin"],["Ymax"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + [ok,this.plen,this.csiz,this.phi,this.xmin,this.xmax,this.ymin,this.ymax,exprs] = scicos_getvalue("Set Scope parameters",[["pendulum length"],["cart size (square side)"],["slope"],["Xmin"],["Xmax"],["Ymin"],["Ymax"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); if (!ok) { break; } mess = []; - if (plen<=0||csiz<=0) { + if (this.plen<=0||this.csiz<=0) { mess = [[mess],["Pendulum length and cart size must be positive."],[" "]]; ok = false; } - if (ymin>=ymax) { + if (this.ymin>=this.ymax) { mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; ok = false; } - if (xmin>=xmax) { + if (this.xmin>=this.xmax) { mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; ok = false; } if (!ok) { message(mess); } else { - rpar = [[plen],[csiz],[phi],[xmin],[xmax],[ymin],[ymax]]; + rpar = [[this.plen],[this.csiz],[this.phi],[this.xmin],[this.xmax],[this.ymin],[this.ymax]]; model.rpar = rpar; graphics.exprs = exprs; this.x.graphics = graphics; diff --git a/js/Misc/BPLATFORM.pickle b/js/Misc/BPLATFORM.pickle index 0d1dde24..b9b40604 100644 --- a/js/Misc/BPLATFORM.pickle +++ b/js/Misc/BPLATFORM.pickle @@ -2,8 +2,22 @@ c__builtin__ set p0 ((lp1 -S'x' +S'phi' p2 -atp3 -Rp4 +aS'ymax' +p3 +aS'csiz' +p4 +aS'xmax' +p5 +aS'plen' +p6 +aS'xmin' +p7 +aS'x' +p8 +aS'ymin' +p9 +atp10 +Rp11 .
\ No newline at end of file diff --git a/js/Misc/CBLOCK.js b/js/Misc/CBLOCK.js index 79830868..305ce9f7 100644 --- a/js/Misc/CBLOCK.js +++ b/js/Misc/CBLOCK.js @@ -9,10 +9,10 @@ function CBLOCK() { z0 = []; typ = "c"; auto = []; - rpar = []; - ipar = []; + this.rpar = []; + this.ipar = []; funam = "toto"; - ng = 0; + this.ng = 0; model = scicos_model(); model.sim = list(" ",2004); model.in1 = in1; @@ -21,13 +21,13 @@ function CBLOCK() { model.evtout = clkout; model.state = x0; model.dstate = z0; - model.rpar = rpar; - model.ipar = ipar; + model.rpar = this.rpar; + model.ipar = this.ipar; model.blocktype = typ; model.firing = auto; model.dep_ut = [true,false]; - model.nzcross = ng; - label = list(transpose([funam,"n",sci2exp(in1),sci2exp(out),sci2exp(clkin),sci2exp(clkout),sci2exp(x0),sci2exp(0),sci2exp(z0),sci2exp(rpar),sci2exp(ipar),sci2exp(auto),"y","n"]),[]); + model.nzcross = this.ng; + label = list(transpose([funam,"n",sci2exp(in1),sci2exp(out),sci2exp(clkin),sci2exp(clkout),sci2exp(x0),sci2exp(0),sci2exp(z0),sci2exp(this.rpar),sci2exp(this.ipar),sci2exp(auto),"y","n"]),[]); gr_i = []; this.x = standard_define([4,2],model,label,gr_i); return new BasicBlock(this.x); @@ -43,53 +43,53 @@ function CBLOCK() { graphics = arg1.graphics; label = graphics.exprs; while (true) { - [ok,function_name,impli,i,o,ci,co,xx,ng,z,rpar,ipar,auto0,depu,dept,lab] = scicos_getvalue("Set C-Block2 block parameters",[["simulation function"],["is block implicit? (y,n)"],["input ports sizes"],["output ports sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["number of zero crossing surfaces"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"str",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%6)","str",1,"str",1),label[1-1]); + [ok,this.function_name,this.impli,this.i,this.o,this.ci,this.co,this.xx,this.ng,this.z,this.rpar,this.ipar,this.auto0,this.depu,this.dept,this.lab] = scicos_getvalue("Set C-Block2 block parameters",[["simulation function"],["is block implicit? (y,n)"],["input ports sizes"],["output ports sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["number of zero crossing surfaces"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"str",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%6)","str",1,"str",1),label[1-1]); if (!ok) { break; } - label[1-1] = lab; - funam = stripblanks(function_name); - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - ipar = int(ipar.slice()); - nx = size(xx,1); - nz = size(z,1); - i = int(i.slice()); - o = int(o.slice()); - nout = size(o,1); - ci = int(ci.slice()); - nevin = size(ci,1); - co = int(co.slice()); - nevout = size(co,1); - if (part(impli,1)=="y") { + label[1-1] = this.lab; + funam = stripblanks(this.function_name); + this.xx = this.xx.slice(); + this.z = this.z.slice(); + this.rpar = this.rpar.slice(); + this.ipar = int(this.ipar.slice()); + nx = size(this.xx,1); + nz = size(this.z,1); + this.i = int(this.i.slice()); + this.o = int(this.o.slice()); + nout = size(this.o,1); + this.ci = int(this.ci.slice()); + nevin = size(this.ci,1); + this.co = int(this.co.slice()); + nevout = size(this.co,1); + if (part(this.impli,1)=="y") { funtyp = 12004; } else { funtyp = 2004; } - if ([[ci],[co]]!=[]) { - if (max([[ci],[co]])>1) { + if ([[this.ci],[this.co]]!=[]) { + if (max([[this.ci],[this.co]])>1) { message("vector event links not supported"); ok = false; } } - depu = stripblanks(depu); - if (part(depu,1)=="y") { - depu = true; + this.depu = stripblanks(this.depu); + if (part(this.depu,1)=="y") { + this.depu = true; } else { - depu = false; + this.depu = false; } - dept = stripblanks(dept); - if (part(dept,1)=="y") { - dept = true; + this.dept = stripblanks(this.dept); + if (part(this.dept,1)=="y") { + this.dept = true; } else { - dept = false; + this.dept = false; } - dep_ut = [depu,dept]; + dep_ut = [this.depu,this.dept]; if (funam==" ") { break; } - if (model.sim[1-1]!=funam||sign(size(model.state,"*"))!=sign(nx)||sign(size(model.dstate,"*"))!=sign(nz)||model.nzcross!=ng||sign(size(model.evtout,"*"))!=sign(nevout)) { + if (model.sim[1-1]!=funam||sign(size(model.state,"*"))!=sign(nx)||sign(size(model.dstate,"*"))!=sign(nz)||model.nzcross!=this.ng||sign(size(model.evtout,"*"))!=sign(nevout)) { tt = []; } tt = label[2-1]; @@ -100,20 +100,20 @@ function CBLOCK() { break; } } else { - [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); + [model,graphics,ok] = check_io(model,graphics,this.i,this.o,this.ci,this.co); if (ok) { model.sim = list(funam,funtyp); - model.in1 = i; - model.out = o; - model.evtin = ci; - model.evtout = co; - model.state = xx; - model.dstate = z; - model.rpar = rpar; - model.ipar = ipar; - model.firing = auto0; + model.in1 = this.i; + model.out = this.o; + model.evtin = this.ci; + model.evtout = this.co; + model.state = this.xx; + model.dstate = this.z; + model.rpar = this.rpar; + model.ipar = this.ipar; + model.firing = this.auto0; model.dep_ut = dep_ut; - model.nzcross = ng; + model.nzcross = this.ng; label[2-1] = tt; this.x.model = model; graphics.exprs = label; diff --git a/js/Misc/CBLOCK.pickle b/js/Misc/CBLOCK.pickle index 0d1dde24..03de52dc 100644 --- a/js/Misc/CBLOCK.pickle +++ b/js/Misc/CBLOCK.pickle @@ -2,8 +2,38 @@ c__builtin__ set p0 ((lp1 -S'x' +S'impli' p2 -atp3 -Rp4 +aS'co' +p3 +aS'i' +p4 +aS'auto0' +p5 +aS'ci' +p6 +aS'o' +p7 +aS'ng' +p8 +aS'depu' +p9 +aS'dept' +p10 +aS'xx' +p11 +aS'rpar' +p12 +aS'lab' +p13 +aS'ipar' +p14 +aS'x' +p15 +aS'z' +p16 +aS'function_name' +p17 +atp18 +Rp19 .
\ No newline at end of file diff --git a/js/Misc/CBLOCK4.js b/js/Misc/CBLOCK4.js index f0d39733..42697562 100644 --- a/js/Misc/CBLOCK4.js +++ b/js/Misc/CBLOCK4.js @@ -27,55 +27,55 @@ function CBLOCK4() { graphics = arg1.graphics; label = graphics.exprs; while (true) { - [ok,function_name,impli,in1,it,out,ot,ci,co,xx,z,oz,rpar,ipar,opar,nmode,nzcr,auto0,depu,dept,lab] = scicos_getvalue("Set C-Block4 block parameters",[["Simulation function"],["Is block implicit? (y,n)"],["Input ports sizes"],["Input ports type"],["Output port sizes"],["Output ports type"],["Input event ports sizes"],["Output events ports sizes"],["Initial continuous state"],["Initial discrete state"],["Initial object state"],["Real parameters vector"],["Integer parameters vector"],["Object parameters list"],["Number of modes"],["Number of zero crossings"],["Initial firing vector (<0 for no firing)"],["Direct feedthrough (y or n)"],["Time dependence (y or n)"]],list("str",1,"str",1,"mat",[-1,2],"vec",-1,"mat",[-1,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"lis",-1,"vec",-1,"vec",-1,"lis",-1,"vec",1,"vec",1,"vec","sum(%8)","str",1,"str",1),label[1-1]); + [ok,this.function_name,this.impli,this.in1,this.it,this.out,this.ot,this.ci,this.co,this.xx,this.z,this.oz,this.rpar,this.ipar,this.opar,this.nmode,this.nzcr,this.auto0,this.depu,this.dept,this.lab] = scicos_getvalue("Set C-Block4 block parameters",[["Simulation function"],["Is block implicit? (y,n)"],["Input ports sizes"],["Input ports type"],["Output port sizes"],["Output ports type"],["Input event ports sizes"],["Output events ports sizes"],["Initial continuous state"],["Initial discrete state"],["Initial object state"],["Real parameters vector"],["Integer parameters vector"],["Object parameters list"],["Number of modes"],["Number of zero crossings"],["Initial firing vector (<0 for no firing)"],["Direct feedthrough (y or n)"],["Time dependence (y or n)"]],list("str",1,"str",1,"mat",[-1,2],"vec",-1,"mat",[-1,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"lis",-1,"vec",-1,"vec",-1,"lis",-1,"vec",1,"vec",1,"vec","sum(%8)","str",1,"str",1),label[1-1]); if (!ok) { break; } - label[1-1] = lab; - funam = stripblanks(function_name); - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - ipar = int(ipar.slice()); - nx = size(xx,1); - nz = size(z,1); - ci = int(ci.slice()); - nevin = size(ci,1); - co = int(co.slice()); - nevout = size(co,1); - if (part(impli,1)=="y") { + label[1-1] = this.lab; + funam = stripblanks(this.function_name); + this.xx = this.xx.slice(); + this.z = this.z.slice(); + this.rpar = this.rpar.slice(); + this.ipar = int(this.ipar.slice()); + nx = size(this.xx,1); + nz = size(this.z,1); + this.ci = int(this.ci.slice()); + nevin = size(this.ci,1); + this.co = int(this.co.slice()); + nevout = size(this.co,1); + if (part(this.impli,1)=="y") { funtyp = 12004; } else { funtyp = 2004; } - if ([[ci],[co]]!=[]) { - if (max([[ci],[co]])>1) { + if ([[this.ci],[this.co]]!=[]) { + if (max([[this.ci],[this.co]])>1) { message("vector event links not supported"); ok = false; } } if (ok) { - depu = stripblanks(depu); - if (part(depu,1)=="y") { - depu = true; + this.depu = stripblanks(this.depu); + if (part(this.depu,1)=="y") { + this.depu = true; } else { - depu = false; + this.depu = false; } - dept = stripblanks(dept); - if (part(dept,1)=="y") { - dept = true; + this.dept = stripblanks(this.dept); + if (part(this.dept,1)=="y") { + this.dept = true; } else { - dept = false; + this.dept = false; } - dep_ut = [depu,dept]; + dep_ut = [this.depu,this.dept]; if (funam==" ") { break; } - if (model.sim[1-1]!=funam||sign(size(model.state,"*"))!=sign(nx)||sign(size(model.dstate,"*"))!=sign(nz)||model.nzcross!=nzcr||sign(size(model.evtout,"*"))!=sign(nevout)) { + if (model.sim[1-1]!=funam||sign(size(model.state,"*"))!=sign(nx)||sign(size(model.dstate,"*"))!=sign(nz)||model.nzcross!=this.nzcr||sign(size(model.evtout,"*"))!=sign(nevout)) { tt = []; } tt = label[2-1]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ci,co); + [model,graphics,ok] = set_io(model,graphics,list(this.in1,this.it),list(this.out,this.ot),this.ci,this.co); } if (ok) { while (true) { @@ -86,15 +86,15 @@ function CBLOCK4() { } } else { model.sim = list(funam,funtyp); - model.state = xx; - model.dstate = z; - model.odstate = oz; - model.rpar = rpar; - model.ipar = ipar; - model.opar = opar; - model.firing = auto0; - model.nzcross = nzcr; - model.nmode = nmode; + model.state = this.xx; + model.dstate = this.z; + model.odstate = this.oz; + model.rpar = this.rpar; + model.ipar = this.ipar; + model.opar = this.opar; + model.firing = this.auto0; + model.nzcross = this.nzcr; + model.nmode = this.nmode; model.dep_ut = dep_ut; label[2-1] = tt; this.x.model = model; diff --git a/js/Misc/CBLOCK4.pickle b/js/Misc/CBLOCK4.pickle index 97b4636e..c7fe3d2c 100644 --- a/js/Misc/CBLOCK4.pickle +++ b/js/Misc/CBLOCK4.pickle @@ -2,10 +2,50 @@ c__builtin__ set p0 ((lp1 -S'x' +S'impli' p2 -aS'CC4' +aS'co' p3 -atp4 -Rp5 +aS'ci' +p4 +aS'rpar' +p5 +aS'xx' +p6 +aS'out' +p7 +aS'function_name' +p8 +aS'in1' +p9 +aS'lab' +p10 +aS'it' +p11 +aS'nmode' +p12 +aS'z' +p13 +aS'CC4' +p14 +aS'auto0' +p15 +aS'nzcr' +p16 +aS'depu' +p17 +aS'dept' +p18 +aS'opar' +p19 +aS'oz' +p20 +aS'ipar' +p21 +aS'x' +p22 +aS'ot' +p23 +atp24 +Rp25 .
\ No newline at end of file diff --git a/js/Misc/CONSTRAINT2_c.js b/js/Misc/CONSTRAINT2_c.js index bf52312c..b1491fc7 100644 --- a/js/Misc/CONSTRAINT2_c.js +++ b/js/Misc/CONSTRAINT2_c.js @@ -1,18 +1,18 @@ /* autogenerated from "macros/Misc/CONSTRAINT2_c.sci" */ function CONSTRAINT2_c() { CONSTRAINT2_c.prototype.define = function CONSTRAINT2_c() { - x0 = [0]; - xd0 = [0]; - id = [0]; + this.x0 = [0]; + this.xd0 = [0]; + this.id = [0]; model = scicos_model(); model.sim = list("constraint_c",10004); model.in1 = 1; model.out = [[1],[1]]; - model.state = [[x0],[xd0]]; - model.ipar = id; + model.state = [[this.x0],[this.xd0]]; + model.ipar = this.id; model.blocktype = "c"; model.dep_ut = [false,true]; - exprs = list(strcat(sci2exp(x0)),strcat(sci2exp(xd0)),strcat(sci2exp(id))); + exprs = list(strcat(sci2exp(this.x0)),strcat(sci2exp(this.xd0)),strcat(sci2exp(this.id))); gr_i = []; this.x = standard_define([3,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -29,16 +29,16 @@ function CONSTRAINT2_c() { model = arg1.model; while (true) { ask_again = false; - [ok,x0,xd0,id,exprs] = scicos_getvalue("Set Constraint block parameters",[["Initial guess values of states x"],["Initial guess values of derivative x\'"],["Id(i)=1: if x\'(i) is present in the feedback, else Id(i)=0"]],list("vec",-1,"vec",-1,"vec",-1),exprs); + [ok,this.x0,this.xd0,this.id,exprs] = scicos_getvalue("Set Constraint block parameters",[["Initial guess values of states x"],["Initial guess values of derivative x\'"],["Id(i)=1: if x\'(i) is present in the feedback, else Id(i)=0"]],list("vec",-1,"vec",-1,"vec",-1),exprs); if (!ok) { break; } - x0 = x0.slice(); - N = size(x0,"*"); - xd0 = xd0.slice(); - Nxd = size(xd0,"*"); - id = id.slice(); - Nid = size(id,"*"); + this.x0 = this.x0.slice(); + N = size(this.x0,"*"); + this.xd0 = this.xd0.slice(); + Nxd = size(this.xd0,"*"); + this.id = this.id.slice(); + Nid = size(this.id,"*"); if ((N!=Nxd)||(N!=Nid)) { message("incompatible sizes, states, their derivatives, and ID should be the same size "); ask_again = true; @@ -49,22 +49,22 @@ function CONSTRAINT2_c() { } if ((!ask_again)) { for (i=1;i<=N;i+=1) { - if (!((id[i-1]==0)||(id[i-1]==1))) { + if (!((this.id[i-1]==0)||(this.id[i-1]==1))) { ask_again = true; x_message([["Id(i) must be either"],["0 when x\'(i) is not present in the feedback"],["1: when x\'(i) is present in the feedback"]]); break; } - if ((id[i-1]==0)) { - id[i-1] = -1; + if ((this.id[i-1]==0)) { + this.id[i-1] = -1; } } } if (!ask_again) { graphics.exprs = exprs; - model.state = [[x0],[xd0]]; + model.state = [[this.x0],[this.xd0]]; model.out = [[N],[N]]; model.in1 = N; - model.ipar = id; + model.ipar = this.id; this.x.graphics = graphics; this.x.model = model; break; diff --git a/js/Misc/CONSTRAINT2_c.pickle b/js/Misc/CONSTRAINT2_c.pickle index 0d1dde24..5bd09a0b 100644 --- a/js/Misc/CONSTRAINT2_c.pickle +++ b/js/Misc/CONSTRAINT2_c.pickle @@ -4,6 +4,12 @@ p0 ((lp1 S'x' p2 -atp3 -Rp4 +aS'x0' +p3 +aS'id' +p4 +aS'xd0' +p5 +atp6 +Rp7 .
\ No newline at end of file diff --git a/js/Misc/CONSTRAINT_c.js b/js/Misc/CONSTRAINT_c.js index 33b9a1d5..e9bd4102 100644 --- a/js/Misc/CONSTRAINT_c.js +++ b/js/Misc/CONSTRAINT_c.js @@ -1,13 +1,13 @@ /* autogenerated from "macros/Misc/CONSTRAINT_c.sci" */ function CONSTRAINT_c() { CONSTRAINT_c.prototype.define = function CONSTRAINT_c() { - x0 = [[0],[0]]; + this.x0 = [[0],[0]]; model = scicos_model(); model.sim = list("constraint_c",10004); model.in1 = 1; model.out = 1; model.ipar = 0; - model.state = x0; + model.state = this.x0; model.blocktype = "c"; model.dep_ut = [false,true]; exprs = "0"; @@ -26,19 +26,19 @@ function CONSTRAINT_c() { exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,x0,exprs] = scicos_getvalue("Set solver block parameters","Initial guess values",list("vec",-1),exprs); + [ok,this.x0,exprs] = scicos_getvalue("Set solver block parameters","Initial guess values",list("vec",-1),exprs); if (!ok) { break; } - x0 = x0.slice(); - N = size(x0,"*"); + this.x0 = this.x0.slice(); + N = size(this.x0,"*"); if (N<=0) { message("number of states (constraints) must be > 0 "); } else { [model,graphics,ok] = check_io(model,graphics,N,N,[],[]); if (ok) { graphics.exprs = exprs; - model.state = [[x0],[zeros(N,1)]]; + model.state = [[this.x0],[zeros(N,1)]]; model.out = N; model.in1 = N; model.ipar = -1*ones(N,1); diff --git a/js/Misc/CONSTRAINT_c.pickle b/js/Misc/CONSTRAINT_c.pickle index 0d1dde24..f41d682d 100644 --- a/js/Misc/CONSTRAINT_c.pickle +++ b/js/Misc/CONSTRAINT_c.pickle @@ -4,6 +4,8 @@ p0 ((lp1 S'x' p2 -atp3 -Rp4 +aS'x0' +p3 +atp4 +Rp5 .
\ No newline at end of file diff --git a/js/Misc/DEADBAND.js b/js/Misc/DEADBAND.js index f1a0f417..da9809e0 100644 --- a/js/Misc/DEADBAND.js +++ b/js/Misc/DEADBAND.js @@ -1,9 +1,9 @@ /* autogenerated from "macros/Misc/DEADBAND.sci" */ function DEADBAND() { DEADBAND.prototype.define = function DEADBAND() { - minp = -.5; - maxp = .5; - rpar = [[maxp],[minp]]; + this.minp = -.5; + this.maxp = .5; + rpar = [[this.maxp],[this.minp]]; model = scicos_model(); model.sim = list("deadband",4); model.in1 = 1; @@ -13,7 +13,7 @@ function DEADBAND() { model.rpar = rpar; model.blocktype = "c"; model.dep_ut = [true,false]; - exprs = [[string(maxp)],[string(minp)],[string(model.nmode)]]; + exprs = [[string(this.maxp)],[string(this.minp)],[string(model.nmode)]]; gr_i = []; this.x = standard_define([2,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -29,16 +29,16 @@ function DEADBAND() { exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,maxp,minp,zeroc,exprs] = scicos_getvalue("Set Deadband parameters",[["End of dead band"],["Start of dead band"],["zero crossing (0:no, 1:yes)"]],list("vec",1,"vec",1,"vec",1),exprs); + [ok,this.maxp,this.minp,this.zeroc,exprs] = scicos_getvalue("Set Deadband parameters",[["End of dead band"],["Start of dead band"],["zero crossing (0:no, 1:yes)"]],list("vec",1,"vec",1,"vec",1),exprs); if (!ok) { break; } - if (maxp<=minp) { + if (this.maxp<=this.minp) { message("Upper limit must be > Lower limit"); } else { - rpar = [[maxp],[minp]]; + rpar = [[this.maxp],[this.minp]]; model.rpar = rpar; - if (zeroc!=0) { + if (this.zeroc!=0) { model.nzcross = 2; model.nmode = 1; } else { diff --git a/js/Misc/DEADBAND.pickle b/js/Misc/DEADBAND.pickle index 0d1dde24..00d3a947 100644 --- a/js/Misc/DEADBAND.pickle +++ b/js/Misc/DEADBAND.pickle @@ -2,8 +2,14 @@ c__builtin__ set p0 ((lp1 -S'x' +S'minp' p2 -atp3 -Rp4 +aS'x' +p3 +aS'maxp' +p4 +aS'zeroc' +p5 +atp6 +Rp7 .
\ No newline at end of file diff --git a/js/Misc/DIFF_f.js b/js/Misc/DIFF_f.js index 9e374115..d8b26b21 100644 --- a/js/Misc/DIFF_f.js +++ b/js/Misc/DIFF_f.js @@ -1,15 +1,15 @@ /* autogenerated from "macros/Misc/DIFF_f.sci" */ function DIFF_f() { DIFF_f.prototype.define = function DIFF_f() { - x0 = [[0],[0]]; + this.x0 = [[0],[0]]; model = scicos_model(); model.sim = list("diffblk",10001); model.in1 = 1; model.out = 1; - model.state = x0; + model.state = this.x0; model.blocktype = "c"; model.dep_ut = [false,true]; - exprs = [[strcat(sci2exp(x0[1-1]))],[strcat(sci2exp(x0[2-1]))]]; + exprs = [[strcat(sci2exp(this.x0[1-1]))],[strcat(sci2exp(this.x0[2-1]))]]; gr_i = []; this.x = standard_define([2,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -25,12 +25,12 @@ function DIFF_f() { exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,x0,xd0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["Initial state"],["Initial Derivative"]],list("vec",1,"vec",1),exprs); + [ok,this.x0,this.xd0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["Initial state"],["Initial Derivative"]],list("vec",1,"vec",1),exprs); if (!ok) { break; } graphics.exprs = exprs; - model.state = [[x0.slice()],[xd0.slice()]]; + model.state = [[this.x0.slice()],[this.xd0.slice()]]; this.x.graphics = graphics; this.x.model = model; break; diff --git a/js/Misc/DIFF_f.pickle b/js/Misc/DIFF_f.pickle index 0d1dde24..59a4988d 100644 --- a/js/Misc/DIFF_f.pickle +++ b/js/Misc/DIFF_f.pickle @@ -4,6 +4,10 @@ p0 ((lp1 S'x' p2 -atp3 -Rp4 +aS'x0' +p3 +aS'xd0' +p4 +atp5 +Rp6 .
\ No newline at end of file diff --git a/js/Misc/EDGETRIGGER.js b/js/Misc/EDGETRIGGER.js index 5cffb67e..1f9a65a8 100644 --- a/js/Misc/EDGETRIGGER.js +++ b/js/Misc/EDGETRIGGER.js @@ -1,17 +1,17 @@ /* autogenerated from "macros/Misc/EDGETRIGGER.sci" */ function EDGETRIGGER() { EDGETRIGGER.prototype.define = function EDGETRIGGER() { - edge = 1; + this.edge = 1; model = scicos_model(); model.sim = list("edgetrig",4); model.in1 = 1; model.out = 1; model.dstate = 0; model.nzcross = 1; - model.ipar = sign(edge); + model.ipar = sign(this.edge); model.blocktype = "c"; model.dep_ut = [true,false]; - exprs = [string(edge)]; + exprs = [string(this.edge)]; gr_i = []; this.x = standard_define([3,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -27,11 +27,11 @@ function EDGETRIGGER() { exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,edge,exprs] = scicos_getvalue("Set edge trigger block parameters",["rising (1), falling (-1), both (0)"],list("vec",1),exprs); + [ok,this.edge,exprs] = scicos_getvalue("Set edge trigger block parameters",["rising (1), falling (-1), both (0)"],list("vec",1),exprs); if (!ok) { break; } - model.ipar = sign(edge); + model.ipar = sign(this.edge); graphics.exprs = exprs; this.x.graphics = graphics; this.x.model = model; diff --git a/js/Misc/EDGETRIGGER.pickle b/js/Misc/EDGETRIGGER.pickle index 0d1dde24..e8699233 100644 --- a/js/Misc/EDGETRIGGER.pickle +++ b/js/Misc/EDGETRIGGER.pickle @@ -4,6 +4,8 @@ p0 ((lp1 S'x' p2 -atp3 -Rp4 +aS'edge' +p3 +atp4 +Rp5 .
\ No newline at end of file diff --git a/js/Misc/EXPRESSION.pickle b/js/Misc/EXPRESSION.pickle index de00e428..4ed700d3 100644 --- a/js/Misc/EXPRESSION.pickle +++ b/js/Misc/EXPRESSION.pickle @@ -2,14 +2,20 @@ c__builtin__ set p0 ((lp1 -S'getfield' +S'PREVAR_foo' p2 -aS'x' +aS'getfield' p3 aS'PREVAR_scicos_context' p4 -aS'PREVAR_foo' +aS'%exx' p5 -atp6 -Rp7 +aS'%nin' +p6 +aS'x' +p7 +aS'%usenz' +p8 +atp9 +Rp10 .
\ No newline at end of file diff --git a/js/Misc/HYSTHERESIS.js b/js/Misc/HYSTHERESIS.js index da9e1b60..f29d10d9 100644 --- a/js/Misc/HYSTHERESIS.js +++ b/js/Misc/HYSTHERESIS.js @@ -3,18 +3,18 @@ function HYSTHERESIS() { HYSTHERESIS.prototype.define = function HYSTHERESIS() { in1 = 1; ipar = [0]; - nzz = 2; + this.nzz = 2; rpar = [[1],[0],[1],[0]]; model = scicos_model(); model.sim = list("hystheresis",4); model.in1 = in1; model.out = 1; model.rpar = rpar; - model.nzcross = nzz; + model.nzcross = this.nzz; model.nmode = 1; model.blocktype = "c"; model.dep_ut = [true,false]; - exprs = [[string(rpar)],[string(sign(nzz))]]; + exprs = [[string(rpar)],[string(sign(this.nzz))]]; gr_i = []; this.x = standard_define([2,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -30,19 +30,19 @@ function HYSTHERESIS() { exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,high_lim,low_lim,out_high,out_low,nzz,exprs] = scicos_getvalue("Set parameters",[["switch on at"],["switch off at"],["output when on"],["output when off"],["use zero crossing: yes (1), no (0)"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + [ok,this.high_lim,this.low_lim,this.out_high,this.out_low,this.nzz,exprs] = scicos_getvalue("Set parameters",[["switch on at"],["switch off at"],["output when on"],["output when off"],["use zero crossing: yes (1), no (0)"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); if (!ok) { break; } - if (low_lim>high_lim) { + if (this.low_lim>this.high_lim) { message("switch on value must be larger than switch off value"); } else { graphics.exprs = exprs; - model.rpar = transpose([high_lim,low_lim,out_high,out_low]); - if (nzz>0) { - nzz = 2; + model.rpar = transpose([this.high_lim,this.low_lim,this.out_high,this.out_low]); + if (this.nzz>0) { + this.nzz = 2; } - model.nzcross = nzz; + model.nzcross = this.nzz; this.x.graphics = graphics; this.x.model = model; break; diff --git a/js/Misc/HYSTHERESIS.pickle b/js/Misc/HYSTHERESIS.pickle index 0d1dde24..e6d8e07f 100644 --- a/js/Misc/HYSTHERESIS.pickle +++ b/js/Misc/HYSTHERESIS.pickle @@ -2,8 +2,18 @@ c__builtin__ set p0 ((lp1 -S'x' +S'low_lim' p2 -atp3 -Rp4 +aS'out_low' +p3 +aS'nzz' +p4 +aS'out_high' +p5 +aS'high_lim' +p6 +aS'x' +p7 +atp8 +Rp9 .
\ No newline at end of file diff --git a/js/Misc/LOGICAL_OP.js b/js/Misc/LOGICAL_OP.js index 6d875b4c..163f69cf 100644 --- a/js/Misc/LOGICAL_OP.js +++ b/js/Misc/LOGICAL_OP.js @@ -3,7 +3,7 @@ function LOGICAL_OP() { LOGICAL_OP.prototype.define = function LOGICAL_OP() { in1 = [[-1],[-1]]; ipar = [0]; - nin = 2; + this.nin = 2; model = scicos_model(); model.sim = list("logicalop",4); model.in1 = in1; @@ -11,7 +11,7 @@ function LOGICAL_OP() { model.ipar = ipar; model.blocktype = "c"; model.dep_ut = [true,false]; - exprs = [[string(nin)],[string(ipar)]]; + exprs = [[string(this.nin)],[string(ipar)]]; gr_i = []; this.x = standard_define([2,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -30,57 +30,57 @@ function LOGICAL_OP() { exprs = [[exprs],[sci2exp(1)],[sci2exp(0)]]; } while (true) { - [ok,nin,rule,Datatype,tp,exprs] = scicos_getvalue("Set parameters",[["number of inputs"],["Operator: AND (0), OR (1), NAND (2), NOR (3), XOR (4), NOT (5)","Datatype (1=double 3=int32 ...)"],["Bitwise Rule(0=No 1=yes)"]],list("vec",1,"vec",1,"vec",1,"vec",1),exprs); + [ok,this.nin,this.rule,this.Datatype,this.tp,exprs] = scicos_getvalue("Set parameters",[["number of inputs"],["Operator: AND (0), OR (1), NAND (2), NOR (3), XOR (4), NOT (5)","Datatype (1=double 3=int32 ...)"],["Bitwise Rule(0=No 1=yes)"]],list("vec",1,"vec",1,"vec",1,"vec",1),exprs); if (!ok) { break; } - nin = int(nin); - rule = int(rule); - tp = int(tp); - if (nin<1) { + this.nin = int(this.nin); + this.rule = int(this.rule); + this.tp = int(this.tp); + if (this.nin<1) { message("Number of inputs must be >=1 "); ok = false; - } else if ((rule<0)||(rule>5)) { - message("Incorrect operator "+string(rule)+" ; must be 0 to 5."); + } else if ((this.rule<0)||(this.rule>5)) { + message("Incorrect operator "+string(this.rule)+" ; must be 0 to 5."); ok = false; - } else if ((rule==5)&&(nin>1)) { + } else if ((this.rule==5)&&(this.nin>1)) { message("Only one input allowed for NOT operation"); - nin = 1; - } else if (((Datatype==1)&&(tp!=0))) { + this.nin = 1; + } else if (((this.Datatype==1)&&(this.tp!=0))) { message("Bitwise Rule is only activated when Data type is integer"); ok = false; } if (ok) { - if ((tp!=0)) { - tp = 1; + if ((this.tp!=0)) { + this.tp = 1; } - if (Datatype==1) { + if (this.Datatype==1) { model.sim = list("logicalop",4); - model.ipar = [rule]; + model.ipar = [this.rule]; } else { - if (Datatype==3) { + if (this.Datatype==3) { model.sim = list("logicalop_i32",4); - } else if (Datatype==4) { + } else if (this.Datatype==4) { model.sim = list("logicalop_i16",4); - } else if (Datatype==5) { + } else if (this.Datatype==5) { model.sim = list("logicalop_i8",4); - } else if (Datatype==6) { + } else if (this.Datatype==6) { model.sim = list("logicalop_ui32",4); - } else if (Datatype==7) { + } else if (this.Datatype==7) { model.sim = list("logicalop_ui16",4); - } else if (Datatype==8) { + } else if (this.Datatype==8) { model.sim = list("logicalop_ui8",4); } else { message("Datatype is not supported"); ok = false; } - model.ipar = [[rule],[tp]]; + model.ipar = [[this.rule],[this.tp]]; } if (ok) { - it = Datatype*ones(nin,1); - ot = Datatype; - in1 = [-ones(nin,1),-2*ones(nin,1)]; - if ((rule!=5)&&(nin==1)) { + it = this.Datatype*ones(this.nin,1); + ot = this.Datatype; + in1 = [-ones(this.nin,1),-2*ones(this.nin,1)]; + if ((this.rule!=5)&&(this.nin==1)) { out = [1,1]; [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); } else { @@ -89,17 +89,17 @@ function LOGICAL_OP() { } } if (ok) { - if (rule==0) { + if (this.rule==0) { label = "AND"; - } else if (rule==1) { + } else if (this.rule==1) { label = "OR"; - } else if (rule==2) { + } else if (this.rule==2) { label = "NAND"; - } else if (rule==3) { + } else if (this.rule==3) { label = "NOR"; - } else if (rule==4) { + } else if (this.rule==4) { label = "XOR"; - } else if (rule==5) { + } else if (this.rule==5) { label = "NOT"; } graphics.exprs = exprs; diff --git a/js/Misc/LOGICAL_OP.pickle b/js/Misc/LOGICAL_OP.pickle index 0d1dde24..05bf68ab 100644 --- a/js/Misc/LOGICAL_OP.pickle +++ b/js/Misc/LOGICAL_OP.pickle @@ -2,8 +2,16 @@ c__builtin__ set p0 ((lp1 -S'x' +S'Datatype' p2 -atp3 -Rp4 +aS'x' +p3 +aS'nin' +p4 +aS'tp' +p5 +aS'rule' +p6 +atp7 +Rp8 .
\ No newline at end of file diff --git a/js/Misc/MBLOCK.js b/js/Misc/MBLOCK.js index bf6d83e4..aa51887b 100644 --- a/js/Misc/MBLOCK.js +++ b/js/Misc/MBLOCK.js @@ -7,9 +7,9 @@ function MBLOCK() { this.outtype = [["I"],["E"]]; param = [["R"],["L"]]; paramv = list(0.1,.0001); - pprop = [[0],[0]]; + this.pprop = [[0],[0]]; nameF = "generic"; - exprs = tlist(["MBLOCK","in","intype","out","outtype","param","paramv","pprop","nameF","funtxt"],sci2exp(this.in1.slice()),sci2exp(this.intype.slice()),sci2exp(this.out.slice()),sci2exp(this.outtype.slice()),sci2exp(param.slice()),list(string(0.1),string(.0001)),sci2exp(pprop.slice()),nameF,[]); + exprs = tlist(["MBLOCK","in","intype","out","outtype","param","paramv","pprop","nameF","funtxt"],sci2exp(this.in1.slice()),sci2exp(this.intype.slice()),sci2exp(this.out.slice()),sci2exp(this.outtype.slice()),sci2exp(param.slice()),list(string(0.1),string(.0001)),sci2exp(this.pprop.slice()),nameF,[]); model = scicos_model(); model.blocktype = "c"; model.dep_ut = [false,true]; @@ -44,17 +44,17 @@ function MBLOCK() { exprs = graphics.exprs; if (this.type[exprs-1]==15) { paramv = list(); - pprop = []; + this.pprop = []; for (i=1;i<=size(model.rpar,"*");i+=1) { paramv[$+1-1] = string(model.rpar[i-1]); - pprop[$+1-1] = 0; + this.pprop[$+1-1] = 0; } - exprs = tlist(["MBLOCK","in","intype","out","outtype","param","paramv","pprop","nameF","funtxt"],exprs[1-1][1-1],exprs[1-1][2-1],exprs[1-1][3-1],exprs[1-1][4-1],exprs[1-1][5-1],paramv,sci2exp(pprop.slice()),exprs[1-1][7-1],exprs[2-1]); + exprs = tlist(["MBLOCK","in","intype","out","outtype","param","paramv","pprop","nameF","funtxt"],exprs[1-1][1-1],exprs[1-1][2-1],exprs[1-1][3-1],exprs[1-1][4-1],exprs[1-1][5-1],paramv,sci2exp(this.pprop.slice()),exprs[1-1][7-1],exprs[2-1]); } - lab_1 = list(exprs.in1,exprs.intype,exprs.out,exprs.outtype,exprs.param,exprs.pprop,exprs.nameF); + this.lab_1 = list(exprs.in1,exprs.intype,exprs.out,exprs.outtype,exprs.param,exprs.pprop,exprs.nameF); lab_2 = exprs.paramv; while (true) { - [ok,Tin,Tintype,Tout,Touttype,Tparam,pprop,Tfunam,lab_1] = scicos_getvalue("Set Modelica generic block parameters",[["Input variables: "],["Input variables types: "],["Output variables: "],["Output variables types:"],["Parameters in Modelica:"],["Parameters properties: "],["Function name: "]],list("str",-1,"str",-1,"str",-1,"str",-1,"str",-1,"vec",-1,"str",-1),lab_1); + [ok,this.Tin,this.Tintype,this.Tout,this.Touttype,this.Tparam,this.pprop,this.Tfunam,this.lab_1] = scicos_getvalue("Set Modelica generic block parameters",[["Input variables: "],["Input variables types: "],["Output variables: "],["Output variables types:"],["Parameters in Modelica:"],["Parameters properties: "],["Function name: "]],list("str",-1,"str",-1,"str",-1,"str",-1,"str",-1,"vec",-1,"str",-1),this.lab_1); if (!ok) { break; } @@ -134,14 +134,14 @@ function MBLOCK() { } } if (ok) { - pprop = pprop.slice(); - if ((size(param,"*")!=size(pprop,"*"))) { + this.pprop = this.pprop.slice(); + if ((size(param,"*")!=size(this.pprop,"*"))) { messagebox([["There is differences in"],["size of param and size "],["of param properties."]],"modal","error"); ok = false; } } if (ok) { - if (max(pprop)>2||min(pprop)<0) { + if (max(this.pprop)>2||min(this.pprop)<0) { messagebox([["Parameters properties must be :"],["0 : for simple paramater,"],["1 : for initial state value,"],["2 : for a fixed initial state value."]],"modal","error"); ok = false; } @@ -165,7 +165,7 @@ function MBLOCK() { [model,graphics,ok] = set_io(model,graphics,list([ones(this.in1),ones(this.in1)],ones(this.in1)),list([ones(this.out),ones(this.out)],ones(this.out)),[],[],intypex,outtypex); } if (ok) { - Tparam_lab = evstr(Tparam); + Tparam_lab = evstr(this.Tparam); Tparam_sz = size(Tparam_lab,"*"); if (Tparam_sz>lstsize(lab_2)) { for (i=1;i<=(Tparam_sz-lstsize(lab_2));i+=1) { @@ -186,11 +186,11 @@ function MBLOCK() { rhs_txt = ""; for (i=1;i<=Tparam_sz;i+=1) { lhs_txt = lhs_txt+"%v"+string(i)+","; - if (pprop[i-1]==0) { + if (this.pprop[i-1]==0) { lab_txt = lab_txt+"\'"+Tparam_lab[i-1]+"\';"; - } else if (pprop[i-1]==1) { + } else if (this.pprop[i-1]==1) { lab_txt = lab_txt+"\'"+Tparam_lab[i-1]+" (state) \';"; - } else if (pprop[i-1]==2) { + } else if (this.pprop[i-1]==2) { lab_txt = lab_txt+"\'"+Tparam_lab[i-1]+" (fixed state) \';"; } rhs_txt = rhs_txt+"\'vec\',-1,"; @@ -221,7 +221,7 @@ function MBLOCK() { tt = []; } } - [ok,tt] = MODCOM(this.funam,tt,this.in1,this.out,param,paramv,pprop); + [ok,tt] = MODCOM(this.funam,tt,this.in1,this.out,param,paramv,this.pprop); if (!ok) { break; } @@ -231,8 +231,8 @@ function MBLOCK() { mo.model = nameF; mo.inputs = this.in1; mo.outputs = this.out; - if (max(pprop)>0) { - mo.parameters = list(transpose(param),paramv,transpose(pprop)); + if (max(this.pprop)>0) { + mo.parameters = list(transpose(param),paramv,transpose(this.pprop)); } else { mo.parameters = list(transpose(param),paramv); } @@ -242,11 +242,11 @@ function MBLOCK() { model.rpar = [[model.rpar],[paramv[i-1].slice()]]; } model.sim[1-1] = this.funam; - exprs.in1 = lab_1[1-1]; - exprs.intype = lab_1[2-1]; - exprs.out = lab_1[3-1]; - exprs.outtype = lab_1[4-1]; - exprs.param = lab_1[5-1]; + exprs.in1 = this.lab_1[1-1]; + exprs.intype = this.lab_1[2-1]; + exprs.out = this.lab_1[3-1]; + exprs.outtype = this.lab_1[4-1]; + exprs.param = this.lab_1[5-1]; exprs.paramv = list(); if (Tparam_sz!=0) { if (this.type[lab_2-1]==15) { @@ -259,8 +259,8 @@ function MBLOCK() { } } } - exprs.pprop = lab_1[6-1]; - exprs.nameF = lab_1[7-1]; + exprs.pprop = this.lab_1[6-1]; + exprs.nameF = this.lab_1[7-1]; exprs.funtxt = tt; this.x.model = model; graphics.gr_i[1-1][1-1] = "txt=[\'Modelica\';\' "+nameF+" \'];"; diff --git a/js/Misc/MBLOCK.pickle b/js/Misc/MBLOCK.pickle index ca02cacd..1213cf91 100644 --- a/js/Misc/MBLOCK.pickle +++ b/js/Misc/MBLOCK.pickle @@ -2,20 +2,36 @@ c__builtin__ set p0 ((lp1 -S'intype' +S'Touttype' p2 -aS'in1' +aS'lab_1' p3 -aS'outtype' +aS'Tparam' p4 -aS'funam' +aS'intype' p5 -aS'x' +aS'in1' p6 -aS'type' +aS'Tin' p7 -aS'out' +aS'outtype' p8 -atp9 -Rp10 +aS'Tout' +p9 +aS'pprop' +p10 +aS'funam' +p11 +aS'x' +p12 +aS'out' +p13 +aS'type' +p14 +aS'Tintype' +p15 +aS'Tfunam' +p16 +atp17 +Rp18 .
\ No newline at end of file diff --git a/js/Misc/MEMORY_f.js b/js/Misc/MEMORY_f.js index 46528ac6..77bea301 100644 --- a/js/Misc/MEMORY_f.js +++ b/js/Misc/MEMORY_f.js @@ -28,17 +28,17 @@ function MEMORY_f() { exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,a,inh,exprs] = scicos_getvalue("Set memory block parameters",[["initial condition"],["Inherit (1: no, 0: yes)"]],list("vec",-1,"vec",1),exprs); + [ok,this.a,this.inh,exprs] = scicos_getvalue("Set memory block parameters",[["initial condition"],["Inherit (1: no, 0: yes)"]],list("vec",-1,"vec",1),exprs); if (!ok) { break; } - if (inh==0) { - inh = []; + if (this.inh==0) { + this.inh = []; } else { - inh = 1; + this.inh = 1; } - [model,graphics,ok] = check_io(model,graphics,-1,-1,inh,[]); - out = size(a,"*"); + [model,graphics,ok] = check_io(model,graphics,-1,-1,this.inh,[]); + out = size(this.a,"*"); if (out==0) { ok = false; messagebox("Initial condition empty","modal","error"); @@ -46,7 +46,7 @@ function MEMORY_f() { in1 = out; if (ok) { graphics.exprs = exprs; - model.rpar = a; + model.rpar = this.a; model.in1 = in1; model.out = out; this.x.graphics = graphics; diff --git a/js/Misc/MEMORY_f.pickle b/js/Misc/MEMORY_f.pickle index 0d1dde24..c11db162 100644 --- a/js/Misc/MEMORY_f.pickle +++ b/js/Misc/MEMORY_f.pickle @@ -2,8 +2,12 @@ c__builtin__ set p0 ((lp1 -S'x' +S'a' p2 -atp3 -Rp4 +aS'x' +p3 +aS'inh' +p4 +atp5 +Rp6 .
\ No newline at end of file diff --git a/js/Misc/PENDULUM_ANIM.js b/js/Misc/PENDULUM_ANIM.js index 5aa97023..50e33f55 100644 --- a/js/Misc/PENDULUM_ANIM.js +++ b/js/Misc/PENDULUM_ANIM.js @@ -1,19 +1,19 @@ /* autogenerated from "macros/Misc/PENDULUM_ANIM.sci" */ function PENDULUM_ANIM() { PENDULUM_ANIM.prototype.define = function PENDULUM_ANIM() { - plen = 2; - csiz = 2; - phi = 0; - xmin = -5; - xmax = 5; - ymin = -5; - ymax = 5; + this.plen = 2; + this.csiz = 2; + this.phi = 0; + this.xmin = -5; + this.xmax = 5; + this.ymin = -5; + this.ymax = 5; model = scicos_model(); model.sim = list("anim_pen",5); model.in1 = [[1],[1]]; model.evtin = 1; model.dstate = 0; - model.rpar = [[plen],[csiz],[phi],[xmin],[xmax],[ymin],[ymax]]; + model.rpar = [[this.plen],[this.csiz],[this.phi],[this.xmin],[this.xmax],[this.ymin],[this.ymax]]; model.blocktype = "d"; model.dep_ut = [false,false]; exprs = string(model.rpar); @@ -33,27 +33,27 @@ function PENDULUM_ANIM() { model = arg1.model; dstate = model.dstate; while (true) { - [ok,plen,csiz,phi,xmin,xmax,ymin,ymax,exprs] = scicos_getvalue("Set Scope parameters",[["pendulum length"],["cart size (square side)"],["slope"],["Xmin"],["Xmax"],["Ymin"],["Ymax"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + [ok,this.plen,this.csiz,this.phi,this.xmin,this.xmax,this.ymin,this.ymax,exprs] = scicos_getvalue("Set Scope parameters",[["pendulum length"],["cart size (square side)"],["slope"],["Xmin"],["Xmax"],["Ymin"],["Ymax"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); if (!ok) { break; } mess = []; - if (plen<=0||csiz<=0) { + if (this.plen<=0||this.csiz<=0) { mess = [[mess],["Pendulum length and cart size must be positive."],[" "]]; ok = false; } - if (ymin>=ymax) { + if (this.ymin>=this.ymax) { mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; ok = false; } - if (xmin>=xmax) { + if (this.xmin>=this.xmax) { mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; ok = false; } if (!ok) { message(mess); } else { - rpar = [[plen],[csiz],[phi],[xmin],[xmax],[ymin],[ymax]]; + rpar = [[this.plen],[this.csiz],[this.phi],[this.xmin],[this.xmax],[this.ymin],[this.ymax]]; model.rpar = rpar; graphics.exprs = exprs; this.x.graphics = graphics; diff --git a/js/Misc/PENDULUM_ANIM.pickle b/js/Misc/PENDULUM_ANIM.pickle index 0d1dde24..b9b40604 100644 --- a/js/Misc/PENDULUM_ANIM.pickle +++ b/js/Misc/PENDULUM_ANIM.pickle @@ -2,8 +2,22 @@ c__builtin__ set p0 ((lp1 -S'x' +S'phi' p2 -atp3 -Rp4 +aS'ymax' +p3 +aS'csiz' +p4 +aS'xmax' +p5 +aS'plen' +p6 +aS'xmin' +p7 +aS'x' +p8 +aS'ymin' +p9 +atp10 +Rp11 .
\ No newline at end of file diff --git a/js/Misc/RATELIMITER.js b/js/Misc/RATELIMITER.js index 5ec433ea..95d2397b 100644 --- a/js/Misc/RATELIMITER.js +++ b/js/Misc/RATELIMITER.js @@ -1,9 +1,9 @@ /* autogenerated from "macros/Misc/RATELIMITER.sci" */ function RATELIMITER() { RATELIMITER.prototype.define = function RATELIMITER() { - minp = -1; - maxp = 1; - rpar = [[maxp],[minp]]; + this.minp = -1; + this.maxp = 1; + rpar = [[this.maxp],[this.minp]]; model = scicos_model(); model.sim = list("ratelimiter",4); model.in1 = 1; @@ -11,7 +11,7 @@ function RATELIMITER() { model.rpar = rpar; model.blocktype = "c"; model.dep_ut = [true,false]; - exprs = [[string(maxp)],[string(minp)]]; + exprs = [[string(this.maxp)],[string(this.minp)]]; gr_i = []; this.x = standard_define([3.5,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -27,14 +27,14 @@ function RATELIMITER() { exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,maxp,minp,exprs] = scicos_getvalue("Set rate limiter parameters",[["max slope"],["min slope"]],list("vec",1,"vec",1),exprs); + [ok,this.maxp,this.minp,exprs] = scicos_getvalue("Set rate limiter parameters",[["max slope"],["min slope"]],list("vec",1,"vec",1),exprs); if (!ok) { break; } - if (maxp<=minp||maxp<=0||minp>=0) { + if (this.maxp<=this.minp||this.maxp<=0||this.minp>=0) { message("We must have max_slope> 0 > min_slope."); } else { - rpar = [[maxp],[minp]]; + rpar = [[this.maxp],[this.minp]]; model.rpar = rpar; graphics.exprs = exprs; this.x.graphics = graphics; diff --git a/js/Misc/RATELIMITER.pickle b/js/Misc/RATELIMITER.pickle index 0d1dde24..f1a9f181 100644 --- a/js/Misc/RATELIMITER.pickle +++ b/js/Misc/RATELIMITER.pickle @@ -2,8 +2,12 @@ c__builtin__ set p0 ((lp1 -S'x' +S'minp' p2 -atp3 -Rp4 +aS'x' +p3 +aS'maxp' +p4 +atp5 +Rp6 .
\ No newline at end of file diff --git a/js/Misc/RELATIONALOP.js b/js/Misc/RELATIONALOP.js index fd096070..8ed6cb4b 100644 --- a/js/Misc/RELATIONALOP.js +++ b/js/Misc/RELATIONALOP.js @@ -30,62 +30,62 @@ function RELATIONALOP() { exprs = [[exprs],[sci2exp(1)]]; } while (true) { - [ok,rule,zcr,Datatype,exprs] = scicos_getvalue("Set parameters",[["Operator: == (0), ~= (1), < (2), <= (3), > (4), >= (5)"],["Use zero crossing (no: 0), (yes: 1)","Datatype (1=double 3=int32 ...)"]],list("vec",1,"vec",1,"vec",1),exprs); + [ok,this.rule,this.zcr,this.Datatype,exprs] = scicos_getvalue("Set parameters",[["Operator: == (0), ~= (1), < (2), <= (3), > (4), >= (5)"],["Use zero crossing (no: 0), (yes: 1)","Datatype (1=double 3=int32 ...)"]],list("vec",1,"vec",1,"vec",1),exprs); if (!ok) { break; } - rule = int(rule); - if (zcr!=0) { - zcr = 1; + this.rule = int(this.rule); + if (this.zcr!=0) { + this.zcr = 1; } - if ((rule<0)||(rule>5)) { - message("Incorrect operator "+string(rule)+" ; must be 0 to 5."); + if ((this.rule<0)||(this.rule>5)) { + message("Incorrect operator "+string(this.rule)+" ; must be 0 to 5."); ok = false; } - if ((Datatype==1)) { + if ((this.Datatype==1)) { model.sim = list("relational_op",4); - } else if ((Datatype==3||Datatype==9)) { + } else if ((this.Datatype==3||this.Datatype==9)) { model.sim = list("relational_op_i32",4); - } else if ((Datatype==4)) { + } else if ((this.Datatype==4)) { model.sim = list("relational_op_i16",4); - } else if ((Datatype==5)) { + } else if ((this.Datatype==5)) { model.sim = list("relational_op_i8",4); - } else if ((Datatype==6)) { + } else if ((this.Datatype==6)) { model.sim = list("relational_op_ui32",4); - } else if ((Datatype==7)) { + } else if ((this.Datatype==7)) { model.sim = list("relational_op_ui16",4); - } else if ((Datatype==8)) { + } else if ((this.Datatype==8)) { model.sim = list("relational_op_ui8",4); } else { message("Datatype is not supported"); ok = false; } if (ok) { - it = Datatype*ones(1,2); - ot = Datatype; + it = this.Datatype*ones(1,2); + ot = this.Datatype; in1 = [[-1,-2],[-1,-2]]; out = [-1,-2]; [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); } if (ok) { - if (rule==0) { + if (this.rule==0) { label = "=="; - } else if (rule==1) { + } else if (this.rule==1) { label = "~="; - } else if (rule==2) { + } else if (this.rule==2) { label = "<"; - } else if (rule==3) { + } else if (this.rule==3) { label = "≤"; - } else if (rule==4) { + } else if (this.rule==4) { label = ">"; - } else if (rule==5) { + } else if (this.rule==5) { label = "≥"; } graphics.exprs = exprs; graphics.style = ["fontSize=13;fontStyle=1;displayedLabel="+label]; - model.ipar = [rule]; - model.nzcross = zcr; - model.nmode = zcr; + model.ipar = [this.rule]; + model.nzcross = this.zcr; + model.nmode = this.zcr; this.x.graphics = graphics; this.x.model = model; break; diff --git a/js/Misc/RELATIONALOP.pickle b/js/Misc/RELATIONALOP.pickle index 0d1dde24..08689c46 100644 --- a/js/Misc/RELATIONALOP.pickle +++ b/js/Misc/RELATIONALOP.pickle @@ -2,8 +2,14 @@ c__builtin__ set p0 ((lp1 -S'x' +S'Datatype' p2 -atp3 -Rp4 +aS'x' +p3 +aS'zcr' +p4 +aS'rule' +p5 +atp6 +Rp7 .
\ No newline at end of file diff --git a/js/Misc/SUPER_f.js b/js/Misc/SUPER_f.js index 658ee514..96598262 100644 --- a/js/Misc/SUPER_f.js +++ b/js/Misc/SUPER_f.js @@ -20,7 +20,7 @@ function SUPER_f() { model.dep_ut = [false,false]; gr_i = []; this.x = standard_define([2,2],model,[],gr_i); - return new BasicBlock(this.x); + return new SuperBlock(this.x); } SUPER_f.prototype.details = function SUPER_f() { return this.x; @@ -29,6 +29,6 @@ function SUPER_f() { } SUPER_f.prototype.set = function SUPER_f() { xcos(arg1.model.rpar); - return new BasicBlock(this.x); + return new SuperBlock(this.x); } } diff --git a/js/Misc/TEXT_f.js b/js/Misc/TEXT_f.js index 0b8d4b9c..9e8c7cde 100644 --- a/js/Misc/TEXT_f.js +++ b/js/Misc/TEXT_f.js @@ -1,19 +1,19 @@ /* autogenerated from "macros/Misc/TEXT_f.sci" */ function TEXT_f() { TEXT_f.prototype.define = function TEXT_f() { - font = 2; - siz = 1; + this.font = 2; + this.siz = 1; model = scicos_model(); model.sim = "text"; model.rpar = "Text"; - model.ipar = [[font],[siz]]; - exprs = [["Text"],[string(font)],[string(siz)]]; + model.ipar = [[this.font],[this.siz]]; + exprs = [["Text"],[string(this.font)],[string(this.siz)]]; graphics = scicos_graphics(); graphics.orig = [0,0]; graphics.sz = [2,1]; graphics.exprs = exprs; this.x = mlist(["Text","graphics","model","void","gui"],graphics,model," ","TEXT_f"); - return new BasicBlock(this.x); + return new TextBlock(this.x); } TEXT_f.prototype.details = function TEXT_f() { return this.x; @@ -30,15 +30,15 @@ function TEXT_f() { exprs = [[exprs],["3"],["1"]]; } while (true) { - [ok,txt,font,siz,exprs] = scicos_getvalue("Set Text block parameters",[["Text"],["Font number"],["Font size"]],list("str",-1,"vec",1,"vec",1),exprs); + [ok,this.txt,this.font,this.siz,exprs] = scicos_getvalue("Set Text block parameters",[["Text"],["Font number"],["Font size"]],list("str",-1,"vec",1,"vec",1),exprs); if (!ok) { break; } - if (font<=0||font>6) { + if (this.font<=0||this.font>6) { message("Font number must be greater than 0 and less than 7"); ok = false; } - if (siz<0) { + if (this.siz<0) { message("Font size must be positive"); ok = false; } @@ -48,8 +48,8 @@ function TEXT_f() { default_font_style = gh_winpal.font_style; default_font_size = gh_winpal.font_size; default_font_color = gh_winpal.font_color; - gh_winpal.font_style = font; - gh_winpal.font_size = siz; + gh_winpal.font_style = this.font; + gh_winpal.font_size = this.siz; r = xstringl(0,0,exprs[1-1],evstr(exprs[2-1]),evstr(exprs[3-1])); gh_winpal.font_style = default_font_style; gh_winpal.font_size = default_font_size; @@ -57,13 +57,13 @@ function TEXT_f() { sz = r.slice(3-1,4); graphics.sz = sz; this.x.graphics = graphics; - ipar = [[font],[siz]]; - model.rpar = txt; + ipar = [[this.font],[this.siz]]; + model.rpar = this.txt; model.ipar = ipar; this.x.model = model; break; } } - return new BasicBlock(this.x); + return new TextBlock(this.x); } } diff --git a/js/Misc/TEXT_f.pickle b/js/Misc/TEXT_f.pickle index 0d1dde24..b5b9efc8 100644 --- a/js/Misc/TEXT_f.pickle +++ b/js/Misc/TEXT_f.pickle @@ -2,8 +2,14 @@ c__builtin__ set p0 ((lp1 -S'x' +S'font' p2 -atp3 -Rp4 +aS'x' +p3 +aS'txt' +p4 +aS'siz' +p5 +atp6 +Rp7 .
\ No newline at end of file diff --git a/js/Misc/c_block.js b/js/Misc/c_block.js index 77e2cb6d..ffd42ee6 100644 --- a/js/Misc/c_block.js +++ b/js/Misc/c_block.js @@ -9,8 +9,8 @@ function c_block() { z0 = []; typ = "c"; auto = []; - rpar = []; - funam = "toto"; + this.rpar = []; + this.funam = "toto"; model = scicos_model(); model.sim = list(" ",2001); model.in1 = in1; @@ -19,12 +19,12 @@ function c_block() { model.evtout = clkout; model.state = x0; model.dstate = z0; - model.rpar = rpar; + model.rpar = this.rpar; model.ipar = 0; model.blocktype = typ; model.firing = auto; model.dep_ut = [true,false]; - label = list([[sci2exp(in1)],[sci2exp(out)],[strcat(sci2exp(rpar))],[funam]],list([])); + label = list([[sci2exp(in1)],[sci2exp(out)],[strcat(sci2exp(this.rpar))],[this.funam]],list([])); gr_i = []; this.x = standard_define([3,2],model,label,gr_i); return new BasicBlock(this.x); @@ -40,31 +40,31 @@ function c_block() { graphics = arg1.graphics; label = graphics.exprs; while (true) { - [ok,i,o,rpar,funam,lab] = scicos_getvalue("Set C_block parameters",[["input ports sizes"],["output port sizes"],["System parameters vector"],["function name"]],list("vec",-1,"vec",-1,"vec",-1,"str",-1),label[1-1]); + [ok,this.i,this.o,this.rpar,this.funam,this.lab] = scicos_getvalue("Set C_block parameters",[["input ports sizes"],["output port sizes"],["System parameters vector"],["function name"]],list("vec",-1,"vec",-1,"vec",-1,"str",-1),label[1-1]); if (!ok) { break; } - if (funam==" ") { + if (this.funam==" ") { break; } - label[1-1] = lab; - rpar = rpar.slice(); - i = int(i.slice()); - ni = size(i,1); - o = int(o.slice()); - no = size(o,1); + label[1-1] = this.lab; + this.rpar = this.rpar.slice(); + this.i = int(this.i.slice()); + ni = size(this.i,1); + this.o = int(this.o.slice()); + no = size(this.o,1); tt = label[2-1]; - if (model.sim[1-1]!=funam||size(model.in1,"*")!=size(i,"*")||size(model.out,"*")!=size(o,"*")) { + if (model.sim[1-1]!=this.funam||size(model.in1,"*")!=size(this.i,"*")||size(model.out,"*")!=size(this.o,"*")) { tt = []; } - [ok,tt] = CFORTR(funam,tt,i,o); + [ok,tt] = CFORTR(this.funam,tt,this.i,this.o); if (!ok) { break; } - [model,graphics,ok] = check_io(model,graphics,i,o,[],[]); + [model,graphics,ok] = check_io(model,graphics,this.i,this.o,[],[]); if (ok) { - model.sim[1-1] = funam; - model.rpar = rpar; + model.sim[1-1] = this.funam; + model.rpar = this.rpar; label[2-1] = tt; this.x.model = model; graphics.exprs = label; diff --git a/js/Misc/c_block.pickle b/js/Misc/c_block.pickle index 0d1dde24..72dce4d4 100644 --- a/js/Misc/c_block.pickle +++ b/js/Misc/c_block.pickle @@ -2,8 +2,18 @@ c__builtin__ set p0 ((lp1 -S'x' +S'i' p2 -atp3 -Rp4 +aS'lab' +p3 +aS'rpar' +p4 +aS'o' +p5 +aS'funam' +p6 +aS'x' +p7 +atp8 +Rp9 .
\ No newline at end of file diff --git a/js/Misc/fortran_block.js b/js/Misc/fortran_block.js index 7cd0df3e..79bfa270 100644 --- a/js/Misc/fortran_block.js +++ b/js/Misc/fortran_block.js @@ -14,8 +14,8 @@ function fortran_block() { model.blocktype = "c"; model.firing = []; model.dep_ut = [true,false]; - funam = "forty"; - label = list([[sci2exp(model.in1)],[sci2exp(model.out)],[strcat(sci2exp(model.rpar))],[funam]],list([])); + this.funam = "forty"; + label = list([[sci2exp(model.in1)],[sci2exp(model.out)],[strcat(sci2exp(model.rpar))],[this.funam]],list([])); gr_i = []; this.x = standard_define([4,2],model,label,gr_i); return new BasicBlock(this.x); @@ -31,31 +31,31 @@ function fortran_block() { graphics = arg1.graphics; label = graphics.exprs; while (true) { - [ok,i,o,rpar,funam,lab] = scicos_getvalue("Set fortran_block parameters",[["input ports sizes"],["output port sizes"],["System parameters vector"],["function name"]],list("vec",-1,"vec",-1,"vec",-1,"str",-1),label[1-1]); + [ok,this.i,this.o,this.rpar,this.funam,this.lab] = scicos_getvalue("Set fortran_block parameters",[["input ports sizes"],["output port sizes"],["System parameters vector"],["function name"]],list("vec",-1,"vec",-1,"vec",-1,"str",-1),label[1-1]); if (!ok) { break; } - if (funam==" ") { + if (this.funam==" ") { break; } - label[1-1] = lab; - rpar = rpar.slice(); - i = int(i.slice()); - ni = size(i,1); - o = int(o.slice()); - no = size(o,1); + label[1-1] = this.lab; + this.rpar = this.rpar.slice(); + this.i = int(this.i.slice()); + ni = size(this.i,1); + this.o = int(this.o.slice()); + no = size(this.o,1); tt = label[2-1]; - if (model.sim[1-1]!=funam||size(model.in1,"*")!=size(i,"*")||size(model.out,"*")!=size(o,"*")) { + if (model.sim[1-1]!=this.funam||size(model.in1,"*")!=size(this.i,"*")||size(model.out,"*")!=size(this.o,"*")) { tt = []; } - [ok,tt] = FORTR(funam,tt,i,o); + [ok,tt] = FORTR(this.funam,tt,this.i,this.o); if (!ok) { break; } - [model,graphics,ok] = check_io(model,graphics,i,o,[],[]); + [model,graphics,ok] = check_io(model,graphics,this.i,this.o,[],[]); if (ok) { - model.sim[1-1] = funam; - model.rpar = rpar; + model.sim[1-1] = this.funam; + model.rpar = this.rpar; label[2-1] = tt; this.x.model = model; graphics.exprs = label; diff --git a/js/Misc/fortran_block.pickle b/js/Misc/fortran_block.pickle index 0d1dde24..72dce4d4 100644 --- a/js/Misc/fortran_block.pickle +++ b/js/Misc/fortran_block.pickle @@ -2,8 +2,18 @@ c__builtin__ set p0 ((lp1 -S'x' +S'i' p2 -atp3 -Rp4 +aS'lab' +p3 +aS'rpar' +p4 +aS'o' +p5 +aS'funam' +p6 +aS'x' +p7 +atp8 +Rp9 .
\ No newline at end of file diff --git a/js/Misc/generic_block.js b/js/Misc/generic_block.js index 9ec5cd22..230ee9d1 100644 --- a/js/Misc/generic_block.js +++ b/js/Misc/generic_block.js @@ -2,9 +2,9 @@ function generic_block() { generic_block.prototype.define = function generic_block() { model = scicos_model(); - function_name = "sinblk"; - funtyp = 1; - model.sim = list(function_name,funtyp); + this.function_name = "sinblk"; + this.funtyp = 1; + model.sim = list(this.function_name,this.funtyp); model.in1 = 1; model.out = 1; model.evtin = []; @@ -16,7 +16,7 @@ function generic_block() { model.blocktype = "c"; model.firing = []; model.dep_ut = [true,false]; - label = [[function_name],[sci2exp(funtyp)],[sci2exp(model.in1)],[sci2exp(model.out)],[sci2exp(model.evtin)],[sci2exp(model.evtout)],[sci2exp(model.state)],[sci2exp(model.dstate)],[sci2exp(model.rpar)],[sci2exp(model.ipar)],[sci2exp(model.firing)],["y"],["n"]]; + label = [[this.function_name],[sci2exp(this.funtyp)],[sci2exp(model.in1)],[sci2exp(model.out)],[sci2exp(model.evtin)],[sci2exp(model.evtout)],[sci2exp(model.state)],[sci2exp(model.dstate)],[sci2exp(model.rpar)],[sci2exp(model.ipar)],[sci2exp(model.firing)],["y"],["n"]]; gr_i = []; this.x = standard_define([2,2],model,label,gr_i); return new BasicBlock(this.x); @@ -35,57 +35,57 @@ function generic_block() { label[9-1] = []; } while (true) { - [ok,function_name,funtyp,i,o,ci,co,xx,z,rpar,ipar,auto0,depu,dept,lab] = scicos_getvalue("Set GENERIC block parameters",[["simulation function"],["function type (0,1,2,..)"],["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%6)","str",1,"str",1),label); + [ok,this.function_name,this.funtyp,this.i,this.o,this.ci,this.co,this.xx,this.z,this.rpar,this.ipar,this.auto0,this.depu,this.dept,this.lab] = scicos_getvalue("Set GENERIC block parameters",[["simulation function"],["function type (0,1,2,..)"],["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%6)","str",1,"str",1),label); if (!ok) { break; } - label = lab; - function_name = stripblanks(function_name); - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - ipar = int(ipar.slice()); - i = int(i.slice()); - o = int(o.slice()); - ci = int(ci.slice()); - co = int(co.slice()); - funtyp = int(funtyp); - if (funtyp<0) { + label = this.lab; + this.function_name = stripblanks(this.function_name); + this.xx = this.xx.slice(); + this.z = this.z.slice(); + this.rpar = this.rpar.slice(); + this.ipar = int(this.ipar.slice()); + this.i = int(this.i.slice()); + this.o = int(this.o.slice()); + this.ci = int(this.ci.slice()); + this.co = int(this.co.slice()); + this.funtyp = int(this.funtyp); + if (this.funtyp<0) { message("function type cannot be negative"); ok = false; } - if ([[ci],[co]]!=[]) { - if (max([[ci],[co]])>1) { + if ([[this.ci],[this.co]]!=[]) { + if (max([[this.ci],[this.co]])>1) { message("vector event links not supported"); ok = false; } } - depu = stripblanks(depu); - if (part(depu,1)=="y") { - depu = true; + this.depu = stripblanks(this.depu); + if (part(this.depu,1)=="y") { + this.depu = true; } else { - depu = false; + this.depu = false; } - dept = stripblanks(dept); - if (part(dept,1)=="y") { - dept = true; + this.dept = stripblanks(this.dept); + if (part(this.dept,1)=="y") { + this.dept = true; } else { - dept = false; + this.dept = false; } - dep_ut = [depu,dept]; + dep_ut = [this.depu,this.dept]; if (ok) { - [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); + [model,graphics,ok] = check_io(model,graphics,this.i,this.o,this.ci,this.co); } if (ok) { - if (funtyp==3) { + if (this.funtyp==3) { needcompile = 4; } - model.sim = list(function_name,funtyp); - model.state = xx; - model.dstate = z; - model.rpar = rpar; - model.ipar = ipar; - model.firing = auto0; + model.sim = list(this.function_name,this.funtyp); + model.state = this.xx; + model.dstate = this.z; + model.rpar = this.rpar; + model.ipar = this.ipar; + model.firing = this.auto0; model.dep_ut = dep_ut; arg1.model = model; graphics.exprs = label; diff --git a/js/Misc/generic_block.pickle b/js/Misc/generic_block.pickle index 0d1dde24..e4602e80 100644 --- a/js/Misc/generic_block.pickle +++ b/js/Misc/generic_block.pickle @@ -2,8 +2,36 @@ c__builtin__ set p0 ((lp1 -S'x' +S'ci' p2 -atp3 -Rp4 +aS'co' +p3 +aS'i' +p4 +aS'auto0' +p5 +aS'o' +p6 +aS'rpar' +p7 +aS'depu' +p8 +aS'dept' +p9 +aS'xx' +p10 +aS'funtyp' +p11 +aS'lab' +p12 +aS'ipar' +p13 +aS'x' +p14 +aS'z' +p15 +aS'function_name' +p16 +atp17 +Rp18 .
\ No newline at end of file diff --git a/js/Misc/generic_block2.js b/js/Misc/generic_block2.js index 7eb9f7f5..e6372a3b 100644 --- a/js/Misc/generic_block2.js +++ b/js/Misc/generic_block2.js @@ -2,9 +2,9 @@ function generic_block2() { generic_block2.prototype.define = function generic_block2() { model = scicos_model(); - function_name = "sinblk"; - funtyp = 1; - model.sim = list(function_name,funtyp); + this.function_name = "sinblk"; + this.funtyp = 1; + model.sim = list(this.function_name,this.funtyp); model.in1 = 1; model.out = 1; model.evtin = []; @@ -16,7 +16,7 @@ function generic_block2() { model.blocktype = "c"; model.firing = []; model.dep_ut = [true,false]; - label = [[function_name],[sci2exp(funtyp)],[sci2exp(model.in1)],[sci2exp(model.out)],[sci2exp(model.evtin)],[sci2exp(model.evtout)],[sci2exp(model.state)],[sci2exp(model.dstate)],[sci2exp(model.rpar)],[sci2exp(model.ipar)],[sci2exp(model.nmode)],[sci2exp(model.nzcross)],[sci2exp(model.firing)],["y"],["n"]]; + label = [[this.function_name],[sci2exp(this.funtyp)],[sci2exp(model.in1)],[sci2exp(model.out)],[sci2exp(model.evtin)],[sci2exp(model.evtout)],[sci2exp(model.state)],[sci2exp(model.dstate)],[sci2exp(model.rpar)],[sci2exp(model.ipar)],[sci2exp(model.nmode)],[sci2exp(model.nzcross)],[sci2exp(model.firing)],["y"],["n"]]; gr_i = []; this.x = standard_define([2,2],model,label,gr_i); return new BasicBlock(this.x); @@ -35,59 +35,59 @@ function generic_block2() { label[9-1] = []; } while (true) { - [ok,function_name,funtyp,i,o,ci,co,xx,z,rpar,ipar,nmode,nzcr,auto0,depu,dept,lab] = scicos_getvalue("Set GENERIC block parameters",[["simulation function"],["function type (0,1,2,..)"],["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["number of modes"],["number of zero_crossings"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec","sum(%6)","str",1,"str",1),label); + [ok,this.function_name,this.funtyp,this.i,this.o,this.ci,this.co,this.xx,this.z,this.rpar,this.ipar,this.nmode,this.nzcr,this.auto0,this.depu,this.dept,this.lab] = scicos_getvalue("Set GENERIC block parameters",[["simulation function"],["function type (0,1,2,..)"],["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["number of modes"],["number of zero_crossings"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec","sum(%6)","str",1,"str",1),label); if (!ok) { break; } - label = lab; - function_name = stripblanks(function_name); - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - ipar = int(ipar.slice()); - i = int(i.slice()); - o = int(o.slice()); - ci = int(ci.slice()); - co = int(co.slice()); - funtyp = int(funtyp); - if (funtyp<0) { + label = this.lab; + this.function_name = stripblanks(this.function_name); + this.xx = this.xx.slice(); + this.z = this.z.slice(); + this.rpar = this.rpar.slice(); + this.ipar = int(this.ipar.slice()); + this.i = int(this.i.slice()); + this.o = int(this.o.slice()); + this.ci = int(this.ci.slice()); + this.co = int(this.co.slice()); + this.funtyp = int(this.funtyp); + if (this.funtyp<0) { message("function type cannot be negative"); ok = false; } - if ([[ci],[co]]!=[]) { - if (max([[ci],[co]])>1) { + if ([[this.ci],[this.co]]!=[]) { + if (max([[this.ci],[this.co]])>1) { message("vector event links not supported"); ok = false; } } - depu = stripblanks(depu); - if (part(depu,1)=="y") { - depu = true; + this.depu = stripblanks(this.depu); + if (part(this.depu,1)=="y") { + this.depu = true; } else { - depu = false; + this.depu = false; } - dept = stripblanks(dept); - if (part(dept,1)=="y") { - dept = true; + this.dept = stripblanks(this.dept); + if (part(this.dept,1)=="y") { + this.dept = true; } else { - dept = false; + this.dept = false; } - dep_ut = [depu,dept]; + dep_ut = [this.depu,this.dept]; if (ok) { - [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); + [model,graphics,ok] = check_io(model,graphics,this.i,this.o,this.ci,this.co); } if (ok) { - if (funtyp==3) { + if (this.funtyp==3) { needcompile = 4; } - model.sim = list(function_name,funtyp); - model.state = xx; - model.dstate = z; - model.rpar = rpar; - model.ipar = ipar; - model.firing = auto0; - model.nzcross = nzcr; - model.nmode = nmode; + model.sim = list(this.function_name,this.funtyp); + model.state = this.xx; + model.dstate = this.z; + model.rpar = this.rpar; + model.ipar = this.ipar; + model.firing = this.auto0; + model.nzcross = this.nzcr; + model.nmode = this.nmode; model.dep_ut = dep_ut; arg1.model = model; graphics.exprs = label; diff --git a/js/Misc/generic_block2.pickle b/js/Misc/generic_block2.pickle index 0d1dde24..9c0af7dc 100644 --- a/js/Misc/generic_block2.pickle +++ b/js/Misc/generic_block2.pickle @@ -2,8 +2,40 @@ c__builtin__ set p0 ((lp1 -S'x' +S'ci' p2 -atp3 -Rp4 +aS'co' +p3 +aS'i' +p4 +aS'auto0' +p5 +aS'o' +p6 +aS'rpar' +p7 +aS'depu' +p8 +aS'dept' +p9 +aS'xx' +p10 +aS'nzcr' +p11 +aS'funtyp' +p12 +aS'lab' +p13 +aS'ipar' +p14 +aS'x' +p15 +aS'z' +p16 +aS'nmode' +p17 +aS'function_name' +p18 +atp19 +Rp20 .
\ No newline at end of file diff --git a/js/Misc/generic_block3.js b/js/Misc/generic_block3.js index 2b94d741..899e8c49 100644 --- a/js/Misc/generic_block3.js +++ b/js/Misc/generic_block3.js @@ -2,9 +2,9 @@ function generic_block3() { generic_block3.prototype.define = function generic_block3() { model = scicos_model(); - function_name = "sinblk"; - funtyp = 4; - model.sim = list(function_name,funtyp); + this.function_name = "sinblk"; + this.funtyp = 4; + model.sim = list(this.function_name,this.funtyp); model.in1 = 1; model.in2 = 1; model.intyp = 1; @@ -12,7 +12,7 @@ function generic_block3() { model.out2 = 1; model.outtyp = 1; model.dep_ut = [true,false]; - label = [[function_name],[sci2exp(funtyp)],[sci2exp([model.in1,model.in2])],[sci2exp(model.intyp)],[sci2exp([model.out,model.out2]),sci2exp(model.outtyp)],[sci2exp(model.evtin)],[sci2exp(model.evtout)],[sci2exp(model.state)],[sci2exp(model.dstate)],[sci2exp(model.odstate)],[sci2exp(model.rpar)],[sci2exp(model.ipar)],[sci2exp(model.opar)],[sci2exp(model.nmode)],[sci2exp(model.nzcross)],[sci2exp(model.firing)],["y"],["n"]]; + label = [[this.function_name],[sci2exp(this.funtyp)],[sci2exp([model.in1,model.in2])],[sci2exp(model.intyp)],[sci2exp([model.out,model.out2]),sci2exp(model.outtyp)],[sci2exp(model.evtin)],[sci2exp(model.evtout)],[sci2exp(model.state)],[sci2exp(model.dstate)],[sci2exp(model.odstate)],[sci2exp(model.rpar)],[sci2exp(model.ipar)],[sci2exp(model.opar)],[sci2exp(model.nmode)],[sci2exp(model.nzcross)],[sci2exp(model.firing)],["y"],["n"]]; gr_i = []; this.x = standard_define([4,2],model,label,gr_i); return new BasicBlock(this.x); @@ -31,67 +31,67 @@ function generic_block3() { label[9-1] = []; } while (true) { - [ok,function_name,funtyp,in1,it,out,ot,ci,co,xx,z,oz,rpar,ipar,opar,nmode,nzcr,auto0,depu,dept,lab] = scicos_getvalue("Set GENERIC block parameters",[["Simulation function"],["Function type (0,1,2,..)"],["Input ports sizes"],["Input ports type"],["Output port sizes"],["Output ports type"],["Input event ports sizes"],["Output events ports sizes"],["Initial continuous state"],["Initial discrete state"],["Initial object state"],["Real parameters vector"],["Integer parameters vector"],["Object parameters list"],["Number of modes"],["Number of zero crossings"],["Initial firing vector (<0 for no firing)"],["Direct feedthrough (y or n)"],["Time dependence (y or n)"]],list("str",1,"vec",1,"mat",[-1,2],"vec",-1,"mat",[-1,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"lis",-1,"vec",-1,"vec",-1,"lis",-1,"vec",1,"vec",1,"vec","sum(%8)","str",1,"str",1),label); + [ok,this.function_name,this.funtyp,this.in1,this.it,this.out,this.ot,this.ci,this.co,this.xx,this.z,this.oz,this.rpar,this.ipar,this.opar,this.nmode,this.nzcr,this.auto0,this.depu,this.dept,this.lab] = scicos_getvalue("Set GENERIC block parameters",[["Simulation function"],["Function type (0,1,2,..)"],["Input ports sizes"],["Input ports type"],["Output port sizes"],["Output ports type"],["Input event ports sizes"],["Output events ports sizes"],["Initial continuous state"],["Initial discrete state"],["Initial object state"],["Real parameters vector"],["Integer parameters vector"],["Object parameters list"],["Number of modes"],["Number of zero crossings"],["Initial firing vector (<0 for no firing)"],["Direct feedthrough (y or n)"],["Time dependence (y or n)"]],list("str",1,"vec",1,"mat",[-1,2],"vec",-1,"mat",[-1,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"lis",-1,"vec",-1,"vec",-1,"lis",-1,"vec",1,"vec",1,"vec","sum(%8)","str",1,"str",1),label); if (!ok) { break; } - label = lab; - function_name = stripblanks(function_name); - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - ipar = int(ipar.slice()); - ci = int(ci.slice()); - co = int(co.slice()); - funtyp = funtyp; - if (funtyp<0) { + label = this.lab; + this.function_name = stripblanks(this.function_name); + this.xx = this.xx.slice(); + this.z = this.z.slice(); + this.rpar = this.rpar.slice(); + this.ipar = int(this.ipar.slice()); + this.ci = int(this.ci.slice()); + this.co = int(this.co.slice()); + this.funtyp = this.funtyp; + if (this.funtyp<0) { message("function type cannot be negative"); ok = false; } - if ([[ci],[co]]!=[]) { - if (max([[ci],[co]])>1) { + if ([[this.ci],[this.co]]!=[]) { + if (max([[this.ci],[this.co]])>1) { message("vector event links not supported"); ok = false; } } - if (this.type[opar-1]!=15) { + if (this.type[this.opar-1]!=15) { message("object parameter must be a list"); ok = false; } - if (this.type[oz-1]!=15) { + if (this.type[this.oz-1]!=15) { message("discrete object state must be a list"); ok = false; } - depu = stripblanks(depu); - if (part(depu,1)=="y") { - depu = true; + this.depu = stripblanks(this.depu); + if (part(this.depu,1)=="y") { + this.depu = true; } else { - depu = false; + this.depu = false; } - dept = stripblanks(dept); - if (part(dept,1)=="y") { - dept = true; + this.dept = stripblanks(this.dept); + if (part(this.dept,1)=="y") { + this.dept = true; } else { - dept = false; + this.dept = false; } - dep_ut = [depu,dept]; + dep_ut = [this.depu,this.dept]; if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ci,co); + [model,graphics,ok] = set_io(model,graphics,list(this.in1,this.it),list(this.out,this.ot),this.ci,this.co); } if (ok) { - if (funtyp==3) { + if (this.funtyp==3) { needcompile = 4; } - model.sim = list(function_name,funtyp); - model.state = xx; - model.dstate = z; - model.odstate = oz; - model.rpar = rpar; - model.ipar = ipar; - model.opar = opar; - model.firing = auto0; - model.nzcross = nzcr; - model.nmode = nmode; + model.sim = list(this.function_name,this.funtyp); + model.state = this.xx; + model.dstate = this.z; + model.odstate = this.oz; + model.rpar = this.rpar; + model.ipar = this.ipar; + model.opar = this.opar; + model.firing = this.auto0; + model.nzcross = this.nzcr; + model.nmode = this.nmode; model.dep_ut = dep_ut; arg1.model = model; graphics.exprs = label; diff --git a/js/Misc/generic_block3.pickle b/js/Misc/generic_block3.pickle index 54a16ece..3e4746c4 100644 --- a/js/Misc/generic_block3.pickle +++ b/js/Misc/generic_block3.pickle @@ -2,10 +2,50 @@ c__builtin__ set p0 ((lp1 -S'x' +S'ci' p2 -aS'type' +aS'co' p3 -atp4 -Rp5 +aS'it' +p4 +aS'rpar' +p5 +aS'auto0' +p6 +aS'funtyp' +p7 +aS'out' +p8 +aS'type' +p9 +aS'function_name' +p10 +aS'in1' +p11 +aS'lab' +p12 +aS'nmode' +p13 +aS'z' +p14 +aS'xx' +p15 +aS'nzcr' +p16 +aS'depu' +p17 +aS'dept' +p18 +aS'opar' +p19 +aS'oz' +p20 +aS'ipar' +p21 +aS'x' +p22 +aS'ot' +p23 +atp24 +Rp25 .
\ No newline at end of file diff --git a/js/Misc/scifunc_block.js b/js/Misc/scifunc_block.js index 50a5eb63..ff014084 100644 --- a/js/Misc/scifunc_block.js +++ b/js/Misc/scifunc_block.js @@ -9,7 +9,7 @@ function scifunc_block() { z0 = []; typ = "c"; auto = []; - rpar = []; + this.rpar = []; model = scicos_model(); model.sim = list("scifunc",3); model.in1 = in1; @@ -18,13 +18,13 @@ function scifunc_block() { model.evtout = clkout; model.state = x0; model.dstate = z0; - model.rpar = rpar; + model.rpar = this.rpar; model.ipar = 0; model.opar = list(); model.blocktype = typ; model.firing = auto; model.dep_ut = [true,false]; - exprs = list([[sci2exp(in1)],[sci2exp(out)],[sci2exp(clkin)],[sci2exp(clkout)],[strcat(sci2exp(x0))],[strcat(sci2exp(z0))],[strcat(sci2exp(rpar))],[sci2exp(auto)]],list("y1=sin(u1)"," "," ","y1=sin(u1)"," "," "," ")); + exprs = list([[sci2exp(in1)],[sci2exp(out)],[sci2exp(clkin)],[sci2exp(clkout)],[strcat(sci2exp(x0))],[strcat(sci2exp(z0))],[strcat(sci2exp(this.rpar))],[sci2exp(auto)]],list("y1=sin(u1)"," "," ","y1=sin(u1)"," "," "," ")); gr_i = []; this.x = standard_define([2,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -44,34 +44,34 @@ function scifunc_block() { exprs[1-1][9-1] = "0"; } while (true) { - [ok,i,o,ci,co,xx,z,rpar,auto0,deptime,lab] = scicos_getvalue([["Set scifunc_block parameters"],["only regular blocks supported"]],[["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["System parameters vector"],["initial firing vector (<0 for no firing)"],["is block always active (0:no, 1:yes)"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%4)","vec",1),exprs[1-1]); + [ok,this.i,this.o,this.ci,this.co,this.xx,this.z,this.rpar,this.auto0,this.deptime,this.lab] = scicos_getvalue([["Set scifunc_block parameters"],["only regular blocks supported"]],[["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["System parameters vector"],["initial firing vector (<0 for no firing)"],["is block always active (0:no, 1:yes)"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%4)","vec",1),exprs[1-1]); if (!ok) { break; } - exprs[1-1] = lab; - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - nrp = prod(size(rpar)); - i = int(i.slice()); - ni = size(i,1); - o = int(o.slice()); - no = size(o,1); - ci = int(ci.slice()); - nci = size(ci,1); - co = int(co.slice()); - nco = size(co,1); - [ok,tt,dep_ut] = genfunc1(exprs[2-1],i,o,nci,nco,size(xx,1),size(z,1),nrp,"c"); - dep_ut[2-1] = (1==deptime); + exprs[1-1] = this.lab; + this.xx = this.xx.slice(); + this.z = this.z.slice(); + this.rpar = this.rpar.slice(); + nrp = prod(size(this.rpar)); + this.i = int(this.i.slice()); + ni = size(this.i,1); + this.o = int(this.o.slice()); + no = size(this.o,1); + this.ci = int(this.ci.slice()); + nci = size(this.ci,1); + this.co = int(this.co.slice()); + nco = size(this.co,1); + [ok,tt,dep_ut] = genfunc1(exprs[2-1],this.i,this.o,nci,nco,size(this.xx,1),size(this.z,1),nrp,"c"); + dep_ut[2-1] = (1==this.deptime); if (!ok) { break; } - [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); + [model,graphics,ok] = check_io(model,graphics,this.i,this.o,this.ci,this.co); if (ok) { - auto = auto0; - model.state = xx; - model.dstate = z; - model.rpar = rpar; + auto = this.auto0; + model.state = this.xx; + model.dstate = this.z; + model.rpar = this.rpar; if (model.ipar!=0) { model.opar = model.ipar; model.ipar = 0; diff --git a/js/Misc/scifunc_block.pickle b/js/Misc/scifunc_block.pickle index 0d1dde24..4ae6bee1 100644 --- a/js/Misc/scifunc_block.pickle +++ b/js/Misc/scifunc_block.pickle @@ -2,8 +2,28 @@ c__builtin__ set p0 ((lp1 -S'x' +S'ci' p2 -atp3 -Rp4 +aS'co' +p3 +aS'i' +p4 +aS'deptime' +p5 +aS'auto0' +p6 +aS'o' +p7 +aS'rpar' +p8 +aS'xx' +p9 +aS'lab' +p10 +aS'x' +p11 +aS'z' +p12 +atp13 +Rp14 .
\ No newline at end of file diff --git a/js/Misc/scifunc_block_m.js b/js/Misc/scifunc_block_m.js index 8e338ba6..8268975d 100644 --- a/js/Misc/scifunc_block_m.js +++ b/js/Misc/scifunc_block_m.js @@ -9,7 +9,7 @@ function scifunc_block_m() { z0 = []; typ = "c"; auto = []; - rpar = []; + this.rpar = []; it = 1; model = scicos_model(); model.sim = list("scifunc",3); @@ -23,13 +23,13 @@ function scifunc_block_m() { model.evtout = clkout; model.state = x0; model.dstate = z0; - model.rpar = rpar; + model.rpar = this.rpar; model.ipar = 0; model.opar = list(); model.blocktype = typ; model.firing = auto; model.dep_ut = [true,false]; - exprs = list([[sci2exp([in1,in1])],[sci2exp([out,out])],[sci2exp(clkin)],[sci2exp(clkout)],[strcat(sci2exp(x0))],[strcat(sci2exp(z0))],[strcat(sci2exp(rpar))],[sci2exp(auto)],[sci2exp(0)]],list("y1=sin(u1)"," "," ","y1=sin(u1)"," "," "," ")); + exprs = list([[sci2exp([in1,in1])],[sci2exp([out,out])],[sci2exp(clkin)],[sci2exp(clkout)],[strcat(sci2exp(x0))],[strcat(sci2exp(z0))],[strcat(sci2exp(this.rpar))],[sci2exp(auto)],[sci2exp(0)]],list("y1=sin(u1)"," "," ","y1=sin(u1)"," "," "," ")); gr_i = []; this.x = standard_define([4,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -46,34 +46,34 @@ function scifunc_block_m() { graphics = arg1.graphics; exprs = graphics.exprs; while (true) { - [ok,i,o,ci,co,xx,z,rpar,auto0,deptime,lab] = scicos_getvalue([["Set scifunc_block parameters"],["only regular blocks supported"]],[["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["System parameters vector"],["initial firing vector (<0 for no firing)"],["is block always active (0:no, 1:yes)"]],list("mat",[-1,2],"mat",[-2,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1),exprs[1-1]); + [ok,this.i,this.o,this.ci,this.co,this.xx,this.z,this.rpar,this.auto0,this.deptime,this.lab] = scicos_getvalue([["Set scifunc_block parameters"],["only regular blocks supported"]],[["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["System parameters vector"],["initial firing vector (<0 for no firing)"],["is block always active (0:no, 1:yes)"]],list("mat",[-1,2],"mat",[-2,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1),exprs[1-1]); if (!ok) { break; } - exprs[1-1] = lab; - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - it = ones(1,size(i,1)); - ot = ones(1,size(o,1)); - nrp = prod(size(rpar)); - ni = size(i,1); - no = size(o,1); - ci = int(ci.slice()); - nci = size(ci,1); - co = int(co.slice()); - nco = size(co,1); - [ok,tt,dep_ut] = genfunc2(exprs[2-1],i,o,nci,nco,size(xx,1),size(z,1),nrp,"c"); - dep_ut[2-1] = (1==deptime); + exprs[1-1] = this.lab; + this.xx = this.xx.slice(); + this.z = this.z.slice(); + this.rpar = this.rpar.slice(); + it = ones(1,size(this.i,1)); + ot = ones(1,size(this.o,1)); + nrp = prod(size(this.rpar)); + ni = size(this.i,1); + no = size(this.o,1); + this.ci = int(this.ci.slice()); + nci = size(this.ci,1); + this.co = int(this.co.slice()); + nco = size(this.co,1); + [ok,tt,dep_ut] = genfunc2(exprs[2-1],this.i,this.o,nci,nco,size(this.xx,1),size(this.z,1),nrp,"c"); + dep_ut[2-1] = (1==this.deptime); if (!ok) { break; } - [model,graphics,ok] = set_io(model,graphics,list(i,it),list(o,ot),ci,co); + [model,graphics,ok] = set_io(model,graphics,list(this.i,it),list(this.o,ot),this.ci,this.co); if (ok) { - auto = auto0; - model.state = xx; - model.dstate = z; - model.rpar = rpar; + auto = this.auto0; + model.state = this.xx; + model.dstate = this.z; + model.rpar = this.rpar; if (model.ipar!=0) { model.opar = model.ipar; model.ipar = 0; diff --git a/js/Misc/scifunc_block_m.pickle b/js/Misc/scifunc_block_m.pickle index 0d1dde24..4ae6bee1 100644 --- a/js/Misc/scifunc_block_m.pickle +++ b/js/Misc/scifunc_block_m.pickle @@ -2,8 +2,28 @@ c__builtin__ set p0 ((lp1 -S'x' +S'ci' p2 -atp3 -Rp4 +aS'co' +p3 +aS'i' +p4 +aS'deptime' +p5 +aS'auto0' +p6 +aS'o' +p7 +aS'rpar' +p8 +aS'xx' +p9 +aS'lab' +p10 +aS'x' +p11 +aS'z' +p12 +atp13 +Rp14 .
\ No newline at end of file |