diff options
author | Adhitya Kamakshidasan | 2016-07-09 14:24:27 +0530 |
---|---|---|
committer | GitHub | 2016-07-09 14:24:27 +0530 |
commit | 6edd05efe3a83ce2f59bc1378c700e1099dac7ac (patch) | |
tree | f0d2593b35c303dfaa6c60ddb44653a7323e57e8 /data_structures_correct/Flowmeter.js | |
parent | d462636acfbd2ae45d0457719108f280bf4b5d48 (diff) | |
parent | 91e04a82a600a163738621f4698d910080cace5f (diff) | |
download | xcos-on-web-6edd05efe3a83ce2f59bc1378c700e1099dac7ac.tar.gz xcos-on-web-6edd05efe3a83ce2f59bc1378c700e1099dac7ac.tar.bz2 xcos-on-web-6edd05efe3a83ce2f59bc1378c700e1099dac7ac.zip |
Merge pull request #155 from ASP1234/master
Fix Modelica Issue
Diffstat (limited to 'data_structures_correct/Flowmeter.js')
-rw-r--r-- | data_structures_correct/Flowmeter.js | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/data_structures_correct/Flowmeter.js b/data_structures_correct/Flowmeter.js index 4e5b7c9..a10f96b 100644 --- a/data_structures_correct/Flowmeter.js +++ b/data_structures_correct/Flowmeter.js @@ -1,61 +1,61 @@ -function Flowmeter() { - - Flowmeter.prototype.define = function Flowmeter() { - this.ModelName = "Flowmeter"; - this.PrametersValue = 1; - this.ParametersName = "Qini"; - - var model = scicos_model(); - - this.Typein = []; - this.Typeout = []; - - this.MI = []; - this.MO = []; - this.P = [[50,105,-1,90],[0,10,2,0],[101,10,-2,0]]; - this.PortName = [["Mesure"],["C1"],["C2"]]; - - 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([this.ParametersName]))); - var exprs = new ScilabString(["1"]); - var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"Flowmeter\",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(new ScilabString([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); - } - - Flowmeter.prototype.details = function Flowmeter() { - return this.x; - } -} +function Flowmeter() {
+
+ Flowmeter.prototype.define = function Flowmeter() {
+ this.ModelName = "Flowmeter";
+ this.PrametersValue = 1;
+ this.ParametersName = "Qini";
+
+ var model = scicos_model();
+
+ this.Typein = [];
+ this.Typeout = [];
+
+ this.MI = [];
+ this.MO = [];
+ this.P = [[50,105,-1,90],[0,10,2,0],[101,10,-2,0]];
+ this.PortName = [["Mesure"],["C1"],["C2"]];
+
+ 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([this.ParametersName])));
+ var exprs = new ScilabString(["1"]);
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"Flowmeter\",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(new ScilabString([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);
+ }
+
+ Flowmeter.prototype.details = function Flowmeter() {
+ return this.x;
+ }
+}
|