Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some updates to the JavaScript target
- pre.js is now included with the omc sources - It is now possible to use nodejs to run the generated code. An executable wrapper script is generated and the simulate() command now works - The XML files are embedded within the JS code now (just like we do for FMI) - We use -override arguments to pass stopTime,stepSize,tolerance and outputFormat instead of a full xml-file in a virtual file system git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@19251 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
Showing
9 changed files
with
67 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var Module = {}; | ||
|
||
Module['noInitialRun'] = true; | ||
Module['OpenModelica_readFile'] = function(fname) { | ||
return intArrayToString(FS.findObject(fname).contents); | ||
}; | ||
|
||
try { // Try to add an event listener like a webworker thread | ||
self.addEventListener('message', function(e) { | ||
var data = e.data; | ||
if (!data) return; | ||
var result = {}; | ||
try { | ||
shouldRunNow = true; | ||
var args = ['-override','outputFormat=csv,stopTime=' + data.stopTime +',tolerance=' + data.tolerance + ',stepSize=' + data.stepSize]; | ||
Module.callMain(args); | ||
result.csv = intArrayToString(FS.findObject(data.basename + "_res.csv").contents); | ||
result.status = "Simulation finished"; | ||
} catch(err) { | ||
result.status = "Simulation failed"; | ||
}; | ||
self.postMessage(result); | ||
}, false); | ||
} catch (e) { | ||
} |