- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » OMC Scripting
OMC Scripting
OMC Scripting
I tried this command
getParameterValue("BouncingBall","e")
on the BouncingBall model within share\doc\omc\testmodels:
model BouncingBall
parameter Real e=0.7 "coefficient of restitution";
...
and I received this error message:
[<interactive>:1:1-1:0:writable] Error: Class getParameterValue not found in scope <global scope> (looking for a function or record).
According to this web page (https://build.openmodelica.org/Document … alue.html), the getParameterValue function should work. What did I miss? Any help would be greatly appreciated. Thanks.
BTW, loadModel(Modelica) and loadFile(getInstallationDirectoryPath()+"/share/doc/omc/testmodels/BouncingBall.mo") both returned true beforehand.
Best regards,
Axel
Re: OMC Scripting
The doc is like this:
Code:
function getParameterValue
input TypeName class_;
input String parameterName;
output String parameterValue;
end getParameterValue;
Which means you need to call it like this:
Code:
getParameterValue(BouncingBall,"e"); // no quotes for the first argument which is of TypeName
For more examples of the API you can have a look here:
https://github.com/OpenModelica/OpenMod … active-API
Begin with files interactive_*.mos
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Re: OMC Scripting
BTW, what do you want to do with the API?
- adrpo
- 885 Posts
Re: OMC Scripting
Thanks for your help. I want to improve the SysML-Modelica transformation and make it work between OpenModelica 1.9.3 and MagicDraw 18.2 (https://github.com/SysMLModelicaIntegra … modelica).
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » OMC Scripting