Commit ef6b1944 authored by i.elizarov's avatar i.elizarov
Browse files

Worked on the basic components of the fluid model for the side panel: model...

Worked on the basic components of the fluid model for the side panel: model for the array of channels is complete
parent 2699b212
function Odd_even "Returns true if the argument is odd; otherwise, returns false"
input Integer x;
output Boolean result;
algorithm
result := if rem(x, 2) == 0 then true else false;
end Odd_even;
model Piping_local "Sections of channels"
package Medium =
Modelica.Media.Water.ConstantPropertyLiquidWater;
parameter Modelica.SIunits.Height channel_height = 40e-3 "Height of the channels (CH)";
parameter Modelica.SIunits.Length channel_cross_section_width = 5e-3 "Width of cross-section of the channels";
parameter Modelica.SIunits.Length channel_horizontal_lenght_middle = 42e-3 "Horizontal length of the middle channel (HLM)";
parameter Modelica.SIunits.Length channel_horizontal_lenght_right_left = 29e-3 "Horizontal length of the right and left channel (HLRL)";
parameter Modelica.SIunits.Height channel_cross_section_height = 1e-3 "Height of cross-section of the channels";
parameter Modelica.SIunits.Height channel_roughness = 0.015e-3 "Rougness of wet surface";
parameter Modelica.SIunits.Density novec_density = 1600 "NOVEC density";
parameter Integer channel_number = 22 "Vertical array of channels";
parameter Real epsilon_left_right(min = 0)= 0.5 "Local hydraulic resistance coefficient";
parameter Real epsilon_left_right_middle(min = 0)= 0.5 "Local hydraulic resistance coefficient";
Modelica.Fluid.Pipes.StaticPipe pipe_left[channel_number](each allowFlowReversal = false, each crossArea = channel_cross_section_width * channel_cross_section_height,
each final isCircular = false,
each length = channel_height,
each roughness = channel_roughness,
each perimeter = 2*channel_cross_section_width + 2*channel_cross_section_height,
redeclare package Medium=Medium) annotation(
Placement(visible = true, transformation(origin = {-40, 0}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.StaticPipe pipe_middle_left[channel_number](each allowFlowReversal = false, each crossArea = channel_cross_section_width * channel_cross_section_height,
each final isCircular = false,
each length = channel_height,
each roughness = channel_roughness,
each perimeter = 2*channel_cross_section_width + 2*channel_cross_section_height,
redeclare package Medium=Medium) annotation(
Placement(visible = true, transformation(origin = {-12, 0}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.StaticPipe pipe_middle_right[channel_number](each allowFlowReversal = false, each crossArea = channel_cross_section_width * channel_cross_section_height,
each final isCircular = false,
each length = channel_height,
each roughness = channel_roughness,
each perimeter = 2*channel_cross_section_width + 2*channel_cross_section_height,
redeclare package Medium=Medium) annotation(
Placement(visible = true, transformation(origin = {18, 0}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.StaticPipe pipe_right[channel_number](each allowFlowReversal = false, each crossArea = channel_cross_section_width * channel_cross_section_height,
each final isCircular = false,
each length = channel_height,
each roughness = channel_roughness,
each perimeter = 2*channel_cross_section_width + 2*channel_cross_section_height,
redeclare package Medium=Medium) annotation(
Placement(visible = true, transformation(origin = {50, 0}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
inner Modelica.Fluid.System system(m_flow_small = 0.008e-3, m_flow_start = 0.008) annotation(
Placement(visible = true, transformation(origin = {130, 90}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_a port_a1(redeclare package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {-80, 100}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-74, 98}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_a port_a2(redeclare package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {-30, 100}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-20, 100}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_a port_a3(redeclare package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {30, 100}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {36, 100}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_a port_a4(redeclare package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {80, 100}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {82, 100}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_b port_b1(redeclare package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {-82, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-82, -98}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_b port_b2(redeclare package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {-30, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-32, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_b port_b3(redeclare package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {30, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {38, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_b port_b4(redeclare package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {80, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {80, -98}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Fittings.SimpleGenericOrifice loc_res_left[channel_number-1](each diameter = sqrt(4 * channel_cross_section_width * channel_cross_section_height / 3.14), each zeta = epsilon_left_right, redeclare package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {-50, -30}, extent = {{-8, -8}, {8, 8}}, rotation = -90)));
Modelica.Fluid.Fittings.SimpleGenericOrifice loc_res_middle_left[channel_number-1](each diameter = sqrt(4 * channel_cross_section_width * channel_cross_section_height / 3.14), each zeta = epsilon_left_right_middle, redeclare package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {-24, -30}, extent = {{-8, -8}, {8, 8}}, rotation = -90)));
Modelica.Fluid.Fittings.SimpleGenericOrifice loc_res_middle_right[channel_number-1](each diameter = sqrt(4 * channel_cross_section_width * channel_cross_section_height / 3.14), each zeta = epsilon_left_right_middle, redeclare package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {32, -30}, extent = {{-8, -8}, {8, 8}}, rotation = -90)));
Modelica.Fluid.Fittings.SimpleGenericOrifice loc_res_right[channel_number-1](each diameter = sqrt(4 * channel_cross_section_width * channel_cross_section_height / 3.14), each zeta = epsilon_left_right, redeclare package Medium = Medium) annotation(
Placement(visible = true, transformation(origin = {68, -28}, extent = {{-8, -8}, {8, 8}}, rotation = -90)));
equation
for i in 1:channel_number - 1 loop
if Odd_even(i) then
connect(pipe_left[i].port_b, loc_res_left[i].port_a);
connect(loc_res_left[i].port_b, pipe_left[i + 1].port_a);
connect(pipe_middle_left[i].port_b, loc_res_middle_left[i].port_a);
connect(loc_res_middle_left[i].port_b, pipe_middle_left[i + 1].port_a);
connect(pipe_middle_right[i].port_b, loc_res_middle_right[i].port_a);
connect(loc_res_middle_right[i].port_b, pipe_middle_right[i+1].port_a);
connect(pipe_right[i].port_b, loc_res_right[i].port_a);
connect(loc_res_right[i].port_b, pipe_right[i+1].port_a);
else
connect(pipe_left[i].port_b, loc_res_left[i].port_a);
connect(loc_res_left[i].port_b, pipe_left[i + 1].port_a);
connect(pipe_middle_left[i].port_b, loc_res_middle_left[i].port_a);
connect(loc_res_middle_left[i].port_b, pipe_middle_left[i + 1].port_a);
connect(pipe_middle_right[i].port_b, loc_res_middle_right[i].port_a);
connect(loc_res_middle_right[i].port_b, pipe_middle_right[i+1].port_a);
connect(pipe_right[i].port_b, loc_res_right[i].port_a);
connect(loc_res_right[i].port_b, pipe_right[i+1].port_a);
end if;
end for;
connect(pipe_left[channel_number].port_b, port_b1) annotation(
Line(points = {{-40, -10}, {-40, -56}, {-82, -56}, {-82, -100}}, color = {0, 127, 255}));
connect(pipe_middle_left[channel_number].port_b, port_b2) annotation(
Line(points = {{-12, -10}, {-14, -10}, {-14, -70}, {-30, -70}, {-30, -100}}, color = {0, 127, 255}));
connect(pipe_middle_right[channel_number].port_b, port_b3) annotation(
Line(points = {{18, -10}, {18, -74}, {30, -74}, {30, -100}}, color = {0, 127, 255}));
connect(pipe_right[channel_number].port_b, port_b4) annotation(
Line(points = {{50, -10}, {50, -62}, {80, -62}, {80, -100}}, color = {0, 127, 255}));
connect(port_a1, pipe_left[1].port_a) annotation(
Line(points = {{-80, 100}, {-80, 28}, {-40, 28}, {-40, 10}}));
connect(port_a2, pipe_middle_left[1].port_a) annotation(
Line(points = {{-30, 100}, {-30, 46}, {-12, 46}, {-12, 10}}));
connect(port_a3, pipe_middle_right[1].port_a) annotation(
Line(points = {{30, 100}, {30, 56}, {18, 56}, {18, 10}}));
connect(port_a4, pipe_right[1].port_a) annotation(
Line(points = {{80, 100}, {80, 40}, {50, 40}, {50, 10}}));
annotation(
uses(Modelica(version = "3.2.3")),
Icon(graphics = {Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}})}),
Diagram(graphics = {Text(origin = {-77, 0}, extent = {{-17, 10}, {17, -10}}, textString = "N elements")}));
end Piping_local;
model banana_simple
package Medium =
Modelica.Media.Water.ConstantPropertyLiquidWater;
Piping_simple piping(channel_number = 22) annotation(
Placement(visible = true, transformation(origin = {-6, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system(m_flow_start = 0.008) annotation(
Placement(visible = true, transformation(origin = {-70, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.FixedBoundary boundary(redeclare package Medium = Medium, nPorts = 4, p = 2e5) annotation(
Placement(visible = true, transformation(origin = {-44, 32}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.FixedBoundary boundary1(redeclare package Medium = Medium, nPorts = 4, p = 1e5) annotation(
Placement(visible = true, transformation(origin = {-44, -34}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(boundary.ports[1], piping.port_a1) annotation(
Line(points = {{-34, 32}, {-14, 32}, {-14, 6}}, color = {0, 127, 255}));
connect(piping.port_a2, boundary.ports[2]) annotation(
Line(points = {{-8, 6}, {-8, 32}, {-34, 32}}, color = {0, 127, 255}));
connect(piping.port_a3, boundary.ports[3]) annotation(
Line(points = {{-2, 6}, {-2, 32}, {-34, 32}}, color = {0, 127, 255}));
connect(piping.port_a4, boundary.ports[4]) annotation(
Line(points = {{2, 6}, {2, 32}, {-34, 32}}, color = {0, 127, 255}));
connect(boundary1.ports[1], piping.port_b1) annotation(
Line(points = {{-34, -34}, {-14, -34}, {-14, -14}}, color = {0, 127, 255}));
connect(piping.port_b2, boundary1.ports[2]) annotation(
Line(points = {{-10, -14}, {-10, -34}, {-34, -34}}, color = {0, 127, 255}));
connect(piping.port_b3, boundary1.ports[3]) annotation(
Line(points = {{-2, -14}, {-2, -34}, {-34, -34}}, color = {0, 127, 255}));
connect(piping.port_b4, boundary1.ports[4]) annotation(
Line(points = {{2, -14}, {2, -34}, {-34, -34}}, color = {0, 127, 255}));
annotation(
uses(Modelica(version = "3.2.3")),
Diagram(graphics = {Text(origin = {41, 70}, extent = {{-39, 12}, {39, -12}}, textString = "Piping_simple")}));
end banana_simple;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment