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
  • Index
  • » Users
  • » Capricorn2013
  • » Profile

Posts

Posts

Oct-27-13 21:57:23
what is syntax for summation?!
Category: Programming

i have an  array r[3]={1,2,3} ...
and i want to do the summation of the elements of this array...
what is the syntax for summation ?

Oct-27-13 21:14:55
how to declare array in modelica language
Category: Programming

Can you also please tell me about matrix.. what is the proper syntax for declaring a matrix with 2 rows and 3 columns .. and values in first row being 1,2,3 and second row 4,5,6 ?

Oct-27-13 21:11:01
how to declare array in modelica language
Category: Programming

thanks a lot current/smile

Oct-27-13 21:05:58
how to declare array in modelica language
Category: Programming

okay thanks .. and if i need to put the 3 values then should i use the following syntax??

Real r[3] =[1.1, 2.1, 3.1];

Oct-27-13 21:01:15
how to declare array in modelica language
Category: Programming

Hi,

Can someone please tell me how to declare an array in modelica? What is the syntax for it? kindly give an example.

Thanks

Oct-20-13 16:16:28
How to give an initial value
Category: Programming

Thanks a lot, it worked current/smile

Oct-20-13 15:33:06
How to give an initial value
Category: Programming

Hi,

I have written the following code in Openmodelica:

***************************************************************
model Tank
  parameter Real Rho;
  parameter Real A;
  parameter Real Aout;
  parameter Real g;
  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;

model Tank1
  Tank MyTank1(Rho = 1000, A = 1, Aout = 0.0025, g = 9.81);
  Tank MyTank2(Rho = 1000, A = 2, Aout = 0.0025, g = 9.81);
end Tank1;

***************************************************************

As it can be seen, I have given an initial value of 2.1 to the variable h.. However, when i simulate it, the value of variable h starts from 0 .. i believe it should start from 2.1 .. can anyone tell me what am I doing wrong here.

Thanks

Oct-19-13 23:01:14
Adding a Modelica Library to my model
Category: Programming

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

Oct-19-13 22:50:05
Adding a Modelica Library to my model
Category: Programming

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

  • Index
  • » Users
  • » Capricorn2013
  • » Profile
You are here: