diff options
Diffstat (limited to 'js/Linear/VARIABLE_DELAY.js')
-rw-r--r-- | js/Linear/VARIABLE_DELAY.js | 53 |
1 files changed, 27 insertions, 26 deletions
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; + } + } } } |