diff options
-rw-r--r-- | data_structures_correct/Ground.js | 30 | ||||
-rw-r--r-- | dependencies.js | 129 | ||||
-rw-r--r-- | finalmodsheet.xsl | 10 |
3 files changed, 135 insertions, 34 deletions
diff --git a/data_structures_correct/Ground.js b/data_structures_correct/Ground.js new file mode 100644 index 0000000..9ebe910 --- /dev/null +++ b/data_structures_correct/Ground.js @@ -0,0 +1,30 @@ +function Ground() { + + Ground.prototype.define = function Ground() { + + var model = scicos_model(); + model.in = new ScilabDouble([1]); + model.out = new ScilabDouble(); + model.sim = new ScilabString(["Ground"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var mo = modelica(); + mo.model = new ScilabString(["Ground"]); + mo.inputs = new ScilabString(["p"]); + mo.outputs = new ScilabDouble(); + model.equations = mo; + + var exprs = new ScilabString([""]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"Ground\",sz(1),sz(2));"]); + this.x = standard_define(new ScilabDouble([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 GroundBlock(this.x); + } + + Ground.prototype.details = function Ground() { + return this.x; + } +} diff --git a/dependencies.js b/dependencies.js index ea46827..307ee92 100644 --- a/dependencies.js +++ b/dependencies.js @@ -1,33 +1,24 @@ -$.getScript('math.js'); -$.getScript('combined.js'); +var dir = ["data_structures_correct"]; +var fileextension = "."; -// @Adhitya: 02-07-2016: Commented Jitesh's work to call Data Structures individually, -// and combined all of them into combined.js using combine_script.bat - -/* -$.ajax({ - type: "POST", - - // Invoke filenames.php - url: "filenames.php", - - // Receive the resultant filenames from the php script in JSON format - dataType: "json", - - // Add url for the required folder - data: { - url: "/data_structures_correct/" - }, - success: function (data) { - - // @Parameter: data will have the required filenames in the mentioned folder - // For each url, add the script to the body div element with getScript function - for (i in data) { - $.getScript(data[i]); - } - } +var script = document.createElement("script"); + script.src = "math.js"; + document.head.appendChild(script); +$.each(dir, function(index, value) { + $.ajax({ // http://stackoverflow.com/a/18480589 + url: value, + success: function(data) { + $(data).find("a:contains(" + fileextension + ")").each(function() { + var filename = this.href.replace(window.location.host, ""); + filename = filename.replace("https://", value); + filename = filename.replace("http://", value); + var script = document.createElement("script"); + script.src = filename; + document.head.appendChild(script); + }); + } + }); }); -*/ function AfficheBlock() { if (arguments.length > 0) { @@ -420,6 +411,86 @@ function RoundBlock() { } } +function GroundBlock() { + + if (arguments.length > 0) { + var options = arguments[0]; + this.angle = options.angle; // Not Known + this.blockType = getData(options.model.blocktype)[0]; + 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 = "GroundBlock"; + this.blockElementName = arguments.callee.caller.name; + } +} + function zeros() { if (arguments.length == 0) { return [0]; @@ -484,4 +555,4 @@ function inverse() { str += arg + "]]"; var array = JSON.parse(str); return array; -} +}
\ No newline at end of file diff --git a/finalmodsheet.xsl b/finalmodsheet.xsl index 9226a66..d7ff4f5 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'"> + <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'"> <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'"> + <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'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> @@ -821,7 +821,7 @@ Look for TAG:Break1!!! <xsl:apply-templates /> </xsl:element> </xsl:template> - <xsl:template name="GroudBlock" match="GroudBlock"> + <xsl:template name="GroundBlock" match="GroundBlock"> <xsl:element name="GroundBlock"> <xsl:if test="@dependsOnU"> <xsl:attribute name="dependsOnU"> @@ -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'"> + <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'"> <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'"> + <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'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> |