diff options
Diffstat (limited to 'js/Events/freq_div.js')
-rw-r--r-- | js/Events/freq_div.js | 143 |
1 files changed, 72 insertions, 71 deletions
diff --git a/js/Events/freq_div.js b/js/Events/freq_div.js index 8569364c..d3a993b4 100644 --- a/js/Events/freq_div.js +++ b/js/Events/freq_div.js @@ -96,28 +96,29 @@ function freq_div() { lnk.from = [5,2,0]; lnk.to = [1,1,1]; scs_m_1.objs[10-1] = lnk; -blk={}; -lnk={}; + blk={}; + lnk={}; model = scicos_model(); model.sim = "csuper"; model.evtin = 1; model.evtout = 1; model.rpar = scs_m_1; gr_i = []; - x = standard_define([3,2],model,[],gr_i); + this.x = standard_define([3,2],model,[],gr_i); } freq_div.prototype.details = function freq_div() { + return this.x; } freq_div.prototype.get = function freq_div() { } freq_div.prototype.set = function freq_div() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="Modulo_Count") { - path = i; -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="Modulo_Count") { + path = i; + break; + } + } newpar = list(); y = 0; spath = list(); @@ -131,68 +132,68 @@ break; exprs = graphics.exprs; model = xx.model; while (true) { - [ok,%ph,%df,exprs] = scicos_getvalue("Set frequency division block parameters",[["Phase (0 to division factor -1)"],["Division factor"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (ok) { - if (%df<1) { - %df = 1; -} - %ph = abs(%ph); - if (%ph>%df-1) { - %ph = %df-1; -} - graphics.exprs = exprs; - model.ipar = %df; - model.dstate = %ph; - xxn.graphics = graphics; - xxn.model = model; -break; -} -} + [ok,%ph,%df,exprs] = scicos_getvalue("Set frequency division block parameters",[["Phase (0 to division factor -1)"],["Division factor"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (ok) { + if (%df<1) { + %df = 1; + } + %ph = abs(%ph); + if (%ph>%df-1) { + %ph = %df-1; + } + graphics.exprs = exprs; + model.ipar = %df; + model.dstate = %ph; + xxn.graphics = graphics; + xxn.model = model; + break; + } + } if (diffobjs(xxn,xx)) { - model = xx.model; - model_n = xxn.model; - if (!is_modelica_block(xx)) { - modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.label,model_n.label); - if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)) { - needcompile = 1; -} - if (or(model.firing!=model_n.firing)) { - needcompile = 2; -} - if (model.sim=="input"||model.sim=="output") { - if (model.ipar!=model_n.ipar) { - needcompile = 4; -} -} - if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { - needcompile = 4; -} - if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { - needcompile = 4; -} - if (prod(size(model_n.sim))>1) { - if (model_n.sim[2-1]>1000) { - if (model.sim[1-1]!=model_n.sim[1-1]) { - needcompile = 4; -} -} -} - } else { - modified = or(model_n!=model); - eq = model.equations; - eqn = model_n.equations; - if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { - needcompile = 4; -} -} - arg1[spath-1] = xxn; - newpar[size(newpar)+1-1] = 1; - y = max(y,needcompile); -} - x = arg1; + model = xx.model; + model_n = xxn.model; + if (!is_modelica_block(xx)) { + modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.label,model_n.label); + if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)) { + needcompile = 1; + } + if (or(model.firing!=model_n.firing)) { + needcompile = 2; + } + if (model.sim=="input"||model.sim=="output") { + if (model.ipar!=model_n.ipar) { + needcompile = 4; + } + } + if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { + needcompile = 4; + } + if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; + } + if (prod(size(model_n.sim))>1) { + if (model_n.sim[2-1]>1000) { + if (model.sim[1-1]!=model_n.sim[1-1]) { + needcompile = 4; + } + } + } + } else { + modified = or(model_n!=model); + eq = model.equations; + eqn = model_n.equations; + if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { + needcompile = 4; + } + } + arg1[spath-1] = xxn; + newpar[size(newpar)+1-1] = 1; + y = max(y,needcompile); + } + this.x = arg1; typ = newpar; } } |