- Index
- » Programming
- » Modelica Language
- » Adding a Modelica Library to my model
Adding a Modelica Library to my model
Adding a Modelica Library to my model
Hi,
I have just started programming in modelica using OpenModelica. I am a beginner so please bear with me. I have written the following code in OMEdit:
***********************************************
model Tank
parameter Real Rho = 1000;
parameter Real A = 1;
parameter Real Aout = 0.0025;
parameter Real g = 9.81;
Real mdot_In = 20;
Real mdot_Out;
Real m;
Real h(start = 2.1);
equation
der(m) = mdot_In - mdot_Out;
m = A * h * Rho;
mdot_Out = Rho * Aout * Sqrt(2 * g * h);
end Tank;
*******************************
I am getting an error that Sqrt is not in scope. I understand that I have to add the library Modelica.Math .. But how should I do it? Should i type it somewhere inside my code? ..
To be precise, this is what the error is ""[<interactive>:13:3-13:42:writable] Error: Class Sqrt not found in scope Tank (looking for a function or record).
Error: Error occurred while flattening model Tank
""
Also if someone can explain whats the difference between class and model in plain English with some example, that would be great.
Re: Adding a Modelica Library to my model
That's because is sqrt with small caps. Try that.
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Re: Adding a Modelica Library to my model
For your other question, the best is to read the Modelica specificaiton section 4.6 Specialized Classes,
https://modelica.org/documents/ModelicaSpec33.pdf
Adeel.
- adeas
- 454 Posts
- Index
- » Programming
- » Modelica Language
- » Adding a Modelica Library to my model