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/CLSS.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/CLSS.js')
-rw-r--r-- | js/Linear/CLSS.js | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/js/Linear/CLSS.js b/js/Linear/CLSS.js index 1bd13689..05f1fe80 100644 --- a/js/Linear/CLSS.js +++ b/js/Linear/CLSS.js @@ -1,84 +1,84 @@ /* autogenerated from "macros/Linear/CLSS.sci" */ function CLSS() { CLSS.prototype.define = function CLSS() { -x0=0; -A=-1; -B=1; -C=1; -D=0; -in1=1; -out=1; -model=scicos_model(); -model.sim=list("csslti4",4); -model.in1=in1; -model.out=out; -model.state=x0; -model.rpar=[[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; -model.blocktype="c"; -model.dep_ut=[false,true]; -exprs=[[strcat(sci2exp(A))],[strcat(sci2exp(B))],[strcat(sci2exp(C))],[strcat(sci2exp(D))],[strcat(sci2exp(x0))]]; -gr_i=[]; -x=standard_define([4,2],model,exprs,gr_i); + x0 = 0; + A = -1; + B = 1; + C = 1; + D = 0; + in1 = 1; + out = 1; + model = scicos_model(); + model.sim = list("csslti4",4); + model.in1 = in1; + model.out = out; + model.state = x0; + model.rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + model.blocktype = "c"; + model.dep_ut = [false,true]; + exprs = [[strcat(sci2exp(A))],[strcat(sci2exp(B))],[strcat(sci2exp(C))],[strcat(sci2exp(D))],[strcat(sci2exp(x0))]]; + gr_i = []; + x = standard_define([4,2],model,exprs,gr_i); } CLSS.prototype.details = function CLSS() { } CLSS.prototype.get = function CLSS() { } CLSS.prototype.set = function CLSS() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -if (size(exprs,"*")==7) { -exprs=exprs[[1:4,7]-1]; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + if (size(exprs,"*")==7) { + exprs = exprs[[1:4,7]-1]; } -model=arg1.model; -while (true) { -[ok,A,B,C,D,x0,exprs]=scicos_getvalue("Set continuous linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); -if (!ok) { + model = arg1.model; + while (true) { + [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); + if (!ok) { break; } -out=size(C,1); -if (out==0) { -out=[]; + out = size(C,1); + if (out==0) { + out = []; } -in1=size(B,2); -if (in1==0) { -in1=[]; + in1 = size(B,2); + if (in1==0) { + in1 = []; } -[ms,ns]=size(A); -okD=true; -if (size(D,"*")!=size(C,1)*size(B,2)) { -if (size(D,"*")==1) { -D=D*ones(C*B); -} else if (size(D,"*")==0) { -D=zeros(C*B); -} else { -okD=false; + [ms,ns] = size(A); + okD = true; + if (size(D,"*")!=size(C,1)*size(B,2)) { + if (size(D,"*")==1) { + D = D*ones(C*B); + } else if (size(D,"*")==0) { + D = zeros(C*B); + } else { + okD = false; } } -if (ms!=ns||!okD) { + if (ms!=ns||!okD) { message(_("Matrix A is not square or D has wrong dimension")); -} else { -[model,graphics,ok]=check_io(model,graphics,in1,out,[],[]); -if (ok) { -graphics.exprs=exprs; -rpar=[[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; -if (D!=[]) { -if (norm(D,1)!=0) { -mmm=[true,true]; -} else { -mmm=[false,true]; + } else { + [model,graphics,ok] = check_io(model,graphics,in1,out,[],[]); + if (ok) { + graphics.exprs = exprs; + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + if (D!=[]) { + if (norm(D,1)!=0) { + mmm = [true,true]; + } else { + mmm = [false,true]; } -if (or(model.dep_ut!=mmm)) { -model.dep_ut=mmm; + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; } -} else { -model.dep_ut=[false,true]; + } else { + model.dep_ut = [false,true]; } -model.state=x0.slice(); -model.rpar=rpar; -x.graphics=graphics; -x.model=model; + model.state = x0.slice(); + model.rpar = rpar; + x.graphics = graphics; + x.model = model; break; } } |