From ecbed44c4c128c738c9d3026434239bc2924c6d1 Mon Sep 17 00:00:00 2001 From: Chhavi Date: Tue, 5 Jul 2016 07:50:43 +0000 Subject: PRODUCT --- data_structures_correct/PRODUCT.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 data_structures_correct/PRODUCT.js (limited to 'data_structures_correct') diff --git a/data_structures_correct/PRODUCT.js b/data_structures_correct/PRODUCT.js new file mode 100644 index 0000000..0e9e6c8 --- /dev/null +++ b/data_structures_correct/PRODUCT.js @@ -0,0 +1,23 @@ +function PRODUCT() { + + PRODUCT.prototype.define = function PRODUCT() { + this.sgn = [[1],[-1]]; + + var model = scicos_model(); + model.sim = list(new ScilabString(["product"]), new ScilabDouble([4])); + model.in = new ScilabDouble([-1], [-1]); + model.out = new ScilabDouble([-1]); + model.ipar = new ScilabDouble(...this.sgn); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var exprs = new ScilabString([sci2exp(this.sgn)]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),"PRODUCT",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([2, 3]), model, exprs, gr_i); + return new Product(this.x); + } + PRODUCT.prototype.details = function PRODUCT() { + return this.x; + } +} -- cgit From 5985b05da9feec5dec76a5b144ebb41a5d1c9f1c Mon Sep 17 00:00:00 2001 From: Chhavi Date: Tue, 5 Jul 2016 09:16:47 +0000 Subject: INIMPL_f --- data_structures_correct/INIMPL_f.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 data_structures_correct/INIMPL_f.js (limited to 'data_structures_correct') diff --git a/data_structures_correct/INIMPL_f.js b/data_structures_correct/INIMPL_f.js new file mode 100644 index 0000000..4b35d43 --- /dev/null +++ b/data_structures_correct/INIMPL_f.js @@ -0,0 +1,28 @@ +function INIMPL_f() { + + INIMPL_f.prototype.define = function INIMPL_f() { + var model = scicos_model(); + model.sim = new ScilabString(["inimpl"]); + model.out = new ScilabDouble([-1]); + model.out2 = new ScilabDouble([1]); + model.ipar = new ScilabDouble([1]); + model.dep_ut = new ScilabBoolean([false, false]); + model.blocktype = new ScilabString(["c"]); + + var mo = modelica(); + mo.model = new ScilabString(["PORT"]); + mo.outputs = new ScilabString(["n"]); + mo.inputs = new ScilabDouble(); + model.equations = mo; + + var exprs = new ScilabString(["1"]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),"INIMPL_f",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([1, 1]), model, exprs, gr_i); + this.x.graphics.out_implicit = new ScilabString(["I"]); + return new ImplicitInBlock(this.x); + } + INIMPL_f.prototype.details = function INIMPL_f() { + return this.x; + } +} -- cgit From af07e1a58bf0ed958196a470d596d4539d6c1660 Mon Sep 17 00:00:00 2001 From: Chhavi Date: Tue, 5 Jul 2016 09:17:40 +0000 Subject: OUTIMPL_f --- data_structures_correct/OUTIMPL_f.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 data_structures_correct/OUTIMPL_f.js (limited to 'data_structures_correct') diff --git a/data_structures_correct/OUTIMPL_f.js b/data_structures_correct/OUTIMPL_f.js new file mode 100644 index 0000000..c5846e7 --- /dev/null +++ b/data_structures_correct/OUTIMPL_f.js @@ -0,0 +1,30 @@ +function OUTIMPL_f() { + + OUTIMPL_f.prototype.define = function OUTIMPL_f() { + var model = scicos_model(); + model.in = new ScilabDouble([-1]); + model.in2 = new ScilabDouble([1]); + + this.prt = 1; + model.sim = new ScilabString(["outimpl"]); + model.ipar = new ScilabDouble([1]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([false, false]); + + var mo = modelica(); + mo.model = new ScilabString(["PORT"]); + mo.inputs = new ScilabString(["n"]); + mo.outputs = new ScilabDouble(); + model.equations = mo; + + var exprs = new ScilabString(["1"]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),"OUTIMPL_f",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([1, 1]), model, exprs, gr_i); + this.x.graphics.in_implicit = new ScilabString(["I"]); + return new ImplicitOutBlock(this.x); + } + OUTIMPL_f.prototype.details = function OUTIMPL_f() { + return this.x; + } +} -- cgit From 7b2cf9ebaf0a2c433e45ff15e7534d684e86155a Mon Sep 17 00:00:00 2001 From: Chhavi Date: Tue, 5 Jul 2016 09:59:36 +0000 Subject: NPN --- data_structures_correct/NPN.js | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 data_structures_correct/NPN.js (limited to 'data_structures_correct') diff --git a/data_structures_correct/NPN.js b/data_structures_correct/NPN.js new file mode 100644 index 0000000..f6f9c9d --- /dev/null +++ b/data_structures_correct/NPN.js @@ -0,0 +1,56 @@ +function NPN() { + + NPN.prototype.define = function NPN() { + this.ModelName = "NPN"; + this.PrametersValue = [[50], [0.1], [0], [0.02], [1.200e-10], [5.000e-09], [1.000e-12], [4.000e-13], [5.000e-13], [0.8], [0.4], [0.8], [0.333], [1.000e-15], [1.000e-15], [0.02585], [40]]; + this.ParametersName = [["Bf"], ["Br"], ["Is"], ["Vak"], ["Tauf"], ["Taur"], ["Ccs"], ["Cje"], ["Cjc"], ["Phie"], ["Me"], ["Phic"], ["Mc"], ["Gbc"], ["Gbe"], ["Vt"], ["EMinMax"]]; + this.model = scicos_model(); + this.Typein = []; + this.Typeout = []; + this.MI = []; + this.MO = []; + this.P = [[100, 90, -2, 0], [0, 50, 2, 0], [100, 10, -2, 0]]; + this.PortName = [["C"], ["B"], ["E"]]; + + 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 model = scicos_model(); + 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(["50"], ["0.1"], ["1.e-16"], ["0.02"], ["0.12e-9"], ["5e-9"], ["1e-12"], ["0.4e-12"], ["0.5e-12"], ["0.8"], ["0.4"], ["0.8"], ["0.333"], ["1e-15"], ["1e-15"], ["0.02585"], ["40"]); + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),"NPN",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 = standard_define([2, 2], model, exprs, list(gr_i, new ScilabDouble([0]))); + this.x.graphics.in_implicit = new ScilabString(...this.Typein); + this.x.graphics.out_implicit = new ScilabString(...this.Typeout); + return new BasicBlock(this.x); + } + NPN.prototype.details = function NPN() { + return this.x; + } +} -- cgit