$.getScript('math.js'); $.getScript('combined.js'); // @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]); } } }); */ function AfficheBlock() { 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.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; this.dState = options.model.dstate; this.oDState = list(); this.equations = list(); // Not Known this.blockName = "AfficheBlock"; this.blockElementName = arguments.callee.caller.name; } } function BigSom() { if (arguments.length > 0) { var options = arguments[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 = "+"; // 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 = list(); // Not Known this.blockName = "BigSom"; this.blockElementName = arguments.callee.caller.name; } } function EventInBlock() { if (arguments.length > 0) { var options = arguments[0]; this.blockType = getData(options.model.blocktype)[0]; this.connectable = options.connectable; // Not Known 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.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; this.equations = list(); // Not Known this.blockName = "EventInBlock"; this.blockElementName = arguments.callee.caller.name; } } function EventOutBlock() { if (arguments.length > 0) { var options = arguments[0]; this.blockType = getData(options.model.blocktype)[0]; this.connectable = options.connectable; // Not Known 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.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; this.equations = list(); // Not Known this.blockName = "EventOutBlock"; this.blockElementName = arguments.callee.caller.name; } } function RoundBlock() { 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 = list(); // Not Known this.blockName = "RoundBlock"; this.blockElementName = arguments.callee.caller.name; } } 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]; } else if (arguments.length == 1) { var a = arguments[0]; if (typeof a.length === 'undefined') { return [0]; } else { return math.zeros(math.size(a)); } } else { var args = Array.prototype.slice.call(arguments); return math.zeros(args); } } function ones() { if (arguments.length == 0) { return [1]; } else if (arguments.length == 1) { var a = arguments[0]; if (typeof a.length === 'undefined') { return [1]; } else { return math.ones(math.size(a)); } } else { var args = Array.prototype.slice.call(arguments); return math.ones(args); } } function size() { if (arguments.length == 1) return math.size(arguments[0]) else { var res = math.size(arguments[0]); if (res.length == 1) res.push(1); switch (arguments[1]) { case 'r': case 1: return res[0]; case 'c': case 2: return res[1]; case '*': return res[0] * res[1]; default: return res[arguments[1]]; } } } function inverse() { var str = "[[" var arg = arguments[0]; arg = arg.replace(/ /g, "],["); str += arg + "]]"; var array = JSON.parse(str); return array; }