diff options
author | ASP1234 | 2016-07-05 03:55:44 +0000 |
---|---|---|
committer | ASP1234 | 2016-07-05 03:55:44 +0000 |
commit | fc854a637d437056a60bed2ebf10df29c4407f89 (patch) | |
tree | baef3e21002cdc68ade61d7fe31c207acedf1b7f /dependencies.js | |
parent | 463b44ee3287be82505bdb95ea82185c5a560318 (diff) | |
download | xcos-on-web-fc854a637d437056a60bed2ebf10df29c4407f89.tar.gz xcos-on-web-fc854a637d437056a60bed2ebf10df29c4407f89.tar.bz2 xcos-on-web-fc854a637d437056a60bed2ebf10df29c4407f89.zip |
Implement Ground Block
Diffstat (limited to 'dependencies.js')
-rw-r--r-- | dependencies.js | 129 |
1 files changed, 100 insertions, 29 deletions
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 |