diff options
author | Adhitya Kamakshidasan | 2016-07-12 15:28:26 +0530 |
---|---|---|
committer | GitHub | 2016-07-12 15:28:26 +0530 |
commit | a0a37b2eb0f8912f5f62166c57b760d35d5760f0 (patch) | |
tree | 0176cf3f058a23b6ffc075dd71b35fe4e8c85c9b /data_structures_correct | |
parent | 3e26a30a0319cadf4e76685911007be1f4e17998 (diff) | |
parent | 4e2adfaa2c68899b72f70d3cb82d9960a647644a (diff) | |
download | xcos-on-web-a0a37b2eb0f8912f5f62166c57b760d35d5760f0.tar.gz xcos-on-web-a0a37b2eb0f8912f5f62166c57b760d35d5760f0.tar.bz2 xcos-on-web-a0a37b2eb0f8912f5f62166c57b760d35d5760f0.zip |
Merge pull request #169 from avi-psvm-dutta/master
Implement ZCROSS_f Block
Diffstat (limited to 'data_structures_correct')
-rw-r--r-- | data_structures_correct/VVsourceAC.js | 39 | ||||
-rw-r--r-- | data_structures_correct/VsourceAC.js | 37 | ||||
-rw-r--r-- | data_structures_correct/ZCROSS_f.js | 29 |
3 files changed, 105 insertions, 0 deletions
diff --git a/data_structures_correct/VVsourceAC.js b/data_structures_correct/VVsourceAC.js new file mode 100644 index 0000000..120b3bb --- /dev/null +++ b/data_structures_correct/VVsourceAC.js @@ -0,0 +1,39 @@ +function VVsourceAC() { + + VVsourceAC.prototype.define = function VVsourceAC() { + var model = scicos_model(); + + model.in = new ScilabDouble([1], [1]); + model.out = new ScilabDouble([1]); + + this.VA = 220; + this.FR = 50; + + model.rpar = new ScilabDouble([this.FR]); + model.sim = new ScilabString(["VVsourceAC"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var mo = modelica_function(); + mo.model = new ScilabString(["VVsourceAC"]); + mo.inputs = new ScilabString(["p", "VA"]); + mo.outputs = new ScilabString(["n"]); + mo.parameters = list(new ScilabString(["f"]), list(new ScilabDouble([this.FR]))); + model.equations = mo; + + var exprs = new ScilabString([this.FR]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VVsourceAC\",sz(1),sz(2));"]); + + + this.x = standard_define([2, 2], model, exprs, list(gr_i, 0)); + this.x.graphics.in_implicit = new ScilabString(["I", "E"]); + this.x.graphics.out_implicit = new ScilabString(["I"]); + + return new BasicBlock(this.x); + } + + VVsourceAC.prototype.details = function VVsourceAC() { + return this.x; + } +} diff --git a/data_structures_correct/VsourceAC.js b/data_structures_correct/VsourceAC.js new file mode 100644 index 0000000..59cc3b4 --- /dev/null +++ b/data_structures_correct/VsourceAC.js @@ -0,0 +1,37 @@ +function VsourceAC() { + + VsourceAC.prototype.define = function VsourceAC() { + var model = scicos_model(); + model.in = new ScilabDouble([1]); + model.out = new ScilabDouble([1]); + + this.VA = 220; + + this.FR = 50; + model.rpar = new ScilabDouble([this.VA], [this.FR]); + model.sim = new ScilabString(["VsourceAC"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var mo = modelica_function(); + mo.model = new ScilabString(["VsourceAC"]); + mo.inputs = new ScilabString(["p"]); + mo.outputs = new ScilabString(["n"]); + mo.parameters = list(new ScilabString(["VA"], ["f"]), list(new ScilabDouble([this.VA]), new ScilabDouble([this.FR]))); + model.equations = mo; + + var exprs = new ScilabString([this.VA], [this.FR]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VsourceAC\",sz(1),sz(2));"]); + + this.x = standard_define([2, 2], model, exprs, list(gr_i, 0)); + this.x.graphics.in_implicit = new ScilabString(["I"]); + this.x.graphics.out_implicit = new ScilabString(["I"]); + + return new BasicBlock(this.x); + } + + VsourceAC.prototype.details = function VsourceAC() { + return this.x; + } +} diff --git a/data_structures_correct/ZCROSS_f.js b/data_structures_correct/ZCROSS_f.js new file mode 100644 index 0000000..8d2e66a --- /dev/null +++ b/data_structures_correct/ZCROSS_f.js @@ -0,0 +1,29 @@ +function ZCROSS_f() { + + ZCROSS_f.prototype.define = function ZCROSS_f() { + this.rpar = [[-1], [-1], [0], [0]]; + + this.in = 1; + + var model = scicos_model(); + model.sim = list(new ScilabString(["zcross"]), new ScilabDouble([1])); + model.in = new ScilabDouble([this.in]); + model.nzcross = new ScilabDouble([this.in]); + model.evtout = new ScilabDouble([1]); + model.rpar = new ScilabDouble([-1], [-1], [0], [0]); + model.blocktype = new ScilabString(["z"]); + model.firing = new ScilabDouble([-1]); + model.dep_ut = new ScilabBoolean([true, false]); + + var exprs = new ScilabString([sci2exp(this.in)]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"ZCROSS_f\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i); + + return new BasicBlock(this.x); + } + + ZCROSS_f.prototype.details = function ZCROSS_f() { + return this.x; + } +} |