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 | |
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')
36 files changed, 1726 insertions, 1726 deletions
diff --git a/js/Linear/BIGSOM_f.js b/js/Linear/BIGSOM_f.js index 13cca127..23b27e04 100644 --- a/js/Linear/BIGSOM_f.js +++ b/js/Linear/BIGSOM_f.js @@ -1,39 +1,39 @@ /* autogenerated from "macros/Linear/BIGSOM_f.sci" */ function BIGSOM_f() { BIGSOM_f.prototype.define = function BIGSOM_f() { -sgn=[[1],[1]]; -model=scicos_model(); -model.sim=list("sum",2); -model.in1=[[-1],[-1]]; -model.out=-1; -model.rpar=sgn; -model.blocktype="c"; -model.dep_ut=[true,false]; -exprs=sci2exp(sgn); -gr_i=[]; -x=standard_define([2,3],model,exprs,gr_i); + sgn = [[1],[1]]; + model = scicos_model(); + model.sim = list("sum",2); + model.in1 = [[-1],[-1]]; + model.out = -1; + model.rpar = sgn; + model.blocktype = "c"; + model.dep_ut = [true,false]; + exprs = sci2exp(sgn); + gr_i = []; + x = standard_define([2,3],model,exprs,gr_i); } BIGSOM_f.prototype.details = function BIGSOM_f() { } BIGSOM_f.prototype.get = function BIGSOM_f() { } BIGSOM_f.prototype.set = function BIGSOM_f() { -x=arg1; -graphics=arg1.graphics; -model=arg1.model; -exprs=graphics.exprs; -while (true) { -[ok,sgn,exprs]=scicos_getvalue("Set sum block parameters","Inputs ports signs/gain",list("vec",-1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + model = arg1.model; + exprs = graphics.exprs; + while (true) { + [ok,sgn,exprs] = scicos_getvalue("Set sum block parameters","Inputs ports signs/gain",list("vec",-1),exprs); + if (!ok) { break; } -in1=-ones(size(sgn,"*"),1); -[model,graphics,ok]=check_io(model,graphics,in1,-1,[],[]); -if (ok) { -model.rpar=sgn.slice(); -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + in1 = -ones(size(sgn,"*"),1); + [model,graphics,ok] = check_io(model,graphics,in1,-1,[],[]); + if (ok) { + model.rpar = sgn.slice(); + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/CLINDUMMY_f.js b/js/Linear/CLINDUMMY_f.js index 3fc5112a..32a65e6b 100644 --- a/js/Linear/CLINDUMMY_f.js +++ b/js/Linear/CLINDUMMY_f.js @@ -1,21 +1,21 @@ /* autogenerated from "macros/Linear/CLINDUMMY_f.sci" */ function CLINDUMMY_f() { CLINDUMMY_f.prototype.define = function CLINDUMMY_f() { -x0=0; -model=scicos_model(); -model.sim=list("cdummy",4); -model.state=x0; -model.blocktype="c"; -model.firing=[]; -model.dep_ut=[false,true]; -gr_i=[]; -x=standard_define([3,2],model,[],gr_i); + x0 = 0; + model = scicos_model(); + model.sim = list("cdummy",4); + model.state = x0; + model.blocktype = "c"; + model.firing = []; + model.dep_ut = [false,true]; + gr_i = []; + x = standard_define([3,2],model,[],gr_i); } CLINDUMMY_f.prototype.details = function CLINDUMMY_f() { } CLINDUMMY_f.prototype.get = function CLINDUMMY_f() { } CLINDUMMY_f.prototype.set = function CLINDUMMY_f() { -x=arg1; + x = arg1; } } diff --git a/js/Linear/CLR.js b/js/Linear/CLR.js index dcebbfb5..d6768d96 100644 --- a/js/Linear/CLR.js +++ b/js/Linear/CLR.js @@ -1,71 +1,71 @@ /* autogenerated from "macros/Linear/CLR.sci" */ function CLR() { CLR.prototype.define = function CLR() { -x0=0; -A=-1; -B=1; -C=1; -D=0; -exprs=[["1"],["1+s"]]; -model=scicos_model(); -model.sim=list("csslti4",4); -model.in1=1; -model.out=1; -model.state=x0; -model.rpar=[[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; -model.blocktype="c"; -model.dep_ut=[false,true]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + x0 = 0; + A = -1; + B = 1; + C = 1; + D = 0; + exprs = [["1"],["1+s"]]; + model = scicos_model(); + model.sim = list("csslti4",4); + model.in1 = 1; + model.out = 1; + model.state = x0; + model.rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + model.blocktype = "c"; + model.dep_ut = [false,true]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } CLR.prototype.details = function CLR() { } CLR.prototype.get = function CLR() { } CLR.prototype.set = function CLR() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -x0=model.state; -rpar=model.rpar; -ns=prod(size(x0)); -nin=1; -nout=1; -PREVAR_scicos_context=PREVAR_scicos_context; -PREVAR_scicos_context.s=%s; -while (true) { -[ok,num,den,exprs]=scicos_getvalue("Set continuous SISO transfer parameters",[["Numerator (s)"],["Denominator (s)"]],list("pol",1,"pol",1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + x0 = model.state; + rpar = model.rpar; + ns = prod(size(x0)); + nin = 1; + nout = 1; + PREVAR_scicos_context = PREVAR_scicos_context; + PREVAR_scicos_context.s = %s; + while (true) { + [ok,num,den,exprs] = scicos_getvalue("Set continuous SISO transfer parameters",[["Numerator (s)"],["Denominator (s)"]],list("pol",1,"pol",1),exprs); + if (!ok) { break; } -if (degree(num)>degree(den)) { + if (degree(num)>degree(den)) { message("Transfer function must be proper or strictly proper."); -ok=false; + ok = false; } -if (ok) { -H=cont_frm(num,den); -[A,B,C,D]=H.slice(2-1,5); -graphics.exprs=exprs; -[ns1,ns1]=size(A); -rpar=[[matrix(A,ns1*ns1,1)],[matrix(B,ns1,1)],[matrix(C,ns1,1)],[D]]; -if (norm(D,1)!=0) { -mmm=[true,true]; -} else { -mmm=[false,true]; + if (ok) { + H = cont_frm(num,den); + [A,B,C,D] = H.slice(2-1,5); + graphics.exprs = exprs; + [ns1,ns1] = size(A); + rpar = [[matrix(A,ns1*ns1,1)],[matrix(B,ns1,1)],[matrix(C,ns1,1)],[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; } -if (ns1<=ns) { -x0=x0.slice(1-1,ns1); -} else { -x0[ns1-1][1-1]=0; + if (ns1<=ns) { + x0 = x0.slice(1-1,ns1); + } else { + x0[ns1-1][1-1] = 0; } -model.state=x0; -model.rpar=rpar; -x.graphics=graphics; -x.model=model; + model.state = x0; + model.rpar = rpar; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/CLR_f.js b/js/Linear/CLR_f.js index 3b87cba3..459f975b 100644 --- a/js/Linear/CLR_f.js +++ b/js/Linear/CLR_f.js @@ -1,71 +1,71 @@ /* autogenerated from "macros/Linear/CLR_f.sci" */ function CLR_f() { CLR_f.prototype.define = function CLR_f() { -x0=0; -A=-1; -B=1; -C=1; -D=0; -exprs=[["1"],["1+s"]]; -model=scicos_model(); -model.sim=list("csslti",1); -model.in1=1; -model.out=1; -model.state=x0; -model.rpar=[[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; -model.blocktype="c"; -model.dep_ut=[false,true]; -gr_i=[]; -x=standard_define([2.5,2.5],model,exprs,gr_i); + x0 = 0; + A = -1; + B = 1; + C = 1; + D = 0; + exprs = [["1"],["1+s"]]; + model = scicos_model(); + model.sim = list("csslti",1); + model.in1 = 1; + model.out = 1; + model.state = x0; + model.rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + model.blocktype = "c"; + model.dep_ut = [false,true]; + gr_i = []; + x = standard_define([2.5,2.5],model,exprs,gr_i); } CLR_f.prototype.details = function CLR_f() { } CLR_f.prototype.get = function CLR_f() { } CLR_f.prototype.set = function CLR_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -x0=model.state; -rpar=model.rpar; -ns=prod(size(x0)); -nin=1; -nout=1; -PREVAR_scicos_context=PREVAR_scicos_context; -PREVAR_scicos_context.s=%s; -while (true) { -[ok,num,den,exprs]=scicos_getvalue("Set continuous SISO transfer parameters",[["Numerator (s)"],["Denominator (s)"]],list("pol",1,"pol",1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + x0 = model.state; + rpar = model.rpar; + ns = prod(size(x0)); + nin = 1; + nout = 1; + PREVAR_scicos_context = PREVAR_scicos_context; + PREVAR_scicos_context.s = %s; + while (true) { + [ok,num,den,exprs] = scicos_getvalue("Set continuous SISO transfer parameters",[["Numerator (s)"],["Denominator (s)"]],list("pol",1,"pol",1),exprs); + if (!ok) { break; } -if (degree(num)>degree(den)) { + if (degree(num)>degree(den)) { message("Transfer must be proper or strictly proper"); -ok=false; + ok = false; } -if (ok) { -H=cont_frm(num,den); -[A,B,C,D]=H.slice(2-1,5); -graphics.exprs=exprs; -[ns1,ns1]=size(A); -rpar=[[matrix(A,ns1*ns1,1)],[matrix(B,ns1,1)],[matrix(C,ns1,1)],[D]]; -if (norm(D,1)!=0) { -mmm=[true,true]; -} else { -mmm=[false,true]; + if (ok) { + H = cont_frm(num,den); + [A,B,C,D] = H.slice(2-1,5); + graphics.exprs = exprs; + [ns1,ns1] = size(A); + rpar = [[matrix(A,ns1*ns1,1)],[matrix(B,ns1,1)],[matrix(C,ns1,1)],[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; } -if (ns1<=ns) { -x0=x0.slice(1-1,ns1); -} else { -x0[ns1-1][1-1]=0; + if (ns1<=ns) { + x0 = x0.slice(1-1,ns1); + } else { + x0[ns1-1][1-1] = 0; } -model.state=x0; -model.rpar=rpar; -x.graphics=graphics; -x.model=model; + model.state = x0; + model.rpar = rpar; + x.graphics = graphics; + x.model = model; break; } } 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; } } diff --git a/js/Linear/CLSS_f.js b/js/Linear/CLSS_f.js index fe2c0dbc..1a78799d 100644 --- a/js/Linear/CLSS_f.js +++ b/js/Linear/CLSS_f.js @@ -1,74 +1,74 @@ /* autogenerated from "macros/Linear/CLSS_f.sci" */ function CLSS_f() { CLSS_f.prototype.define = function CLSS_f() { -x0=0; -A=-1; -B=1; -C=1; -D=0; -in1=1; -out=1; -model=scicos_model(); -model.sim=list("csslti",1); -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("csslti",1); + 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_f.prototype.details = function CLSS_f() { } CLSS_f.prototype.get = function CLSS_f() { } CLSS_f.prototype.set = function CLSS_f() { -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); -if (ms!=ns) { + [ms,ns] = size(A); + if (ms!=ns) { message("A matrix must be square"); -} 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; } } diff --git a/js/Linear/DELAYV_f.js b/js/Linear/DELAYV_f.js index 32d5eca9..08c96e3e 100644 --- a/js/Linear/DELAYV_f.js +++ b/js/Linear/DELAYV_f.js @@ -1,60 +1,60 @@ /* autogenerated from "macros/Linear/DELAYV_f.sci" */ function DELAYV_f() { DELAYV_f.prototype.define = function DELAYV_f() { -nin=1; -z0=zeros(11,1); -zz0=z0.slice(1-1,$-1); -T=1; -model=scicos_model(); -model.sim=list("delayv",1); -model.in1=[[nin],[1]]; -model.out=nin; -model.evtin=1; -model.evtout=[[1],[1]]; -model.dstate=z0; -model.rpar=T/(size(zz0,"*")); -model.blocktype="d"; -model.firing=[0,-1]; -model.dep_ut=[true,false]; -exprs=[[string(nin)],[strcat(string(z0.slice(1-1,$-1)),";")],[string(T)]]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + nin = 1; + z0 = zeros(11,1); + zz0 = z0.slice(1-1,$-1); + T = 1; + model = scicos_model(); + model.sim = list("delayv",1); + model.in1 = [[nin],[1]]; + model.out = nin; + model.evtin = 1; + model.evtout = [[1],[1]]; + model.dstate = z0; + model.rpar = T/(size(zz0,"*")); + model.blocktype = "d"; + model.firing = [0,-1]; + model.dep_ut = [true,false]; + exprs = [[string(nin)],[strcat(string(z0.slice(1-1,$-1)),";")],[string(T)]]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } DELAYV_f.prototype.details = function DELAYV_f() { } DELAYV_f.prototype.get = function DELAYV_f() { } DELAYV_f.prototype.set = function DELAYV_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -nin=model.in1[1-1]; -z0=model.dstate; -zz0=z0.slice(1-1,$-1); -told=z0[$-1]; -while (true) { -[ok,nin,zz0,T,exprs]=scicos_getvalue("Set delay parameters",[["Number of inputs"],["Register initial condition"],["Max delay"]],list("vec",1,"vec",-1,"vec",1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + nin = model.in1[1-1]; + z0 = model.dstate; + zz0 = z0.slice(1-1,$-1); + told = z0[$-1]; + while (true) { + [ok,nin,zz0,T,exprs] = scicos_getvalue("Set delay parameters",[["Number of inputs"],["Register initial condition"],["Max delay"]],list("vec",1,"vec",-1,"vec",1),exprs); + if (!ok) { break; } -if (size(zz0,"*")<2) { + if (size(zz0,"*")<2) { message("Register length must be at least 2"); -ok=false; + ok = false; } -if (T<=0) { + if (T<=0) { message("Delay must be positive"); -ok=false; + ok = false; } -if (ok) { -[model,graphics,ok]=check_io(model,graphics,[[nin],[1]],nin,1,[[1],[1]]); + if (ok) { + [model,graphics,ok] = check_io(model,graphics,[[nin],[1]],nin,1,[[1],[1]]); } -if (ok) { -graphics.exprs=exprs; -model.dstate=[[zz0.slice()],[told]]; -model.rpar=T/(size(zz0,"*")); -x.graphics=graphics; -x.model=model; + if (ok) { + graphics.exprs = exprs; + model.dstate = [[zz0.slice()],[told]]; + model.rpar = T/(size(zz0,"*")); + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/DELAY_f.js b/js/Linear/DELAY_f.js index 8ae0eca2..cde21698 100644 --- a/js/Linear/DELAY_f.js +++ b/js/Linear/DELAY_f.js @@ -1,128 +1,128 @@ /* autogenerated from "macros/Linear/DELAY_f.sci" */ function DELAY_f() { DELAY_f.prototype.define = function DELAY_f() { -evtdly=EVTDLY_f("define"); -evtdly.graphics.orig=[243,296]; -evtdly.graphics.sz=[40,40]; -evtdly.graphics.flip=true; -evtdly.graphics.exprs=[["0.1"],["0"]]; -evtdly.graphics.pein=10; -evtdly.graphics.peout=7; -evtdly.model.rpar=0.1; -evtdly.model.firing=0; -register=REGISTER_f("define"); -register.graphics.orig=[238,195]; -register.graphics.sz=[50,50]; -register.graphics.flip=true; -register.graphics.exprs="0;0;0;0;0;0;0;0;0;0"; -register.graphics.pin=6; -register.graphics.pout=5; -register.graphics.pein=9; -input_port=IN_f("define"); -input_port.graphics.orig=[92,210]; -input_port.graphics.sz=[20,20]; -input_port.graphics.flip=true; -input_port.graphics.exprs=[["1"],["1"]]; -input_port.graphics.pout=6; -input_port.model.ipar=1; -output_port=OUT_f("define"); -output_port.graphics.orig=[440,210]; -output_port.graphics.sz=[20,20]; -output_port.graphics.flip=true; -output_port.graphics.exprs=[["1"],["1"]]; -output_port.graphics.pin=5; -output_port.model.ipar=1; -split=CLKSPLIT_f("define"); -split.graphics.orig=[[263],[271.2]]; -split.graphics.pein=7; -split.graphics.peout=[[9],[10]]; -diagram=scicos_diagram(); -diagram.objs[1-1]=input_port; -diagram.objs[2-1]=output_port; -diagram.objs[3-1]=register; -diagram.objs[4-1]=evtdly; -diagram.objs[5-1]=scicos_link(xx=[[296.6],[440]],yy=[[220],[220]],from=[3,1],to=[2,1]); -diagram.objs[6-1]=scicos_link(xx=[[112],[229.4]],yy=[[220],[220]],from=[1,1],to=[3,1]); -diagram.objs[7-1]=scicos_link(xx=[[263],[263]],yy=[[290.3],[271.2]],ct=[5,-1],from=[4,1],to=[8,1]); -diagram.objs[8-1]=split; -diagram.objs[9-1]=scicos_link(xx=[[263],[263]],yy=[[271.2],[250.7]],ct=[5,-1],from=[8,1],to=[3,1]); -diagram.objs[10-1]=scicos_link(xx=[[263],[308.6],[308.6],[263],[263]],yy=[[271.2],[271.2],[367],[367],[341.7]],ct=[5,-1],from=[8,2],to=[4,1]); -x=scicos_block(); -x.gui="DELAY_f"; -x.graphics.sz=[2,2]; -x.graphics.gr_i=[]; -x.graphics.pin=0; -x.graphics.pout=0; -x.model.sim="csuper"; -x.model.in1=1; -x.model.out=1; -x.model.blocktype="h"; -x.model.dep_ut=[false,false]; -x.model.rpar=diagram; -x.graphics.in_implicit=["E"]; -x.graphics.in_style=""; -x.graphics.out_implicit=["E"]; -x.graphics.out_style=""; + evtdly = EVTDLY_f("define"); + evtdly.graphics.orig = [243,296]; + evtdly.graphics.sz = [40,40]; + evtdly.graphics.flip = true; + evtdly.graphics.exprs = [["0.1"],["0"]]; + evtdly.graphics.pein = 10; + evtdly.graphics.peout = 7; + evtdly.model.rpar = 0.1; + evtdly.model.firing = 0; + register = REGISTER_f("define"); + register.graphics.orig = [238,195]; + register.graphics.sz = [50,50]; + register.graphics.flip = true; + register.graphics.exprs = "0;0;0;0;0;0;0;0;0;0"; + register.graphics.pin = 6; + register.graphics.pout = 5; + register.graphics.pein = 9; + input_port = IN_f("define"); + input_port.graphics.orig = [92,210]; + input_port.graphics.sz = [20,20]; + input_port.graphics.flip = true; + input_port.graphics.exprs = [["1"],["1"]]; + input_port.graphics.pout = 6; + input_port.model.ipar = 1; + output_port = OUT_f("define"); + output_port.graphics.orig = [440,210]; + output_port.graphics.sz = [20,20]; + output_port.graphics.flip = true; + output_port.graphics.exprs = [["1"],["1"]]; + output_port.graphics.pin = 5; + output_port.model.ipar = 1; + split = CLKSPLIT_f("define"); + split.graphics.orig = [[263],[271.2]]; + split.graphics.pein = 7; + split.graphics.peout = [[9],[10]]; + diagram = scicos_diagram(); + diagram.objs[1-1] = input_port; + diagram.objs[2-1] = output_port; + diagram.objs[3-1] = register; + diagram.objs[4-1] = evtdly; + diagram.objs[5-1] = scicos_link(xx=[[296.6],[440]],yy=[[220],[220]],from=[3,1],to=[2,1]); + diagram.objs[6-1] = scicos_link(xx=[[112],[229.4]],yy=[[220],[220]],from=[1,1],to=[3,1]); + diagram.objs[7-1] = scicos_link(xx=[[263],[263]],yy=[[290.3],[271.2]],ct=[5,-1],from=[4,1],to=[8,1]); + diagram.objs[8-1] = split; + diagram.objs[9-1] = scicos_link(xx=[[263],[263]],yy=[[271.2],[250.7]],ct=[5,-1],from=[8,1],to=[3,1]); + diagram.objs[10-1] = scicos_link(xx=[[263],[308.6],[308.6],[263],[263]],yy=[[271.2],[271.2],[367],[367],[341.7]],ct=[5,-1],from=[8,2],to=[4,1]); + x = scicos_block(); + x.gui = "DELAY_f"; + x.graphics.sz = [2,2]; + x.graphics.gr_i = []; + x.graphics.pin = 0; + x.graphics.pout = 0; + x.model.sim = "csuper"; + x.model.in1 = 1; + x.model.out = 1; + x.model.blocktype = "h"; + x.model.dep_ut = [false,false]; + x.model.rpar = diagram; + x.graphics.in_implicit = ["E"]; + x.graphics.in_style = ""; + x.graphics.out_implicit = ["E"]; + x.graphics.out_style = ""; } DELAY_f.prototype.details = function DELAY_f() { } DELAY_f.prototype.get = function DELAY_f() { } DELAY_f.prototype.set = function DELAY_f() { -ppath=list(0,0); + ppath = list(0,0); for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { -o=arg1.model.rpar.objs[i-1]; -if (typeof(o)=="Block"&&o.gui=="REGISTER_f") { -ppath[1-1]=i; + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="REGISTER_f") { + ppath[1-1] = i; } -if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") { -ppath[2-1]=i; + if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") { + ppath[2-1] = i; } -if (and(ppath!=list(0,0))) { + if (and(ppath!=list(0,0))) { break; } } -x=arg1; -newpar=list(); -register=x.model.rpar.objs[ppath[1-1]-1]; -evtdly=x.model.rpar.objs[ppath[2-1]-1]; -register_exprs=register.graphics.exprs; -evtdly_exprs=evtdly.graphics.exprs; -exprs=[[evtdly_exprs[1-1]],[register_exprs]]; -while (true) { -[ok,dt,z0,exprs]=scicos_getvalue([["This block implements as a discretized delay"],["it is consist of a shift register and a clock"],["value of the delay is given by;","the discretization time step multiplied by the"],["number-1 of state of the register"]],[["Discretization time step"],["Register initial state"]],list("vec",1,"vec",-1),exprs); -if (!ok) { + x = arg1; + newpar = list(); + register = x.model.rpar.objs[ppath[1-1]-1]; + evtdly = x.model.rpar.objs[ppath[2-1]-1]; + register_exprs = register.graphics.exprs; + evtdly_exprs = evtdly.graphics.exprs; + exprs = [[evtdly_exprs[1-1]],[register_exprs]]; + while (true) { + [ok,dt,z0,exprs] = scicos_getvalue([["This block implements as a discretized delay"],["it is consist of a shift register and a clock"],["value of the delay is given by;","the discretization time step multiplied by the"],["number-1 of state of the register"]],[["Discretization time step"],["Register initial state"]],list("vec",1,"vec",-1),exprs); + if (!ok) { break; } -mess=[]; -if (prod(size(z0))<1) { -mess=[[mess],["Register length must be at least 1"],[" "]]; -ok=false; + mess = []; + if (prod(size(z0))<1) { + mess = [[mess],["Register length must be at least 1"],[" "]]; + ok = false; } -if (dt<=0) { -mess=[[mess],["Discretization time step must be positive"],[" "]]; -ok=false; + if (dt<=0) { + mess = [[mess],["Discretization time step must be positive"],[" "]]; + ok = false; } -if (!ok) { + if (!ok) { message(mess); -} else { -evtdly.graphics.exprs[1-1]=exprs[1-1]; -if (evtdly.model.rpar!=dt) { -evtdly.model.rpar=dt; -newpar[$+1-1]=ppath[2-1]; + } else { + evtdly.graphics.exprs[1-1] = exprs[1-1]; + if (evtdly.model.rpar!=dt) { + evtdly.model.rpar = dt; + newpar[$+1-1] = ppath[2-1]; } -x.model.rpar.objs[ppath[2-1]-1]=evtdly; -register.graphics.exprs=exprs[2-1]; -if (or(register.model.dstate!=z0.slice())) { -register.model.dstate=z0.slice(); -newpar[$+1-1]=ppath[1-1]; + x.model.rpar.objs[ppath[2-1]-1] = evtdly; + register.graphics.exprs = exprs[2-1]; + if (or(register.model.dstate!=z0.slice())) { + register.model.dstate = z0.slice(); + newpar[$+1-1] = ppath[1-1]; } -x.model.rpar.objs[ppath[1-1]-1]=register; + x.model.rpar.objs[ppath[1-1]-1] = register; break; } } -needcompile=0; -y=needcompile; -typ=newpar; + needcompile = 0; + y = needcompile; + typ = newpar; } } diff --git a/js/Linear/DERIV.js b/js/Linear/DERIV.js index acec98d0..a3b0b8dc 100644 --- a/js/Linear/DERIV.js +++ b/js/Linear/DERIV.js @@ -1,21 +1,21 @@ /* autogenerated from "macros/Linear/DERIV.sci" */ function DERIV() { DERIV.prototype.define = function DERIV() { -model=scicos_model(); -model.sim=list("deriv",4); -model.in1=-1; -model.out=-1; -model.blocktype="x"; -model.dep_ut=[true,false]; -exprs=[]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + model = scicos_model(); + model.sim = list("deriv",4); + model.in1 = -1; + model.out = -1; + model.blocktype = "x"; + model.dep_ut = [true,false]; + exprs = []; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } DERIV.prototype.details = function DERIV() { } DERIV.prototype.get = function DERIV() { } DERIV.prototype.set = function DERIV() { -x=arg1; + x = arg1; } } diff --git a/js/Linear/DIFF_c.js b/js/Linear/DIFF_c.js index e6eef6ff..5d953122 100644 --- a/js/Linear/DIFF_c.js +++ b/js/Linear/DIFF_c.js @@ -1,55 +1,55 @@ /* autogenerated from "macros/Linear/DIFF_c.sci" */ function DIFF_c() { DIFF_c.prototype.define = function DIFF_c() { -x0=[[0],[0]]; -model=scicos_model(); -model.sim=list("diffblk_c",10004); -model.in1=1; -model.out=1; -model.state=x0; -model.blocktype="c"; -model.dep_ut=[false,true]; -exprs=[[strcat(sci2exp(x0[1-1]))],[strcat(sci2exp(x0[2-1]))]]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + x0 = [[0],[0]]; + model = scicos_model(); + model.sim = list("diffblk_c",10004); + model.in1 = 1; + model.out = 1; + model.state = x0; + model.blocktype = "c"; + model.dep_ut = [false,true]; + exprs = [[strcat(sci2exp(x0[1-1]))],[strcat(sci2exp(x0[2-1]))]]; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } DIFF_c.prototype.details = function DIFF_c() { } DIFF_c.prototype.get = function DIFF_c() { } DIFF_c.prototype.set = function DIFF_c() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -ask_again=false; -[ok,x0,xd0,exprs]=scicos_getvalue("Set continuous linear system parameters",[["Initial state"],["Initial Derivative"]],list("vec",-1,"vec",-1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + ask_again = false; + [ok,x0,xd0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["Initial state"],["Initial Derivative"]],list("vec",-1,"vec",-1),exprs); + if (!ok) { break; } -x0=x0.slice(); -N=size(x0,"*"); -xd0=xd0.slice(); -Nxd=size(xd0,"*"); -if ((N!=Nxd)) { + x0 = x0.slice(); + N = size(x0,"*"); + xd0 = xd0.slice(); + Nxd = size(xd0,"*"); + if ((N!=Nxd)) { message("Incompatible sizes: states and their derivatives should have the same size "); -ask_again=true; + ask_again = true; } -if ((N<=0&&!ask_again)) { + if ((N<=0&&!ask_again)) { x_message("number of states must be > 0 "); -ask_again=true; + ask_again = true; } -if (!ask_again) { -graphics.exprs=exprs; -model.state=[[x0],[xd0]]; -model.out=[N]; -model.in1=N; -x.graphics=graphics; -x.model=model; + if (!ask_again) { + graphics.exprs = exprs; + model.state = [[x0],[xd0]]; + model.out = [N]; + model.in1 = N; + x.graphics = graphics; + x.model = model; break; } } -x.model.firing=[]; + x.model.firing = []; } } diff --git a/js/Linear/DLR.js b/js/Linear/DLR.js index 8f0cc456..c39494a5 100644 --- a/js/Linear/DLR.js +++ b/js/Linear/DLR.js @@ -1,72 +1,72 @@ /* autogenerated from "macros/Linear/DLR.sci" */ function DLR() { DLR.prototype.define = function DLR() { -x0=0; -A=-1; -B=1; -C=1; -D=0; -exprs=[["1"],["1+z"]]; -model=scicos_model(); -model.sim=list("dsslti4",4); -model.in1=1; -model.out=1; -model.evtin=1; -model.dstate=x0.slice(); -model.rpar=[[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; -model.blocktype="d"; -model.dep_ut=[false,false]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + x0 = 0; + A = -1; + B = 1; + C = 1; + D = 0; + exprs = [["1"],["1+z"]]; + model = scicos_model(); + model.sim = list("dsslti4",4); + model.in1 = 1; + model.out = 1; + model.evtin = 1; + model.dstate = x0.slice(); + model.rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + model.blocktype = "d"; + model.dep_ut = [false,false]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } DLR.prototype.details = function DLR() { } DLR.prototype.get = function DLR() { } DLR.prototype.set = function DLR() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -x0=model.dstate; -ns=prod(size(x0)); -PREVAR_scicos_context=PREVAR_scicos_context; -PREVAR_scicos_context.z=%z; -while (true) { -[ok,num,den,exprs]=scicos_getvalue("Set discrete SISO transfer parameters",[["Numerator (z)"],["Denominator (z)"]],list("pol",1,"pol",1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + x0 = model.dstate; + ns = prod(size(x0)); + PREVAR_scicos_context = PREVAR_scicos_context; + PREVAR_scicos_context.z = %z; + while (true) { + [ok,num,den,exprs] = scicos_getvalue("Set discrete SISO transfer parameters",[["Numerator (z)"],["Denominator (z)"]],list("pol",1,"pol",1),exprs); + if (!ok) { break; } -if (degree(num)>degree(den)) { + if (degree(num)>degree(den)) { message("Transfer function must be proper"); -ok=false; + ok = false; } -if (ok) { -H=cont_frm(num,den); -[A,B,C,D]=H.slice(2-1,5); -graphics.exprs=exprs; -[ns1,ns1]=size(A); -if (ns1<=ns) { -x0=x0.slice(1-1,ns1); -} else { -x0[ns1-1][1-1]=0; + if (ok) { + H = cont_frm(num,den); + [A,B,C,D] = H.slice(2-1,5); + graphics.exprs = exprs; + [ns1,ns1] = size(A); + if (ns1<=ns) { + x0 = x0.slice(1-1,ns1); + } else { + x0[ns1-1][1-1] = 0; } -rpar=[[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; -model.dstate=x0; -model.rpar=rpar; -if (norm(D,1)!=0) { -mmm=[true,false]; -} else { -mmm=[false,false]; + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + model.dstate = x0; + model.rpar = rpar; + if (norm(D,1)!=0) { + mmm = [true,false]; + } else { + mmm = [false,false]; } -if (or(model.dep_ut!=mmm)) { -model.dep_ut=mmm; + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; } -x.graphics=graphics; -x.model=model; + x.graphics = graphics; + x.model = model; break; } } -x.model.firing=[]; + x.model.firing = []; } } diff --git a/js/Linear/DLR_f.js b/js/Linear/DLR_f.js index e3ad64c9..fe84fec7 100644 --- a/js/Linear/DLR_f.js +++ b/js/Linear/DLR_f.js @@ -1,72 +1,72 @@ /* autogenerated from "macros/Linear/DLR_f.sci" */ function DLR_f() { DLR_f.prototype.define = function DLR_f() { -x0=0; -A=-1; -B=1; -C=1; -D=0; -exprs=[["1"],["1+z"]]; -model=scicos_model(); -model.sim="dsslti"; -model.in1=1; -model.out=1; -model.evtin=1; -model.dstate=x0.slice(); -model.rpar=[[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; -model.blocktype="d"; -model.dep_ut=[false,false]; -gr_i=[]; -x=standard_define([2.5,2.5],model,exprs,gr_i); + x0 = 0; + A = -1; + B = 1; + C = 1; + D = 0; + exprs = [["1"],["1+z"]]; + model = scicos_model(); + model.sim = "dsslti"; + model.in1 = 1; + model.out = 1; + model.evtin = 1; + model.dstate = x0.slice(); + model.rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + model.blocktype = "d"; + model.dep_ut = [false,false]; + gr_i = []; + x = standard_define([2.5,2.5],model,exprs,gr_i); } DLR_f.prototype.details = function DLR_f() { } DLR_f.prototype.get = function DLR_f() { } DLR_f.prototype.set = function DLR_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -x0=model.dstate; -ns=prod(size(x0)); -PREVAR_scicos_context=PREVAR_scicos_context; -PREVAR_scicos_context.z=%z; -while (true) { -[ok,num,den,exprs]=scicos_getvalue("Set discrete SISO transfer parameters",[["Numerator (z)"],["Denominator (z)"]],list("pol",1,"pol",1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + x0 = model.dstate; + ns = prod(size(x0)); + PREVAR_scicos_context = PREVAR_scicos_context; + PREVAR_scicos_context.z = %z; + while (true) { + [ok,num,den,exprs] = scicos_getvalue("Set discrete SISO transfer parameters",[["Numerator (z)"],["Denominator (z)"]],list("pol",1,"pol",1),exprs); + if (!ok) { break; } -if (degree(num)>degree(den)) { + if (degree(num)>degree(den)) { message("Transfer must be proper"); -ok=false; + ok = false; } -if (ok) { -H=cont_frm(num,den); -[A,B,C,D]=H.slice(2-1,5); -graphics.exprs=exprs; -[ns1,ns1]=size(A); -if (ns1<=ns) { -x0=x0.slice(1-1,ns1); -} else { -x0[ns1-1][1-1]=0; + if (ok) { + H = cont_frm(num,den); + [A,B,C,D] = H.slice(2-1,5); + graphics.exprs = exprs; + [ns1,ns1] = size(A); + if (ns1<=ns) { + x0 = x0.slice(1-1,ns1); + } else { + x0[ns1-1][1-1] = 0; } -rpar=[[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; -model.dstate=x0; -model.rpar=rpar; -if (norm(D,1)!=0) { -mmm=[true,false]; -} else { -mmm=[false,false]; + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + model.dstate = x0; + model.rpar = rpar; + if (norm(D,1)!=0) { + mmm = [true,false]; + } else { + mmm = [false,false]; } -if (or(model.dep_ut!=mmm)) { -model.dep_ut=mmm; + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; } -x.graphics=graphics; -x.model=model; + x.graphics = graphics; + x.model = model; break; } } -x.model.firing=[]; + x.model.firing = []; } } diff --git a/js/Linear/DLSS.js b/js/Linear/DLSS.js index eacdb24b..869a9b3e 100644 --- a/js/Linear/DLSS.js +++ b/js/Linear/DLSS.js @@ -1,83 +1,83 @@ /* autogenerated from "macros/Linear/DLSS.sci" */ function DLSS() { DLSS.prototype.define = function DLSS() { -x0=0; -A=-1; -B=1; -C=1; -D=0; -model=scicos_model(); -model.sim=list("dsslti4",4); -model.in1=1; -model.out=1; -model.evtin=1; -model.dstate=x0.slice(); -model.rpar=[[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; -model.blocktype="d"; -model.dep_ut=[false,false]; -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; + model = scicos_model(); + model.sim = list("dsslti4",4); + model.in1 = 1; + model.out = 1; + model.evtin = 1; + model.dstate = x0.slice(); + model.rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + model.blocktype = "d"; + model.dep_ut = [false,false]; + 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); } DLSS.prototype.details = function DLSS() { } DLSS.prototype.get = function DLSS() { } DLSS.prototype.set = function DLSS() { -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 discrete 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 discrete 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,1,[]); -if (ok) { -graphics.exprs=exprs; -rpar=[[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; -if (D!=[]) { -if (norm(D,1)!=0) { -mmm=[true,false]; -} else { -mmm=[false,false]; + } else { + [model,graphics,ok] = check_io(model,graphics,in1,out,1,[]); + if (ok) { + graphics.exprs = exprs; + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + if (D!=[]) { + if (norm(D,1)!=0) { + mmm = [true,false]; + } else { + mmm = [false,false]; } -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,false]; + } else { + model.dep_ut = [false,false]; } -model.dstate=x0.slice(); -model.rpar=rpar; -x.graphics=graphics; -x.model=model; + model.dstate = x0.slice(); + model.rpar = rpar; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/DLSS_f.js b/js/Linear/DLSS_f.js index f521b0e4..1a2fb656 100644 --- a/js/Linear/DLSS_f.js +++ b/js/Linear/DLSS_f.js @@ -1,73 +1,73 @@ /* autogenerated from "macros/Linear/DLSS_f.sci" */ function DLSS_f() { DLSS_f.prototype.define = function DLSS_f() { -x0=0; -A=-1; -B=1; -C=1; -D=0; -model=scicos_model(); -model.sim=list("dsslti",1); -model.in1=1; -model.out=1; -model.evtin=1; -model.dstate=x0.slice(); -model.rpar=[[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; -model.blocktype="d"; -model.dep_ut=[false,false]; -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; + model = scicos_model(); + model.sim = list("dsslti",1); + model.in1 = 1; + model.out = 1; + model.evtin = 1; + model.dstate = x0.slice(); + model.rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + model.blocktype = "d"; + model.dep_ut = [false,false]; + 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); } DLSS_f.prototype.details = function DLSS_f() { } DLSS_f.prototype.get = function DLSS_f() { } DLSS_f.prototype.set = function DLSS_f() { -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 discrete 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 discrete 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); -if (ms!=ns) { + [ms,ns] = size(A); + if (ms!=ns) { message("A matrix must be square"); -} else { -[model,graphics,ok]=check_io(model,graphics,in1,out,1,[]); -if (ok) { -graphics.exprs=exprs; -rpar=[[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; -if (D!=[]) { -if (norm(D,1)!=0) { -mmm=[true,false]; -} else { -mmm=[false,false]; + } else { + [model,graphics,ok] = check_io(model,graphics,in1,out,1,[]); + if (ok) { + graphics.exprs = exprs; + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + if (D!=[]) { + if (norm(D,1)!=0) { + mmm = [true,false]; + } else { + mmm = [false,false]; } -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,false]; + } else { + model.dep_ut = [false,false]; } -model.dstate=x0.slice(); -model.rpar=rpar; -x.graphics=graphics; -x.model=model; + model.dstate = x0.slice(); + model.rpar = rpar; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/DOLLAR.js b/js/Linear/DOLLAR.js index e404c6cc..5b736b28 100644 --- a/js/Linear/DOLLAR.js +++ b/js/Linear/DOLLAR.js @@ -1,88 +1,88 @@ /* autogenerated from "macros/Linear/DOLLAR.sci" */ function DOLLAR() { DOLLAR.prototype.define = function DOLLAR() { -z=0; -inh=0; -in1=1; -exprs=string([[z],[inh]]); -model=scicos_model(); -model.sim=list("dollar4",4); -model.in1=in1; -model.out=in1; -model.evtin=1-inh; -model.dstate=z; -model.blocktype="d"; -model.dep_ut=[false,false]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + z = 0; + inh = 0; + in1 = 1; + exprs = string([[z],[inh]]); + model = scicos_model(); + model.sim = list("dollar4",4); + model.in1 = in1; + model.out = in1; + model.evtin = 1-inh; + model.dstate = z; + model.blocktype = "d"; + model.dep_ut = [false,false]; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } DOLLAR.prototype.details = function DOLLAR() { } DOLLAR.prototype.get = function DOLLAR() { } DOLLAR.prototype.set = function DOLLAR() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -if (size(exprs,"*")<2) { -exprs[2-1]="0"; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + if (size(exprs,"*")<2) { + exprs[2-1] = "0"; } -while (true) { -[ok,a,inh,exprs]=scicos_getvalue("Set 1/z block parameters",[["initial condition"],["Inherit (no:0, yes:1)"]],list("mat",[-1,-2],"vec",-1),exprs); -if (!ok) { + while (true) { + [ok,a,inh,exprs] = scicos_getvalue("Set 1/z block parameters",[["initial condition"],["Inherit (no:0, yes:1)"]],list("mat",[-1,-2],"vec",-1),exprs); + if (!ok) { break; } -out=[size(a,1),size(a,2)]; -if (out==0) { -out=[]; + out = [size(a,1),size(a,2)]; + if (out==0) { + out = []; } -in1=out; -model.sim=list("dollar4_m",4); -model.odstate=list(a); -model.dstate=[]; -if (this.type[(a)==1-1]) { -if (isreal(a)) { -it=1; -ot=1; -if ((size(a,1)==1||size(a,2)==1)) { -model.sim=list("dollar4",4); -model.dstate=a.slice(); -model.odstate=list(); + in1 = out; + model.sim = list("dollar4_m",4); + model.odstate = list(a); + model.dstate = []; + if (this.type[(a)==1-1]) { + if (isreal(a)) { + it = 1; + ot = 1; + if ((size(a,1)==1||size(a,2)==1)) { + model.sim = list("dollar4",4); + model.dstate = a.slice(); + model.odstate = list(); } -} else { -it=2; -ot=2; + } else { + it = 2; + ot = 2; } -} else if ((typeof(a)=="int32")) { -it=3; -ot=3; -} else if ((typeof(a)=="int16")) { -it=4; -ot=4; -} else if ((typeof(a)=="int8")) { -it=5; -ot=5; -} else if ((typeof(a)=="uint32")) { -it=6; -ot=6; -} else if ((typeof(a)=="uint16")) { -it=7; -ot=7; -} else if ((typeof(a)=="uint8")) { -it=8; -ot=8; -} else { + } else if ((typeof(a)=="int32")) { + it = 3; + ot = 3; + } else if ((typeof(a)=="int16")) { + it = 4; + ot = 4; + } else if ((typeof(a)=="int8")) { + it = 5; + ot = 5; + } else if ((typeof(a)=="uint32")) { + it = 6; + ot = 6; + } else if ((typeof(a)=="uint16")) { + it = 7; + ot = 7; + } else if ((typeof(a)=="uint8")) { + it = 8; + ot = 8; + } else { message("type is not recognized"); -ok=false; + ok = false; } -if (ok) { -[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),ones(1-inh,1),[]); + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(1-inh,1),[]); } -if (ok) { -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + if (ok) { + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/DOLLAR_f.js b/js/Linear/DOLLAR_f.js index ef8a8f98..b5f1be1a 100644 --- a/js/Linear/DOLLAR_f.js +++ b/js/Linear/DOLLAR_f.js @@ -1,53 +1,53 @@ /* autogenerated from "macros/Linear/DOLLAR_f.sci" */ function DOLLAR_f() { DOLLAR_f.prototype.define = function DOLLAR_f() { -z=0; -inh=0; -in1=1; -exprs=string([[z],[inh]]); -model=scicos_model(); -model.sim="dollar"; -model.in1=in1; -model.out=in1; -model.evtin=1-inh; -model.dstate=z; -model.blocktype="d"; -model.dep_ut=[false,false]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + z = 0; + inh = 0; + in1 = 1; + exprs = string([[z],[inh]]); + model = scicos_model(); + model.sim = "dollar"; + model.in1 = in1; + model.out = in1; + model.evtin = 1-inh; + model.dstate = z; + model.blocktype = "d"; + model.dep_ut = [false,false]; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } DOLLAR_f.prototype.details = function DOLLAR_f() { } DOLLAR_f.prototype.get = function DOLLAR_f() { } DOLLAR_f.prototype.set = function DOLLAR_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -if (size(exprs,"*")<2) { -exprs[2-1]="0"; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + if (size(exprs,"*")<2) { + exprs[2-1] = "0"; } -while (true) { -[ok,a,inh,exprs]=scicos_getvalue("Set 1/z block parameters",[["initial condition"],["Inherit (no:0, yes:1)"]],list("vec",-1,"vec",-1),exprs); -if (!ok) { + while (true) { + [ok,a,inh,exprs] = scicos_getvalue("Set 1/z block parameters",[["initial condition"],["Inherit (no:0, yes:1)"]],list("vec",-1,"vec",-1),exprs); + if (!ok) { break; } -out=size(a,"*"); -if (out==0) { -out=[]; + out = size(a,"*"); + if (out==0) { + out = []; } -in1=out; -if (ok) { -[model,graphics,ok]=check_io(model,graphics,-1,-1,ones(1-inh,1),[]); + in1 = out; + if (ok) { + [model,graphics,ok] = check_io(model,graphics,-1,-1,ones(1-inh,1),[]); } -if (ok) { -graphics.exprs=exprs; -model.dstate=a; -model.in1=in1; -model.out=out; -x.graphics=graphics; -x.model=model; + if (ok) { + graphics.exprs = exprs; + model.dstate = a; + model.in1 = in1; + model.out = out; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/DOLLAR_m.js b/js/Linear/DOLLAR_m.js index e322d911..8fa53e30 100644 --- a/js/Linear/DOLLAR_m.js +++ b/js/Linear/DOLLAR_m.js @@ -1,88 +1,88 @@ /* autogenerated from "macros/Linear/DOLLAR_m.sci" */ function DOLLAR_m() { DOLLAR_m.prototype.define = function DOLLAR_m() { -z=0; -inh=0; -in1=1; -exprs=string([[z],[inh]]); -model=scicos_model(); -model.sim=list("dollar4",4); -model.in1=in1; -model.out=in1; -model.evtin=1-inh; -model.dstate=z; -model.blocktype="d"; -model.dep_ut=[false,false]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + z = 0; + inh = 0; + in1 = 1; + exprs = string([[z],[inh]]); + model = scicos_model(); + model.sim = list("dollar4",4); + model.in1 = in1; + model.out = in1; + model.evtin = 1-inh; + model.dstate = z; + model.blocktype = "d"; + model.dep_ut = [false,false]; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } DOLLAR_m.prototype.details = function DOLLAR_m() { } DOLLAR_m.prototype.get = function DOLLAR_m() { } DOLLAR_m.prototype.set = function DOLLAR_m() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -if (size(exprs,"*")<2) { -exprs[2-1]="0"; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + if (size(exprs,"*")<2) { + exprs[2-1] = "0"; } -while (true) { -[ok,a,inh,exprs]=scicos_getvalue("Set 1/z block parameters",[["initial condition"],["Inherit (no:0, yes:1)"]],list("mat",[-1,-2],"vec",-1),exprs); -if (!ok) { + while (true) { + [ok,a,inh,exprs] = scicos_getvalue("Set 1/z block parameters",[["initial condition"],["Inherit (no:0, yes:1)"]],list("mat",[-1,-2],"vec",-1),exprs); + if (!ok) { break; } -out=[size(a,1),size(a,2)]; -if (out==0) { -out=[]; + out = [size(a,1),size(a,2)]; + if (out==0) { + out = []; } -in1=out; -model.sim=list("dollar4_m",4); -model.odstate=list(a); -model.dstate=[]; -if ((this.type[a-1]==1)) { -if (isreal(a)) { -it=1; -ot=1; -if ((size(a,1)==1||size(a,2)==1)) { -model.sim=list("dollar4",4); -model.dstate=a.slice(); -model.odstate=list(); + in1 = out; + model.sim = list("dollar4_m",4); + model.odstate = list(a); + model.dstate = []; + if ((this.type[a-1]==1)) { + if (isreal(a)) { + it = 1; + ot = 1; + if ((size(a,1)==1||size(a,2)==1)) { + model.sim = list("dollar4",4); + model.dstate = a.slice(); + model.odstate = list(); } -} else { -it=2; -ot=2; + } else { + it = 2; + ot = 2; } -} else if ((typeof(a)=="int32")) { -it=3; -ot=3; -} else if ((typeof(a)=="int16")) { -it=4; -ot=4; -} else if ((typeof(a)=="int8")) { -it=5; -ot=5; -} else if ((typeof(a)=="uint32")) { -it=6; -ot=6; -} else if ((typeof(a)=="uint16")) { -it=7; -ot=7; -} else if ((typeof(a)=="uint8")) { -it=8; -ot=8; -} else { + } else if ((typeof(a)=="int32")) { + it = 3; + ot = 3; + } else if ((typeof(a)=="int16")) { + it = 4; + ot = 4; + } else if ((typeof(a)=="int8")) { + it = 5; + ot = 5; + } else if ((typeof(a)=="uint32")) { + it = 6; + ot = 6; + } else if ((typeof(a)=="uint16")) { + it = 7; + ot = 7; + } else if ((typeof(a)=="uint8")) { + it = 8; + ot = 8; + } else { message("type is not recognized"); -ok=false; + ok = false; } -if (ok) { -[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),ones(1-inh,1),[]); + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(1-inh,1),[]); } -if (ok) { -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + if (ok) { + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/GAINBLK.js b/js/Linear/GAINBLK.js index 2f188149..b907fe60 100644 --- a/js/Linear/GAINBLK.js +++ b/js/Linear/GAINBLK.js @@ -1,144 +1,144 @@ /* autogenerated from "macros/Linear/GAINBLK.sci" */ function GAINBLK() { GAINBLK.prototype.define = function GAINBLK() { -gain=1; -in1=-1; -out=-1; -in2=-2; -out2=-2; -model=scicos_model(); -model.sim=list("gainblk",4); -model.in1=in1; -model.out=out; -model.in2=in2; -model.out2=out2; -model.rpar=gain; -model.blocktype="c"; -model.dep_ut=[true,false]; -exprs=[strcat(sci2exp(gain))]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + gain = 1; + in1 = -1; + out = -1; + in2 = -2; + out2 = -2; + model = scicos_model(); + model.sim = list("gainblk",4); + model.in1 = in1; + model.out = out; + model.in2 = in2; + model.out2 = out2; + model.rpar = gain; + model.blocktype = "c"; + model.dep_ut = [true,false]; + exprs = [strcat(sci2exp(gain))]; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } GAINBLK.prototype.details = function GAINBLK() { } GAINBLK.prototype.get = function GAINBLK() { } GAINBLK.prototype.set = function GAINBLK() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -if (size(exprs,"*")==1) { -exprs=[[exprs],[sci2exp(0)]]; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + if (size(exprs,"*")==1) { + exprs = [[exprs],[sci2exp(0)]]; } -while (true) { -[ok,gain,over,exprs]=scicos_getvalue("Set gain block parameters",[["Gain"],["Do On Overflow(0=Nothing 1=Saturate 2=Error)"]],list("mat",[-1,-1],"vec",1),exprs); -if (!ok) { + while (true) { + [ok,gain,over,exprs] = scicos_getvalue("Set gain block parameters",[["Gain"],["Do On Overflow(0=Nothing 1=Saturate 2=Error)"]],list("mat",[-1,-1],"vec",1),exprs); + if (!ok) { break; } -if (gain==[]) { + if (gain==[]) { message("Gain must have at least one element"); -} else { -if (typeof(gain)=="constant") { -if (isreal(gain)) { -it=1; -ot=1; -model.sim=list("gainblk",4); -model.rpar=gain.slice(); -model.opar=list(); -} else { + } else { + if (typeof(gain)=="constant") { + if (isreal(gain)) { + it = 1; + ot = 1; + model.sim = list("gainblk",4); + model.rpar = gain.slice(); + model.opar = list(); + } else { message("type is not supported"); -ok=false; + ok = false; } -} else { -if ((over==0)) { -if ((typeof(gain)=="int32")) { -ot=3; -model.sim=list("gainblk_i32n",4); -} else if ((typeof(gain)=="int16")) { -ot=4; -model.sim=list("gainblk_i16n",4); -} else if ((typeof(gain)=="int8")) { -ot=5; -model.sim=list("gainblk_i8n",4); -} else if ((typeof(gain)=="uint32")) { -ot=6; -model.sim=list("gainblk_ui32n",4); -} else if ((typeof(gain)=="uint16")) { -ot=7; -model.sim=list("gainblk_ui16n",4); -} else if ((typeof(gain)=="uint8")) { -ot=8; -model.sim=list("gainblk_ui8n",4); -} else { + } else { + if ((over==0)) { + if ((typeof(gain)=="int32")) { + ot = 3; + model.sim = list("gainblk_i32n",4); + } else if ((typeof(gain)=="int16")) { + ot = 4; + model.sim = list("gainblk_i16n",4); + } else if ((typeof(gain)=="int8")) { + ot = 5; + model.sim = list("gainblk_i8n",4); + } else if ((typeof(gain)=="uint32")) { + ot = 6; + model.sim = list("gainblk_ui32n",4); + } else if ((typeof(gain)=="uint16")) { + ot = 7; + model.sim = list("gainblk_ui16n",4); + } else if ((typeof(gain)=="uint8")) { + ot = 8; + model.sim = list("gainblk_ui8n",4); + } else { message("type is not supported."); -ok=false; + ok = false; } -} else if ((over==1)) { -if ((typeof(gain)=="int32")) { -ot=3; -model.sim=list("gainblk_i32s",4); -} else if ((typeof(gain)=="int16")) { -ot=4; -model.sim=list("gainblk_i16s",4); -} else if ((typeof(gain)=="int8")) { -ot=5; -model.sim=list("gainblk_i8s",4); -} else if ((typeof(gain)=="uint32")) { -ot=6; -model.sim=list("gainblk_ui32s",4); -} else if ((typeof(gain)=="uint16")) { -ot=7; -model.sim=list("gainblk_ui16s",4); -} else if ((typeof(gain)=="uint8")) { -ot=8; -model.sim=list("gainblk_ui8s",4); -} else { + } else if ((over==1)) { + if ((typeof(gain)=="int32")) { + ot = 3; + model.sim = list("gainblk_i32s",4); + } else if ((typeof(gain)=="int16")) { + ot = 4; + model.sim = list("gainblk_i16s",4); + } else if ((typeof(gain)=="int8")) { + ot = 5; + model.sim = list("gainblk_i8s",4); + } else if ((typeof(gain)=="uint32")) { + ot = 6; + model.sim = list("gainblk_ui32s",4); + } else if ((typeof(gain)=="uint16")) { + ot = 7; + model.sim = list("gainblk_ui16s",4); + } else if ((typeof(gain)=="uint8")) { + ot = 8; + model.sim = list("gainblk_ui8s",4); + } else { message("type is not supported."); -ok=false; + ok = false; } -} else if ((over==2)) { -if ((typeof(gain)=="int32")) { -ot=3; -model.sim=list("gainblk_i32e",4); -} else if ((typeof(gain)=="int16")) { -ot=4; -model.sim=list("gainblk_i16e",4); -} else if ((typeof(gain)=="int8")) { -ot=5; -model.sim=list("gainblk_i8e",4); -} else if ((typeof(gain)=="uint32")) { -ot=6; -model.sim=list("gainblk_ui32e",4); -} else if ((typeof(gain)=="uint16")) { -ot=7; -model.sim=list("gainblk_ui16e",4); -} else if ((typeof(gain)=="uint8")) { -ot=8; -model.sim=list("gainblk_ui8e",4); -} else { + } else if ((over==2)) { + if ((typeof(gain)=="int32")) { + ot = 3; + model.sim = list("gainblk_i32e",4); + } else if ((typeof(gain)=="int16")) { + ot = 4; + model.sim = list("gainblk_i16e",4); + } else if ((typeof(gain)=="int8")) { + ot = 5; + model.sim = list("gainblk_i8e",4); + } else if ((typeof(gain)=="uint32")) { + ot = 6; + model.sim = list("gainblk_ui32e",4); + } else if ((typeof(gain)=="uint16")) { + ot = 7; + model.sim = list("gainblk_ui16e",4); + } else if ((typeof(gain)=="uint8")) { + ot = 8; + model.sim = list("gainblk_ui8e",4); + } else { message("type is not an integer."); -ok=false; + ok = false; } -} else { + } else { message("Do on Overflow must be 0,1,2"); -ok=false; + ok = false; } -model.rpar=[]; -model.opar=list(gain.slice()); + model.rpar = []; + model.opar = list(gain.slice()); } -if (ok) { -[out,in1]=size(gain); -if (out*in1!=1) { -[model,graphics,ok]=set_io(model,graphics,list([in1,-1],ot),list([out,-1],ot),[],[]); -} else { -[model,graphics,ok]=set_io(model,graphics,list([-1,-2],ot),list([-1,-2],ot),[],[]); + if (ok) { + [out,in1] = size(gain); + if (out*in1!=1) { + [model,graphics,ok] = set_io(model,graphics,list([in1,-1],ot),list([out,-1],ot),[],[]); + } else { + [model,graphics,ok] = set_io(model,graphics,list([-1,-2],ot),list([-1,-2],ot),[],[]); } } -if (ok) { -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + if (ok) { + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/GAINBLK_f.js b/js/Linear/GAINBLK_f.js index ad391196..b2efa274 100644 --- a/js/Linear/GAINBLK_f.js +++ b/js/Linear/GAINBLK_f.js @@ -1,44 +1,44 @@ /* autogenerated from "macros/Linear/GAINBLK_f.sci" */ function GAINBLK_f() { GAINBLK_f.prototype.define = function GAINBLK_f() { -gain=1; -in1=1; -out=1; -model=scicos_model(); -model.sim="gain"; -model.in1=in1; -model.out=out; -model.rpar=gain; -model.blocktype="c"; -model.dep_ut=[true,false]; -exprs=[strcat(sci2exp(gain))]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + gain = 1; + in1 = 1; + out = 1; + model = scicos_model(); + model.sim = "gain"; + model.in1 = in1; + model.out = out; + model.rpar = gain; + model.blocktype = "c"; + model.dep_ut = [true,false]; + exprs = [strcat(sci2exp(gain))]; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } GAINBLK_f.prototype.details = function GAINBLK_f() { } GAINBLK_f.prototype.get = function GAINBLK_f() { } GAINBLK_f.prototype.set = function GAINBLK_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,gain,exprs]=scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs[1-1]); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,gain,exprs] = scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs[1-1]); + if (!ok) { break; } -if (gain==[]) { + if (gain==[]) { message("Gain must have at least one element"); -} else { -[out,in1]=size(gain); -[model,graphics,ok]=check_io(model,graphics,in1,out,[],[]); -if (ok) { -graphics.exprs=exprs; -model.rpar=gain.slice(); -x.graphics=graphics; -x.model=model; + } else { + [out,in1] = size(gain); + [model,graphics,ok] = check_io(model,graphics,in1,out,[],[]); + if (ok) { + graphics.exprs = exprs; + model.rpar = gain.slice(); + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/GAIN_f.js b/js/Linear/GAIN_f.js index fcca61a8..836dee96 100644 --- a/js/Linear/GAIN_f.js +++ b/js/Linear/GAIN_f.js @@ -1,44 +1,44 @@ /* autogenerated from "macros/Linear/GAIN_f.sci" */ function GAIN_f() { GAIN_f.prototype.define = function GAIN_f() { -gain=1; -in1=1; -out=1; -model=scicos_model(); -model.sim="gain"; -model.in1=1; -model.out=1; -model.rpar=gain; -model.blocktype="c"; -model.dep_ut=[true,false]; -exprs=[[strcat(sci2exp(gain))],[strcat(sci2exp(in1))],[strcat(sci2exp(out))]]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + gain = 1; + in1 = 1; + out = 1; + model = scicos_model(); + model.sim = "gain"; + model.in1 = 1; + model.out = 1; + model.rpar = gain; + model.blocktype = "c"; + model.dep_ut = [true,false]; + exprs = [[strcat(sci2exp(gain))],[strcat(sci2exp(in1))],[strcat(sci2exp(out))]]; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } GAIN_f.prototype.details = function GAIN_f() { } GAIN_f.prototype.get = function GAIN_f() { } GAIN_f.prototype.set = function GAIN_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,gain,exprs]=scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs[1-1]); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,gain,exprs] = scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs[1-1]); + if (!ok) { break; } -if (gain==[]) { + if (gain==[]) { message("Gain must have at least one element"); -} else { -[out,in1]=size(gain); -[model,graphics,ok]=check_io(model,graphics,in1,out,[],[]); -if (ok) { -graphics.exprs=exprs; -model.rpar=gain.slice(); -x.graphics=graphics; -x.model=model; + } else { + [out,in1] = size(gain); + [model,graphics,ok] = check_io(model,graphics,in1,out,[],[]); + if (ok) { + graphics.exprs = exprs; + model.rpar = gain.slice(); + x.graphics = graphics; + x.model = model; break; } } 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; } } diff --git a/js/Linear/INTEGRAL_f.js b/js/Linear/INTEGRAL_f.js index 95cc752c..3530d6b6 100644 --- a/js/Linear/INTEGRAL_f.js +++ b/js/Linear/INTEGRAL_f.js @@ -1,38 +1,38 @@ /* autogenerated from "macros/Linear/INTEGRAL_f.sci" */ function INTEGRAL_f() { INTEGRAL_f.prototype.define = function INTEGRAL_f() { -x0=0; -model=scicos_model(); -model.sim="integr"; -model.in1=1; -model.out=1; -model.state=x0; -model.blocktype="c"; -model.dep_ut=[false,true]; -exprs=strcat(sci2exp(x0)); -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + x0 = 0; + model = scicos_model(); + model.sim = "integr"; + model.in1 = 1; + model.out = 1; + model.state = x0; + model.blocktype = "c"; + model.dep_ut = [false,true]; + exprs = strcat(sci2exp(x0)); + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } INTEGRAL_f.prototype.details = function INTEGRAL_f() { } INTEGRAL_f.prototype.get = function INTEGRAL_f() { } INTEGRAL_f.prototype.set = function INTEGRAL_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,x0,exprs]=scicos_getvalue("Set continuous linear system parameters","Initial state",list("vec",1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,x0,exprs] = scicos_getvalue("Set continuous linear system parameters","Initial state",list("vec",1),exprs); + if (!ok) { break; } -graphics.exprs=exprs; -model.state=x0; -x.graphics=graphics; -x.model=model; + graphics.exprs = exprs; + model.state = x0; + x.graphics = graphics; + x.model = model; break; } -x.model.firing=[]; + x.model.firing = []; } } diff --git a/js/Linear/INTEGRAL_m.js b/js/Linear/INTEGRAL_m.js index d18b4af5..733d18f2 100644 --- a/js/Linear/INTEGRAL_m.js +++ b/js/Linear/INTEGRAL_m.js @@ -1,121 +1,121 @@ /* autogenerated from "macros/Linear/INTEGRAL_m.sci" */ function INTEGRAL_m() { INTEGRAL_m.prototype.define = function INTEGRAL_m() { -maxp=1; -minp=-1; -rpar=[]; -model=scicos_model(); -model.state=0; -model.sim=list("integral_func",4); -model.in1=1; -model.out=1; -model.in2=1; -model.out2=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); + maxp = 1; + minp = -1; + rpar = []; + model = scicos_model(); + model.state = 0; + model.sim = list("integral_func",4); + model.in1 = 1; + model.out = 1; + model.in2 = 1; + model.out2 = 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); } INTEGRAL_m.prototype.details = function INTEGRAL_m() { } INTEGRAL_m.prototype.get = function INTEGRAL_m() { } INTEGRAL_m.prototype.set = function INTEGRAL_m() { -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("mat",[-1,-1],"vec",1,"vec",1,"mat",[-1,-1],"mat",[-1,-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("mat",[-1,-1],"vec",1,"vec",1,"mat",[-1,-1],"mat",[-1,-1]),exprs); + if (!ok) { break; } -if (isreal(x0)) { -Datatype=1; -} else { -Datatype=2; + if (isreal(x0)) { + Datatype = 1; + } else { + Datatype = 2; } -if (reinit!=0) { -reinit=1; + if (reinit!=0) { + reinit = 1; } -if (satur!=0) { -satur=1; -if (Datatype==1) { -if (size(maxp,"*")==1) { -maxp=maxp*ones(x0); + if (satur!=0) { + satur = 1; + if (Datatype==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)!=size(maxp)||size(x0)!=size(lowp))) { + if ((size(x0)!=size(maxp)||size(x0)!=size(lowp))) { 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=[[real(maxp.slice())],[real(lowp.slice())]]; -model.nzcross=size(x0,"*"); -model.nmode=size(x0,"*"); + ok = false; + } else { + rpar = [[real(maxp.slice())],[real(lowp.slice())]]; + model.nzcross = size(x0,"*"); + model.nmode = size(x0,"*"); } -} else if ((Datatype==2)) { -if (size(maxp,"*")==1) { -maxp=math.complex(maxp*ones(x0),(maxp*ones(x0))); + } else if ((Datatype==2)) { + if (size(maxp,"*")==1) { + maxp = math.complex(maxp*ones(x0),(maxp*ones(x0))); } -if (size(lowp,"*")==1) { -lowp=math.complex(lowp*ones(x0),(lowp*ones(x0))); + if (size(lowp,"*")==1) { + lowp = math.complex(lowp*ones(x0),(lowp*ones(x0))); } -if ((size(x0)!=size(maxp)||size(x0)!=size(lowp))) { + if ((size(x0)!=size(maxp)||size(x0)!=size(lowp))) { message("x0 and Upper limit and Lower limit must have same size"); -ok=false; -} else if (or(real(maxp)<=real(lowp))||or(imag(maxp)<=imag(lowp))) { + ok = false; + } else if (or(real(maxp)<=real(lowp))||or(imag(maxp)<=imag(lowp))) { message("Upper limits must be > Lower limits"); -ok=false; -} else if (or(real(x0)>real(maxp))||or(real(x0)<real(lowp))||or(imag(x0)>imag(maxp))||or(imag(x0)<imag(lowp))) { + ok = false; + } else if (or(real(x0)>real(maxp))||or(real(x0)<real(lowp))||or(imag(x0)>imag(maxp))||or(imag(x0)<imag(lowp))) { message("Initial condition x0 should be inside the limits"); -ok=false; -} else { -rpar=[[real(maxp.slice())],[real(lowp.slice())],[imag(maxp.slice())],[imag(lowp.slice())]]; -model.nzcross=2*size(x0,"*"); -model.nmode=2*size(x0,"*"); -} -} -} else { -rpar=[]; -model.nzcross=0; -model.nmode=0; -} -if (ok) { -model.rpar=rpar; -if ((Datatype==1)) { -model.state=real(x0.slice()); -model.sim=list("integral_func",4); -it=[[1],[ones(reinit,1)]]; -ot=1; -} else if ((Datatype==2)) { -model.state=[[real(x0.slice())],[imag(x0.slice())]]; -model.sim=list("integralz_func",4); -it=[[2],[2*ones(reinit,1)]]; -ot=2; -} else { + ok = false; + } else { + rpar = [[real(maxp.slice())],[real(lowp.slice())],[imag(maxp.slice())],[imag(lowp.slice())]]; + model.nzcross = 2*size(x0,"*"); + model.nmode = 2*size(x0,"*"); +} +} + } else { + rpar = []; + model.nzcross = 0; + model.nmode = 0; +} + if (ok) { + model.rpar = rpar; + if ((Datatype==1)) { + model.state = real(x0.slice()); + model.sim = list("integral_func",4); + it = [[1],[ones(reinit,1)]]; + ot = 1; + } else if ((Datatype==2)) { + model.state = [[real(x0.slice())],[imag(x0.slice())]]; + model.sim = list("integralz_func",4); + it = [[2],[2*ones(reinit,1)]]; + ot = 2; + } else { message("Datatype is not supported"); -ok=false; + ok = false; } -if (ok) { -in1=[size(x0,1)*[[1],[ones(reinit,1)]],size(x0,2)*[[1],[ones(reinit,1)]]]; -out=size(x0); -[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),ones(reinit,1),[]); + if (ok) { + in1 = [size(x0,1)*[[1],[ones(reinit,1)]],size(x0,2)*[[1],[ones(reinit,1)]]]; + out = size(x0); + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),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; } } diff --git a/js/Linear/PID.js b/js/Linear/PID.js index 8067868f..80d49e79 100644 --- a/js/Linear/PID.js +++ b/js/Linear/PID.js @@ -1,116 +1,116 @@ /* autogenerated from "macros/Linear/PID.sci" */ function PID() { PID.prototype.define = function PID() { -scs_m=scicos_diagram(version="scicos4.2",props=scicos_params(wpar=[600,450,0,0,600,450],Title=["PID"],tol=[0.0001,0.000001,1.000e-10,100001,0,0],tf=100000,context=" ",void1=[],options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(true,33),[8,1],[1,5],list([5,1],[4,1]),[0.8,0.8,0.8]),void2=[],void3=[],doc=list())); -scs_m.objs[1-1]=scicos_block(gui="INTEGRAL_m",graphics=scicos_graphics(orig=[318.304,183.11733],sz=[40,40],flip=true,theta=0,exprs=[["0"],["0"],["0"],["1"],["-1"]],pin=7,pout=9,pein=[],peout=[],gr_i=[],id="1/s",in_implicit="E",out_implicit="E"),model=scicos_model(sim=list("integral_func",4),in1=1,in2=1,intyp=1,out=1,out2=1,outtyp=1,evtin=[],evtout=[],state=0,dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[false,true],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m.objs[2-1]=scicos_block(gui="SUMMATION",graphics=scicos_graphics(orig=[387.97067,172.85067],sz=[40,60],flip=true,theta=0,exprs=[["1"],["[1;1;1]"]],pin=[[10],[9],[11]],pout=19,pein=[],peout=[],gr_i=[],id="",in_implicit=[["E"],["E"],["E"]],out_implicit="E"),model=scicos_model(sim=list("summation",4),in1=[[-1],[-1],[-1]],in2=[[-2],[-2],[-2]],intyp=[[1],[1],[1]],out=-1,out2=-2,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[[1],[1],[1]],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m.objs[3-1]=scicos_block(gui="GAINBLK",graphics=scicos_graphics(orig=[321.23733,235.91733],sz=[40,40],flip=true,theta=0,exprs="1",pin=17,pout=10,pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit="E"),model=scicos_model(sim=list("gainblk",4),in1=-1,in2=-2,intyp=1,out=-1,out2=-2,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=1,ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m.objs[4-1]=scicos_block(gui="DERIV",graphics=scicos_graphics(orig=[319.03733,135.45067],sz=[40,40],flip=true,theta=0,exprs=[],pin=8,pout=11,pein=[],peout=[],gr_i=[],id="s",in_implicit="E",out_implicit="E"),model=scicos_model(sim=list("deriv",4),in1=-1,in2=-2,intyp=1,out=-1,out2=-2,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="x",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m.objs[5-1]=scicos_block(gui="GAINBLK",graphics=scicos_graphics(orig=[255.23733,183.11733],sz=[40,40],flip=true,theta=0,exprs="1",pin=13,pout=7,pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit="E"),model=scicos_model(sim=list("gainblk",4),in1=-1,in2=-2,intyp=1,out=-1,out2=-2,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=1,ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m.objs[6-1]=scicos_block(gui="GAINBLK",graphics=scicos_graphics(orig=[255.23733,135.45067],sz=[40,40],flip=true,theta=0,exprs="1",pin=14,pout=8,pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit="E"),model=scicos_model(sim=list("gainblk",4),in1=-1,in2=-2,intyp=1,out=-1,out2=-2,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=1,ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m.objs[7-1]=scicos_link(xx=[[303.80876],[309.73257]],yy=[[203.11733],[203.11733]],id="drawlink",thick=[0,0],ct=[1,1],from=[5,1,0],to=[1,1,1]); -scs_m.objs[8-1]=scicos_link(xx=[[303.80876],[310.4659]],yy=[[155.45067],[155.45067]],id="drawlink",thick=[0,0],ct=[1,1],from=[6,1,0],to=[4,1,1]); -scs_m.objs[9-1]=scicos_link(xx=[[366.87543],[379.39924]],yy=[[203.11733],[202.85067]],id="drawlink",thick=[0,0],ct=[1,1],from=[1,1,0],to=[2,2,1]); -scs_m.objs[10-1]=scicos_link(xx=[[369.80876],[379.39924],[379.39924]],yy=[[255.91733],[255.91733],[217.85067]],id="drawlink",thick=[0,0],ct=[1,1],from=[3,1,0],to=[2,1,1]); -scs_m.objs[11-1]=scicos_link(xx=[[367.60876],[379.39924],[379.39924]],yy=[[155.45067],[155.45067],[187.85067]],id="drawlink",thick=[0,0],ct=[1,1],from=[4,1,0],to=[2,3,1]); -scs_m.objs[12-1]=scicos_block(gui="SPLIT_f",graphics=scicos_graphics(orig=[[234.704],[203.11733]],sz=[0.3333333,0.3333333],flip=true,theta=0,exprs=[],pin=16,pout=[[13],[14]],pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit=[["E"],["E"],["E"]]),model=scicos_model(sim="lsplit",in1=-1,in2=[],intyp=1,out=[[-1],[-1],[-1]],out2=[],outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m.objs[13-1]=scicos_link(xx=[[234.704],[246.6659]],yy=[[203.11733],[203.11733]],id="drawlink",thick=[0,0],ct=[1,1],from=[12,1,0],to=[5,1,1]); -scs_m.objs[14-1]=scicos_link(xx=[[234.704],[234.704],[246.6659]],yy=[[203.11733],[155.45067],[155.45067]],id="drawlink",thick=[0,0],ct=[1,1],from=[12,2,0],to=[6,1,1]); -scs_m.objs[15-1]=scicos_block(gui="SPLIT_f",graphics=scicos_graphics(orig=[[233.97067],[203.11733]],sz=[0.3333333,0.3333333],flip=true,theta=0,exprs=[],pin=21,pout=[[16],[17]],pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit=[["E"],["E"],["E"]]),model=scicos_model(sim="lsplit",in1=-1,in2=[],intyp=1,out=[[-1],[-1],[-1]],out2=[],outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m.objs[16-1]=scicos_link(xx=[[233.97067],[234.704]],yy=[[203.11733],[203.11733]],id="drawlink",thick=[0,0],ct=[1,1],from=[15,1,0],to=[12,1,1]); -scs_m.objs[17-1]=scicos_link(xx=[[233.97067],[233.97067],[312.6659]],yy=[[203.11733],[255.91733],[255.91733]],id="drawlink",thick=[0,0],ct=[1,1],from=[15,2,0],to=[3,1,1]); -scs_m.objs[18-1]=scicos_block(gui="OUT_f",graphics=scicos_graphics(orig=[456.5421,192.85067],sz=[20,20],flip=true,theta=0,exprs="1",pin=19,pout=[],pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit=[]),model=scicos_model(sim="output",in1=-1,in2=[],intyp=-1,out=[],out2=[],outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=1,opar=list(),blocktype="c",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m.objs[19-1]=scicos_link(xx=[[436.5421],[456.5421]],yy=[[202.85067],[202.85067]],id="drawlink",thick=[0,0],ct=[1,1],from=[2,1,0],to=[18,1,1]); -scs_m.objs[20-1]=scicos_block(gui="IN_f",graphics=scicos_graphics(orig=[193.97067,193.11733],sz=[20,20],flip=true,theta=0,exprs="1",pin=[],pout=21,pein=[],peout=[],gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim="input",in1=[],in2=[],intyp=1,out=-1,out2=[],outtyp=-1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=1,opar=list(),blocktype="c",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m.objs[21-1]=scicos_link(xx=[[213.97067],[233.97067]],yy=[[203.11733],[203.11733]],id="drawlink",thick=[0,0],ct=[1,1],from=[20,1,0],to=[15,1,1]); -model=scicos_model(); -model.sim="csuper"; -model.in1=-1; -model.in2=-2; -model.out=-1; -model.out2=-2; -model.intyp=1; -model.outtyp=1; -model.blocktype="h"; -model.firing=false; -model.dep_ut=[false,false]; -model.rpar=scs_m; -gr_i=[]; -x=standard_define([2,2],model,[],gr_i); + scs_m = scicos_diagram(version="scicos4.2",props=scicos_params(wpar=[600,450,0,0,600,450],Title=["PID"],tol=[0.0001,0.000001,1.000e-10,100001,0,0],tf=100000,context=" ",void1=[],options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(true,33),[8,1],[1,5],list([5,1],[4,1]),[0.8,0.8,0.8]),void2=[],void3=[],doc=list())); + scs_m.objs[1-1] = scicos_block(gui="INTEGRAL_m",graphics=scicos_graphics(orig=[318.304,183.11733],sz=[40,40],flip=true,theta=0,exprs=[["0"],["0"],["0"],["1"],["-1"]],pin=7,pout=9,pein=[],peout=[],gr_i=[],id="1/s",in_implicit="E",out_implicit="E"),model=scicos_model(sim=list("integral_func",4),in1=1,in2=1,intyp=1,out=1,out2=1,outtyp=1,evtin=[],evtout=[],state=0,dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[false,true],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m.objs[2-1] = scicos_block(gui="SUMMATION",graphics=scicos_graphics(orig=[387.97067,172.85067],sz=[40,60],flip=true,theta=0,exprs=[["1"],["[1;1;1]"]],pin=[[10],[9],[11]],pout=19,pein=[],peout=[],gr_i=[],id="",in_implicit=[["E"],["E"],["E"]],out_implicit="E"),model=scicos_model(sim=list("summation",4),in1=[[-1],[-1],[-1]],in2=[[-2],[-2],[-2]],intyp=[[1],[1],[1]],out=-1,out2=-2,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[[1],[1],[1]],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m.objs[3-1] = scicos_block(gui="GAINBLK",graphics=scicos_graphics(orig=[321.23733,235.91733],sz=[40,40],flip=true,theta=0,exprs="1",pin=17,pout=10,pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit="E"),model=scicos_model(sim=list("gainblk",4),in1=-1,in2=-2,intyp=1,out=-1,out2=-2,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=1,ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m.objs[4-1] = scicos_block(gui="DERIV",graphics=scicos_graphics(orig=[319.03733,135.45067],sz=[40,40],flip=true,theta=0,exprs=[],pin=8,pout=11,pein=[],peout=[],gr_i=[],id="s",in_implicit="E",out_implicit="E"),model=scicos_model(sim=list("deriv",4),in1=-1,in2=-2,intyp=1,out=-1,out2=-2,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="x",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m.objs[5-1] = scicos_block(gui="GAINBLK",graphics=scicos_graphics(orig=[255.23733,183.11733],sz=[40,40],flip=true,theta=0,exprs="1",pin=13,pout=7,pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit="E"),model=scicos_model(sim=list("gainblk",4),in1=-1,in2=-2,intyp=1,out=-1,out2=-2,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=1,ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m.objs[6-1] = scicos_block(gui="GAINBLK",graphics=scicos_graphics(orig=[255.23733,135.45067],sz=[40,40],flip=true,theta=0,exprs="1",pin=14,pout=8,pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit="E"),model=scicos_model(sim=list("gainblk",4),in1=-1,in2=-2,intyp=1,out=-1,out2=-2,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=1,ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m.objs[7-1] = scicos_link(xx=[[303.80876],[309.73257]],yy=[[203.11733],[203.11733]],id="drawlink",thick=[0,0],ct=[1,1],from=[5,1,0],to=[1,1,1]); + scs_m.objs[8-1] = scicos_link(xx=[[303.80876],[310.4659]],yy=[[155.45067],[155.45067]],id="drawlink",thick=[0,0],ct=[1,1],from=[6,1,0],to=[4,1,1]); + scs_m.objs[9-1] = scicos_link(xx=[[366.87543],[379.39924]],yy=[[203.11733],[202.85067]],id="drawlink",thick=[0,0],ct=[1,1],from=[1,1,0],to=[2,2,1]); + scs_m.objs[10-1] = scicos_link(xx=[[369.80876],[379.39924],[379.39924]],yy=[[255.91733],[255.91733],[217.85067]],id="drawlink",thick=[0,0],ct=[1,1],from=[3,1,0],to=[2,1,1]); + scs_m.objs[11-1] = scicos_link(xx=[[367.60876],[379.39924],[379.39924]],yy=[[155.45067],[155.45067],[187.85067]],id="drawlink",thick=[0,0],ct=[1,1],from=[4,1,0],to=[2,3,1]); + scs_m.objs[12-1] = scicos_block(gui="SPLIT_f",graphics=scicos_graphics(orig=[[234.704],[203.11733]],sz=[0.3333333,0.3333333],flip=true,theta=0,exprs=[],pin=16,pout=[[13],[14]],pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit=[["E"],["E"],["E"]]),model=scicos_model(sim="lsplit",in1=-1,in2=[],intyp=1,out=[[-1],[-1],[-1]],out2=[],outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m.objs[13-1] = scicos_link(xx=[[234.704],[246.6659]],yy=[[203.11733],[203.11733]],id="drawlink",thick=[0,0],ct=[1,1],from=[12,1,0],to=[5,1,1]); + scs_m.objs[14-1] = scicos_link(xx=[[234.704],[234.704],[246.6659]],yy=[[203.11733],[155.45067],[155.45067]],id="drawlink",thick=[0,0],ct=[1,1],from=[12,2,0],to=[6,1,1]); + scs_m.objs[15-1] = scicos_block(gui="SPLIT_f",graphics=scicos_graphics(orig=[[233.97067],[203.11733]],sz=[0.3333333,0.3333333],flip=true,theta=0,exprs=[],pin=21,pout=[[16],[17]],pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit=[["E"],["E"],["E"]]),model=scicos_model(sim="lsplit",in1=-1,in2=[],intyp=1,out=[[-1],[-1],[-1]],out2=[],outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m.objs[16-1] = scicos_link(xx=[[233.97067],[234.704]],yy=[[203.11733],[203.11733]],id="drawlink",thick=[0,0],ct=[1,1],from=[15,1,0],to=[12,1,1]); + scs_m.objs[17-1] = scicos_link(xx=[[233.97067],[233.97067],[312.6659]],yy=[[203.11733],[255.91733],[255.91733]],id="drawlink",thick=[0,0],ct=[1,1],from=[15,2,0],to=[3,1,1]); + scs_m.objs[18-1] = scicos_block(gui="OUT_f",graphics=scicos_graphics(orig=[456.5421,192.85067],sz=[20,20],flip=true,theta=0,exprs="1",pin=19,pout=[],pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit=[]),model=scicos_model(sim="output",in1=-1,in2=[],intyp=-1,out=[],out2=[],outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=1,opar=list(),blocktype="c",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m.objs[19-1] = scicos_link(xx=[[436.5421],[456.5421]],yy=[[202.85067],[202.85067]],id="drawlink",thick=[0,0],ct=[1,1],from=[2,1,0],to=[18,1,1]); + scs_m.objs[20-1] = scicos_block(gui="IN_f",graphics=scicos_graphics(orig=[193.97067,193.11733],sz=[20,20],flip=true,theta=0,exprs="1",pin=[],pout=21,pein=[],peout=[],gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim="input",in1=[],in2=[],intyp=1,out=-1,out2=[],outtyp=-1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=1,opar=list(),blocktype="c",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m.objs[21-1] = scicos_link(xx=[[213.97067],[233.97067]],yy=[[203.11733],[203.11733]],id="drawlink",thick=[0,0],ct=[1,1],from=[20,1,0],to=[15,1,1]); + model = scicos_model(); + model.sim = "csuper"; + model.in1 = -1; + model.in2 = -2; + model.out = -1; + model.out2 = -2; + model.intyp = 1; + model.outtyp = 1; + model.blocktype = "h"; + model.firing = false; + model.dep_ut = [false,false]; + model.rpar = scs_m; + gr_i = []; + x = standard_define([2,2],model,[],gr_i); } PID.prototype.details = function PID() { } PID.prototype.get = function PID() { } PID.prototype.set = function PID() { -ppath=list(0,0,0); + ppath = list(0,0,0); for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { -o=arg1.model.rpar.objs[i-1]; -if (typeof(o)=="Link") { -from=arg1.model.rpar.objs[o.from[1-1]-1]; -to=arg1.model.rpar.objs[o.to[1-1]-1]; -if (from.gui=="GAINBLK") { -switch (to.gui) { -case "SUMMATION": -ppath[1-1]=o.from[1-1]; -case "INTEGRAL_m": -ppath[2-1]=o.from[1-1]; -case "DERIV": -ppath[3-1]=o.from[1-1]; + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Link") { + from = arg1.model.rpar.objs[o.from[1-1]-1]; + to = arg1.model.rpar.objs[o.to[1-1]-1]; + if (from.gui=="GAINBLK") { + switch (to.gui) { + case "SUMMATION": + ppath[1-1] = o.from[1-1]; + case "INTEGRAL_m": + ppath[2-1] = o.from[1-1]; + case "DERIV": + ppath[3-1] = o.from[1-1]; } -} else if (to.gui=="GAINBLK") { -switch (from.gui) { -case "SUMMATION": -ppath[1-1]=o.to[1-1]; -case "INTEGRAL_m": -ppath[2-1]=o.to[1-1]; -case "DERIV": -ppath[3-1]=o.to[1-1]; + } else if (to.gui=="GAINBLK") { + switch (from.gui) { + case "SUMMATION": + ppath[1-1] = o.to[1-1]; + case "INTEGRAL_m": + ppath[2-1] = o.to[1-1]; + case "DERIV": + ppath[3-1] = o.to[1-1]; } } -if (and(ppath!=list(0,0,0))) { + if (and(ppath!=list(0,0,0))) { break; } } } -newpar=list(); -xx1=arg1.model.rpar.objs[ppath[1-1]-1]; -exprs[1-1]=xx1.graphics.exprs[1-1]; -p_old=xx1.model.rpar; -xx2=arg1.model.rpar.objs[ppath[2-1]-1]; -exprs[2-1]=xx2.graphics.exprs[1-1]; -i_old=xx2.model.rpar; -xx3=arg1.model.rpar.objs[ppath[3-1]-1]; -exprs[3-1]=xx3.graphics.exprs[1-1]; -d_old=xx3.model.rpar; -y=0; -while (true) { -[ok,p,i,d,exprs0]=scicos_getvalue("Set PID parameters",[["Proportional"],["Integral"],["Derivation"]],list("vec",-1,"vec",-1,"vec",-1),exprs); -if (!ok) { + newpar = list(); + xx1 = arg1.model.rpar.objs[ppath[1-1]-1]; + exprs[1-1] = xx1.graphics.exprs[1-1]; + p_old = xx1.model.rpar; + xx2 = arg1.model.rpar.objs[ppath[2-1]-1]; + exprs[2-1] = xx2.graphics.exprs[1-1]; + i_old = xx2.model.rpar; + xx3 = arg1.model.rpar.objs[ppath[3-1]-1]; + exprs[3-1] = xx3.graphics.exprs[1-1]; + d_old = xx3.model.rpar; + y = 0; + while (true) { + [ok,p,i,d,exprs0] = scicos_getvalue("Set PID parameters",[["Proportional"],["Integral"],["Derivation"]],list("vec",-1,"vec",-1,"vec",-1),exprs); + if (!ok) { break; } -if (ok) { -xx1.graphics.exprs=exprs0[1-1]; -xx1.model.rpar=p; -xx2.graphics.exprs=exprs0[2-1]; -xx2.model.rpar=i; -xx3.graphics.exprs=exprs0[3-1]; -xx3.model.rpar=d; -arg1.model.rpar.objs[ppath[1-1]-1]=xx1; -arg1.model.rpar.objs[ppath[2-1]-1]=xx2; -arg1.model.rpar.objs[ppath[3-1]-1]=xx3; + if (ok) { + xx1.graphics.exprs = exprs0[1-1]; + xx1.model.rpar = p; + xx2.graphics.exprs = exprs0[2-1]; + xx2.model.rpar = i; + xx3.graphics.exprs = exprs0[3-1]; + xx3.model.rpar = d; + arg1.model.rpar.objs[ppath[1-1]-1] = xx1; + arg1.model.rpar.objs[ppath[2-1]-1] = xx2; + arg1.model.rpar.objs[ppath[3-1]-1] = xx3; break; } } -needcompile=0; -if (!(p_old==p&&i_old==i&&d_old==d)) { -newpar[size(newpar)+1-1]=ppath[1-1]; -newpar[size(newpar)+1-1]=ppath[2-1]; -newpar[size(newpar)+1-1]=ppath[3-1]; -needcompile=2; + needcompile = 0; + if (!(p_old==p&&i_old==i&&d_old==d)) { + newpar[size(newpar)+1-1] = ppath[1-1]; + newpar[size(newpar)+1-1] = ppath[2-1]; + newpar[size(newpar)+1-1] = ppath[3-1]; + needcompile = 2; } -x=arg1; -y=max(y,needcompile); -typ=newpar; + x = arg1; + y = max(y,needcompile); + typ = newpar; } } diff --git a/js/Linear/REGISTER.js b/js/Linear/REGISTER.js index ce6d6c13..f99a4043 100644 --- a/js/Linear/REGISTER.js +++ b/js/Linear/REGISTER.js @@ -1,79 +1,79 @@ /* autogenerated from "macros/Linear/REGISTER.sci" */ function REGISTER() { REGISTER.prototype.define = function REGISTER() { -z0=zeros(10,1); -model=scicos_model(); -model.sim=list("delay4",4); -model.in1=1; -model.out=1; -model.evtin=1; -model.dstate=z0; -model.blocktype="d"; -model.dep_ut=[false,false]; -exprs=strcat(string(z0),";"); -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + z0 = zeros(10,1); + model = scicos_model(); + model.sim = list("delay4",4); + model.in1 = 1; + model.out = 1; + model.evtin = 1; + model.dstate = z0; + model.blocktype = "d"; + model.dep_ut = [false,false]; + exprs = strcat(string(z0),";"); + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } REGISTER.prototype.details = function REGISTER() { } REGISTER.prototype.get = function REGISTER() { } REGISTER.prototype.set = function REGISTER() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -if (size(exprs,1)==1) { -exprs=[[exprs],[sci2exp(1)]]; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + if (size(exprs,1)==1) { + exprs = [[exprs],[sci2exp(1)]]; } -while (true) { -[ok,z0,it,exprs]=scicos_getvalue("Set delay parameters",[["Register initial condition"],["Datatype (1=double 3=int32 ...)"]],list("vec",-1,"vec",1),exprs); -if (!ok) { + while (true) { + [ok,z0,it,exprs] = scicos_getvalue("Set delay parameters",[["Register initial condition"],["Datatype (1=double 3=int32 ...)"]],list("vec",-1,"vec",1),exprs); + if (!ok) { break; } -if (prod(size(z0))<1) { + if (prod(size(z0))<1) { message("Register length must be at least 1"); -ok=false; + ok = false; } -if (it==1) { -model.sim=list("delay4",4); -z0=double(z0); -model.dstate=z0; -model.odstate=list(); -} else { -if (it==3) { -model.sim=list("delay4_i32",4); -z0=int32(z0); -} else if (it==4) { -model.sim=list("delay4_i16",4); -z0=int16(z0); -} else if (it==5) { -model.sim=list("delay4_i8",4); -z0=int8(z0); -} else if (it==6) { -model.sim=list("delay4_ui32",4); -z0=uint32(z0); -} else if (it==7) { -model.sim=list("delay4_ui16",4); -z0=uint16(z0); -} else if (it==8) { -model.sim=list("delay4_ui8",4); -z0=uint8(z0); -} else { + if (it==1) { + model.sim = list("delay4",4); + z0 = double(z0); + model.dstate = z0; + model.odstate = list(); + } else { + if (it==3) { + model.sim = list("delay4_i32",4); + z0 = int32(z0); + } else if (it==4) { + model.sim = list("delay4_i16",4); + z0 = int16(z0); + } else if (it==5) { + model.sim = list("delay4_i8",4); + z0 = int8(z0); + } else if (it==6) { + model.sim = list("delay4_ui32",4); + z0 = uint32(z0); + } else if (it==7) { + model.sim = list("delay4_ui16",4); + z0 = uint16(z0); + } else if (it==8) { + model.sim = list("delay4_ui8",4); + z0 = uint8(z0); + } else { message("Datatype is not supported"); -ok=false; + ok = false; } -model.odstate=list(z0); -model.dstate=[]; + model.odstate = list(z0); + model.dstate = []; } -if (ok) { -in1=[1,1]; -[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(in1,it),1,[]); + if (ok) { + in1 = [1,1]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(in1,it),1,[]); } -if (ok) { -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + if (ok) { + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/REGISTER_f.js b/js/Linear/REGISTER_f.js index 786d8d1a..663d839f 100644 --- a/js/Linear/REGISTER_f.js +++ b/js/Linear/REGISTER_f.js @@ -1,42 +1,42 @@ /* autogenerated from "macros/Linear/REGISTER_f.sci" */ function REGISTER_f() { REGISTER_f.prototype.define = function REGISTER_f() { -z0=zeros(10,1); -model=scicos_model(); -model.sim="delay"; -model.in1=1; -model.out=1; -model.evtin=1; -model.dstate=z0; -model.blocktype="d"; -model.dep_ut=[false,false]; -exprs=strcat(string(z0),";"); -gr_i=[]; -x=standard_define([2.5,2.5],model,exprs,gr_i); + z0 = zeros(10,1); + model = scicos_model(); + model.sim = "delay"; + model.in1 = 1; + model.out = 1; + model.evtin = 1; + model.dstate = z0; + model.blocktype = "d"; + model.dep_ut = [false,false]; + exprs = strcat(string(z0),";"); + gr_i = []; + x = standard_define([2.5,2.5],model,exprs,gr_i); } REGISTER_f.prototype.details = function REGISTER_f() { } REGISTER_f.prototype.get = function REGISTER_f() { } REGISTER_f.prototype.set = function REGISTER_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,z0,exprs]=scicos_getvalue("Set delay parameters","Register initial condition",list("vec",-1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,z0,exprs] = scicos_getvalue("Set delay parameters","Register initial condition",list("vec",-1),exprs); + if (!ok) { break; } -if (prod(size(z0))<1) { + if (prod(size(z0))<1) { message("Register length must be at least 1"); -ok=false; + ok = false; } -if (ok) { -graphics.exprs=exprs; -model.dstate=z0; -x.graphics=graphics; -x.model=model; + if (ok) { + graphics.exprs = exprs; + model.dstate = z0; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/SAMPHOLD.js b/js/Linear/SAMPHOLD.js index 5c155e3b..5c9bacf5 100644 --- a/js/Linear/SAMPHOLD.js +++ b/js/Linear/SAMPHOLD.js @@ -1,23 +1,23 @@ /* autogenerated from "macros/Linear/SAMPHOLD.sci" */ function SAMPHOLD() { SAMPHOLD.prototype.define = function SAMPHOLD() { -in1=-1; -model=scicos_model(); -model.sim=list("samphold4",4); -model.in1=-1; -model.out=-1; -model.evtin=1; -model.blocktype="d"; -model.dep_ut=[true,false]; -gr_i=[]; -x=standard_define([2,2],model," ",gr_i); + in1 = -1; + model = scicos_model(); + model.sim = list("samphold4",4); + model.in1 = -1; + model.out = -1; + model.evtin = 1; + model.blocktype = "d"; + model.dep_ut = [true,false]; + gr_i = []; + x = standard_define([2,2],model," ",gr_i); } SAMPHOLD.prototype.details = function SAMPHOLD() { } SAMPHOLD.prototype.get = function SAMPHOLD() { } SAMPHOLD.prototype.set = function SAMPHOLD() { -x=arg1; -x.model.firing=[]; + x = arg1; + x.model.firing = []; } } diff --git a/js/Linear/SAMPHOLD_m.js b/js/Linear/SAMPHOLD_m.js index 3f022788..327372ad 100644 --- a/js/Linear/SAMPHOLD_m.js +++ b/js/Linear/SAMPHOLD_m.js @@ -1,48 +1,48 @@ /* autogenerated from "macros/Linear/SAMPHOLD_m.sci" */ function SAMPHOLD_m() { SAMPHOLD_m.prototype.define = function SAMPHOLD_m() { -model=scicos_model(); -model.sim=list("samphold4_m",4); -model.in1=-1; -model.in2=-2; -model.intyp=1; -model.outtyp=1; -model.out=-1; -model.out2=-2; -model.evtin=1; -model.blocktype="d"; -model.dep_ut=[true,false]; -label=[sci2exp(1)]; -gr_i=[]; -x=standard_define([2,2],model,label,gr_i); + model = scicos_model(); + model.sim = list("samphold4_m",4); + model.in1 = -1; + model.in2 = -2; + model.intyp = 1; + model.outtyp = 1; + model.out = -1; + model.out2 = -2; + model.evtin = 1; + model.blocktype = "d"; + model.dep_ut = [true,false]; + label = [sci2exp(1)]; + gr_i = []; + x = standard_define([2,2],model,label,gr_i); } SAMPHOLD_m.prototype.details = function SAMPHOLD_m() { } SAMPHOLD_m.prototype.get = function SAMPHOLD_m() { } SAMPHOLD_m.prototype.set = function SAMPHOLD_m() { -x=arg1; -x.model.firing=[]; -graphics=arg1.graphics; -label=graphics.exprs; -model=arg1.model; -while (true) { -[ok,it,exprs]=scicos_getvalue("Set parameters Block",["Datatype(1=real double 2=Complex 3=int32 ...)"],list("vec",1),label); -if (!ok) { + x = arg1; + x.model.firing = []; + graphics = arg1.graphics; + label = graphics.exprs; + model = arg1.model; + while (true) { + [ok,it,exprs] = scicos_getvalue("Set parameters Block",["Datatype(1=real double 2=Complex 3=int32 ...)"],list("vec",1),label); + if (!ok) { break; } -if (((it<1)||(it>8))) { + if (((it<1)||(it>8))) { message("Datatype is not supported"); -ok=false; + ok = false; } -if (ok) { -in1=[model.in1,model.in2]; -[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(in1,it),1,[]); -if (ok) { -graphics.exprs=exprs; -arg1.graphics=graphics; -arg1.model=model; -x=arg1; + if (ok) { + in1 = [model.in1,model.in2]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(in1,it),1,[]); + if (ok) { + graphics.exprs = exprs; + arg1.graphics = graphics; + arg1.model = model; + x = arg1; break; } } diff --git a/js/Linear/SAMPLEHOLD_f.js b/js/Linear/SAMPLEHOLD_f.js index 96624e37..c56fe8a5 100644 --- a/js/Linear/SAMPLEHOLD_f.js +++ b/js/Linear/SAMPLEHOLD_f.js @@ -1,23 +1,23 @@ /* autogenerated from "macros/Linear/SAMPLEHOLD_f.sci" */ function SAMPLEHOLD_f() { SAMPLEHOLD_f.prototype.define = function SAMPLEHOLD_f() { -in1=-1; -model=scicos_model(); -model.sim="samphold"; -model.in1=-1; -model.out=-1; -model.evtin=1; -model.blocktype="d"; -model.dep_ut=[true,false]; -gr_i=[]; -x=standard_define([2,2],model," ",gr_i); + in1 = -1; + model = scicos_model(); + model.sim = "samphold"; + model.in1 = -1; + model.out = -1; + model.evtin = 1; + model.blocktype = "d"; + model.dep_ut = [true,false]; + gr_i = []; + x = standard_define([2,2],model," ",gr_i); } SAMPLEHOLD_f.prototype.details = function SAMPLEHOLD_f() { } SAMPLEHOLD_f.prototype.get = function SAMPLEHOLD_f() { } SAMPLEHOLD_f.prototype.set = function SAMPLEHOLD_f() { -x=arg1; -x.model.firing=[]; + x = arg1; + x.model.firing = []; } } diff --git a/js/Linear/SOM_f.js b/js/Linear/SOM_f.js index 3d201947..e119ce47 100644 --- a/js/Linear/SOM_f.js +++ b/js/Linear/SOM_f.js @@ -1,40 +1,40 @@ /* autogenerated from "macros/Linear/SOM_f.sci" */ function SOM_f() { SOM_f.prototype.define = function SOM_f() { -sgn=[[1],[1],[1]]; -model=scicos_model(); -model.sim=list("sum",2); -model.in1=[[-1],[-1],[-1]]; -model.out=-1; -model.rpar=sgn; -model.blocktype="c"; -model.dep_ut=[true,false]; -exprs=[[sci2exp(1)],[sci2exp(sgn)]]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + sgn = [[1],[1],[1]]; + model = scicos_model(); + model.sim = list("sum",2); + model.in1 = [[-1],[-1],[-1]]; + model.out = -1; + model.rpar = sgn; + model.blocktype = "c"; + model.dep_ut = [true,false]; + exprs = [[sci2exp(1)],[sci2exp(sgn)]]; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } SOM_f.prototype.details = function SOM_f() { } SOM_f.prototype.get = function SOM_f() { } SOM_f.prototype.set = function SOM_f() { -x=arg1; -graphics=arg1.graphics; -model=arg1.model; -exprs=graphics.exprs; -if (size(exprs,"*")==2) { -exprs=exprs[2-1]; + x = arg1; + graphics = arg1.graphics; + model = arg1.model; + exprs = graphics.exprs; + if (size(exprs,"*")==2) { + exprs = exprs[2-1]; } -if (size(exprs,"*")!=3) { -exprs=string(model.rpar); + if (size(exprs,"*")!=3) { + exprs = string(model.rpar); } -if (graphics.flip) { -labs=["down","left","up"]; -} else { -labs=["down","right","up"]; + if (graphics.flip) { + labs = ["down","left","up"]; + } else { + labs = ["down","right","up"]; } -str=[["This sum block is obsolete","parameters cannot be modified. Please replace it with new sum block"],["and gain blocks in the linear palette"," ","Input ports are located at up, side and down positions.","Current gains are:"]]; -str=[[str],[(part(labs.slice(),1,7)+exprs.slice())]]; + str = [["This sum block is obsolete","parameters cannot be modified. Please replace it with new sum block"],["and gain blocks in the linear palette"," ","Input ports are located at up, side and down positions.","Current gains are:"]]; + str = [[str],[(part(labs.slice(),1,7)+exprs.slice())]]; message(str); } } diff --git a/js/Linear/SUMMATION.js b/js/Linear/SUMMATION.js index 53da4f34..d5171c25 100644 --- a/js/Linear/SUMMATION.js +++ b/js/Linear/SUMMATION.js @@ -1,135 +1,135 @@ /* autogenerated from "macros/Linear/SUMMATION.sci" */ function SUMMATION() { SUMMATION.prototype.define = function SUMMATION() { -sgn=[[1],[-1]]; -model=scicos_model(); -model.sim=list("summation",4); -model.in1=[[-1],[-1]]; -model.out=-1; -model.in2=[[-2],[-2]]; -model.out2=-2; -model.ipar=sgn; -model.blocktype="c"; -model.dep_ut=[true,false]; -exprs=sci2exp(sgn); -gr_i=[]; -x=standard_define([2,3],model,exprs,gr_i); + sgn = [[1],[-1]]; + model = scicos_model(); + model.sim = list("summation",4); + model.in1 = [[-1],[-1]]; + model.out = -1; + model.in2 = [[-2],[-2]]; + model.out2 = -2; + model.ipar = sgn; + model.blocktype = "c"; + model.dep_ut = [true,false]; + exprs = sci2exp(sgn); + gr_i = []; + x = standard_define([2,3],model,exprs,gr_i); } SUMMATION.prototype.details = function SUMMATION() { } SUMMATION.prototype.get = function SUMMATION() { } SUMMATION.prototype.set = function SUMMATION() { -x=arg1; -graphics=arg1.graphics; -model=arg1.model; -exprs=graphics.exprs; -if (size(exprs,1)==1) { -exprs=[[sci2exp(1)],[exprs],[sci2exp(0)]]; -} else if (size(exprs,1)==2) { -exprs=[[exprs],[sci2exp(0)]]; + x = arg1; + graphics = arg1.graphics; + model = arg1.model; + exprs = graphics.exprs; + if (size(exprs,1)==1) { + exprs = [[sci2exp(1)],[exprs],[sci2exp(0)]]; + } else if (size(exprs,1)==2) { + exprs = [[exprs],[sci2exp(0)]]; } -while (true) { -[ok,Datatype,sgn,satur,exprs]=scicos_getvalue("Set sum block parameters",[["Datatype (1=real double 2=complex 3=int32 ...)"],["Number of inputs or sign vector (of +1, -1)"],["Do on Overflow(0=Nothing 1=Saturate 2=Error)"]],list("vec",1,"vec",-1,"vec",1),exprs); -if (!ok) { + while (true) { + [ok,Datatype,sgn,satur,exprs] = scicos_getvalue("Set sum block parameters",[["Datatype (1=real double 2=complex 3=int32 ...)"],["Number of inputs or sign vector (of +1, -1)"],["Do on Overflow(0=Nothing 1=Saturate 2=Error)"]],list("vec",1,"vec",-1,"vec",1),exprs); + if (!ok) { break; } -sgn=sgn.slice(); -if ((satur!=0&&satur!=1&&satur!=2)) { + sgn = sgn.slice(); + if ((satur!=0&&satur!=1&&satur!=2)) { message("Do on overflow must be 0,1,2"); -ok=false; + ok = false; } -if (size(sgn,1)==1) { -if (sgn<1) { + if (size(sgn,1)==1) { + if (sgn<1) { message("Number of inputs must be > 0"); -ok=false; -} else if (sgn==1) { -in1=-1; -in2=-2; -sgn=[]; -nout=1; -nout2=1; -} else { -in1=-ones(sgn,1); -in2=2*in1; -sgn=ones(sgn,1); -nout=-1; -nout2=-2; + ok = false; + } else if (sgn==1) { + in1 = -1; + in2 = -2; + sgn = []; + nout = 1; + nout2 = 1; + } else { + in1 = -ones(sgn,1); + in2 = 2*in1; + sgn = ones(sgn,1); + nout = -1; + nout2 = -2; } -} else { -if (!and(abs(sgn)==1)) { + } else { + if (!and(abs(sgn)==1)) { message("Signs can only be +1 or -1"); -ok=false; -} else { -in1=-ones(size(sgn,1),1); -in2=2*in1; -nout=-1; -nout2=-2; + ok = false; + } else { + in1 = -ones(size(sgn,1),1); + in2 = 2*in1; + nout = -1; + nout2 = -2; } } -it=Datatype*ones(1,size(in1,1)); -ot=Datatype; -if (Datatype==1) { -model.sim=list("summation",4); -} else if (Datatype==2) { -model.sim=list("summation_z",4); -} else if (((Datatype<1)||(Datatype>8))) { + it = Datatype*ones(1,size(in1,1)); + ot = Datatype; + if (Datatype==1) { + model.sim = list("summation",4); + } else if (Datatype==2) { + model.sim = list("summation_z",4); + } else if (((Datatype<1)||(Datatype>8))) { message("Datatype is not supported"); -ok=false; -} else { -if (satur==0) { -if (Datatype==3) { -model.sim=list("summation_i32n",4); -} else if (Datatype==4) { -model.sim=list("summation_i16n",4); -} else if (Datatype==5) { -model.sim=list("summation_i8n",4); -} else if (Datatype==6) { -model.sim=list("summation_ui32n",4); -} else if (Datatype==7) { -model.sim=list("summation_ui16n",4); -} else if (Datatype==8) { -model.sim=list("summation_ui8n",4); + ok = false; + } else { + if (satur==0) { + if (Datatype==3) { + model.sim = list("summation_i32n",4); + } else if (Datatype==4) { + model.sim = list("summation_i16n",4); + } else if (Datatype==5) { + model.sim = list("summation_i8n",4); + } else if (Datatype==6) { + model.sim = list("summation_ui32n",4); + } else if (Datatype==7) { + model.sim = list("summation_ui16n",4); + } else if (Datatype==8) { + model.sim = list("summation_ui8n",4); } -} else if (satur==1) { -if (Datatype==3) { -model.sim=list("summation_i32s",4); -} else if (Datatype==4) { -model.sim=list("summation_i16s",4); -} else if (Datatype==5) { -model.sim=list("summation_i8s",4); -} else if (Datatype==6) { -model.sim=list("summation_ui32s",4); -} else if (Datatype==7) { -model.sim=list("summation_ui16s",4); -} else if (Datatype==8) { -model.sim=list("summation_ui8s",4); + } else if (satur==1) { + if (Datatype==3) { + model.sim = list("summation_i32s",4); + } else if (Datatype==4) { + model.sim = list("summation_i16s",4); + } else if (Datatype==5) { + model.sim = list("summation_i8s",4); + } else if (Datatype==6) { + model.sim = list("summation_ui32s",4); + } else if (Datatype==7) { + model.sim = list("summation_ui16s",4); + } else if (Datatype==8) { + model.sim = list("summation_ui8s",4); } -} else if (satur==2) { -if (Datatype==3) { -model.sim=list("summation_i32e",4); -} else if (Datatype==4) { -model.sim=list("summation_i16e",4); -} else if (Datatype==5) { -model.sim=list("summation_i8e",4); -} else if (Datatype==6) { -model.sim=list("summation_ui32e",4); -} else if (Datatype==7) { -model.sim=list("summation_ui16e",4); -} else if (Datatype==8) { -model.sim=list("summation_ui8e",4); + } else if (satur==2) { + if (Datatype==3) { + model.sim = list("summation_i32e",4); + } else if (Datatype==4) { + model.sim = list("summation_i16e",4); + } else if (Datatype==5) { + model.sim = list("summation_i8e",4); + } else if (Datatype==6) { + model.sim = list("summation_ui32e",4); + } else if (Datatype==7) { + model.sim = list("summation_ui16e",4); + } else if (Datatype==8) { + model.sim = list("summation_ui8e",4); } } } -if (ok) { -[model,graphics,ok]=set_io(model,graphics,list([in1,in2],it),list([nout,nout2],ot),[],[]); + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list([in1,in2],it),list([nout,nout2],ot),[],[]); } -if (ok) { -model.rpar=satur; -model.ipar=sgn; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + if (ok) { + model.rpar = satur; + model.ipar = sgn; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/SUM_f.js b/js/Linear/SUM_f.js index 15e8df7a..024692bd 100644 --- a/js/Linear/SUM_f.js +++ b/js/Linear/SUM_f.js @@ -1,21 +1,21 @@ /* autogenerated from "macros/Linear/SUM_f.sci" */ function SUM_f() { SUM_f.prototype.define = function SUM_f() { -model=scicos_model(); -model.sim=list("plusblk",2); -model.in1=[[-1],[-1],[-1]]; -model.out=-1; -model.blocktype="c"; -model.dep_ut=[true,false]; -gr_i=[]; -exprs=[]; -x=standard_define([1,1],model,exprs,gr_i); + model = scicos_model(); + model.sim = list("plusblk",2); + model.in1 = [[-1],[-1],[-1]]; + model.out = -1; + model.blocktype = "c"; + model.dep_ut = [true,false]; + gr_i = []; + exprs = []; + x = standard_define([1,1],model,exprs,gr_i); } SUM_f.prototype.details = function SUM_f() { } SUM_f.prototype.get = function SUM_f() { } SUM_f.prototype.set = function SUM_f() { -x=arg1; + x = arg1; } } diff --git a/js/Linear/TCLSS.js b/js/Linear/TCLSS.js index df49ee89..516eb048 100644 --- a/js/Linear/TCLSS.js +++ b/js/Linear/TCLSS.js @@ -1,81 +1,81 @@ /* autogenerated from "macros/Linear/TCLSS.sci" */ function TCLSS() { TCLSS.prototype.define = function TCLSS() { -x0=0; -A=0; -B=1; -C=1; -D=0; -in1=1; -nx=size(x0,"*"); -out=1; -model=scicos_model(); -model.sim=list("tcslti4",4); -model.in1=[[in1],[nx]]; -model.out=out; -model.evtin=1; -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([3,2],model,exprs,gr_i); + x0 = 0; + A = 0; + B = 1; + C = 1; + D = 0; + in1 = 1; + nx = size(x0,"*"); + out = 1; + model = scicos_model(); + model.sim = list("tcslti4",4); + model.in1 = [[in1],[nx]]; + model.out = out; + model.evtin = 1; + 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([3,2],model,exprs,gr_i); } TCLSS.prototype.details = function TCLSS() { } TCLSS.prototype.get = function TCLSS() { } TCLSS.prototype.set = function TCLSS() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -if (size(exprs,"*")==7) { -exprs=exprs[[1:4,7]-1]; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + if (size(exprs,"*")==7) { + exprs = exprs[[1:4,7]-1]; } -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) { + 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); -if (ms!=ns) { + [ms,ns] = size(A); + if (ms!=ns) { message("A matrix must be square"); -} else { -[model,graphics,ok]=check_io(model,graphics,[[in1],[ms]],out,1,[]); -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],[ms]],out,1,[]); + 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; -if (D!=[]) { -model.sim=list("tcslti4",4); -} else { -model.sim=list("tcsltj4",4); + model.state = x0.slice(); + model.rpar = rpar; + if (D!=[]) { + model.sim = list("tcslti4",4); + } else { + model.sim = list("tcsltj4",4); } -x.graphics=graphics; -x.model=model; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/TCLSS_f.js b/js/Linear/TCLSS_f.js index 9da638ee..9d43d97e 100644 --- a/js/Linear/TCLSS_f.js +++ b/js/Linear/TCLSS_f.js @@ -1,81 +1,81 @@ /* autogenerated from "macros/Linear/TCLSS_f.sci" */ function TCLSS_f() { TCLSS_f.prototype.define = function TCLSS_f() { -x0=0; -A=0; -B=1; -C=1; -D=0; -in1=1; -nx=size(x0,"*"); -out=1; -model=scicos_model(); -model.sim=list("tcslti",1); -model.in1=[[in1],[nx]]; -model.out=out; -model.evtin=1; -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([3,2],model,exprs,gr_i); + x0 = 0; + A = 0; + B = 1; + C = 1; + D = 0; + in1 = 1; + nx = size(x0,"*"); + out = 1; + model = scicos_model(); + model.sim = list("tcslti",1); + model.in1 = [[in1],[nx]]; + model.out = out; + model.evtin = 1; + 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([3,2],model,exprs,gr_i); } TCLSS_f.prototype.details = function TCLSS_f() { } TCLSS_f.prototype.get = function TCLSS_f() { } TCLSS_f.prototype.set = function TCLSS_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -if (size(exprs,"*")==7) { -exprs=exprs[[1:4,7]-1]; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + if (size(exprs,"*")==7) { + exprs = exprs[[1:4,7]-1]; } -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) { + 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); -if (ms!=ns) { + [ms,ns] = size(A); + if (ms!=ns) { message("A matrix must be square"); -} else { -[model,graphics,ok]=check_io(model,graphics,[[in1],[ms]],out,1,[]); -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],[ms]],out,1,[]); + 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; -if (D!=[]) { -model.sim=list("tcslti",1); -} else { -model.sim=list("tcsltj",1); + model.state = x0.slice(); + model.rpar = rpar; + if (D!=[]) { + model.sim = list("tcslti",1); + } else { + model.sim = list("tcsltj",1); } -x.graphics=graphics; -x.model=model; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/TIME_DELAY.js b/js/Linear/TIME_DELAY.js index bfdf2466..e4d235c6 100644 --- a/js/Linear/TIME_DELAY.js +++ b/js/Linear/TIME_DELAY.js @@ -1,55 +1,55 @@ /* autogenerated from "macros/Linear/TIME_DELAY.sci" */ function TIME_DELAY() { TIME_DELAY.prototype.define = function TIME_DELAY() { -nin=1; -T=1; -init=0; -N=1024; -model=scicos_model(); -model.sim=list("time_delay",4); -model.in1=[nin]; -model.out=nin; -model.rpar=[T,init]; -model.ipar=N; -model.blocktype="x"; -model.dep_ut=[false,true]; -exprs=[[string(T)],[string(init)],[string(N)]]; -gr_i=[]; -x=standard_define([3.5,2],model,exprs,gr_i); + nin = 1; + T = 1; + init = 0; + N = 1024; + model = scicos_model(); + model.sim = list("time_delay",4); + model.in1 = [nin]; + model.out = nin; + model.rpar = [T,init]; + model.ipar = N; + model.blocktype = "x"; + model.dep_ut = [false,true]; + exprs = [[string(T)],[string(init)],[string(N)]]; + gr_i = []; + x = standard_define([3.5,2],model,exprs,gr_i); } TIME_DELAY.prototype.details = function TIME_DELAY() { } TIME_DELAY.prototype.get = function TIME_DELAY() { } TIME_DELAY.prototype.set = function TIME_DELAY() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -nin=model.in1[1-1]; -while (true) { -[ok,T,init,N,exprs]=scicos_getvalue("Set delay parameters",[["Delay"],["initial input"],["Buffer size"]],list("vec",1,"vec",1,"vec",1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + nin = model.in1[1-1]; + while (true) { + [ok,T,init,N,exprs] = scicos_getvalue("Set delay parameters",[["Delay"],["initial input"],["Buffer size"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { break; } -if (N<2) { + if (N<2) { message("Buffer must be larger than 2"); -ok=false; + ok = false; } -if (T<=0) { + if (T<=0) { message("Delay must be positive"); -ok=false; + ok = false; } -if (ok) { -[model,graphics,ok]=check_io(model,graphics,[-1],-1,[],[]); + if (ok) { + [model,graphics,ok] = check_io(model,graphics,[-1],-1,[],[]); } -if (ok) { -graphics.exprs=exprs; -model.rpar=[[T],[init]]; -model.ipar=N; -model.dep_ut=[false,true]; -x.graphics=graphics; -x.model=model; + if (ok) { + graphics.exprs = exprs; + model.rpar = [[T],[init]]; + model.ipar = N; + model.dep_ut = [false,true]; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Linear/VARIABLE_DELAY.js b/js/Linear/VARIABLE_DELAY.js index 23ef7824..3a87c5c0 100644 --- a/js/Linear/VARIABLE_DELAY.js +++ b/js/Linear/VARIABLE_DELAY.js @@ -1,54 +1,54 @@ /* autogenerated from "macros/Linear/VARIABLE_DELAY.sci" */ function VARIABLE_DELAY() { VARIABLE_DELAY.prototype.define = function VARIABLE_DELAY() { -nin=1; -T=1; -init=0; -N=1024; -model=scicos_model(); -model.sim=list("variable_delay",4); -model.in1=[[nin],[1]]; -model.out=nin; -model.rpar=[T,init]; -model.ipar=N; -model.blocktype="d"; -model.dep_ut=[false,false]; -exprs=[[string(T)],[string(init)],[string(N)]]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + nin = 1; + T = 1; + init = 0; + N = 1024; + model = scicos_model(); + model.sim = list("variable_delay",4); + model.in1 = [[nin],[1]]; + model.out = nin; + model.rpar = [T,init]; + model.ipar = N; + model.blocktype = "d"; + model.dep_ut = [false,false]; + exprs = [[string(T)],[string(init)],[string(N)]]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } VARIABLE_DELAY.prototype.details = function VARIABLE_DELAY() { } VARIABLE_DELAY.prototype.get = function VARIABLE_DELAY() { } VARIABLE_DELAY.prototype.set = function VARIABLE_DELAY() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -nin=model.in1[1-1]; -while (true) { -[ok,T,init,N,exprs]=scicos_getvalue("Set delay parameters",[["Max delay"],["initial input"],["Buffer size"]],list("vec",1,"vec",1,"vec",1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + nin = model.in1[1-1]; + while (true) { + [ok,T,init,N,exprs] = scicos_getvalue("Set delay parameters",[["Max delay"],["initial input"],["Buffer size"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { break; } -if (N<2) { + if (N<2) { message("Buffer must be larger than 2"); -ok=false; + ok = false; } -if (T<=0) { + if (T<=0) { message("Delay must be positive"); -ok=false; + ok = false; } -if (ok) { -[model,graphics,ok]=check_io(model,graphics,[[-1],[1]],-1,[],[]); + if (ok) { + [model,graphics,ok] = check_io(model,graphics,[[-1],[1]],-1,[],[]); } -if (ok) { -graphics.exprs=exprs; -model.rpar=[[T],[init]]; -model.ipar=N; -x.graphics=graphics; -x.model=model; + if (ok) { + graphics.exprs = exprs; + model.rpar = [[T],[init]]; + model.ipar = N; + x.graphics = graphics; + x.model = model; break; } } |