Skip to content

Commit

Permalink
add userguide to OMMatlab and OMJulia
Browse files Browse the repository at this point in the history
  • Loading branch information
arun3688 authored and sjoelund committed Mar 23, 2018
1 parent 742335f commit dbc28d8
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 0 deletions.
2 changes: 2 additions & 0 deletions UsersGuide/source/index.rst
Expand Up @@ -35,6 +35,8 @@ Generated on |date| at |time|
emscripten
interop_c_python
ompython
ommatlab
omjulia
scripting_api
omchelptext
simulationflags
Expand Down
Binary file added UsersGuide/source/media/sineplot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions UsersGuide/source/omjulia.rst
@@ -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.
83 changes: 83 additions & 0 deletions UsersGuide/source/ommatlab.rst
@@ -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.

0 comments on commit dbc28d8

Please sign in to comment.