Changes

Jump to navigation Jump to search
Created page with "== GNU Octave scripting for OpenModelica == GNU Octave scripting OpenModelica interface using ZEROMQ based on OMMatlab available at: [https://github.com/OpenModelica/OMMatlab..."
== GNU Octave scripting for OpenModelica ==

GNU Octave scripting OpenModelica interface using ZEROMQ based on OMMatlab available at: [https://github.com/OpenModelica/OMMatlab/ github.com/OpenModelica/OMMatlab/].

OpenModelica is an open-source Modelica-based modeling and simulation environment intended for industrial and academic usage. It is often used for modeling, simulating, optimizing, and analyzing complex dynamic systems.

== Source Code ==

Source code for this class is available at: [https://github.com/PR-DC/PRDC_OMOctave github.com/PR-DC/PRDC_OMOctave]

== Requirements ==

Provided interface is partially tested with GNU Octave 6.2.0.

== Installation ==

Clone the repository and add the installation directory to Octave PATH. For Example

<syntaxhighlight lang="octave">
>> addpath('C:\OMOctave\')
</syntaxhighlight>

You can also directly use the OMOctave package directly from the directory where you have cloned, without need to perform the above steps. But the package cannot be used globally.

== Usage ==

<syntaxhighlight lang="octave">
>> omc = OMOctave();
>> omc.sendExpression("getVersion()")
ans =
{
[1,1] = OpenModelica v1.16.5 (64-bit)
}
>> omc.sendExpression("model a end a;")
ans =
{
[1,1] = a
}
>> omc.sendExpression('loadFile("C:/Program Files/OpenModelica1.16.5-64bit/OMSens/resource/BouncingBall.mo")')
ans =
{
[1,1] = true
}
>> omc.sendExpression("getClassNames()")
ans =
{
[1,1] = BouncingBall
[1,2] = a
}
>> omc.sendExpression("simulate(BouncingBall)")
ans =

scalar structure containing the fields:

resultFile = C:/Users/User/Desktop/OMOctave/BouncingBall_res.mat
simulationOptions = startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'BouncingBall', options = '', outputFormat = 'mat', variabl
eFilter = '.*', cflags = '', simflags = ''
messages = LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
LOG_SUCCESS | info | The simulation finished successfully.

timeFrontend = 0.0065355
timeBackend = 0.0096361
timeSimCode = 0.0013927
timeTemplates = 0.0318059
timeCompile = 8.706928700000001
timeSimulation = 0.3084547
timeTotal = 9.0651016
>> omc.close();
</syntaxhighlight>

To see the list of available OpenModelicaScripting API see: [https://www.openmodelica.org/doc/OpenModelicaUsersGuide/latest/scripting_api.html openmodelica.org/doc/OpenModelicaUsersGuide/latest/scripting_api.html]

== Discussion ==

Discussion about this class is avialable at [https://octave.discourse.group/t/openmodelica-interface-for-octave/936 Discourse].

== Author and Licensing ==

Author: Miloš Petrašinović <mpetrasinovic@pr-dc.com>

[https://pr-dc.com PR-DC.COM]

PR-DC, Aerospace Company, Republic of Serbia

Distributed under the GNU General Public License v3.0 or later license.

[[Category:User Codes]]

Navigation menu