diff options
author | ASP1234 | 2016-06-23 11:36:40 +0000 |
---|---|---|
committer | ASP1234 | 2016-06-23 11:36:40 +0000 |
commit | 9abb694b2a82d14643dc695b321f63d8b6f1112e (patch) | |
tree | 13261e4933cb7b78abef20a854f76a26a11a3266 /data_structures_correct | |
parent | d8b0cfac9a71a9c2628c84505cf0f962f3c08f36 (diff) | |
download | xcos-on-web-9abb694b2a82d14643dc695b321f63d8b6f1112e.tar.gz xcos-on-web-9abb694b2a82d14643dc695b321f63d8b6f1112e.tar.bz2 xcos-on-web-9abb694b2a82d14643dc695b321f63d8b6f1112e.zip |
Implement Capacitor Block
Diffstat (limited to 'data_structures_correct')
-rw-r--r-- | data_structures_correct/Capacitor.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/data_structures_correct/Capacitor.js b/data_structures_correct/Capacitor.js new file mode 100644 index 0000000..1924ddd --- /dev/null +++ b/data_structures_correct/Capacitor.js @@ -0,0 +1,31 @@ +function Capacitor() { + + Capacitor.prototype.define = function Capacitor() { + + var model = scicos_model(); + var C = 0.01,v = 0; + model.rpar = new ScilabDouble([C], [v]); + model.sim = new ScilabString(["Capacitor"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var mo = modelica(); + mo.model = new ScilabString(["Capacitor"]); + mo.inputs = new ScilabString(["p"]); + mo.outputs = new ScilabString(["n"]); + mo.parameters = list(new ScilabString(["C", "v"]), list(new ScilabDouble([C]), new ScilabDouble([v])), new ScilabDouble([0, 1])); + model.equations = mo; + model.in = new ScilabDouble(...ones(size(getData(mo.inputs), "*"), 1)); + model.out = new ScilabDouble(...ones(size(getData(mo.outputs), "*"), 1)); + + var exprs = new ScilabString([C], [v]); + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"Capacitor\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([2, 1.1]), model, exprs, list(gr_i, new ScilabDouble([0]))); + this.x.graphics.in_implicit = new ScilabString(["I"]); + this.x.graphics.out_implicit = new ScilabString(["I"]); + return new BasicBlock(this.x); + } + Capacitor.prototype.details = function Capacitor() { + return this.x; + } +}
\ No newline at end of file |