summaryrefslogtreecommitdiff
path: root/js/Linear
diff options
context:
space:
mode:
Diffstat (limited to 'js/Linear')
-rw-r--r--js/Linear/BIGSOM_f.js33
-rw-r--r--js/Linear/BIGSOM_f.pickle6
-rw-r--r--js/Linear/CLINDUMMY_f.js5
-rw-r--r--js/Linear/CLINDUMMY_f.pickle6
-rw-r--r--js/Linear/CLR.js73
-rw-r--r--js/Linear/CLR.pickle6
-rw-r--r--js/Linear/CLR_f.js73
-rw-r--r--js/Linear/CLR_f.pickle6
-rw-r--r--js/Linear/CLSS.js109
-rw-r--r--js/Linear/CLSS.pickle6
-rw-r--r--js/Linear/CLSS_f.js89
-rw-r--r--js/Linear/CLSS_f.pickle6
-rw-r--r--js/Linear/DELAYV_f.js53
-rw-r--r--js/Linear/DELAYV_f.pickle6
-rw-r--r--js/Linear/DELAY_f.js125
-rw-r--r--js/Linear/DELAY_f.pickle6
-rw-r--r--js/Linear/DERIV.js5
-rw-r--r--js/Linear/DERIV.pickle6
-rw-r--r--js/Linear/DIFF_c.js61
-rw-r--r--js/Linear/DIFF_c.pickle6
-rw-r--r--js/Linear/DLR.js75
-rw-r--r--js/Linear/DLR.pickle6
-rw-r--r--js/Linear/DLR_f.js75
-rw-r--r--js/Linear/DLR_f.pickle6
-rw-r--r--js/Linear/DLSS.js109
-rw-r--r--js/Linear/DLSS.pickle6
-rw-r--r--js/Linear/DLSS_f.js89
-rw-r--r--js/Linear/DLSS_f.pickle6
-rw-r--r--js/Linear/DOLLAR.js123
-rw-r--r--js/Linear/DOLLAR.pickle8
-rw-r--r--js/Linear/DOLLAR_f.js53
-rw-r--r--js/Linear/DOLLAR_f.pickle6
-rw-r--r--js/Linear/DOLLAR_m.js123
-rw-r--r--js/Linear/DOLLAR_m.pickle8
-rw-r--r--js/Linear/GAINBLK.js231
-rw-r--r--js/Linear/GAINBLK.pickle6
-rw-r--r--js/Linear/GAINBLK_f.js41
-rw-r--r--js/Linear/GAINBLK_f.pickle6
-rw-r--r--js/Linear/GAIN_f.js41
-rw-r--r--js/Linear/GAIN_f.pickle6
-rw-r--r--js/Linear/INTEGRAL.js105
-rw-r--r--js/Linear/INTEGRAL.pickle6
-rw-r--r--js/Linear/INTEGRAL_f.js27
-rw-r--r--js/Linear/INTEGRAL_f.pickle6
-rw-r--r--js/Linear/INTEGRAL_m.js187
-rw-r--r--js/Linear/INTEGRAL_m.pickle6
-rw-r--r--js/Linear/PID.js107
-rw-r--r--js/Linear/PID.pickle6
-rw-r--r--js/Linear/REGISTER.js109
-rw-r--r--js/Linear/REGISTER.pickle6
-rw-r--r--js/Linear/REGISTER_f.js37
-rw-r--r--js/Linear/REGISTER_f.pickle6
-rw-r--r--js/Linear/SAMPHOLD.js7
-rw-r--r--js/Linear/SAMPHOLD.pickle6
-rw-r--r--js/Linear/SAMPHOLD_m.js47
-rw-r--r--js/Linear/SAMPHOLD_m.pickle6
-rw-r--r--js/Linear/SAMPLEHOLD_f.js7
-rw-r--r--js/Linear/SAMPLEHOLD_f.pickle6
-rw-r--r--js/Linear/SOM_f.js21
-rw-r--r--js/Linear/SOM_f.pickle6
-rw-r--r--js/Linear/SUMMATION.js217
-rw-r--r--js/Linear/SUMMATION.pickle6
-rw-r--r--js/Linear/SUM_f.js5
-rw-r--r--js/Linear/SUM_f.pickle6
-rw-r--r--js/Linear/TCLSS.js99
-rw-r--r--js/Linear/TCLSS.pickle6
-rw-r--r--js/Linear/TCLSS_f.js99
-rw-r--r--js/Linear/TCLSS_f.pickle6
-rw-r--r--js/Linear/TIME_DELAY.js55
-rw-r--r--js/Linear/TIME_DELAY.pickle6
-rw-r--r--js/Linear/VARIABLE_DELAY.js53
-rw-r--r--js/Linear/VARIABLE_DELAY.pickle6
72 files changed, 1548 insertions, 1440 deletions
diff --git a/js/Linear/BIGSOM_f.js b/js/Linear/BIGSOM_f.js
index 23b27e04..4376e478 100644
--- a/js/Linear/BIGSOM_f.js
+++ b/js/Linear/BIGSOM_f.js
@@ -11,31 +11,32 @@ function BIGSOM_f() {
model.dep_ut = [true,false];
exprs = sci2exp(sgn);
gr_i = [];
- x = standard_define([2,3],model,exprs,gr_i);
+ this.x = standard_define([2,3],model,exprs,gr_i);
}
BIGSOM_f.prototype.details = function BIGSOM_f() {
+ return this.x;
}
BIGSOM_f.prototype.get = function BIGSOM_f() {
}
BIGSOM_f.prototype.set = function BIGSOM_f() {
- x = arg1;
+ this.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;
-break;
-}
-}
+ [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;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/BIGSOM_f.pickle b/js/Linear/BIGSOM_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/BIGSOM_f.pickle
+++ b/js/Linear/BIGSOM_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/CLINDUMMY_f.js b/js/Linear/CLINDUMMY_f.js
index 32a65e6b..448f7ffd 100644
--- a/js/Linear/CLINDUMMY_f.js
+++ b/js/Linear/CLINDUMMY_f.js
@@ -9,13 +9,14 @@ function CLINDUMMY_f() {
model.firing = [];
model.dep_ut = [false,true];
gr_i = [];
- x = standard_define([3,2],model,[],gr_i);
+ this.x = standard_define([3,2],model,[],gr_i);
}
CLINDUMMY_f.prototype.details = function CLINDUMMY_f() {
+ return this.x;
}
CLINDUMMY_f.prototype.get = function CLINDUMMY_f() {
}
CLINDUMMY_f.prototype.set = function CLINDUMMY_f() {
- x = arg1;
+ this.x = arg1;
}
}
diff --git a/js/Linear/CLINDUMMY_f.pickle b/js/Linear/CLINDUMMY_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/CLINDUMMY_f.pickle
+++ b/js/Linear/CLINDUMMY_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/CLR.js b/js/Linear/CLR.js
index d6768d96..0b3439e8 100644
--- a/js/Linear/CLR.js
+++ b/js/Linear/CLR.js
@@ -16,14 +16,15 @@ function CLR() {
model.blocktype = "c";
model.dep_ut = [false,true];
gr_i = [];
- x = standard_define([3,2],model,exprs,gr_i);
+ this.x = standard_define([3,2],model,exprs,gr_i);
}
CLR.prototype.details = function CLR() {
+ return this.x;
}
CLR.prototype.get = function CLR() {
}
CLR.prototype.set = function CLR() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
@@ -35,39 +36,39 @@ function CLR() {
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)) {
-message("Transfer function must be proper or strictly proper.");
- 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 (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;
-}
- model.state = x0;
- model.rpar = rpar;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
+ [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)) {
+ message("Transfer function must be proper or strictly proper.");
+ 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 (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;
+ }
+ model.state = x0;
+ model.rpar = rpar;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/CLR.pickle b/js/Linear/CLR.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/CLR.pickle
+++ b/js/Linear/CLR.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/CLR_f.js b/js/Linear/CLR_f.js
index 459f975b..72bd2aaa 100644
--- a/js/Linear/CLR_f.js
+++ b/js/Linear/CLR_f.js
@@ -16,14 +16,15 @@ function CLR_f() {
model.blocktype = "c";
model.dep_ut = [false,true];
gr_i = [];
- x = standard_define([2.5,2.5],model,exprs,gr_i);
+ this.x = standard_define([2.5,2.5],model,exprs,gr_i);
}
CLR_f.prototype.details = function CLR_f() {
+ return this.x;
}
CLR_f.prototype.get = function CLR_f() {
}
CLR_f.prototype.set = function CLR_f() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
@@ -35,39 +36,39 @@ function CLR_f() {
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)) {
-message("Transfer must be proper or strictly proper");
- 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 (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;
-}
- model.state = x0;
- model.rpar = rpar;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
+ [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)) {
+ message("Transfer must be proper or strictly proper");
+ 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 (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;
+ }
+ model.state = x0;
+ model.rpar = rpar;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/CLR_f.pickle b/js/Linear/CLR_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/CLR_f.pickle
+++ b/js/Linear/CLR_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/CLSS.js b/js/Linear/CLSS.js
index 05f1fe80..94d9bd4a 100644
--- a/js/Linear/CLSS.js
+++ b/js/Linear/CLSS.js
@@ -18,70 +18,71 @@ function CLSS() {
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);
+ this.x = standard_define([4,2],model,exprs,gr_i);
}
CLSS.prototype.details = function CLSS() {
+ return this.x;
}
CLSS.prototype.get = function CLSS() {
}
CLSS.prototype.set = function CLSS() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
if (size(exprs,"*")==7) {
- exprs = exprs[[1:4,7]-1];
-}
+ 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) {
-break;
-}
- out = size(C,1);
- if (out==0) {
- out = [];
-}
- 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;
-}
-}
- 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];
-}
- if (or(model.dep_ut!=mmm)) {
- model.dep_ut = mmm;
-}
- } else {
- model.dep_ut = [false,true];
-}
- model.state = x0.slice();
- model.rpar = rpar;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
-}
+ [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 = [];
+ }
+ 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;
+ }
+ }
+ 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];
+ }
+ if (or(model.dep_ut!=mmm)) {
+ model.dep_ut = mmm;
+ }
+ } else {
+ model.dep_ut = [false,true];
+ }
+ model.state = x0.slice();
+ model.rpar = rpar;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ }
}
}
diff --git a/js/Linear/CLSS.pickle b/js/Linear/CLSS.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/CLSS.pickle
+++ b/js/Linear/CLSS.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/CLSS_f.js b/js/Linear/CLSS_f.js
index 1a78799d..d4c2976a 100644
--- a/js/Linear/CLSS_f.js
+++ b/js/Linear/CLSS_f.js
@@ -18,60 +18,61 @@ function CLSS_f() {
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);
+ this.x = standard_define([4,2],model,exprs,gr_i);
}
CLSS_f.prototype.details = function CLSS_f() {
+ return this.x;
}
CLSS_f.prototype.get = function CLSS_f() {
}
CLSS_f.prototype.set = function CLSS_f() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
if (size(exprs,"*")==7) {
- exprs = exprs[[1:4,7]-1];
-}
+ 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) {
-break;
-}
- out = size(C,1);
- if (out==0) {
- out = [];
-}
- in1 = size(B,2);
- if (in1==0) {
- in1 = [];
-}
- [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];
-}
- if (or(model.dep_ut!=mmm)) {
- model.dep_ut = mmm;
-}
- } else {
- model.dep_ut = [false,true];
-}
- model.state = x0.slice();
- model.rpar = rpar;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
-}
+ [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 = [];
+ }
+ in1 = size(B,2);
+ if (in1==0) {
+ in1 = [];
+ }
+ [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];
+ }
+ if (or(model.dep_ut!=mmm)) {
+ model.dep_ut = mmm;
+ }
+ } else {
+ model.dep_ut = [false,true];
+ }
+ model.state = x0.slice();
+ model.rpar = rpar;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ }
}
}
diff --git a/js/Linear/CLSS_f.pickle b/js/Linear/CLSS_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/CLSS_f.pickle
+++ b/js/Linear/CLSS_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/DELAYV_f.js b/js/Linear/DELAYV_f.js
index 08c96e3e..44603e1d 100644
--- a/js/Linear/DELAYV_f.js
+++ b/js/Linear/DELAYV_f.js
@@ -18,14 +18,15 @@ function DELAYV_f() {
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);
+ this.x = standard_define([3,2],model,exprs,gr_i);
}
DELAYV_f.prototype.details = function DELAYV_f() {
+ return this.x;
}
DELAYV_f.prototype.get = function DELAYV_f() {
}
DELAYV_f.prototype.set = function DELAYV_f() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
@@ -34,29 +35,29 @@ function DELAYV_f() {
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) {
-message("Register length must be at least 2");
- ok = false;
-}
- if (T<=0) {
-message("Delay must be positive");
- ok = false;
-}
- 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;
-break;
-}
-}
+ [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) {
+ message("Register length must be at least 2");
+ ok = false;
+ }
+ if (T<=0) {
+ message("Delay must be positive");
+ ok = false;
+ }
+ 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,"*"));
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/DELAYV_f.pickle b/js/Linear/DELAYV_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/DELAYV_f.pickle
+++ b/js/Linear/DELAYV_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/DELAY_f.js b/js/Linear/DELAY_f.js
index cde21698..0a2a2f83 100644
--- a/js/Linear/DELAY_f.js
+++ b/js/Linear/DELAY_f.js
@@ -47,80 +47,81 @@ function DELAY_f() {
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 = "";
+ this.x = scicos_block();
+ this.x.gui = "DELAY_f";
+ this.x.graphics.sz = [2,2];
+ this.x.graphics.gr_i = [];
+ this.x.graphics.pin = 0;
+ this.x.graphics.pout = 0;
+ this.x.model.sim = "csuper";
+ this.x.model.in1 = 1;
+ this.x.model.out = 1;
+ this.x.model.blocktype = "h";
+ this.x.model.dep_ut = [false,false];
+ this.x.model.rpar = diagram;
+ this.x.graphics.in_implicit = ["E"];
+ this.x.graphics.in_style = "";
+ this.x.graphics.out_implicit = ["E"];
+ this.x.graphics.out_style = "";
}
DELAY_f.prototype.details = function DELAY_f() {
+ return this.x;
}
DELAY_f.prototype.get = function DELAY_f() {
}
DELAY_f.prototype.set = function DELAY_f() {
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;
-}
- if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") {
- ppath[2-1] = i;
-}
- if (and(ppath!=list(0,0))) {
-break;
-}
-}
- x = arg1;
+ 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;
+ }
+ if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") {
+ ppath[2-1] = i;
+ }
+ if (and(ppath!=list(0,0))) {
+ break;
+ }
+ }
+ this.x = arg1;
newpar = list();
- register = x.model.rpar.objs[ppath[1-1]-1];
- evtdly = x.model.rpar.objs[ppath[2-1]-1];
+ register = this.x.model.rpar.objs[ppath[1-1]-1];
+ evtdly = this.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;
-}
- if (dt<=0) {
- mess = [[mess],["Discretization time step must be positive"],[" "]];
- ok = false;
-}
- 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];
-}
- 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;
-break;
-}
-}
+ [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;
+ }
+ if (dt<=0) {
+ mess = [[mess],["Discretization time step must be positive"],[" "]];
+ ok = false;
+ }
+ 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];
+ }
+ this.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];
+ }
+ this.x.model.rpar.objs[ppath[1-1]-1] = register;
+ break;
+ }
+ }
needcompile = 0;
y = needcompile;
typ = newpar;
diff --git a/js/Linear/DELAY_f.pickle b/js/Linear/DELAY_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/DELAY_f.pickle
+++ b/js/Linear/DELAY_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/DERIV.js b/js/Linear/DERIV.js
index a3b0b8dc..d8b77628 100644
--- a/js/Linear/DERIV.js
+++ b/js/Linear/DERIV.js
@@ -9,13 +9,14 @@ function DERIV() {
model.dep_ut = [true,false];
exprs = [];
gr_i = [];
- x = standard_define([2,2],model,exprs,gr_i);
+ this.x = standard_define([2,2],model,exprs,gr_i);
}
DERIV.prototype.details = function DERIV() {
+ return this.x;
}
DERIV.prototype.get = function DERIV() {
}
DERIV.prototype.set = function DERIV() {
- x = arg1;
+ this.x = arg1;
}
}
diff --git a/js/Linear/DERIV.pickle b/js/Linear/DERIV.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/DERIV.pickle
+++ b/js/Linear/DERIV.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/DIFF_c.js b/js/Linear/DIFF_c.js
index 5d953122..191e9282 100644
--- a/js/Linear/DIFF_c.js
+++ b/js/Linear/DIFF_c.js
@@ -11,45 +11,46 @@ function DIFF_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);
+ this.x = standard_define([2,2],model,exprs,gr_i);
}
DIFF_c.prototype.details = function DIFF_c() {
+ return this.x;
}
DIFF_c.prototype.get = function DIFF_c() {
}
DIFF_c.prototype.set = function DIFF_c() {
- x = arg1;
+ this.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)) {
-message("Incompatible sizes: states and their derivatives should have the same size ");
- ask_again = true;
-}
- if ((N<=0&&!ask_again)) {
-x_message("number of states must be > 0 ");
- 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;
-break;
-}
-}
- x.model.firing = [];
+ 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)) {
+ message("Incompatible sizes: states and their derivatives should have the same size ");
+ ask_again = true;
+ }
+ if ((N<=0&&!ask_again)) {
+ x_message("number of states must be > 0 ");
+ ask_again = true;
+ }
+ if (!ask_again) {
+ graphics.exprs = exprs;
+ model.state = [[x0],[xd0]];
+ model.out = [N];
+ model.in1 = N;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ this.x.model.firing = [];
}
}
diff --git a/js/Linear/DIFF_c.pickle b/js/Linear/DIFF_c.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/DIFF_c.pickle
+++ b/js/Linear/DIFF_c.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/DLR.js b/js/Linear/DLR.js
index c39494a5..39d11022 100644
--- a/js/Linear/DLR.js
+++ b/js/Linear/DLR.js
@@ -17,14 +17,15 @@ function DLR() {
model.blocktype = "d";
model.dep_ut = [false,false];
gr_i = [];
- x = standard_define([3,2],model,exprs,gr_i);
+ this.x = standard_define([3,2],model,exprs,gr_i);
}
DLR.prototype.details = function DLR() {
+ return this.x;
}
DLR.prototype.get = function DLR() {
}
DLR.prototype.set = function DLR() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
@@ -33,40 +34,40 @@ function DLR() {
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)) {
-message("Transfer function must be proper");
- 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;
-}
- 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;
-}
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
- x.model.firing = [];
+ [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)) {
+ message("Transfer function must be proper");
+ 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;
+ }
+ 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;
+ }
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ this.x.model.firing = [];
}
}
diff --git a/js/Linear/DLR.pickle b/js/Linear/DLR.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/DLR.pickle
+++ b/js/Linear/DLR.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/DLR_f.js b/js/Linear/DLR_f.js
index fe84fec7..0bc0dc73 100644
--- a/js/Linear/DLR_f.js
+++ b/js/Linear/DLR_f.js
@@ -17,14 +17,15 @@ function DLR_f() {
model.blocktype = "d";
model.dep_ut = [false,false];
gr_i = [];
- x = standard_define([2.5,2.5],model,exprs,gr_i);
+ this.x = standard_define([2.5,2.5],model,exprs,gr_i);
}
DLR_f.prototype.details = function DLR_f() {
+ return this.x;
}
DLR_f.prototype.get = function DLR_f() {
}
DLR_f.prototype.set = function DLR_f() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
@@ -33,40 +34,40 @@ function DLR_f() {
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)) {
-message("Transfer must be proper");
- 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;
-}
- 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;
-}
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
- x.model.firing = [];
+ [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)) {
+ message("Transfer must be proper");
+ 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;
+ }
+ 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;
+ }
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ this.x.model.firing = [];
}
}
diff --git a/js/Linear/DLR_f.pickle b/js/Linear/DLR_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/DLR_f.pickle
+++ b/js/Linear/DLR_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/DLSS.js b/js/Linear/DLSS.js
index 869a9b3e..56fa6f74 100644
--- a/js/Linear/DLSS.js
+++ b/js/Linear/DLSS.js
@@ -17,70 +17,71 @@ function DLSS() {
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);
+ this.x = standard_define([4,2],model,exprs,gr_i);
}
DLSS.prototype.details = function DLSS() {
+ return this.x;
}
DLSS.prototype.get = function DLSS() {
}
DLSS.prototype.set = function DLSS() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
if (size(exprs,"*")==7) {
- exprs = exprs[[1:4,7]-1];
-}
+ 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) {
-break;
-}
- out = size(C,1);
- if (out==0) {
- out = [];
-}
- 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;
-}
-}
- 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];
-}
- if (or(model.dep_ut!=mmm)) {
- model.dep_ut = mmm;
-}
- } else {
- model.dep_ut = [false,false];
-}
- model.dstate = x0.slice();
- model.rpar = rpar;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
-}
+ [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 = [];
+ }
+ 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;
+ }
+ }
+ 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];
+ }
+ if (or(model.dep_ut!=mmm)) {
+ model.dep_ut = mmm;
+ }
+ } else {
+ model.dep_ut = [false,false];
+ }
+ model.dstate = x0.slice();
+ model.rpar = rpar;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ }
}
}
diff --git a/js/Linear/DLSS.pickle b/js/Linear/DLSS.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/DLSS.pickle
+++ b/js/Linear/DLSS.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/DLSS_f.js b/js/Linear/DLSS_f.js
index 1a2fb656..c444ce87 100644
--- a/js/Linear/DLSS_f.js
+++ b/js/Linear/DLSS_f.js
@@ -17,60 +17,61 @@ function DLSS_f() {
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);
+ this.x = standard_define([4,2],model,exprs,gr_i);
}
DLSS_f.prototype.details = function DLSS_f() {
+ return this.x;
}
DLSS_f.prototype.get = function DLSS_f() {
}
DLSS_f.prototype.set = function DLSS_f() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
if (size(exprs,"*")==7) {
- exprs = exprs[[1:4,7]-1];
-}
+ 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) {
-break;
-}
- out = size(C,1);
- if (out==0) {
- out = [];
-}
- in1 = size(B,2);
- if (in1==0) {
- in1 = [];
-}
- [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];
-}
- if (or(model.dep_ut!=mmm)) {
- model.dep_ut = mmm;
-}
- } else {
- model.dep_ut = [false,false];
-}
- model.dstate = x0.slice();
- model.rpar = rpar;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
-}
+ [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 = [];
+ }
+ in1 = size(B,2);
+ if (in1==0) {
+ in1 = [];
+ }
+ [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];
+ }
+ if (or(model.dep_ut!=mmm)) {
+ model.dep_ut = mmm;
+ }
+ } else {
+ model.dep_ut = [false,false];
+ }
+ model.dstate = x0.slice();
+ model.rpar = rpar;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ }
}
}
diff --git a/js/Linear/DLSS_f.pickle b/js/Linear/DLSS_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/DLSS_f.pickle
+++ b/js/Linear/DLSS_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/DOLLAR.js b/js/Linear/DOLLAR.js
index 5b736b28..b4413a70 100644
--- a/js/Linear/DOLLAR.js
+++ b/js/Linear/DOLLAR.js
@@ -14,77 +14,78 @@ function DOLLAR() {
model.blocktype = "d";
model.dep_ut = [false,false];
gr_i = [];
- x = standard_define([2,2],model,exprs,gr_i);
+ this.x = standard_define([2,2],model,exprs,gr_i);
}
DOLLAR.prototype.details = function DOLLAR() {
+ return this.x;
}
DOLLAR.prototype.get = function DOLLAR() {
}
DOLLAR.prototype.set = function DOLLAR() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
if (size(exprs,"*")<2) {
- exprs[2-1] = "0";
-}
+ 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) {
-break;
-}
- 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();
-}
- } 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 {
-message("type is not recognized");
- ok = false;
-}
- 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;
-break;
-}
-}
+ [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 = [];
+ }
+ 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 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;
+ }
+ if (ok) {
+ [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(1-inh,1),[]);
+ }
+ if (ok) {
+ graphics.exprs = exprs;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/DOLLAR.pickle b/js/Linear/DOLLAR.pickle
index 0ac03d7f..54a16ece 100644
--- a/js/Linear/DOLLAR.pickle
+++ b/js/Linear/DOLLAR.pickle
@@ -2,8 +2,10 @@ c__builtin__
set
p0
((lp1
-S'type'
+S'x'
p2
-atp3
-Rp4
+aS'type'
+p3
+atp4
+Rp5
. \ No newline at end of file
diff --git a/js/Linear/DOLLAR_f.js b/js/Linear/DOLLAR_f.js
index b5f1be1a..fb853821 100644
--- a/js/Linear/DOLLAR_f.js
+++ b/js/Linear/DOLLAR_f.js
@@ -14,42 +14,43 @@ function DOLLAR_f() {
model.blocktype = "d";
model.dep_ut = [false,false];
gr_i = [];
- x = standard_define([2,2],model,exprs,gr_i);
+ this.x = standard_define([2,2],model,exprs,gr_i);
}
DOLLAR_f.prototype.details = function DOLLAR_f() {
+ return this.x;
}
DOLLAR_f.prototype.get = function DOLLAR_f() {
}
DOLLAR_f.prototype.set = function DOLLAR_f() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
if (size(exprs,"*")<2) {
- exprs[2-1] = "0";
-}
+ 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) {
-break;
-}
- out = size(a,"*");
- if (out==0) {
- out = [];
-}
- 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;
-break;
-}
-}
+ [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 = [];
+ }
+ 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;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/DOLLAR_f.pickle b/js/Linear/DOLLAR_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/DOLLAR_f.pickle
+++ b/js/Linear/DOLLAR_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/DOLLAR_m.js b/js/Linear/DOLLAR_m.js
index 8fa53e30..4cd2dfdf 100644
--- a/js/Linear/DOLLAR_m.js
+++ b/js/Linear/DOLLAR_m.js
@@ -14,77 +14,78 @@ function DOLLAR_m() {
model.blocktype = "d";
model.dep_ut = [false,false];
gr_i = [];
- x = standard_define([2,2],model,exprs,gr_i);
+ this.x = standard_define([2,2],model,exprs,gr_i);
}
DOLLAR_m.prototype.details = function DOLLAR_m() {
+ return this.x;
}
DOLLAR_m.prototype.get = function DOLLAR_m() {
}
DOLLAR_m.prototype.set = function DOLLAR_m() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
if (size(exprs,"*")<2) {
- exprs[2-1] = "0";
-}
+ 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) {
-break;
-}
- 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();
-}
- } 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 {
-message("type is not recognized");
- ok = false;
-}
- 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;
-break;
-}
-}
+ [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 = [];
+ }
+ 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 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;
+ }
+ if (ok) {
+ [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(1-inh,1),[]);
+ }
+ if (ok) {
+ graphics.exprs = exprs;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/DOLLAR_m.pickle b/js/Linear/DOLLAR_m.pickle
index 0ac03d7f..54a16ece 100644
--- a/js/Linear/DOLLAR_m.pickle
+++ b/js/Linear/DOLLAR_m.pickle
@@ -2,8 +2,10 @@ c__builtin__
set
p0
((lp1
-S'type'
+S'x'
p2
-atp3
-Rp4
+aS'type'
+p3
+atp4
+Rp5
. \ No newline at end of file
diff --git a/js/Linear/GAINBLK.js b/js/Linear/GAINBLK.js
index b907fe60..edab742b 100644
--- a/js/Linear/GAINBLK.js
+++ b/js/Linear/GAINBLK.js
@@ -17,131 +17,132 @@ function GAINBLK() {
model.dep_ut = [true,false];
exprs = [strcat(sci2exp(gain))];
gr_i = [];
- x = standard_define([2,2],model,exprs,gr_i);
+ this.x = standard_define([2,2],model,exprs,gr_i);
}
GAINBLK.prototype.details = function GAINBLK() {
+ return this.x;
}
GAINBLK.prototype.get = function GAINBLK() {
}
GAINBLK.prototype.set = function GAINBLK() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
if (size(exprs,"*")==1) {
- exprs = [[exprs],[sci2exp(0)]];
-}
+ 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) {
-break;
-}
- 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 {
-message("type is not supported");
- 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 {
-message("type is not supported.");
- 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 {
-message("type is not supported.");
- 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 {
-message("type is not an integer.");
- ok = false;
-}
- } else {
-message("Do on Overflow must be 0,1,2");
- ok = false;
-}
- 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) {
- graphics.exprs = exprs;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
-}
+ [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==[]) {
+ 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 {
+ message("type is not supported");
+ 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 {
+ message("type is not supported.");
+ 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 {
+ message("type is not supported.");
+ 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 {
+ message("type is not an integer.");
+ ok = false;
+ }
+ } else {
+ message("Do on Overflow must be 0,1,2");
+ ok = false;
+ }
+ 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) {
+ graphics.exprs = exprs;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ }
}
}
diff --git a/js/Linear/GAINBLK.pickle b/js/Linear/GAINBLK.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/GAINBLK.pickle
+++ b/js/Linear/GAINBLK.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/GAINBLK_f.js b/js/Linear/GAINBLK_f.js
index b2efa274..7c574416 100644
--- a/js/Linear/GAINBLK_f.js
+++ b/js/Linear/GAINBLK_f.js
@@ -13,35 +13,36 @@ function GAINBLK_f() {
model.dep_ut = [true,false];
exprs = [strcat(sci2exp(gain))];
gr_i = [];
- x = standard_define([2,2],model,exprs,gr_i);
+ this.x = standard_define([2,2],model,exprs,gr_i);
}
GAINBLK_f.prototype.details = function GAINBLK_f() {
+ return this.x;
}
GAINBLK_f.prototype.get = function GAINBLK_f() {
}
GAINBLK_f.prototype.set = function GAINBLK_f() {
- x = arg1;
+ this.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==[]) {
-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;
-break;
-}
-}
-}
+ [ok,gain,exprs] = scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs[1-1]);
+ if (!ok) {
+ break;
+ }
+ 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();
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ }
}
}
diff --git a/js/Linear/GAINBLK_f.pickle b/js/Linear/GAINBLK_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/GAINBLK_f.pickle
+++ b/js/Linear/GAINBLK_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/GAIN_f.js b/js/Linear/GAIN_f.js
index 836dee96..4af1dce9 100644
--- a/js/Linear/GAIN_f.js
+++ b/js/Linear/GAIN_f.js
@@ -13,35 +13,36 @@ function GAIN_f() {
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);
+ this.x = standard_define([2,2],model,exprs,gr_i);
}
GAIN_f.prototype.details = function GAIN_f() {
+ return this.x;
}
GAIN_f.prototype.get = function GAIN_f() {
}
GAIN_f.prototype.set = function GAIN_f() {
- x = arg1;
+ this.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==[]) {
-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;
-break;
-}
-}
-}
+ [ok,gain,exprs] = scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs[1-1]);
+ if (!ok) {
+ break;
+ }
+ 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();
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ }
}
}
diff --git a/js/Linear/GAIN_f.pickle b/js/Linear/GAIN_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/GAIN_f.pickle
+++ b/js/Linear/GAIN_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/INTEGRAL.js b/js/Linear/INTEGRAL.js
index 289c882c..4184d619 100644
--- a/js/Linear/INTEGRAL.js
+++ b/js/Linear/INTEGRAL.js
@@ -14,67 +14,68 @@ function INTEGRAL() {
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";
+ this.x = standard_define([2,2],model,exprs,gr_i);
+ this.x.graphics.id = "1/s";
}
INTEGRAL.prototype.details = function INTEGRAL() {
+ return this.x;
}
INTEGRAL.prototype.get = function INTEGRAL() {
}
INTEGRAL.prototype.set = function INTEGRAL() {
- x = arg1;
+ this.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;
-}
- if (satur!=0) {
- satur = 1;
- if (size(maxp,"*")==1) {
- maxp = maxp*ones(x0);
-}
- if (size(lowp,"*")==1) {
- lowp = lowp*ones(x0);
-}
- 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)) {
-message("Upper limits must be > Lower limits");
- 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);
-}
- } 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) {
- graphics.exprs = exprs;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
+ [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;
+ }
+ if (satur!=0) {
+ satur = 1;
+ if (size(maxp,"*")==1) {
+ maxp = maxp*ones(x0);
+ }
+ if (size(lowp,"*")==1) {
+ lowp = lowp*ones(x0);
+ }
+ 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)) {
+ message("Upper limits must be > Lower limits");
+ 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);
+ }
+ } 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) {
+ graphics.exprs = exprs;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/INTEGRAL.pickle b/js/Linear/INTEGRAL.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/INTEGRAL.pickle
+++ b/js/Linear/INTEGRAL.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/INTEGRAL_f.js b/js/Linear/INTEGRAL_f.js
index 3530d6b6..8867b09b 100644
--- a/js/Linear/INTEGRAL_f.js
+++ b/js/Linear/INTEGRAL_f.js
@@ -11,28 +11,29 @@ function INTEGRAL_f() {
model.dep_ut = [false,true];
exprs = strcat(sci2exp(x0));
gr_i = [];
- x = standard_define([2,2],model,exprs,gr_i);
+ this.x = standard_define([2,2],model,exprs,gr_i);
}
INTEGRAL_f.prototype.details = function INTEGRAL_f() {
+ return this.x;
}
INTEGRAL_f.prototype.get = function INTEGRAL_f() {
}
INTEGRAL_f.prototype.set = function INTEGRAL_f() {
- x = arg1;
+ this.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;
-break;
-}
- x.model.firing = [];
+ [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;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ this.x.model.firing = [];
}
}
diff --git a/js/Linear/INTEGRAL_f.pickle b/js/Linear/INTEGRAL_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/INTEGRAL_f.pickle
+++ b/js/Linear/INTEGRAL_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/INTEGRAL_m.js b/js/Linear/INTEGRAL_m.js
index 733d18f2..f5e0b140 100644
--- a/js/Linear/INTEGRAL_m.js
+++ b/js/Linear/INTEGRAL_m.js
@@ -16,108 +16,109 @@ function INTEGRAL_m() {
model.dep_ut = [false,true];
exprs = string([[0],[0],[0],[maxp],[minp]]);
gr_i = [];
- x = standard_define([2,2],model,exprs,gr_i);
+ this.x = standard_define([2,2],model,exprs,gr_i);
}
INTEGRAL_m.prototype.details = function INTEGRAL_m() {
+ return this.x;
}
INTEGRAL_m.prototype.get = function INTEGRAL_m() {
}
INTEGRAL_m.prototype.set = function INTEGRAL_m() {
- x = arg1;
+ this.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 (reinit!=0) {
- reinit = 1;
-}
- 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(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)) {
-message("Upper limits must be > Lower limits");
- 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,"*");
-}
- } 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(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))) {
-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))) {
-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 {
-message("Datatype is not supported");
- 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) {
- graphics.exprs = exprs;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
+ [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 (reinit!=0) {
+ reinit = 1;
+ }
+ 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(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)) {
+ message("Upper limits must be > Lower limits");
+ 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,"*");
+ }
+ } 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(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))) {
+ 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))) {
+ 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 {
+ message("Datatype is not supported");
+ 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) {
+ graphics.exprs = exprs;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/INTEGRAL_m.pickle b/js/Linear/INTEGRAL_m.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/INTEGRAL_m.pickle
+++ b/js/Linear/INTEGRAL_m.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/PID.js b/js/Linear/PID.js
index 80d49e79..a1d4d8cd 100644
--- a/js/Linear/PID.js
+++ b/js/Linear/PID.js
@@ -36,43 +36,44 @@ function PID() {
model.dep_ut = [false,false];
model.rpar = scs_m;
gr_i = [];
- x = standard_define([2,2],model,[],gr_i);
+ this.x = standard_define([2,2],model,[],gr_i);
}
PID.prototype.details = function PID() {
+ return this.x;
}
PID.prototype.get = function PID() {
}
PID.prototype.set = function PID() {
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];
-}
- } 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))) {
-break;
-}
-}
-}
+ 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];
+ }
+ } 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))) {
+ break;
+ }
+ }
+ }
newpar = list();
xx1 = arg1.model.rpar.objs[ppath[1-1]-1];
exprs[1-1] = xx1.graphics.exprs[1-1];
@@ -85,31 +86,31 @@ break;
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;
-break;
-}
-}
+ [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;
+ 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;
-}
- x = arg1;
+ 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;
+ }
+ this.x = arg1;
y = max(y,needcompile);
typ = newpar;
}
diff --git a/js/Linear/PID.pickle b/js/Linear/PID.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/PID.pickle
+++ b/js/Linear/PID.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/REGISTER.js b/js/Linear/REGISTER.js
index f99a4043..cc57e75d 100644
--- a/js/Linear/REGISTER.js
+++ b/js/Linear/REGISTER.js
@@ -12,70 +12,71 @@ function REGISTER() {
model.dep_ut = [false,false];
exprs = strcat(string(z0),";");
gr_i = [];
- x = standard_define([3,2],model,exprs,gr_i);
+ this.x = standard_define([3,2],model,exprs,gr_i);
}
REGISTER.prototype.details = function REGISTER() {
+ return this.x;
}
REGISTER.prototype.get = function REGISTER() {
}
REGISTER.prototype.set = function REGISTER() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
if (size(exprs,1)==1) {
- exprs = [[exprs],[sci2exp(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) {
-break;
-}
- if (prod(size(z0))<1) {
-message("Register length must be at least 1");
- 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 {
-message("Datatype is not supported");
- ok = false;
-}
- 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) {
- graphics.exprs = exprs;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
+ [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) {
+ message("Register length must be at least 1");
+ 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 {
+ message("Datatype is not supported");
+ ok = false;
+ }
+ 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) {
+ graphics.exprs = exprs;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/REGISTER.pickle b/js/Linear/REGISTER.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/REGISTER.pickle
+++ b/js/Linear/REGISTER.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/REGISTER_f.js b/js/Linear/REGISTER_f.js
index 663d839f..f7d1a3f9 100644
--- a/js/Linear/REGISTER_f.js
+++ b/js/Linear/REGISTER_f.js
@@ -12,33 +12,34 @@ function REGISTER_f() {
model.dep_ut = [false,false];
exprs = strcat(string(z0),";");
gr_i = [];
- x = standard_define([2.5,2.5],model,exprs,gr_i);
+ this.x = standard_define([2.5,2.5],model,exprs,gr_i);
}
REGISTER_f.prototype.details = function REGISTER_f() {
+ return this.x;
}
REGISTER_f.prototype.get = function REGISTER_f() {
}
REGISTER_f.prototype.set = function REGISTER_f() {
- x = arg1;
+ this.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) {
-message("Register length must be at least 1");
- ok = false;
-}
- if (ok) {
- graphics.exprs = exprs;
- model.dstate = z0;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
+ [ok,z0,exprs] = scicos_getvalue("Set delay parameters","Register initial condition",list("vec",-1),exprs);
+ if (!ok) {
+ break;
+ }
+ if (prod(size(z0))<1) {
+ message("Register length must be at least 1");
+ ok = false;
+ }
+ if (ok) {
+ graphics.exprs = exprs;
+ model.dstate = z0;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/REGISTER_f.pickle b/js/Linear/REGISTER_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/REGISTER_f.pickle
+++ b/js/Linear/REGISTER_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/SAMPHOLD.js b/js/Linear/SAMPHOLD.js
index 5c9bacf5..1df8635a 100644
--- a/js/Linear/SAMPHOLD.js
+++ b/js/Linear/SAMPHOLD.js
@@ -10,14 +10,15 @@ function SAMPHOLD() {
model.blocktype = "d";
model.dep_ut = [true,false];
gr_i = [];
- x = standard_define([2,2],model," ",gr_i);
+ this.x = standard_define([2,2],model," ",gr_i);
}
SAMPHOLD.prototype.details = function SAMPHOLD() {
+ return this.x;
}
SAMPHOLD.prototype.get = function SAMPHOLD() {
}
SAMPHOLD.prototype.set = function SAMPHOLD() {
- x = arg1;
- x.model.firing = [];
+ this.x = arg1;
+ this.x.model.firing = [];
}
}
diff --git a/js/Linear/SAMPHOLD.pickle b/js/Linear/SAMPHOLD.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/SAMPHOLD.pickle
+++ b/js/Linear/SAMPHOLD.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/SAMPHOLD_m.js b/js/Linear/SAMPHOLD_m.js
index 327372ad..c661ad7e 100644
--- a/js/Linear/SAMPHOLD_m.js
+++ b/js/Linear/SAMPHOLD_m.js
@@ -14,38 +14,39 @@ function SAMPHOLD_m() {
model.dep_ut = [true,false];
label = [sci2exp(1)];
gr_i = [];
- x = standard_define([2,2],model,label,gr_i);
+ this.x = standard_define([2,2],model,label,gr_i);
}
SAMPHOLD_m.prototype.details = function SAMPHOLD_m() {
+ return this.x;
}
SAMPHOLD_m.prototype.get = function SAMPHOLD_m() {
}
SAMPHOLD_m.prototype.set = function SAMPHOLD_m() {
- x = arg1;
- x.model.firing = [];
+ this.x = arg1;
+ this.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))) {
-message("Datatype is not supported");
- 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;
-break;
-}
-}
-}
+ [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))) {
+ message("Datatype is not supported");
+ 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;
+ this.x = arg1;
+ break;
+ }
+ }
+ }
}
}
diff --git a/js/Linear/SAMPHOLD_m.pickle b/js/Linear/SAMPHOLD_m.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/SAMPHOLD_m.pickle
+++ b/js/Linear/SAMPHOLD_m.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/SAMPLEHOLD_f.js b/js/Linear/SAMPLEHOLD_f.js
index c56fe8a5..916f2834 100644
--- a/js/Linear/SAMPLEHOLD_f.js
+++ b/js/Linear/SAMPLEHOLD_f.js
@@ -10,14 +10,15 @@ function SAMPLEHOLD_f() {
model.blocktype = "d";
model.dep_ut = [true,false];
gr_i = [];
- x = standard_define([2,2],model," ",gr_i);
+ this.x = standard_define([2,2],model," ",gr_i);
}
SAMPLEHOLD_f.prototype.details = function SAMPLEHOLD_f() {
+ return this.x;
}
SAMPLEHOLD_f.prototype.get = function SAMPLEHOLD_f() {
}
SAMPLEHOLD_f.prototype.set = function SAMPLEHOLD_f() {
- x = arg1;
- x.model.firing = [];
+ this.x = arg1;
+ this.x.model.firing = [];
}
}
diff --git a/js/Linear/SAMPLEHOLD_f.pickle b/js/Linear/SAMPLEHOLD_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/SAMPLEHOLD_f.pickle
+++ b/js/Linear/SAMPLEHOLD_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/SOM_f.js b/js/Linear/SOM_f.js
index e119ce47..0e4cedcc 100644
--- a/js/Linear/SOM_f.js
+++ b/js/Linear/SOM_f.js
@@ -11,30 +11,31 @@ function SOM_f() {
model.dep_ut = [true,false];
exprs = [[sci2exp(1)],[sci2exp(sgn)]];
gr_i = [];
- x = standard_define([2,2],model,exprs,gr_i);
+ this.x = standard_define([2,2],model,exprs,gr_i);
}
SOM_f.prototype.details = function SOM_f() {
+ return this.x;
}
SOM_f.prototype.get = function SOM_f() {
}
SOM_f.prototype.set = function SOM_f() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
model = arg1.model;
exprs = graphics.exprs;
if (size(exprs,"*")==2) {
- exprs = exprs[2-1];
-}
+ exprs = exprs[2-1];
+ }
if (size(exprs,"*")!=3) {
- exprs = string(model.rpar);
-}
+ exprs = string(model.rpar);
+ }
if (graphics.flip) {
- labs = ["down","left","up"];
+ labs = ["down","left","up"];
} else {
- labs = ["down","right","up"];
-}
+ 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())]];
-message(str);
+ message(str);
}
}
diff --git a/js/Linear/SOM_f.pickle b/js/Linear/SOM_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/SOM_f.pickle
+++ b/js/Linear/SOM_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/SUMMATION.js b/js/Linear/SUMMATION.js
index d5171c25..4b5481ec 100644
--- a/js/Linear/SUMMATION.js
+++ b/js/Linear/SUMMATION.js
@@ -13,125 +13,126 @@ function SUMMATION() {
model.dep_ut = [true,false];
exprs = sci2exp(sgn);
gr_i = [];
- x = standard_define([2,3],model,exprs,gr_i);
+ this.x = standard_define([2,3],model,exprs,gr_i);
}
SUMMATION.prototype.details = function SUMMATION() {
+ return this.x;
}
SUMMATION.prototype.get = function SUMMATION() {
}
SUMMATION.prototype.set = function SUMMATION() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
model = arg1.model;
exprs = graphics.exprs;
if (size(exprs,1)==1) {
- exprs = [[sci2exp(1)],[exprs],[sci2exp(0)]];
+ exprs = [[sci2exp(1)],[exprs],[sci2exp(0)]];
} else if (size(exprs,1)==2) {
- exprs = [[exprs],[sci2exp(0)]];
-}
+ 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) {
-break;
-}
- sgn = sgn.slice();
- if ((satur!=0&&satur!=1&&satur!=2)) {
-message("Do on overflow must be 0,1,2");
- ok = false;
-}
- 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;
-}
- } 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;
-}
-}
- 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);
-}
- } 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);
-}
-}
-}
- 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;
-break;
-}
-}
+ [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)) {
+ message("Do on overflow must be 0,1,2");
+ ok = false;
+ }
+ 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;
+ }
+ } 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;
+ }
+ }
+ 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);
+ }
+ } 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);
+ }
+ }
+ }
+ 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;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/SUMMATION.pickle b/js/Linear/SUMMATION.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/SUMMATION.pickle
+++ b/js/Linear/SUMMATION.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/SUM_f.js b/js/Linear/SUM_f.js
index 024692bd..a9f25a10 100644
--- a/js/Linear/SUM_f.js
+++ b/js/Linear/SUM_f.js
@@ -9,13 +9,14 @@ function SUM_f() {
model.dep_ut = [true,false];
gr_i = [];
exprs = [];
- x = standard_define([1,1],model,exprs,gr_i);
+ this.x = standard_define([1,1],model,exprs,gr_i);
}
SUM_f.prototype.details = function SUM_f() {
+ return this.x;
}
SUM_f.prototype.get = function SUM_f() {
}
SUM_f.prototype.set = function SUM_f() {
- x = arg1;
+ this.x = arg1;
}
}
diff --git a/js/Linear/SUM_f.pickle b/js/Linear/SUM_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/SUM_f.pickle
+++ b/js/Linear/SUM_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/TCLSS.js b/js/Linear/TCLSS.js
index 516eb048..e6a19aa3 100644
--- a/js/Linear/TCLSS.js
+++ b/js/Linear/TCLSS.js
@@ -20,65 +20,66 @@ function TCLSS() {
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);
+ this.x = standard_define([3,2],model,exprs,gr_i);
}
TCLSS.prototype.details = function TCLSS() {
+ return this.x;
}
TCLSS.prototype.get = function TCLSS() {
}
TCLSS.prototype.set = function TCLSS() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
if (size(exprs,"*")==7) {
- exprs = exprs[[1:4,7]-1];
-}
+ 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) {
-break;
-}
- out = size(C,1);
- if (out==0) {
- out = [];
-}
- in1 = size(B,2);
- if (in1==0) {
- in1 = [];
-}
- [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];
-}
- if (or(model.dep_ut!=mmm)) {
- model.dep_ut = mmm;
-}
- } 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);
-}
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
-}
+ [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 = [];
+ }
+ in1 = size(B,2);
+ if (in1==0) {
+ in1 = [];
+ }
+ [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];
+ }
+ if (or(model.dep_ut!=mmm)) {
+ model.dep_ut = mmm;
+ }
+ } 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);
+ }
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ }
}
}
diff --git a/js/Linear/TCLSS.pickle b/js/Linear/TCLSS.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/TCLSS.pickle
+++ b/js/Linear/TCLSS.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/TCLSS_f.js b/js/Linear/TCLSS_f.js
index 9d43d97e..fd5483b1 100644
--- a/js/Linear/TCLSS_f.js
+++ b/js/Linear/TCLSS_f.js
@@ -20,65 +20,66 @@ function TCLSS_f() {
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);
+ this.x = standard_define([3,2],model,exprs,gr_i);
}
TCLSS_f.prototype.details = function TCLSS_f() {
+ return this.x;
}
TCLSS_f.prototype.get = function TCLSS_f() {
}
TCLSS_f.prototype.set = function TCLSS_f() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
if (size(exprs,"*")==7) {
- exprs = exprs[[1:4,7]-1];
-}
+ 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) {
-break;
-}
- out = size(C,1);
- if (out==0) {
- out = [];
-}
- in1 = size(B,2);
- if (in1==0) {
- in1 = [];
-}
- [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];
-}
- if (or(model.dep_ut!=mmm)) {
- model.dep_ut = mmm;
-}
- } 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);
-}
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
-}
+ [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 = [];
+ }
+ in1 = size(B,2);
+ if (in1==0) {
+ in1 = [];
+ }
+ [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];
+ }
+ if (or(model.dep_ut!=mmm)) {
+ model.dep_ut = mmm;
+ }
+ } 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);
+ }
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
+ }
}
}
diff --git a/js/Linear/TCLSS_f.pickle b/js/Linear/TCLSS_f.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/TCLSS_f.pickle
+++ b/js/Linear/TCLSS_f.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/TIME_DELAY.js b/js/Linear/TIME_DELAY.js
index e4d235c6..8834f518 100644
--- a/js/Linear/TIME_DELAY.js
+++ b/js/Linear/TIME_DELAY.js
@@ -15,43 +15,44 @@ function TIME_DELAY() {
model.dep_ut = [false,true];
exprs = [[string(T)],[string(init)],[string(N)]];
gr_i = [];
- x = standard_define([3.5,2],model,exprs,gr_i);
+ this.x = standard_define([3.5,2],model,exprs,gr_i);
}
TIME_DELAY.prototype.details = function TIME_DELAY() {
+ return this.x;
}
TIME_DELAY.prototype.get = function TIME_DELAY() {
}
TIME_DELAY.prototype.set = function TIME_DELAY() {
- x = arg1;
+ this.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) {
-message("Buffer must be larger than 2");
- ok = false;
-}
- if (T<=0) {
-message("Delay must be positive");
- ok = false;
-}
- 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;
-break;
-}
-}
+ [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) {
+ message("Buffer must be larger than 2");
+ ok = false;
+ }
+ if (T<=0) {
+ message("Delay must be positive");
+ ok = false;
+ }
+ 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];
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/TIME_DELAY.pickle b/js/Linear/TIME_DELAY.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/TIME_DELAY.pickle
+++ b/js/Linear/TIME_DELAY.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file
diff --git a/js/Linear/VARIABLE_DELAY.js b/js/Linear/VARIABLE_DELAY.js
index 3a87c5c0..f1607678 100644
--- a/js/Linear/VARIABLE_DELAY.js
+++ b/js/Linear/VARIABLE_DELAY.js
@@ -15,42 +15,43 @@ function VARIABLE_DELAY() {
model.dep_ut = [false,false];
exprs = [[string(T)],[string(init)],[string(N)]];
gr_i = [];
- x = standard_define([3,2],model,exprs,gr_i);
+ this.x = standard_define([3,2],model,exprs,gr_i);
}
VARIABLE_DELAY.prototype.details = function VARIABLE_DELAY() {
+ return this.x;
}
VARIABLE_DELAY.prototype.get = function VARIABLE_DELAY() {
}
VARIABLE_DELAY.prototype.set = function VARIABLE_DELAY() {
- x = arg1;
+ this.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) {
-message("Buffer must be larger than 2");
- ok = false;
-}
- if (T<=0) {
-message("Delay must be positive");
- ok = false;
-}
- 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;
-break;
-}
-}
+ [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) {
+ message("Buffer must be larger than 2");
+ ok = false;
+ }
+ if (T<=0) {
+ message("Delay must be positive");
+ ok = false;
+ }
+ if (ok) {
+ [model,graphics,ok] = check_io(model,graphics,[[-1],[1]],-1,[],[]);
+ }
+ if (ok) {
+ graphics.exprs = exprs;
+ model.rpar = [[T],[init]];
+ model.ipar = N;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}
diff --git a/js/Linear/VARIABLE_DELAY.pickle b/js/Linear/VARIABLE_DELAY.pickle
index 154645d8..0d1dde24 100644
--- a/js/Linear/VARIABLE_DELAY.pickle
+++ b/js/Linear/VARIABLE_DELAY.pickle
@@ -2,6 +2,8 @@ c__builtin__
set
p0
((lp1
-tp2
-Rp3
+S'x'
+p2
+atp3
+Rp4
. \ No newline at end of file