summaryrefslogtreecommitdiff
path: root/js/NonLinear
diff options
context:
space:
mode:
authorSunil Shetye2018-07-18 15:33:44 +0530
committerSunil Shetye2018-07-18 17:07:40 +0530
commit4d1e8bb193a7315a8fcfe1e09c33befdee660b7d (patch)
tree360c93b86402e468a69d22fe3187d0809b095587 /js/NonLinear
parentbfa780421678e897b17680f3e7c5db72d8ea8375 (diff)
downloadsci2js-4d1e8bb193a7315a8fcfe1e09c33befdee660b7d.tar.gz
sci2js-4d1e8bb193a7315a8fcfe1e09c33befdee660b7d.tar.bz2
sci2js-4d1e8bb193a7315a8fcfe1e09c33befdee660b7d.zip
add throw after message()
Diffstat (limited to 'js/NonLinear')
-rw-r--r--js/NonLinear/DLRADAPT_f.js2
-rw-r--r--js/NonLinear/EXPBLK_f.js1
-rw-r--r--js/NonLinear/EXPBLK_m.js1
-rw-r--r--js/NonLinear/INTRP2BLK_f.js2
-rw-r--r--js/NonLinear/INTRPLBLK_f.js2
-rw-r--r--js/NonLinear/LOGBLK_f.js1
-rw-r--r--js/NonLinear/LOOKUP_f.js1
-rw-r--r--js/NonLinear/MAXMIN.js1
-rw-r--r--js/NonLinear/PRODUCT.js2
-rw-r--r--js/NonLinear/QUANT_f.js1
-rw-r--r--js/NonLinear/SATURATION.js1
-rw-r--r--js/NonLinear/SAT_f.js2
-rw-r--r--js/NonLinear/TrigFun.js1
13 files changed, 18 insertions, 0 deletions
diff --git a/js/NonLinear/DLRADAPT_f.js b/js/NonLinear/DLRADAPT_f.js
index 34801a96..8b7d6542 100644
--- a/js/NonLinear/DLRADAPT_f.js
+++ b/js/NonLinear/DLRADAPT_f.js
@@ -56,8 +56,10 @@ function DLRADAPT_f() {
var n = tmpvar0[1];
if (m>=n) {
message("Transfer must be strictly proper");
+ throw "user error";
} else if (size(this.rn,1)!=0&&size(this.rn,1)!=size(this.p,"*")) {
message("Numerator roots matrix row size\'s is incorrect");
+ throw "user error";
} else {
var rpar = [[this.p.slice()],[real(this.rn.slice())],[imag(this.rn.slice())],[real(this.rd.slice())],[imag(this.rd.slice())],[this.g.slice()]];
var ipar = [[m],[n],[npt]];
diff --git a/js/NonLinear/EXPBLK_f.js b/js/NonLinear/EXPBLK_f.js
index 1291451c..2b4cc440 100644
--- a/js/NonLinear/EXPBLK_f.js
+++ b/js/NonLinear/EXPBLK_f.js
@@ -34,6 +34,7 @@ function EXPBLK_f() {
}
if (or(this.a<=0)) {
message("a^u : a must be positive");
+ throw "user error";
} else {
this.graphics.exprs = new ScilabDouble([this.exprs]);
this.model.rpar = new ScilabDouble([this.a]);
diff --git a/js/NonLinear/EXPBLK_m.js b/js/NonLinear/EXPBLK_m.js
index 9db00e2c..3aa7f33e 100644
--- a/js/NonLinear/EXPBLK_m.js
+++ b/js/NonLinear/EXPBLK_m.js
@@ -38,6 +38,7 @@ function EXPBLK_m() {
}
if (or(this.a<=0)) {
message("a^u : a must be positive");
+ throw "user error";
} else {
this.graphics.exprs = new ScilabDouble([this.exprs]);
this.model.rpar = new ScilabDouble([this.a]);
diff --git a/js/NonLinear/INTRP2BLK_f.js b/js/NonLinear/INTRP2BLK_f.js
index 54bcb917..c192893c 100644
--- a/js/NonLinear/INTRP2BLK_f.js
+++ b/js/NonLinear/INTRP2BLK_f.js
@@ -40,8 +40,10 @@ function INTRP2BLK_f() {
}
if (size(this.a,"*")!=size(this.c,"c")||size(this.b,"*")!=size(this.c,"r")) {
message("incompatible dimension");
+ throw "user error";
} else if (min(this.a.slice(2-1,$)-this.a.slice(1-1,$-1))<=0||min(this.b.slice(2-1,$)-this.b.slice(1-1,$-1))<=0) {
message("X and Y must be strictly increasing");
+ throw "user error";
} else {
if (ok) {
this.graphics.exprs = new ScilabDouble([this.exprs]);
diff --git a/js/NonLinear/INTRPLBLK_f.js b/js/NonLinear/INTRPLBLK_f.js
index a1b9cb1d..287f2933 100644
--- a/js/NonLinear/INTRPLBLK_f.js
+++ b/js/NonLinear/INTRPLBLK_f.js
@@ -36,8 +36,10 @@ function INTRPLBLK_f() {
}
if (size(this.a,"*")!=size(this.b,"*")) {
message("X and Y must have the same size");
+ throw "user error";
} else if (min(this.a.slice(2-1,$)-this.a.slice(1-1,$-1))<=0) {
message("X must be strictly increasing");
+ throw "user error";
} else {
if (ok) {
this.graphics.exprs = new ScilabDouble([this.exprs]);
diff --git a/js/NonLinear/LOGBLK_f.js b/js/NonLinear/LOGBLK_f.js
index 28dfa9e8..59ee4067 100644
--- a/js/NonLinear/LOGBLK_f.js
+++ b/js/NonLinear/LOGBLK_f.js
@@ -34,6 +34,7 @@ function LOGBLK_f() {
}
if (this.a<=1) {
message("Basis must be larger than 1");
+ throw "user error";
} else {
if (ok) {
this.graphics.exprs = new ScilabDouble([this.exprs]);
diff --git a/js/NonLinear/LOOKUP_f.js b/js/NonLinear/LOOKUP_f.js
index 9a22b665..635a1fce 100644
--- a/js/NonLinear/LOOKUP_f.js
+++ b/js/NonLinear/LOOKUP_f.js
@@ -41,6 +41,7 @@ function LOOKUP_f() {
var n = size(xx,"*");
if (or(xx.slice(2-1,n)-xx.slice(1-1,n-1)<=0)) {
message("You have not defined a function");
+ throw "user error";
var ok = false;
}
if (ok) {
diff --git a/js/NonLinear/MAXMIN.js b/js/NonLinear/MAXMIN.js
index 04c7abab..7de281da 100644
--- a/js/NonLinear/MAXMIN.js
+++ b/js/NonLinear/MAXMIN.js
@@ -43,6 +43,7 @@ function MAXMIN() {
}
if (this.nin!=1&&this.nin!=2) {
message("Wrong number of inputs, only 1 and 2 allowed");
+ throw "user error";
var ok = false;
}
if (ok) {
diff --git a/js/NonLinear/PRODUCT.js b/js/NonLinear/PRODUCT.js
index 77f9b79e..a4db3880 100644
--- a/js/NonLinear/PRODUCT.js
+++ b/js/NonLinear/PRODUCT.js
@@ -32,6 +32,7 @@ function PRODUCT() {
if (size(this.sgn,1)==1) {
if (this.sgn<1) {
message("Number of inputs must be > 0");
+ throw "user error";
var ok = false;
} else if (this.sgn==1) {
var in1 = -1;
@@ -45,6 +46,7 @@ function PRODUCT() {
} else {
if (!and(abs(this.sgn)==1)) {
message("Signs can only be +1 or -1");
+ throw "user error";
var ok = false;
} else {
var in1 = -ones(size(this.sgn,1),1);
diff --git a/js/NonLinear/QUANT_f.js b/js/NonLinear/QUANT_f.js
index 80d91d0a..e619bf1c 100644
--- a/js/NonLinear/QUANT_f.js
+++ b/js/NonLinear/QUANT_f.js
@@ -37,6 +37,7 @@ function QUANT_f() {
}
if (this.meth<1||this.meth>4) {
message("Quantization Type must be from 1 to 4");
+ throw "user error";
} else {
var rpar = this.pas;
this.model.rpar = new ScilabDouble([rpar]);
diff --git a/js/NonLinear/SATURATION.js b/js/NonLinear/SATURATION.js
index 4f01ed4d..172e3235 100644
--- a/js/NonLinear/SATURATION.js
+++ b/js/NonLinear/SATURATION.js
@@ -41,6 +41,7 @@ function SATURATION() {
}
if (this.maxp<=this.minp) {
message("Upper limit must be > Lower limit");
+ throw "user error";
} else {
var rpar = [[this.maxp],[this.minp]];
this.model.rpar = new ScilabDouble(rpar);
diff --git a/js/NonLinear/SAT_f.js b/js/NonLinear/SAT_f.js
index 6de131a1..40e3cf08 100644
--- a/js/NonLinear/SAT_f.js
+++ b/js/NonLinear/SAT_f.js
@@ -41,8 +41,10 @@ function SAT_f() {
}
if (this.maxp<=0) {
message("Max must be strictly positive");
+ throw "user error";
} else if (this.pente<=0) {
message("Slope must be strictly positive");
+ throw "user error";
} else {
var rpar = [[this.minp/this.pente],[this.maxp/this.pente],[this.pente]];
this.model.rpar = new ScilabDouble(rpar);
diff --git a/js/NonLinear/TrigFun.js b/js/NonLinear/TrigFun.js
index ce183d81..97b73bf3 100644
--- a/js/NonLinear/TrigFun.js
+++ b/js/NonLinear/TrigFun.js
@@ -30,6 +30,7 @@ function TrigFun() {
}
if (find(PREVAR_FF==this.fun)==[]) {
message("Sorry but "+this.fun+" is not in the list!");
+ throw "user error";
} else {
this.graphics.exprs = new ScilabDouble([this.exprs]);
execstr("model.sim=list(\'"+this.fun+"_blk\',4)");