diff options
author | Sunil Shetye | 2018-06-26 14:59:47 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-06-26 14:59:47 +0530 |
commit | eb7c8e0cd42d4afe02be3adda2e94b6b0dfdaa00 (patch) | |
tree | 6378935263fe5cafd389b6893ac3b37a1dd4b1a7 /js/Misc/CONSTRAINT2_c.js | |
parent | afed64f1a0eab0b2d742088186d7bc340a2c895b (diff) | |
download | sci2js-eb7c8e0cd42d4afe02be3adda2e94b6b0dfdaa00.tar.gz sci2js-eb7c8e0cd42d4afe02be3adda2e94b6b0dfdaa00.tar.bz2 sci2js-eb7c8e0cd42d4afe02be3adda2e94b6b0dfdaa00.zip |
add return value from scicos_getvalue to global vars
Diffstat (limited to 'js/Misc/CONSTRAINT2_c.js')
-rw-r--r-- | js/Misc/CONSTRAINT2_c.js | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/js/Misc/CONSTRAINT2_c.js b/js/Misc/CONSTRAINT2_c.js index bf52312c..b1491fc7 100644 --- a/js/Misc/CONSTRAINT2_c.js +++ b/js/Misc/CONSTRAINT2_c.js @@ -1,18 +1,18 @@ /* autogenerated from "macros/Misc/CONSTRAINT2_c.sci" */ function CONSTRAINT2_c() { CONSTRAINT2_c.prototype.define = function CONSTRAINT2_c() { - x0 = [0]; - xd0 = [0]; - id = [0]; + this.x0 = [0]; + this.xd0 = [0]; + this.id = [0]; model = scicos_model(); model.sim = list("constraint_c",10004); model.in1 = 1; model.out = [[1],[1]]; - model.state = [[x0],[xd0]]; - model.ipar = id; + model.state = [[this.x0],[this.xd0]]; + model.ipar = this.id; model.blocktype = "c"; model.dep_ut = [false,true]; - exprs = list(strcat(sci2exp(x0)),strcat(sci2exp(xd0)),strcat(sci2exp(id))); + exprs = list(strcat(sci2exp(this.x0)),strcat(sci2exp(this.xd0)),strcat(sci2exp(this.id))); gr_i = []; this.x = standard_define([3,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -29,16 +29,16 @@ function CONSTRAINT2_c() { model = arg1.model; while (true) { ask_again = false; - [ok,x0,xd0,id,exprs] = scicos_getvalue("Set Constraint block parameters",[["Initial guess values of states x"],["Initial guess values of derivative x\'"],["Id(i)=1: if x\'(i) is present in the feedback, else Id(i)=0"]],list("vec",-1,"vec",-1,"vec",-1),exprs); + [ok,this.x0,this.xd0,this.id,exprs] = scicos_getvalue("Set Constraint block parameters",[["Initial guess values of states x"],["Initial guess values of derivative x\'"],["Id(i)=1: if x\'(i) is present in the feedback, else Id(i)=0"]],list("vec",-1,"vec",-1,"vec",-1),exprs); if (!ok) { break; } - x0 = x0.slice(); - N = size(x0,"*"); - xd0 = xd0.slice(); - Nxd = size(xd0,"*"); - id = id.slice(); - Nid = size(id,"*"); + this.x0 = this.x0.slice(); + N = size(this.x0,"*"); + this.xd0 = this.xd0.slice(); + Nxd = size(this.xd0,"*"); + this.id = this.id.slice(); + Nid = size(this.id,"*"); if ((N!=Nxd)||(N!=Nid)) { message("incompatible sizes, states, their derivatives, and ID should be the same size "); ask_again = true; @@ -49,22 +49,22 @@ function CONSTRAINT2_c() { } if ((!ask_again)) { for (i=1;i<=N;i+=1) { - if (!((id[i-1]==0)||(id[i-1]==1))) { + if (!((this.id[i-1]==0)||(this.id[i-1]==1))) { ask_again = true; x_message([["Id(i) must be either"],["0 when x\'(i) is not present in the feedback"],["1: when x\'(i) is present in the feedback"]]); break; } - if ((id[i-1]==0)) { - id[i-1] = -1; + if ((this.id[i-1]==0)) { + this.id[i-1] = -1; } } } if (!ask_again) { graphics.exprs = exprs; - model.state = [[x0],[xd0]]; + model.state = [[this.x0],[this.xd0]]; model.out = [[N],[N]]; model.in1 = N; - model.ipar = id; + model.ipar = this.id; this.x.graphics = graphics; this.x.model = model; break; |