Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add userguide to OMMatlab and OMJulia
- Loading branch information
Showing
4 changed files
with
167 additions
and
0 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,82 @@ | ||
OpenModelica Julia Interface | ||
============================= | ||
|
||
This chapter describes the OpenModelica Julia integration facilities. | ||
|
||
- OMJulia – the OpenModelica Julia scripting interface, see :ref:`OMJulia`. | ||
|
||
.. _OMJulia: | ||
|
||
OMJulia – OpenModelica Julia Interface | ||
---------------------------------------- | ||
|
||
OMJulia – OpenModelica Julia API is a free, open source, highly | ||
portable Julia based interactive session handler for Modelica | ||
scripting. It provides the modeler with components for creating a | ||
complete Modelica modeling, compilation and simulation environment based | ||
on the latest OpenModelica library standard available. OMPython is | ||
architectured to combine both the solving strategy and model building. | ||
So domain experts (people writing the models) and computational | ||
engineers (people writing the solver code) can work on one unified tool | ||
that is industrially viable for optimization of Modelica models, while | ||
offering a flexible platform for algorithm development and research. | ||
OMJulia is not a standalone package, it depends upon the | ||
OpenModelica installation. | ||
|
||
OMJulia is implemented in Julia and depends on | ||
ZeroMQ - high performance asynchronous messaging library and it supports the Modelica | ||
Standard Library version 3.2 that is included in starting with | ||
OpenModelica 1.9.2. | ||
|
||
The Development is in progress and will be soon available.At the moment | ||
a prototype of OMJulia is completed where the users will be able to import the | ||
OMJulia package in Julia and start to interact with omc through API calls | ||
|
||
Current Prototype | ||
~~~~~~~~~~~~~~~~~ | ||
The current version of the OMJulia package contains the following features: | ||
|
||
- import the OMJulia package | ||
- Connect with omc compiler through ZMQ sockets | ||
- Able to interact with omc compiler through list of API calls available from OpenModelicaScripting | ||
- All the API calls are communicated with the help of sendExpression method implemented in Julia | ||
- the results are returned as strings. | ||
|
||
Test Commands | ||
~~~~~~~~~~~~~ | ||
|
||
To get started, create a OMJulia session object: | ||
|
||
>>> using OMJulia | ||
>>> omc= OMJulia() | ||
>>> omc.sendExpression("getVersion()") | ||
'v1.13.0-dev-531-gde26b558a (64-bit)' | ||
>>> omc.sendExpression("loadModel(Modelica)") | ||
'True' | ||
>>> omc.sendExpression("model a Real s; equation s=sin(10*time); end a;") | ||
'{a}' | ||
>>> omc.sendExpression("simulate(a)") | ||
>>> omc.sendExpression("plot(s)") | ||
'true' | ||
|
||
.. figure :: media/sineplot.png | ||
:name: sineplot | ||
Currently this is an incomplete Beta release. In the final release the OMJulia interface is planned to implement | ||
the more advanced API calls below where the users will have the ability to perform interactive simulation | ||
and analysis similar to the enhanced OMPython features. | ||
|
||
List of Planned API support | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
- getQuantities() | ||
- getContinuous() | ||
- getInputs() | ||
- getOutputs() | ||
- getParameters() | ||
- getSimulationOptions() | ||
- getSolutions() | ||
- setInputs() | ||
- setParameters() | ||
- setSimulationOptions() | ||
|
||
With the above list of API calls implemented, the users can have more control over the result types, returned in Julia format. |
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,83 @@ | ||
OpenModelica Matlab Interface | ||
============================= | ||
|
||
This chapter describes the OpenModelica Matlab integration facilities. | ||
|
||
- OMMatlab – the OpenModelica Matlab scripting interface, see :ref:`ommatlab`. | ||
|
||
.. _ommatlab: | ||
|
||
OMMatlab – OpenModelica Matlab Interface | ||
---------------------------------------- | ||
|
||
OMMatlab – OpenModelica Matlab API is a free, open source, highly | ||
portable matlab based interactive session handler for Modelica | ||
scripting. It provides the modeler with components for creating a | ||
complete Modelica modeling, compilation and simulation environment based | ||
on the latest OpenModelica library standard available. OMPython is | ||
architectured to combine both the solving strategy and model building. | ||
So domain experts (people writing the models) and computational | ||
engineers (people writing the solver code) can work on one unified tool | ||
that is industrially viable for optimization of Modelica models, while | ||
offering a flexible platform for algorithm development and research. | ||
OMMatlab is not a standalone package, it depends upon the | ||
OpenModelica installation. | ||
|
||
OMMatlab is implemented in Matlab and depends on | ||
ZeroMQ - high performance asynchronous | ||
messaging library and it supports the Modelica | ||
Standard Library version 3.2 that is included in starting with | ||
OpenModelica 1.9.2. | ||
|
||
The Development is in progress and will be soon available.At the moment | ||
a prototype of OMMatlab is completed where the users will be able to import the | ||
OMMatlab package in Matlab and start to interact with omc through API calls | ||
|
||
Current Prototype | ||
~~~~~~~~~~~~~~~~~ | ||
The current version of the OMMatlab pacakge contains the following features: | ||
|
||
- import the OMMatlab package in Matlab | ||
- Connect with omc compiler through zmq sockets | ||
- Able to interact with omc compiler through list of APIS available from OpenModelicaScripting | ||
- All the API calls are communicated with the help of sendExpression method implemented in matlab pacakge | ||
- the results are returned as strings. | ||
|
||
Test Commands | ||
~~~~~~~~~~~~~ | ||
|
||
To get started, create a OMMatlab session object: | ||
|
||
>>> import OMMatlab.* | ||
>>> omc= OMMatlab() | ||
>>> omc.sendExpression("getVersion()") | ||
'v1.13.0-dev-531-gde26b558a (64-bit)' | ||
>>> omc.sendExpression("loadModel(Modelica)") | ||
'true' | ||
>>> omc.sendExpression("model a Real s; equation s=sin(10*time); end a;") | ||
'{a}' | ||
>>> omc.sendExpression("simulate(a)") | ||
>>> omc.sendExpression("plot(s)") | ||
'true' | ||
|
||
.. figure :: media/sineplot.png | ||
:name: sineplot | ||
Currently this is an incomplete Beta release. In the final release the OMMatlab interface | ||
is planned to implement the more advanced API calls below where the users will have the ability | ||
to perform interactive simulation and analysis similar to the enhanced OMPython features. | ||
|
||
List of Planned API support | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
- getQuantities() | ||
- getContinuous() | ||
- getInputs() | ||
- getOutputs() | ||
- getParameters() | ||
- getSimulationOptions() | ||
- getSolutions() | ||
- setInputs() | ||
- setParameters() | ||
- setSimulationOptions() | ||
|
||
With the above list of API calls implemented, the users can have more control over the result types, returned in Matlab format. |