Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

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. current/smile

Edited by: Capricorn2013 - Oct-19-13 22:59:08

Re: Adding a Modelica Library to my model

That's because is sqrt with small caps. Try that.

Cheers,
Adrian Pop/

Re: Adding a Modelica Library to my model

Oh thats correct indeed .. Thanks a ton current/smile

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.

There are 0 guests and 0 other users also viewing this topic
You are here: