- Index
- » Users
- » Gorzki
- » Profile
Posts
Posts
Hello OM users,
I am writing, because maybe somebody is familiar with this topic and will help.
I tried to develop a model of cross flow heat exchanger, but the checker always tells me that the system is under-constrained (28 variables and 26 equations) I have no idea where is the problem, so I am attaching my code below:
within HeatPump;
model Condenser
// For 100% Vapour- 1 phase of Refr.
//outer Modelica.Fluid.System system "System properties";
import SI = Modelica.SIunits;
import IF = Modelica.Fluid.Interfaces;
//parameter SI.MassFlowRate m_flow_min =0.001 " Smallest Mass flow rate in model";
replaceable package Medium_1 = Modelica.Media.Air.SimpleAir constrainedby
Modelica.Media.Interfaces.PartialMedium "Fluid 1"
annotation(choicesAllMatching);
replaceable package Medium_2 = Modelica.Media.R134a.R134a_ph constrainedby
Modelica.Media.Interfaces.PartialMedium "Fluid 2"
annotation(choicesAllMatching);
// Declaration of the state of the both Fluid
Medium_1.ThermodynamicState State_1;
Medium_2.ThermodynamicState State_2;
parameter SI.Area Aref = 1 "Tube with refrigerant contact area";
parameter SI.CoefficientOfHeatTransfer href = 1;
parameter SI.CoefficientOfHeatTransfer hair=1;
parameter SI.Area Aair = 1 "Air with condenser contact area";
parameter SI.Area Ao = 1;
parameter SI.Efficiency etao = 1;
Modelica.Fluid.Interfaces.FluidPort_a port_a(redeclare package Medium = Medium_2) "Inlet refrigerant" annotation(
Placement(visible = true, transformation(extent = {{-110, -10}, {-90, 10}}, rotation = 0), iconTransformation(extent = {{-10, 88}, {12, 110}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_b port_b(redeclare package Medium = Medium_2) "Outlet refrigerant" annotation(
Placement(visible = true,transformation(extent = {{90, -10}, {110, 10}}, rotation = 0), iconTransformation(extent = {{92, -10}, {114, 12}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_a port_a1(redeclare package Medium = Medium_1) "Inlet air" annotation(
Placement(visible = true,transformation(extent = {{-10, 90}, {10, 110}}, rotation = 0), iconTransformation(origin = {-99, 1}, extent = {{-11, -11}, {11, 11}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_b port_b1(redeclare package Medium = Medium_1) "Outlet air" annotation(
Placement(visible = true,transformation(origin = {1.33227e-15, -100}, extent = {{-10, 10}, {10, -10}}, rotation = 0), iconTransformation(origin = {1, -99}, extent = {{-11, -11}, {11, 11}}, rotation = 0)));
Real Cair = port_a1.m_flow * Medium_1.specificHeatCapacityCp(State_1);
Real Cref = port_a.m_flow * Medium_2.specificHeatCapacityCp(State_2);
Real Cmin = min(Cair, Cref);
Real Cmax = max(Cair, Cref);
Real Cx = Cmin / Cmax;
Real UA = 1/(1 / href * Aref + 1 / etao * hair * Ao);
Real NTU = UA / Cmin;
Real eps1 = 1 - exp(1 / Cx * NTU ^ 0.22 * (exp(-Cx * NTU ^ 0.78) - 1));
Real Q = eps1 * Cmin * (Medium_2.temperature(State_2)-Medium_1.temperature(State_1));
equation
State_1=Medium_1.setState_phX(
port_a1.p,
port_a1.h_outflow,
port_a1.Xi_outflow);
State_2=Medium_2.setState_phX(
port_a.p,
port_a.h_outflow,
port_a.Xi_outflow);
port_b.h_outflow = port_a.h_outflow + (Q/port_a.m_flow);
port_b1.h_outflow = port_a1.h_outflow+ (Q/port_a1.m_flow);
0=port_a.m_flow+port_b.m_flow;
0=port_a1.m_flow+port_b1.m_flow;
port_a.p=port_b.p;
port_a1.p=port_b1.p;
port_a1.Xi_outflow=port_b1.Xi_outflow;
port_a.Xi_outflow=port_b.Xi_outflow;
port_a1.C_outflow=port_b1.C_outflow;
port_a.C_outflow=port_b.C_outflow;
annotation(
Icon(graphics = {Rectangle(fillPattern = FillPattern.Solid, extent = {{-100, 80}, {100, -80}}), Rectangle(origin = {1, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-101, 6}, {99, -14}}), Rectangle(origin = {1, 24}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-101, 6}, {99, -14}}), Rectangle(origin = {1, -18}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-101, 6}, {99, -14}}), Rectangle(origin = {1, -56}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-101, 6}, {99, -14}}), Rectangle(origin = {87, 0}, rotation = 90, fillPattern = FillPattern.Solid, extent = {{-81, 2}, {81, -14}}), Rectangle(origin = {-99, 0}, rotation = 90, fillPattern = FillPattern.Solid, extent = {{-81, 2}, {81, -14}})}));
end Condenser;
all the parameters are just for an example.
Maybe someone have made such a model and have some advice? Thanks in advance.
I also made a test bench for that:
within HeatPump;
model Condenser_Test
replaceable package Medium_1= Modelica.Media.Air.MoistAir;
replaceable package Medium_2=Modelica.Media.R134a.R134a_ph;
Condenser condenser1 annotation(
Placement(visible = true, transformation(origin = {-2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_h boundary(
redeclare package Medium=Medium_2,h = 280,
m_flow = 0.005,
nPorts = 1,
use_h_in = false, use_m_flow_in = false) annotation(
Placement(visible = true, transformation(origin = {-70, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_h boundary2(
redeclare package Medium = Medium_1,
h = 76.9,
m_flow = 0.05,
nPorts = 1,
use_m_flow_in = false) annotation(
Placement(visible = true, transformation(origin = {-2, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Sources.Boundary_pT boundary4(
redeclare package Medium=Medium_2, T = 280, nPorts = 1, p = 1e5,
use_T_in = false,
use_X_in = false, use_p_in = false) annotation(
Placement(visible = true, transformation(origin = {48, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary5(
redeclare package Medium=Medium_1, T = 278, p = 1e5,
use_T_in = false,
use_X_in = false, use_p_in = false) annotation(
Placement(visible = true, transformation(origin = {-2, -52}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
inner Modelica.Fluid.System system(allowFlowReversal = false, energyDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial, m_flow_start = 0.005, massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) annotation(
Placement(visible = true, transformation(origin = {70, 72}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(condenser1.port_b1, boundary5.ports[1]) annotation(
Line(points = {{-2, -10}, {-2, -10}, {-2, -42}, {-2, -42}}, color = {0, 127, 255}));
connect(condenser1.port_b, boundary4.ports[1]) annotation(
Line(points = {{8, 0}, {36, 0}, {36, 0}, {38, 0}}, color = {0, 127, 255}));
connect(boundary.ports[1], condenser1.port_a) annotation(
Line(points = {{-60, 0}, {-12, 0}, {-12, 0}, {-12, 0}}, color = {0, 127, 255}));
connect(boundary2.ports[1], condenser1.port_a1) annotation(
Line(points = {{-2, 34}, {-2, 34}, {-2, 10}, {-2, 10}}, color = {0, 127, 255}));
end Condenser_Test;
but while solving error occurs:
[1] 18:50:11 Translation Error
[HeatPump.Condenser_Test: 46:3-47:88]: Incompatible components in connect statement: connect(condenser1.port_b1, boundary5.ports[1])
- condenser1.port_b1 has components {C_outflow, Xi_outflow, h_outflow, m_flow, p}
- boundary5.ports[1] has components {C_outflow, Xi_outflow, h_outflow, m_flow, p}
Hello OM users,
I am writing, because maybe somebody is familiar with this topic and will help.
I tried to develop a model of cross flow heat exchanger, but the checker always tells me that the system is under-constrained (28 variables and 26 equations) I have no idea where is the problem, so I am attaching my code below:
within HeatPump;
model Condenser
// For 100% Vapour- 1 phase of Refr.
//outer Modelica.Fluid.System system "System properties";
import SI = Modelica.SIunits;
import IF = Modelica.Fluid.Interfaces;
//parameter SI.MassFlowRate m_flow_min =0.001 " Smallest Mass flow rate in model";
replaceable package Medium_1 = Modelica.Media.Air.SimpleAir constrainedby
Modelica.Media.Interfaces.PartialMedium "Fluid 1"
annotation(choicesAllMatching);
replaceable package Medium_2 = Modelica.Media.R134a.R134a_ph constrainedby
Modelica.Media.Interfaces.PartialMedium "Fluid 2"
annotation(choicesAllMatching);
// Declaration of the state of the both Fluid
Medium_1.ThermodynamicState State_1;
Medium_2.ThermodynamicState State_2;
parameter SI.Area Aref = 1 "Tube with refrigerant contact area";
parameter SI.CoefficientOfHeatTransfer href = 1;
parameter SI.CoefficientOfHeatTransfer hair=1;
parameter SI.Area Aair = 1 "Air with condenser contact area";
parameter SI.Area Ao = 1;
parameter SI.Efficiency etao = 1;
Modelica.Fluid.Interfaces.FluidPort_a port_a(redeclare package Medium = Medium_2) "Inlet refrigerant" annotation(
Placement(visible = true, transformation(extent = {{-110, -10}, {-90, 10}}, rotation = 0), iconTransformation(extent = {{-10, 88}, {12, 110}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_b port_b(redeclare package Medium = Medium_2) "Outlet refrigerant" annotation(
Placement(visible = true,transformation(extent = {{90, -10}, {110, 10}}, rotation = 0), iconTransformation(extent = {{92, -10}, {114, 12}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_a port_a1(redeclare package Medium = Medium_1) "Inlet air" annotation(
Placement(visible = true,transformation(extent = {{-10, 90}, {10, 110}}, rotation = 0), iconTransformation(origin = {-99, 1}, extent = {{-11, -11}, {11, 11}}, rotation = 0)));
Modelica.Fluid.Interfaces.FluidPort_b port_b1(redeclare package Medium = Medium_1) "Outlet air" annotation(
Placement(visible = true,transformation(origin = {1.33227e-15, -100}, extent = {{-10, 10}, {10, -10}}, rotation = 0), iconTransformation(origin = {1, -99}, extent = {{-11, -11}, {11, 11}}, rotation = 0)));
Real Cair = port_a1.m_flow * Medium_1.specificHeatCapacityCp(State_1);
Real Cref = port_a.m_flow * Medium_2.specificHeatCapacityCp(State_2);
Real Cmin = min(Cair, Cref);
Real Cmax = max(Cair, Cref);
Real Cx = Cmin / Cmax;
Real UA = 1/(1 / href * Aref + 1 / etao * hair * Ao);
Real NTU = UA / Cmin;
Real eps1 = 1 - exp(1 / Cx * NTU ^ 0.22 * (exp(-Cx * NTU ^ 0.78) - 1));
Real Q = eps1 * Cmin * (Medium_2.temperature(State_2)-Medium_1.temperature(State_1));
equation
State_1=Medium_1.setState_phX(
port_a1.p,
port_a1.h_outflow,
port_a1.Xi_outflow);
State_2=Medium_2.setState_phX(
port_a.p,
port_a.h_outflow,
port_a.Xi_outflow);
port_b.h_outflow = port_a.h_outflow + (Q/port_a.m_flow);
port_b1.h_outflow = port_a1.h_outflow+ (Q/port_a1.m_flow);
0=port_a.m_flow+port_b.m_flow;
0=port_a1.m_flow+port_b1.m_flow;
port_a.p=port_b.p;
port_a1.p=port_b1.p;
port_a1.Xi_outflow=port_b1.Xi_outflow;
port_a.Xi_outflow=port_b.Xi_outflow;
port_a1.C_outflow=port_b1.C_outflow;
port_a.C_outflow=port_b.C_outflow;
annotation(
Icon(graphics = {Rectangle(fillPattern = FillPattern.Solid, extent = {{-100, 80}, {100, -80}}), Rectangle(origin = {1, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-101, 6}, {99, -14}}), Rectangle(origin = {1, 24}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-101, 6}, {99, -14}}), Rectangle(origin = {1, -18}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-101, 6}, {99, -14}}), Rectangle(origin = {1, -56}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-101, 6}, {99, -14}}), Rectangle(origin = {87, 0}, rotation = 90, fillPattern = FillPattern.Solid, extent = {{-81, 2}, {81, -14}}), Rectangle(origin = {-99, 0}, rotation = 90, fillPattern = FillPattern.Solid, extent = {{-81, 2}, {81, -14}})}));
end Condenser;
all the parameters are just for an example.
Maybe someone have made such a model and have some advice? Thanks in advance.
I also made a test bench for that:
within HeatPump;
model Condenser_Test
replaceable package Medium_1= Modelica.Media.Air.MoistAir;
replaceable package Medium_2=Modelica.Media.R134a.R134a_ph;
Condenser condenser1 annotation(
Placement(visible = true, transformation(origin = {-2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_h boundary(
redeclare package Medium=Medium_2,h = 280,
m_flow = 0.005,
nPorts = 1,
use_h_in = false, use_m_flow_in = false) annotation(
Placement(visible = true, transformation(origin = {-70, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_h boundary2(
redeclare package Medium = Medium_1,
h = 76.9,
m_flow = 0.05,
nPorts = 1,
use_m_flow_in = false) annotation(
Placement(visible = true, transformation(origin = {-2, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Sources.Boundary_pT boundary4(
redeclare package Medium=Medium_2, T = 280, nPorts = 1, p = 1e5,
use_T_in = false,
use_X_in = false, use_p_in = false) annotation(
Placement(visible = true, transformation(origin = {48, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary5(
redeclare package Medium=Medium_1, T = 278, p = 1e5,
use_T_in = false,
use_X_in = false, use_p_in = false) annotation(
Placement(visible = true, transformation(origin = {-2, -52}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
inner Modelica.Fluid.System system(allowFlowReversal = false, energyDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial, m_flow_start = 0.005, massDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) annotation(
Placement(visible = true, transformation(origin = {70, 72}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(condenser1.port_b1, boundary5.ports[1]) annotation(
Line(points = {{-2, -10}, {-2, -10}, {-2, -42}, {-2, -42}}, color = {0, 127, 255}));
connect(condenser1.port_b, boundary4.ports[1]) annotation(
Line(points = {{8, 0}, {36, 0}, {36, 0}, {38, 0}}, color = {0, 127, 255}));
connect(boundary.ports[1], condenser1.port_a) annotation(
Line(points = {{-60, 0}, {-12, 0}, {-12, 0}, {-12, 0}}, color = {0, 127, 255}));
connect(boundary2.ports[1], condenser1.port_a1) annotation(
Line(points = {{-2, 34}, {-2, 34}, {-2, 10}, {-2, 10}}, color = {0, 127, 255}));
end Condenser_Test;
but while solving error occurs:
[1] 18:50:11 Translation Error
[HeatPump.Condenser_Test: 46:3-47:88]: Incompatible components in connect statement: connect(condenser1.port_b1, boundary5.ports[1])
- condenser1.port_b1 has components {C_outflow, Xi_outflow, h_outflow, m_flow, p}
- boundary5.ports[1] has components {C_outflow, Xi_outflow, h_outflow, m_flow, p}
- Index
- » Users
- » Gorzki
- » Profile