From caec41e11c82db9159d41b3a1a87b7898d17773f Mon Sep 17 00:00:00 2001 From: ASP1234 Date: Sat, 9 Jul 2016 08:35:53 +0000 Subject: Fix Modelica issue --- data_structures_correct/IdealTransformer.js | 120 ++++++++++++++-------------- 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'data_structures_correct/IdealTransformer.js') diff --git a/data_structures_correct/IdealTransformer.js b/data_structures_correct/IdealTransformer.js index 4a8666f..d2a9fa5 100644 --- a/data_structures_correct/IdealTransformer.js +++ b/data_structures_correct/IdealTransformer.js @@ -1,60 +1,60 @@ -function IdealTransformer() { - - IdealTransformer.prototype.define = function IdealTransformer() { - this.ModelName = "IdealTransformer"; - this.PrametersValue = [1]; - this.ParametersName = ["N"]; - - var model = scicos_model(); - - this.Typein = []; - this.Typeout = []; - this.MI = []; - this.MO = []; - this.P = [[2.5,90,2,0],[2.5,10,2,0],[97.5,90,-2,0],[97.5,10,-2,0]]; - this.PortName = [["p1"],["n1"],["p2"],["n2"]]; - - for (var i = 0; i < size(this.P, "r"); i++) { - if (this.P[i][2] == 1) { - this.Typein.push(["E"]); - this.MI.push(this.PortName[i]); - } - - if (this.P[i][2] == 2) { - this.Typein.push(["I"]); - this.MI.push(this.PortName[i]); - } - if (this.P[i][2] == -1) { - this.Typeout.push(["E"]); - this.MO.push(this.PortName[i]); - } - if (this.P[i][2] == -2) { - this.Typeout.push(["I"]); - this.MO.push(this.PortName[i]); - } - } - var mo = modelica(); - model.sim = new ScilabString([this.ModelName]); - mo.inputs = new ScilabString(...this.MI); - mo.outputs = new ScilabString(...this.MO); - model.rpar = new ScilabDouble(this.PrametersValue); - mo.parameters = list(new ScilabString(this.ParametersName), new ScilabDouble(this.PrametersValue), new ScilabDouble(zeros(getData(this.ParametersName)))); - var exprs = new ScilabString(["1"]); - var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"IdealTransformer\",sz(1),sz(2));"]); - model.blocktype = new ScilabString(["c"]); - model.dep_ut = new ScilabBoolean([false, true]); - mo.model = new ScilabString([this.ModelName]); - model.equations = mo; - model.in = new ScilabDouble(...ones(size(this.MI, "*"), 1)); - model.out = new ScilabDouble(...ones(size(this.MO, "*"), 1)); - this.x = new standard_define(new ScilabDouble([2,2]), model, exprs, list(gr_i), new ScilabDouble([0])); - this.x.graphics.in_implicit = new ScilabDouble(this.Typein); - this.x.graphics.out_implicit = new ScilabDouble(this.Typeout); - return new BasicBlock(this.x); - } - - IdealTransformer.prototype.details = function IdealTransformer() { - return this.x; - } - -} +function IdealTransformer() { + + IdealTransformer.prototype.define = function IdealTransformer() { + this.ModelName = "IdealTransformer"; + this.PrametersValue = [1]; + this.ParametersName = ["N"]; + + var model = scicos_model(); + + this.Typein = []; + this.Typeout = []; + this.MI = []; + this.MO = []; + this.P = [[2.5,90,2,0],[2.5,10,2,0],[97.5,90,-2,0],[97.5,10,-2,0]]; + this.PortName = [["p1"],["n1"],["p2"],["n2"]]; + + for (var i = 0; i < size(this.P, "r"); i++) { + if (this.P[i][2] == 1) { + this.Typein.push(["E"]); + this.MI.push(this.PortName[i]); + } + + if (this.P[i][2] == 2) { + this.Typein.push(["I"]); + this.MI.push(this.PortName[i]); + } + if (this.P[i][2] == -1) { + this.Typeout.push(["E"]); + this.MO.push(this.PortName[i]); + } + if (this.P[i][2] == -2) { + this.Typeout.push(["I"]); + this.MO.push(this.PortName[i]); + } + } + var mo = new modelica_function(); + model.sim = new ScilabString([this.ModelName]); + mo.inputs = new ScilabString(...this.MI); + mo.outputs = new ScilabString(...this.MO); + model.rpar = new ScilabDouble(this.PrametersValue); + mo.parameters = list(new ScilabString(this.ParametersName), new ScilabDouble(this.PrametersValue), new ScilabDouble(zeros(getData(this.ParametersName)))); + var exprs = new ScilabString(["1"]); + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"IdealTransformer\",sz(1),sz(2));"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([false, true]); + mo.model = new ScilabString([this.ModelName]); + model.equations = mo; + model.in = new ScilabDouble(...ones(size(this.MI, "*"), 1)); + model.out = new ScilabDouble(...ones(size(this.MO, "*"), 1)); + this.x = new standard_define(new ScilabDouble([2,2]), model, exprs, list(gr_i), new ScilabDouble([0])); + this.x.graphics.in_implicit = new ScilabDouble(this.Typein); + this.x.graphics.out_implicit = new ScilabDouble(this.Typeout); + return new BasicBlock(this.x); + } + + IdealTransformer.prototype.details = function IdealTransformer() { + return this.x; + } + +} -- cgit