- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Using Modelica Standard Functions /...
Using Modelica Standard Functions / Units
Using Modelica Standard Functions / Units
Hi all,
I'm still relatively new to openmodelica and have been finding ways around this problem for some time, but its finally come to a head and I need to figure it out.
Whenever I try to use any modelica standard library elements (i.e. SIunits, Math functions, etc.) i have an error message when I attempt to run the simulation.
For example:
model nonlinearpendulum
Real theta;
Real omega;
parameter Real L=2;
constant Real g=Modelica.Constants.g_n;
equation
der(theta) = omega;
der(omega) = -(g/L)*Modelica.Math.sin(theta);
end nonlinearpendulum;
simulate(nonlinearpendulum, starTime = 0, stopTime = 10)
record SimulationResult
resultFile = "Simulation failed.
Error: Variable Modelica.Constants.g_n not found in scope nonlinearpendulum
Error: Error occured while flattening model nonlinearpendulum
"
end SimulationResult;
I've tried extending the call to go to a higher level i.e. ModelicaLibrary.Modelica.Math.sin, but it still fails with the same message.
Any ideas on what I need to do to fix this so I can use these elements?
Thanks!
Re: Using Modelica Standard Functions / Units
Does list(Modelica.Constants) give you any output? I suspect the Modelica library is not loaded; try running:
Code:
loadModel(Modelica);
simulate(...);
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Using Modelica Standard Functions /...