diff options
Diffstat (limited to 'js/Hydraulics/Flowmeter.js')
-rw-r--r-- | js/Hydraulics/Flowmeter.js | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/js/Hydraulics/Flowmeter.js b/js/Hydraulics/Flowmeter.js index 6856b2fb..d236c8a7 100644 --- a/js/Hydraulics/Flowmeter.js +++ b/js/Hydraulics/Flowmeter.js @@ -11,24 +11,24 @@ function Flowmeter() { MO = []; P = [[50,105,-1,90],[0,10,2,0],[101,10,-2,0]]; PortName = [["Mesure"],["C1"],["C2"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,29 +44,30 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } Flowmeter.prototype.details = function Flowmeter() { + return this.x; } Flowmeter.prototype.get = function Flowmeter() { } Flowmeter.prototype.set = function Flowmeter() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; - exprs = x.graphics.exprs; + this.x = arg1; + exprs = this.x.graphics.exprs; while (false) { - [ok,Qini,exprs] = scicos_getvalue([["Set Flowmeter block parameters:"],[""],["Qini: "]],"Qini",list("vec",1),exprs); - if (!ok) { -break; -} - x.model.equations.parameters[2-1] = list(Qini); - x.graphics.exprs = exprs; -break; -} + [ok,Qini,exprs] = scicos_getvalue([["Set Flowmeter block parameters:"],[""],["Qini: "]],"Qini",list("vec",1),exprs); + if (!ok) { + break; + } + this.x.model.equations.parameters[2-1] = list(Qini); + this.x.graphics.exprs = exprs; + break; + } } } |