summaryrefslogtreecommitdiff
path: root/data_structures_correct
diff options
context:
space:
mode:
authorAdhitya Kamakshidasan2016-07-05 15:38:21 +0530
committerGitHub2016-07-05 15:38:21 +0530
commitbb0100dc1945b71b050d4911cb4e9d31634fe0cd (patch)
treea6f5ba90d077689a9147d99d63ea9f8e7b97bc3c /data_structures_correct
parent34d6f8642840bd0b095ed350ea70233cd2829d41 (diff)
parent1c6cb81eb9062fee09f885f5e9d9a5f20ba2ced1 (diff)
downloadxcos-on-web-bb0100dc1945b71b050d4911cb4e9d31634fe0cd.tar.gz
xcos-on-web-bb0100dc1945b71b050d4911cb4e9d31634fe0cd.tar.bz2
xcos-on-web-bb0100dc1945b71b050d4911cb4e9d31634fe0cd.zip
Merge pull request #129 from ASP1234/master
Implement Blocks
Diffstat (limited to 'data_structures_correct')
-rw-r--r--data_structures_correct/CVS.js58
-rw-r--r--data_structures_correct/ESELECT_f.js29
-rw-r--r--data_structures_correct/Extract_Activation.js129
-rw-r--r--data_structures_correct/Flowmeter.js61
-rw-r--r--data_structures_correct/GENERAL_f.js29
-rw-r--r--data_structures_correct/MATDET.js36
-rw-r--r--data_structures_correct/MATDIV.js37
-rw-r--r--data_structures_correct/MATSING.js36
-rw-r--r--data_structures_correct/MAXMIN.js23
-rw-r--r--data_structures_correct/M_freq.js24
-rw-r--r--data_structures_correct/PNP.js63
11 files changed, 525 insertions, 0 deletions
diff --git a/data_structures_correct/CVS.js b/data_structures_correct/CVS.js
new file mode 100644
index 0000000..8091332
--- /dev/null
+++ b/data_structures_correct/CVS.js
@@ -0,0 +1,58 @@
+function CVS() {
+
+ CVS.prototype.define = function CVS() {
+ this.ModelName = "CVS";
+ this.PrametersValue = new ScilabDouble();
+ this.ParametersName = new ScilabDouble();
+ var model = scicos_model();
+ this.Typein = [];
+ this.Typeout = [];
+ this.MI = [];
+ this.MO = [];
+ this.P = [[2,50,1,0],[70,98,2,0],[70,2,-2,0]];
+ this.PortName = [["vin"],["p"],["n"]];
+
+ 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 = this.PrametersValue;
+ mo.parameters = list(this.ParametersName, this.PrametersValue, new ScilabDouble(...zeros(getData(this.ParametersName))));
+ var exprs = new ScilabDouble();
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"CVS\",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.1, 3]), 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);
+ }
+
+ CVS.prototype.details = function CVS() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/ESELECT_f.js b/data_structures_correct/ESELECT_f.js
new file mode 100644
index 0000000..dc0ab87
--- /dev/null
+++ b/data_structures_correct/ESELECT_f.js
@@ -0,0 +1,29 @@
+function ESELECT_f() {
+
+ ESELECT_f.prototype.define = function ESELECT_f() {
+ this.out = 2;
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["eselect"]), new ScilabDouble([-2]));
+ model.in = new ScilabDouble([1]);
+ model.in2 = new ScilabDouble([1]);
+ model.intyp = new ScilabDouble([-1]);
+ model.evtin = new ScilabDouble([1]);
+ model.evtout = new ScilabDouble(...ones(this.out, 1));
+ model.blocktype = new ScilabString(["l"]);
+ model.firing = new ScilabDouble(...ones(this.out, 1));
+ model.dep_ut = new ScilabBoolean([true, false]);
+ model.nmode = new ScilabDouble([0]);
+ model.nzcross = new ScilabDouble([0]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"ESELECT_f\",sz(1),sz(2));"]);;
+
+ var exprs = new ScilabString([this.out], [1], [parseInt(getData(model.nmode))]);
+ this.x = new standard_define(new ScilabDouble([4, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ ESELECT_f.prototype.details = function ESELECT_f() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/Extract_Activation.js b/data_structures_correct/Extract_Activation.js
new file mode 100644
index 0000000..a13fc27
--- /dev/null
+++ b/data_structures_correct/Extract_Activation.js
@@ -0,0 +1,129 @@
+function Extract_Activation() {
+
+ Extract_Activation.prototype.define = function Extract_Activation() {
+ var scs_m_1 = scicos_diagram();
+ scs_m_1.objs.push(new IFTHEL_f().internal());
+ scs_m_1.objs.push(new CLKSOMV_f().internal());
+ scs_m_1.objs.push(new IN_f().internal());
+ scs_m_1.objs.push(new CLKOUTV_f().internal());
+ scs_m_1.objs.push(scicos_link({}));
+ scs_m_1.objs.push(scicos_link({}));
+ scs_m_1.objs.push(scicos_link({}));
+ scs_m_1.objs.push(scicos_link({}));
+
+ var blk = scs_m_1.objs[0];
+ var graphics = blk.graphics;
+
+ var model = blk.model;
+ graphics.orig = new ScilabDouble([80, 0]);
+ graphics.sz = new ScilabDouble([60, 40]);
+ graphics.flip = new ScilabBoolean([true]);
+ graphics.exprs = new ScilabString(["0"], ["0"]);
+ model.evtin = new ScilabDouble();
+ model.nzcross = new ScilabDouble([0]);
+ model.nmode = new ScilabDouble([0]);
+ graphics.pin = new ScilabDouble([7]);
+ graphics.peout = new ScilabDouble([5], [6]);
+ model.uid = new ScilabString([count]);
+ blk.doc = list(new ScilabString([count++]));
+ blk.graphics = graphics;
+ blk.model = model;
+ scs_m_1.objs[0] = blk;
+
+ blk = scs_m_1.objs[1];
+ graphics = blk.graphics;
+ model = blk.model;
+ model.outtyp = new ScilabDouble();
+ model.evtin = new ScilabDouble([-1], [-1], [-1]);
+ model.evtout = new ScilabDouble([-1]);
+ graphics.orig = new ScilabDouble([80, -80]);
+ graphics.sz = new ScilabDouble([80, 40]);
+ graphics.flip = new ScilabBoolean([true]);
+ graphics.pein = new ScilabDouble([5], [6], [0]);
+ graphics.peout = new ScilabDouble([8]);
+ graphics.style = new ScilabString(["CLKSOMV_f"]);
+ model.uid = new ScilabString([count]);
+ blk.doc = list(new ScilabString([count++]));
+ blk.graphics = graphics;
+ blk.model = model;
+ scs_m_1.objs[1] = blk;
+
+ blk = scs_m_1.objs[2];
+ graphics = blk.graphics;
+ model = blk.model;
+ graphics.orig = new ScilabDouble([0, 10]);
+ graphics.sz = new ScilabDouble([20, 20]);
+ graphics.flip = new ScilabBoolean([true]);
+ graphics.exprs = new ScilabString(["1"]);
+ model.ipar = new ScilabDouble([1]);
+ graphics.pout = new ScilabDouble([7]);
+ model.uid = new ScilabString([count]);
+ blk.doc = list(new ScilabString([count++]));
+ blk.graphics = graphics;
+ blk.model = model;
+ scs_m_1.objs[2] = blk;
+
+ blk = scs_m_1.objs[3];
+ graphics = blk.graphics;
+ model = blk.model;
+ model.outtyp = new ScilabDouble();
+ graphics.style = new ScilabString(["CLKOUTV_f"]);
+ graphics.orig = new ScilabDouble([110, -140]);
+ graphics.sz = new ScilabDouble([20, 20]);
+ graphics.flip = new ScilabBoolean([true]);
+ graphics.exprs = new ScilabString(["1"]);
+ graphics.gr_i = list(new ScilabString(["xstringb(orig(1),orig(2),\"CLKOUTV_f\",sz(1),sz(2));"]), new ScilabDouble([8]));
+ model.ipar = new ScilabDouble([1]);
+ graphics.pein = new ScilabDouble([8]);
+ model.uid = new ScilabString([count]);
+ blk.doc = list(new ScilabString([count++]));
+ blk.graphics = graphics;
+ blk.model = model;
+ scs_m_1.objs[3] = blk;
+
+ var lnk = scs_m_1.objs[4];
+ lnk.xx = new ScilabDouble([140], [140]);
+ lnk.yy = new ScilabDouble([-44], [-76]);
+ lnk.ct = new ScilabDouble([5, -1]);
+ lnk.from = new ScilabDouble([1, 1, 0]);
+ lnk.to = new ScilabDouble([2, 1, 1]);
+ scs_m_1.objs[4] = lnk;
+
+ lnk = scs_m_1.objs[5];
+ lnk.xx = new ScilabDouble([160], [160]);
+ lnk.yy = new ScilabDouble([-44], [-76]);
+ lnk.ct = new ScilabDouble([5, -1]);
+ lnk.from = new ScilabDouble([1, 2, 0]);
+ lnk.to = new ScilabDouble([2, 2, 1]);
+ scs_m_1.objs[5] = lnk;
+
+ lnk = scs_m_1.objs[6];
+ lnk.xx = new ScilabDouble([64], [116]);
+ lnk.yy = new ScilabDouble([-40], [-20]);
+ lnk.from = new ScilabDouble([3, 1, 0]);
+ lnk.to = new ScilabDouble([1, 1, 1]);
+ scs_m_1.objs[6] = lnk;
+
+ lnk = scs_m_1.objs[7];
+ lnk.xx = new ScilabDouble([160], [160]);
+ lnk.yy = new ScilabDouble([-124], [-176]);
+ lnk.ct = new ScilabDouble([5, -1]);
+ lnk.from = new ScilabDouble([2, 1, 0]);
+ lnk.to = new ScilabDouble([4, 1, 1]);
+ scs_m_1.objs[7] = lnk;
+
+ model = scicos_model();
+ model.sim = new ScilabString(["csuper"]);
+ model.in = new ScilabDouble([1]);
+ model.evtout = new ScilabDouble([1]);
+ model.rpar = scs_m_1;
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"Extract_Activation\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([3, 2]), model, new ScilabDouble(), gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ Extract_Activation.prototype.details = function Extract_Activation() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/Flowmeter.js b/data_structures_correct/Flowmeter.js
new file mode 100644
index 0000000..4e5b7c9
--- /dev/null
+++ b/data_structures_correct/Flowmeter.js
@@ -0,0 +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;
+ }
+}
diff --git a/data_structures_correct/GENERAL_f.js b/data_structures_correct/GENERAL_f.js
new file mode 100644
index 0000000..d70a82e
--- /dev/null
+++ b/data_structures_correct/GENERAL_f.js
@@ -0,0 +1,29 @@
+function GENERAL_f() {
+
+ GENERAL_f.prototype.define = function GENERAL_f() {
+ var rpar = [[0],[0],[0],[0]];
+
+ this.in1 = 1;
+ this.out = 1;
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["zcross"]), new ScilabDouble([1]));
+ model.nzcross = new ScilabDouble([this.in1]);
+ model.in = new ScilabDouble([this.in1]);
+ model.evtout = new ScilabDouble(...ones(this.out, 1));
+ model.rpar = new ScilabDouble([0], [0], [0], [0]);
+ model.blocktype = new ScilabString(["z"]);
+ model.firing = -new ScilabDouble(...ones(this.out, 1));
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var exprs = new ScilabString([sci2exp(this.in1)], [sci2exp(this.out)]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"GENERAL_f\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([3, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ GENERAL_f.prototype.details = function GENERAL_f() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/MATDET.js b/data_structures_correct/MATDET.js
new file mode 100644
index 0000000..7005d7c
--- /dev/null
+++ b/data_structures_correct/MATDET.js
@@ -0,0 +1,36 @@
+function MATDET() {
+
+ MATDET.prototype.define = function MATDET() {
+ var model = scicos_model();
+
+ this.function_name = "mat_det";
+ this.funtyp = 4;
+
+ model.sim = list(new ScilabString([this.function_name]), new ScilabDouble([this.funtyp]));
+ model.in = new ScilabDouble([-1]);
+ model.in2 = new ScilabDouble([-1]);
+ model.intyp = new ScilabDouble([1]);
+ model.out = new ScilabDouble([1]);
+ model.out2 = new ScilabDouble([1]);
+ model.outtyp = new ScilabDouble([1]);
+ model.evtin = new ScilabDouble();
+ model.evtout = new ScilabDouble();
+ model.state = new ScilabDouble();
+ model.dstate = new ScilabDouble();
+ model.rpar = new ScilabDouble();
+ model.ipar = new ScilabDouble();
+ model.blocktype = new ScilabString(["c"]);
+ model.firing = new ScilabDouble();
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var label = new ScilabString([sci2exp(1)]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"MATDET\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, label, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ MATDET.prototype.details = function MATDET() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/MATDIV.js b/data_structures_correct/MATDIV.js
new file mode 100644
index 0000000..6715345
--- /dev/null
+++ b/data_structures_correct/MATDIV.js
@@ -0,0 +1,37 @@
+function MATDIV() {
+
+ MATDIV.prototype.define = function MATDIV() {
+ var model = scicos_model();
+
+ this.function_name = "mat_div";
+ this.funtyp = 4;
+
+ model.sim = list(new ScilabString([this.function_name]), new ScilabDouble([this.funtyp]));
+ model.in = new ScilabDouble([-1], [-2]);
+ model.in2 = new ScilabDouble([-3], [-3]);
+ model.intyp = new ScilabDouble([1, 1]);
+ model.out = new ScilabDouble([-1]);
+ model.out2 = new ScilabDouble([-2]);
+ model.outtyp = new ScilabDouble([1]);
+ model.evtin = new ScilabDouble();
+ model.evtout = new ScilabDouble();
+ model.state = new ScilabDouble();
+ model.dstate = new ScilabDouble();
+ model.rpar = new ScilabDouble();
+ model.ipar = new ScilabDouble();
+ model.blocktype = new ScilabString(["c"]);
+ model.firing = new ScilabDouble();
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var label = new ScilabString([sci2exp(1)]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"MATDIV\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, label, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ MATDIV.prototype.details = function MATDIV() {
+ return this.x;
+ }
+
+}
diff --git a/data_structures_correct/MATSING.js b/data_structures_correct/MATSING.js
new file mode 100644
index 0000000..d99399e
--- /dev/null
+++ b/data_structures_correct/MATSING.js
@@ -0,0 +1,36 @@
+function MATSING() {
+
+ MATSING.prototype.define = function MATSING() {
+ var model = scicos_model();
+
+ this.function_name = "mat_sing";
+ this.funtyp = 4;
+
+ model.sim = list(new ScilabString([this.function_name]), new ScilabDouble([this.funtyp]));
+ model.in = new ScilabDouble([-1]);
+ model.in2 = new ScilabDouble([-2]);
+ model.intyp = new ScilabDouble([1]);
+ model.out = new ScilabDouble([-1]);
+ model.out2 = new ScilabDouble([1]);
+ model.outtyp = new ScilabDouble([1]);
+ model.evtin = new ScilabDouble();
+ model.evtout = new ScilabDouble();
+ model.state = new ScilabDouble();
+ model.dstate = new ScilabDouble();
+ model.rpar = new ScilabDouble();
+ model.ipar = new ScilabDouble();
+ model.blocktype = new ScilabString(["c"]);
+ model.firing = new ScilabDouble();
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var label = new ScilabString([sci2exp(1)], [sci2exp(1)]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"MATSING\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, label, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ MATSING.prototype.details = function MATSING() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/MAXMIN.js b/data_structures_correct/MAXMIN.js
new file mode 100644
index 0000000..c9d7ce6
--- /dev/null
+++ b/data_structures_correct/MAXMIN.js
@@ -0,0 +1,23 @@
+function MAXMIN() {
+
+ MAXMIN.prototype.define = function MAXMIN() {
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["minmax"]), new ScilabDouble([4]));
+ model.out = new ScilabDouble([1]);
+ model.in = new ScilabDouble([-1]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+ model.ipar = new ScilabDouble([0]);
+
+ var exprs = new ScilabString(...math.transpose([[2, 1, 1]]));
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"MAXMIN\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i);
+ this.x.graphics.style = new ScilabString(["MAXMIN;displayedLabel=MAX"]);
+ return new BasicBlock(this.x);
+ }
+
+ MAXMIN.prototype.details = function MAXMIN() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/M_freq.js b/data_structures_correct/M_freq.js
new file mode 100644
index 0000000..e335809
--- /dev/null
+++ b/data_structures_correct/M_freq.js
@@ -0,0 +1,24 @@
+function M_freq() {
+
+ M_freq.prototype.define = function M_freq() {
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["m_frequ"]), new ScilabDouble([4]));
+ model.evtout = new ScilabDouble([1], [1], [1]);
+ model.evtin = new ScilabDouble([1]);
+ model.rpar = new ScilabDouble();
+ model.opar = list(new ScilabDouble([1, 1, 0], [1, 1, 1], [1, 3, 2]), new ScilabDouble([1]), new ScilabDouble([0]), new ScilabDouble([0]));
+ model.blocktype = new ScilabString(["d"]);
+ model.firing = new ScilabDouble([0, -1, -1]);
+ model.dep_ut = new ScilabBoolean([false, false]);
+
+ var exprs = new ScilabString([sci2exp([[1], [2]])], [sci2exp([[0], [0]])]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"M_freq\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([3, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ M_freq.prototype.details = function M_freq() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/PNP.js b/data_structures_correct/PNP.js
new file mode 100644
index 0000000..cb5843a
--- /dev/null
+++ b/data_structures_correct/PNP.js
@@ -0,0 +1,63 @@
+function PNP() {
+
+ PNP.prototype.define = function PNP() {
+ this.ModelName = "PNP";
+ 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"]];
+
+ var 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 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);
+
+ var arr = [];
+ arr.push(zeros(getData(this.ParametersName)));
+ mo.parameters = list(new ScilabString(...this.ParametersName), new ScilabDouble(...this.PrametersValue), new ScilabDouble(...math.transpose(arr)));
+ 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 = "xstringb(orig(1),orig(2),\"PNP\",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);
+ }
+
+ PNP.prototype.details = function PNP() {
+ return this.x;
+ }
+}