diff options
author | Adhitya Kamakshidasan | 2016-07-05 11:31:00 +0530 |
---|---|---|
committer | GitHub | 2016-07-05 11:31:00 +0530 |
commit | dc36ddca0ba67a86725bb584a33bcc59c12e6015 (patch) | |
tree | d39e65c607bfd2d5c11dd523cbcfc6aa264fd96c | |
parent | 81da447552fea9d334a8f53f44dfae461074dbb8 (diff) | |
parent | 99ef8777a7bda86af4e85d15a71ba1c73f85da4b (diff) | |
download | xcos-on-web-dc36ddca0ba67a86725bb584a33bcc59c12e6015.tar.gz xcos-on-web-dc36ddca0ba67a86725bb584a33bcc59c12e6015.tar.bz2 xcos-on-web-dc36ddca0ba67a86725bb584a33bcc59c12e6015.zip |
Merge pull request #120 from ASP1234/master
Implement GOTO Block
-rwxr-xr-x | blocks_xcos/GOTO.xcos | 78 | ||||
-rw-r--r-- | data_structures_correct/GOTO.js | 28 | ||||
-rw-r--r-- | data_structures_correct/Ground.js | 30 | ||||
-rw-r--r-- | dependencies.js | 83 | ||||
-rw-r--r-- | finalmodsheet.xsl | 10 |
5 files changed, 179 insertions, 50 deletions
diff --git a/blocks_xcos/GOTO.xcos b/blocks_xcos/GOTO.xcos index caa5818..a8f787c 100755 --- a/blocks_xcos/GOTO.xcos +++ b/blocks_xcos/GOTO.xcos @@ -1,44 +1,38 @@ <?xml version="1.0" encoding="UTF-8"?> -<XcosDiagram background="-1" title="Untitled"> - <!--Xcos - 1.0 - scilab-5.5.2 - 20150331 1152--> - <Array as="context" scilabClass="String[]"> - <add value=""/> - </Array> - <mxGraphModel as="model"> - <root> - <mxCell id="-1b7beca7:15524560360:-7b7b"/> - <mxCell id="-1b7beca7:15524560360:-7b7c" parent="-1b7beca7:15524560360:-7b7b"/> - <BasicBlock id="-1b7beca7:15524560360:-7b79" interfaceFunctionName="GOTO" parent="-1b7beca7:15524560360:-7b7c" simulationFunctionName="goto" simulationFunctionType="DEFAULT" style="GOTO"> - <ScilabString as="exprs" height="2" width="1"> - <data column="0" line="0" value="A"/> - <data column="0" line="1" value="1"/> - </ScilabString> - <ScilabDouble as="realParameters" height="0" width="0"/> - <ScilabDouble as="integerParameters" height="1" width="1"> - <data column="0" line="0" realPart="1.0"/> - </ScilabDouble> - <Array as="objectsParameters" scilabClass="ScilabList"> - <ScilabString height="1" width="1"> - <data column="0" line="0" value="A"/> - </ScilabString> - </Array> - <ScilabDouble as="nbZerosCrossing" height="1" width="1"> - <data column="0" line="0" realPart="0.0"/> - </ScilabDouble> - <ScilabDouble as="nmode" height="1" width="1"> - <data column="0" line="0" realPart="0.0"/> - </ScilabDouble> - <Array as="oDState" scilabClass="ScilabList"/> - <Array as="equations" scilabClass="ScilabList"/> - <mxGeometry as="geometry" height="7.0" width="7.0" x="37.5" y="37.0"/> - </BasicBlock> - <ExplicitInputPort dataType="UNKNOW_TYPE" id="-1b7beca7:15524560360:-7b78" ordering="1" parent="-1b7beca7:15524560360:-7b79" style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0" value=""> - <mxGeometry as="geometry" height="8.0" width="8.0" x="-8.0" y="-3.5"/> - </ExplicitInputPort> - <mxCell connectable="0" id="-1b7beca7:15524560360:-7b79#identifier" parent="-1b7beca7:15524560360:-7b79" style="noLabel=0;opacity=0;" value="Goto" vertex="1"> - <mxGeometry as="geometry" relative="1" x="0.5" y="1.1"/> - </mxCell> - </root> - </mxGraphModel> - <mxCell as="defaultParent" id="-1b7beca7:15524560360:-7b7c" parent="-1b7beca7:15524560360:-7b7b"/> +<XcosDiagram background="-1" title="Untitled - 12:26:42 PM"> + <!--Xcos - 1.0 - scilab-5.5.2 - 20150331 1152--> + <mxGraphModel as="model"> + <root> + <mxCell id="60e6c3c2:155b4b1be58:-7ffb" /> + <mxCell id="60e6c3c2:155b4b1be58:-7ffc" parent="60e6c3c2:155b4b1be58:-7ffb" /> + <BasicBlock id="60e6c3c2:155b4b1be58:-7fe1" interfaceFunctionName="GOTO" parent="60e6c3c2:155b4b1be58:-7ffc" simulationFunctionName="goto" simulationFunctionType="DEFAULT" style="GOTO"> + <ScilabString as="exprs" height="2" width="1"> + <data column="0" line="0" value="A" /> + <data column="0" line="1" value="1" /> + </ScilabString> + <ScilabDouble as="realParameters" height="0" width="0" /> + <ScilabDouble as="integerParameters" height="1" width="1"> + <data column="0" line="0" realPart="1.0" /> + </ScilabDouble> + <Array as="objectsParameters" scilabClass="ScilabList"> + <ScilabString height="1" width="1"> + <data column="0" line="0" value="A" /> + </ScilabString> + </Array> + <ScilabDouble as="nbZerosCrossing" height="1" width="1"> + <data column="0" line="0" realPart="0.0" /> + </ScilabDouble> + <ScilabDouble as="nmode" height="1" width="1"> + <data column="0" line="0" realPart="0.0" /> + </ScilabDouble> + <Array as="oDState" scilabClass="ScilabList" /> + <Array as="equations" scilabClass="ScilabList" /> + <mxGeometry as="geometry" height="20.0" width="40.0" x="130.0" y="170.0" /> + </BasicBlock> + <ExplicitInputPort dataType="UNKNOW_TYPE" id="60e6c3c2:155b4b1be58:-7fe0" ordering="1" parent="60e6c3c2:155b4b1be58:-7fe1" style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0" value=""> + <mxGeometry as="geometry" height="8.0" width="8.0" x="-8.0" y="6.0" /> + </ExplicitInputPort> + </root> + </mxGraphModel> + <mxCell as="defaultParent" id="60e6c3c2:155b4b1be58:-7ffc" parent="60e6c3c2:155b4b1be58:-7ffb" /> </XcosDiagram> diff --git a/data_structures_correct/GOTO.js b/data_structures_correct/GOTO.js new file mode 100644 index 0000000..7f0a421 --- /dev/null +++ b/data_structures_correct/GOTO.js @@ -0,0 +1,28 @@ +function GOTO() { + + GOTO.prototype.define = function GOTO() { + var model = scicos_model(); + model.sim = new ScilabString(["goto"]); + model.in = new ScilabDouble([-1]); + model.in2 = new ScilabDouble([-2]); + model.intyp = new ScilabDouble([-1]); + model.out = new ScilabDouble(); + model.out2 = new ScilabDouble(); + model.outtyp = new ScilabDouble([1]); + model.ipar = new ScilabDouble([1]); + model.opar = list(new ScilabString(["A"])); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([false, false]); + + var exprs = new ScilabString(["A"], [sci2exp(1)]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"GOTO\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([2, 1]), model, exprs, gr_i); + this.x.graphics.id = new ScilabString(["Goto"]); + return new BasicBlock(this.x) + } + + GOTO.prototype.details = function GOTO() { + return this.x; + } +} 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..51341e4 100644 --- a/dependencies.js +++ b/dependencies.js @@ -7,13 +7,10 @@ $.getScript('combined.js'); /* $.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/" @@ -420,6 +417,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]; 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" /> |