diff options
-rw-r--r-- | data_structures_correct/LOGIC.js | 30 | ||||
-rw-r--r-- | data_structures_correct/Switch.js | 42 | ||||
-rw-r--r-- | data_structures_correct/VoltageSensor.js | 29 | ||||
-rw-r--r-- | dependencies.js | 80 | ||||
-rw-r--r-- | finalmodsheet.xsl | 8 |
5 files changed, 185 insertions, 4 deletions
diff --git a/data_structures_correct/LOGIC.js b/data_structures_correct/LOGIC.js new file mode 100644 index 0000000..0c1db7e --- /dev/null +++ b/data_structures_correct/LOGIC.js @@ -0,0 +1,30 @@ +function LOGIC() { + + LOGIC.prototype.define = function LOGIC() { + this.mat = [[0],[0],[0],[1]]; + + var model = scicos_model(); + model.sim = list(new ScilabString(["logic"]), new ScilabDouble([4])); + model.in = new ScilabDouble([1], [1]); + model.in2 = new ScilabDouble([1], [1]); + model.out = new ScilabDouble([1]); + model.out2 = new ScilabDouble([1]); + model.evtin = new ScilabDouble([1]); + model.intyp = new ScilabDouble([5, 5]); + model.outtyp = new ScilabDouble([5]); + model.opar = list(int8(...this.mat)); + model.blocktype = new ScilabString(["c"]); + model.firing = new ScilabBoolean([false]); + model.dep_ut = new ScilabBoolean([true, false]); + + var exprs = new ScilabString([sci2exp(this.mat)], [sci2exp(0)]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"LOGIC\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i); + return new BasicBlock(this.x); + } + + LOGIC.prototype.details = function LOGIC() { + return this.x; + } +} diff --git a/data_structures_correct/Switch.js b/data_structures_correct/Switch.js new file mode 100644 index 0000000..79c5736 --- /dev/null +++ b/data_structures_correct/Switch.js @@ -0,0 +1,42 @@ +function Switch() { + + Switch.prototype.define = function Switch() { + var model = scicos_model(); + + this.Ron = 0.01; + this.Roff = 1e5; + this.S = [["Ron"], ["Roff"]]; + + var scope = { + Ron: 0.01, + Roff: 1e5 + } + this.Z = math.eval('[ Ron ; Roff ]', scope)._data; + + model.sim = new ScilabString(["Switch"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var mo = new modelica_function(); + mo.model = model.sim; + mo.inputs = new ScilabString(["p"], ["inp"]); + mo.outputs = new ScilabString(["n"]); + mo.parameters = list(new ScilabString(...this.S), new ScilabDouble(...this.Z)); + model.equations = mo; + model.in = new ScilabDouble(...ones(size(getData(mo.inputs), "*"), 1)); + model.out = new ScilabDouble(...ones(size(getData(mo.outputs), "*"), 1)); + model.rpar = new ScilabDouble(...this.Z); + + var exprs = new ScilabString(...this.Z); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"Switch\",sz(1),sz(2));"]); + this.x = standard_define(new ScilabDouble([2, 2]), model, exprs, list(gr_i, new ScilabDouble(0))); + this.x.graphics.in_implicit = new ScilabString([["I"], ["E"]]); + this.x.graphics.out_implicit = new ScilabString(["I"]); + return new BasicBlock(this.x); + } + + Switch.prototype.details = function Switch() { + this.x; + } +} diff --git a/data_structures_correct/VoltageSensor.js b/data_structures_correct/VoltageSensor.js new file mode 100644 index 0000000..0d00317 --- /dev/null +++ b/data_structures_correct/VoltageSensor.js @@ -0,0 +1,29 @@ +function VoltageSensor() { + + VoltageSensor.prototype.define = function VoltageSensor() { + var model = scicos_model(); + model.in = new ScilabDouble([1]); + model.out = new ScilabDouble([1], [, 1]); + model.sim = new ScilabString(["VoltageSensor"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var mo = new modelica_function(); + mo.model = new ScilabString(["VoltageSensor"]); + mo.inputs = new ScilabString(["p"]); + mo.outputs = new ScilabString(["n"], ["v"]); + model.equations = mo; + + var exprs = new ScilabDouble(); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VoltageSensor\",sz(1),sz(2));"]);; + this.x = standard_define([2, 2], model, exprs, list(gr_i, new ScilabDouble([0]))); + this.x.graphics.in_implicit = new ScilabString(["I"]); + this.x.graphics.out_implicit = new ScilabString(["I"], ["E"]); + return new VoltageSensorBlock(this.x); + } + + VoltageSensor.prototype.details = function VoltageSensor() { + return this.x; + } +} diff --git a/dependencies.js b/dependencies.js index 4e44388..8f5b078 100644 --- a/dependencies.js +++ b/dependencies.js @@ -999,6 +999,86 @@ function ExplicitOutBlock() { } } +function VoltageSensorBlock() { + 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"; + 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.style = arguments.callee.caller.name; + this.value = options.value; // 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; + this.oDState = list(); + this.equations = options.model.equations; // Not Known + this.blockName = "VoltageSensorBlock"; + this.blockElementName = arguments.callee.caller.name; + } +} + function Summation() { if (arguments.length > 0) { var options = arguments[0]; diff --git a/finalmodsheet.xsl b/finalmodsheet.xsl index 25ffff6..8b9c804 100644 --- a/finalmodsheet.xsl +++ b/finalmodsheet.xsl @@ -172,7 +172,7 @@ Look for TAG:Break1!!! </xsl:template> <xsl:template name="Object" match="Object"> <xsl:element name="Array"> - <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock'"> + <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock' or name(..)='VoltageSensorBlock'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> @@ -200,7 +200,7 @@ Look for TAG:Break1!!! --> <xsl:template name="Array" match="Array"> <xsl:element name="Array"> - <xsl:if test="name(..)='BasicBlock' or @as='context' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock'"> + <xsl:if test="name(..)='BasicBlock' or @as='context' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock' or nmae(..)='VoltageSensorBlock'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> @@ -1581,7 +1581,7 @@ Look for TAG:Break1!!! </xsl:template> <xsl:template name="ScilabDouble" match="ScilabDouble"> <xsl:element name="ScilabDouble"> - <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock'"> + <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock' or name(..)='VoltageSensorBlock'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> @@ -1613,7 +1613,7 @@ Look for TAG:Break1!!! </xsl:template> <xsl:template name="ScilabString" match="ScilabString"> <xsl:element name="ScilabString"> - <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock'"> + <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock' or name(..)='VoltageSensorBlock'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> |