- Index
- » Programming
- » Modelica Language
- » Error occured while flattening
Error occured while flattening
Error occured while flattening
Hiii
Im beginner to modelica.
Basically this code is to solve the derivative equation ( the variables involved are matrices)
I get this error! I don understand wat to do
model try1
extends Modelica.Math;
extends Modelica.SIunits;
parameter SI.Pressure Intake_Pressure = 100000 "The pressure of air at the intake";
parameter SI.Temperature Intake_Temperature = 298 "The temperature of air entering";
parameter SI.Temperature Wall_Temperature = 310 "The temperature at the pipe wall";
parameter SI.Denstiy Intake_Density = 1.186 "Density of the air entering";
parameter SI.Velocity Intake_Velocity = 346 "The local velocity of air entering";
parameter SI.Length Intake_Dia = 0.041 "The diameter of the intake pipe";
parameter SI.Length Intake_length = 1 "The length of the intake pipe";
parameter SI.Density Exit_Density = 1.2 "The density of air exiting ,could be into cylinder or atm";
parameter SI.Temperature Exit_Temperature = 340 "The exit temperature of the gas";
parameter Real no_of_vol = 5;
SI.Area Intake_area_pipe;
SI.MassFlowRate Intake_mfr;
SI.MassFlowRate Exit_mfr;
SI.InternalEnergy Stag_IntEnergy;
SI.Enthalpy Stag_Enthaly;
Real k_cylinder;
Real h_convection;
Real f_pipe;
Real z;
Real dl;
Real A1[3,3] = {{1,0,0},{0,dl,0},{0,0,1}};
Real A2[3,3] = {{dl,0,0},{0,dl,0},{0,0,dl}};
Real B[6,6,3,3];
Real Alpha[6,6];
Real Beta[6,6];
Real Delta[6,6];
Real W[3,1];
Real Rhs[3,1];
equation
Intake_area_pipe = pi / 4 * Intake_dia ^ 2;
Intake_mfr = Intake_Density * Intake_area_pipe * Intkae_Velocity;
for i in 1:6 loop
for k in 1:6 loop
for j in 0.5:5.5 loop
dl = Intake_length / no_of_vol;
W = {Alpha(1, i),Beta(1, j),Delta(1, i)};
z = i * k;
if z == 1 and z == 36 then
B[i,k] = A1;
elseif i == k then
B[i,k] = A2;
else
B[i,k] = zeros(3, 3);
end if;
Alpha(1, 1) = 1.186;
ALpha(1, 6) = 1.204;
Beta(0, -0.5) = 20;
Beta(0, 5.5) = 28;
Delta(1, 1) = 718 * Alpha(1, 1) * Intake_Temperature + (0.5 * Beta(0.0 - 0.5) ^ 2) / Alpha(1, 1) * Intake_area_pipe;
Delta(1, 6) = 718 * ALpha(1, 6) * Exit_Temperature + (0.5 * Beta(0, 5.5) ^ 2) / Alpha(1, 6) * Intake_area_pipe;
Rhs = {Beta(1, j - 1) - Beta(1, j),0.4 * Intake_are_pipe * ({Alpha(1, i) * Delta(1, i)} - {Alpha(1, i + 1) * Delta(1, i + 1)}) - 0.8 * ({Beta(1, j) ^ 2 / Alpha(1, i + 1)} - {Beta(1, j - 1) ^ 2 / Alpha(1, i)}),1.4 * ({Beta(1, j) * Delta(1, i)} - {Beta(1, j - 1) * Delta(1, i - 1)}) - 0.2 / Intake_area_pipe ^ 2 * ({Beta(1, j) ^ 3 / Alpha(1, i) ^ 2} - {Beta(1, j - 1) ^ 3 / Alpha(1, i - 1) ^ 2})};
B * der(W) = Rhs;
end for;
end for;
end for;
end try1;
Kindly help!
Thanks
- Index
- » Programming
- » Modelica Language
- » Error occured while flattening