- Index
- » Users
- » Capricorn2013
- » Profile
Posts
Posts
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 ?
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 ?
thanks a lot
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];
Hi,
Can someone please tell me how to declare an array in modelica? What is the syntax for it? kindly give an example.
Thanks
Thanks a lot, it worked
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
Oh thats correct indeed .. Thanks a ton
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.
- Index
- » Users
- » Capricorn2013
- » Profile