diff options
author | Sunil Shetye | 2018-06-25 12:08:56 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-06-25 12:45:27 +0530 |
commit | 7c70459c10aed0d74ee03896abaf47fefdbf7c8f (patch) | |
tree | 6f6acc6a5087295c6e59f0f94bfda5025049d5fa /js/Linear/INTEGRAL.js | |
parent | 870479a2e4b932426a904b2ebae7e4ee72037326 (diff) | |
download | sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.tar.gz sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.tar.bz2 sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.zip |
separate out code for getvalue
Diffstat (limited to 'js/Linear/INTEGRAL.js')
-rw-r--r-- | js/Linear/INTEGRAL.js | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/js/Linear/INTEGRAL.js b/js/Linear/INTEGRAL.js index 539b6c49..289c882c 100644 --- a/js/Linear/INTEGRAL.js +++ b/js/Linear/INTEGRAL.js @@ -1,78 +1,78 @@ /* autogenerated from "macros/Linear/INTEGRAL.sci" */ function INTEGRAL() { INTEGRAL.prototype.define = function INTEGRAL() { -maxp=1; -minp=-1; -rpar=[]; -model=scicos_model(); -model.state=0; -model.sim=list("integral_func",4); -model.in1=1; -model.out=1; -model.rpar=rpar; -model.blocktype="c"; -model.dep_ut=[false,true]; -exprs=string([[0],[0],[0],[maxp],[minp]]); -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); -x.graphics.id="1/s"; + maxp = 1; + minp = -1; + rpar = []; + model = scicos_model(); + model.state = 0; + model.sim = list("integral_func",4); + model.in1 = 1; + model.out = 1; + model.rpar = rpar; + model.blocktype = "c"; + model.dep_ut = [false,true]; + exprs = string([[0],[0],[0],[maxp],[minp]]); + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); + x.graphics.id = "1/s"; } INTEGRAL.prototype.details = function INTEGRAL() { } INTEGRAL.prototype.get = function INTEGRAL() { } INTEGRAL.prototype.set = function INTEGRAL() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,x0,reinit,satur,maxp,lowp,exprs]=scicos_getvalue("Set Integral block parameters",[["Initial Condition"],["With re-intialization (1:yes, 0:no)"],["With saturation (1:yes, 0:no)"],["Upper limit"],["Lower limit"]],list("vec",-1,"vec",1,"vec",1,"vec",-1,"vec",-1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,x0,reinit,satur,maxp,lowp,exprs] = scicos_getvalue("Set Integral block parameters",[["Initial Condition"],["With re-intialization (1:yes, 0:no)"],["With saturation (1:yes, 0:no)"],["Upper limit"],["Lower limit"]],list("vec",-1,"vec",1,"vec",1,"vec",-1,"vec",-1),exprs); + if (!ok) { break; } -x0=x0.slice(); -maxp=maxp.slice(); -lowp=lowp.slice(); -if (reinit!=0) { -reinit=1; + x0 = x0.slice(); + maxp = maxp.slice(); + lowp = lowp.slice(); + if (reinit!=0) { + reinit = 1; } -if (satur!=0) { -satur=1; -if (size(maxp,"*")==1) { -maxp=maxp*ones(x0); + if (satur!=0) { + satur = 1; + if (size(maxp,"*")==1) { + maxp = maxp*ones(x0); } -if (size(lowp,"*")==1) { -lowp=lowp*ones(x0); + if (size(lowp,"*")==1) { + lowp = lowp*ones(x0); } -if ((size(x0,1)!=size(maxp,1)||size(x0,1)!=size(lowp,1))) { + if ((size(x0,1)!=size(maxp,1)||size(x0,1)!=size(lowp,1))) { message("x0 and Upper limit and Lower limit must have same size"); -ok=false; -} else if (or(maxp<=lowp)) { + ok = false; + } else if (or(maxp<=lowp)) { message("Upper limits must be > Lower limits"); -ok=false; -} else if (or(x0>maxp)||or(x0<lowp)) { + ok = false; + } else if (or(x0>maxp)||or(x0<lowp)) { message("Initial condition x0 should be inside the limits"); -ok=false; -} else { -rpar=[[maxp],[lowp]]; -model.nzcross=size(x0,1); -model.nmode=size(x0,1); + ok = false; + } else { + rpar = [[maxp],[lowp]]; + model.nzcross = size(x0,1); + model.nmode = size(x0,1); } -} else { -rpar=[]; -model.nzcross=0; -model.nmode=0; + } else { + rpar = []; + model.nzcross = 0; + model.nmode = 0; } -if (ok) { -model.rpar=rpar; -model.state=x0; -[model,graphics,ok]=check_io(model,graphics,size(x0,1)*[[1],[ones(reinit,1)]],size(x0,1),ones(reinit,1),[]); + if (ok) { + model.rpar = rpar; + model.state = x0; + [model,graphics,ok] = check_io(model,graphics,size(x0,1)*[[1],[ones(reinit,1)]],size(x0,1),ones(reinit,1),[]); } -if (ok) { -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + if (ok) { + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } |