diff options
-rw-r--r-- | data_structures_correct/CVS.js | 58 | ||||
-rw-r--r-- | data_structures_correct/ESELECT_f.js | 29 | ||||
-rw-r--r-- | data_structures_correct/Extract_Activation.js | 129 | ||||
-rw-r--r-- | data_structures_correct/Flowmeter.js | 61 | ||||
-rw-r--r-- | data_structures_correct/GENERAL_f.js | 29 | ||||
-rw-r--r-- | data_structures_correct/INIMPL_f.js | 28 | ||||
-rw-r--r-- | data_structures_correct/MATDET.js | 36 | ||||
-rw-r--r-- | data_structures_correct/MATDIV.js | 37 | ||||
-rw-r--r-- | data_structures_correct/MATSING.js | 36 | ||||
-rw-r--r-- | data_structures_correct/MAXMIN.js | 23 | ||||
-rw-r--r-- | data_structures_correct/M_freq.js | 24 | ||||
-rw-r--r-- | data_structures_correct/NPN.js | 56 | ||||
-rw-r--r-- | data_structures_correct/OUTIMPL_f.js | 30 | ||||
-rw-r--r-- | data_structures_correct/PNP.js | 63 | ||||
-rw-r--r-- | data_structures_correct/PRODUCT.js | 23 | ||||
-rw-r--r-- | dependencies.js | 265 | ||||
-rw-r--r-- | index.html | 21 |
17 files changed, 943 insertions, 5 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/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; + } +} 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/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; + } +} 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; + } +} 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; + } +} 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; + } +} diff --git a/dependencies.js b/dependencies.js index 51341e4..860d4f8 100644 --- a/dependencies.js +++ b/dependencies.js @@ -497,6 +497,271 @@ function GroundBlock() { } } +function Product() { + if (arguments.length > 0) { + var options = arguments[0]; + this.angle = options.angle; // Not Known + this.blockType = getData(options.model.blocktype)[0]; + this.connectable = options.connectable; // Not Known + var dep_ut = getData(options.model.dep_ut); + if (dep_ut[0] == "true") + this.dependsOnU = "1"; + if (dep_ut[1] == "true") + this.dependsOnT = "1"; + this.id = options.id; + this.interfaceFunctionName = arguments.callee.caller.name; + this.ordering = options.ordering; + this.parent = options.parent; + if (options.model.sim instanceof Array) { + this.simulationFunctionName = getData(options.model.sim[0])[0]; + var func_type; + switch (getData(options.model.sim[1])[0].toString()) { + case "-2.0": + func_type = "ESELECT"; + break; + case "-1.0": + func_type = "IFTHENELSE"; + break; + case "1.0": + func_type = "TYPE_1"; + break; + case "2.0": + func_type = "TYPE_2"; + break; + case "3.0": + func_type = "TYPE_3"; + break; + case "4.0": + func_type = "C_OR_FORTRAN"; + break; + case "5.0": + func_type = "SCILAB"; + break; + case "99.0": + func_type = "DEBUG"; + break; + case "1001.0": + func_type = "DYNAMIC_FORTRAN_1"; + break; + case "2001.0": + func_type = "DYNAMIC_C_1"; + break; + case "2004.0": + func_type = "DYNAMIC_EXPLICIT_4"; + break; + case "10001.0": + func_type = "OLDBLOCKS"; + break; + case "10004.0": + func_type = "IMPLICIT_C_OR_FORTRAN"; + break; + case "30004.0": + func_type = "MODELICA"; + break; + } + this.simulationFunctionType = func_type; + } else { + this.simulationFunctionName = getData(options.model.sim)[0]; + this.simulationFunctionType = "DEFAULT"; + } + if(!isEmpty(options.graphics.style)) { + this.style = getData(options.graphics.style)[0]; + } + else { + this.style = arguments.callee.caller.name; + } + this.value = options.value; // Not Known + this.vertex = options.vertex; // Not Known + this.visible = options.visible; // Not Known + this.exprs = options.graphics.exprs; + this.realParameters = options.model.rpar; + this.integerParameters = options.model.ipar; + this.objectsParameters = options.model.opar; + this.nbZerosCrossing = options.model.nzcross; + this.nmode = options.model.nmode; + if(!isEmpty(options.model.state)) { + this.state = options.model.state; + } + if(!isEmpty(options.model.dstate)) { + this.dState = options.model.dstate; + } + this.oDState = options.model.odstate; + this.equations = options.model.equations; + this.blockName = "Product"; + this.blockElementName = arguments.callee.caller.name; + } +} + +function ImplicitOutBlock() { + if (arguments.length > 0) { + var options = arguments[0]; + this.angle = options.angle; // Not Known + this.blockType = getData(options.model.blocktype)[0]; + this.connectable = options.connectable; // Not Known + var dep_ut = getData(options.model.dep_ut); + if (dep_ut[0] == "true") + this.dependsOnU = "1"; + if (dep_ut[1] == "true") + this.dependsOnT = "1"; + this.id = options.id; + this.interfaceFunctionName = arguments.callee.caller.name; + this.ordering = options.ordering; + this.parent = options.parent; + if (options.model.sim instanceof Array) { + this.simulationFunctionName = getData(options.model.sim[0])[0]; + var func_type; + switch (getData(options.model.sim[1])[0].toString()) { + case "-2.0": + func_type = "ESELECT"; + break; + case "-1.0": + func_type = "IFTHENELSE"; + break; + case "1.0": + func_type = "TYPE_1"; + break; + case "2.0": + func_type = "TYPE_2"; + break; + case "3.0": + func_type = "TYPE_3"; + break; + case "4.0": + func_type = "C_OR_FORTRAN"; + break; + case "5.0": + func_type = "SCILAB"; + break; + case "99.0": + func_type = "DEBUG"; + break; + case "1001.0": + func_type = "DYNAMIC_FORTRAN_1"; + break; + case "2001.0": + func_type = "DYNAMIC_C_1"; + break; + case "2004.0": + func_type = "DYNAMIC_EXPLICIT_4"; + break; + case "10001.0": + func_type = "OLDBLOCKS"; + break; + case "10004.0": + func_type = "IMPLICIT_C_OR_FORTRAN"; + break; + case "30004.0": + func_type = "MODELICA"; + break; + } + this.simulationFunctionType = func_type; + } else { + this.simulationFunctionName = getData(options.model.sim)[0]; + this.simulationFunctionType = "DEFAULT"; + } + this.value = options.value; // Not Known + this.vertex = options.vertex; // Not Known + this.visible = options.visible; // Not Known + this.exprs = options.graphics.exprs; + this.integerParameters = options.model.ipar; + this.objectsParameters = options.model.opar; + if(!isEmpty(options.model.state)) { + this.state = options.model.state; + } + if(!isEmpty(options.model.dstate)) { + this.dState = options.model.dstate; + } + this.equations = options.model.equations; + this.blockName = "ImplicitOutBlock"; + this.blockElementName = arguments.callee.caller.name; + } +} + +function ImplicitInBlock() { + if (arguments.length > 0) { + var options = arguments[0]; + this.angle = options.angle; // Not Known + this.blockType = getData(options.model.blocktype)[0]; + this.connectable = options.connectable; // Not Known + var dep_ut = getData(options.model.dep_ut); + if (dep_ut[0] == "true") + this.dependsOnU = "1"; + if (dep_ut[1] == "true") + this.dependsOnT = "1"; + this.id = options.id; + this.interfaceFunctionName = arguments.callee.caller.name; + this.ordering = options.ordering; + this.parent = options.parent; + if (options.model.sim instanceof Array) { + this.simulationFunctionName = getData(options.model.sim[0])[0]; + var func_type; + switch (getData(options.model.sim[1])[0].toString()) { + case "-2.0": + func_type = "ESELECT"; + break; + case "-1.0": + func_type = "IFTHENELSE"; + break; + case "1.0": + func_type = "TYPE_1"; + break; + case "2.0": + func_type = "TYPE_2"; + break; + case "3.0": + func_type = "TYPE_3"; + break; + case "4.0": + func_type = "C_OR_FORTRAN"; + break; + case "5.0": + func_type = "SCILAB"; + break; + case "99.0": + func_type = "DEBUG"; + break; + case "1001.0": + func_type = "DYNAMIC_FORTRAN_1"; + break; + case "2001.0": + func_type = "DYNAMIC_C_1"; + break; + case "2004.0": + func_type = "DYNAMIC_EXPLICIT_4"; + break; + case "10001.0": + func_type = "OLDBLOCKS"; + break; + case "10004.0": + func_type = "IMPLICIT_C_OR_FORTRAN"; + break; + case "30004.0": + func_type = "MODELICA"; + break; + } + this.simulationFunctionType = func_type; + } else { + this.simulationFunctionName = getData(options.model.sim)[0]; + this.simulationFunctionType = "DEFAULT"; + } + this.value = options.value; // Not Known + this.vertex = options.vertex; // Not Known + this.visible = options.visible; // Not Known + this.exprs = options.graphics.exprs; + this.integerParameters = options.model.ipar; + this.objectsParameters = options.model.opar; + if(!isEmpty(options.model.state)) { + this.state = options.model.state; + } + if(!isEmpty(options.model.dstate)) { + this.dState = options.model.dstate; + } + this.equations = options.model.equations; + this.blockName = "ImplicitInBlock"; + this.blockElementName = arguments.callee.caller.name; + } +} + function zeros() { if (arguments.length == 0) { return [0]; @@ -743,7 +743,7 @@ if (mxUtils.isNode(cell.value)) { var stylesheet = graph.getStylesheet(); - var style = stylesheet.styles[cell.style]; + var style = stylesheet.styles[cell.value.getAttribute('style')]; var displayedLabel = style['displayedLabel']; if(displayedLabel != null) { var displayParameter = cell.blockInstance.instance.displayParameter; @@ -1214,6 +1214,9 @@ */ function styleToObject(style) { + if(style.indexOf(';') == -1) { + style = style + ';'; + } var defaultStyle = style.substring(0, style.indexOf(';')); var styleObject = { @@ -1620,7 +1623,7 @@ var trigger = document.getElementById(button); var styleObject = styleToObject(style); var previousValue = 1; - if ('fontStyle' in styleObjesct) { + if ('fontStyle' in styleObject) { previousValue = styleObject['fontStyle']; // To get a bit mask: @@ -1948,7 +1951,11 @@ btn.onclick = function() { var input = document.getElementById('color').value; var style = graph.getModel().getStyle(cell); - var styleObject = styleToObject(style); + + if(style != null) { + var styleObject = styleToObject(style); + } + if (selectProperty == "edgeStrokeColor") { styleObject['strokeColor'] = input; } else if (selectProperty == "bgColor") { @@ -1960,8 +1967,12 @@ } else if (selectProperty == "edgeTextColor") { styleObject['fontColor'] = input; } - style = objectToStyle(styleObject); - graph.getModel().setStyle(cell, style); + + if(style != null) { + style = objectToStyle(styleObject); + graph.getModel().setStyle(cell, style); + } + wind.destroy(); }; myform.appendChild(btn); |