Reputation: 31
I am developing a model for Heat Exchangers. I wrote the energy balance equation. When I check the model, I am getting the error shown in the figure. I am not able to figure it out the remaining three equations
model HX1
replaceable package Medium1 = Modelica.Media.Air.DryAirNasa annotation (
choicesAllMatching=true);
replaceable package Medium2 =
Modelica.Media.Water.ConstantPropertyLiquidWater annotation (
choicesAllMatching=true);
Modelica.Fluid.Interfaces.FluidPort_a AirInlet
annotation (Placement(transformation(extent={{-110,48},{-90,68}})));
Modelica.Fluid.Interfaces.FluidPort_a WaterOutlet
annotation (Placement(transformation(extent={{90,-48},{110,-28}})));
Modelica.Fluid.Interfaces.FluidPort_b AirOutlet
annotation (Placement(transformation(extent={{88,50},{108,70}})));
Modelica.Fluid.Interfaces.FluidPort_b WaterInlet
annotation (Placement(transformation(extent={{-110,-56},{-90,-36}})));
equation
WaterInlet.m_flow * (WaterOutlet.h_outflow - WaterInlet.h_outflow)
= AirInlet.m_flow * ( AirInlet.h_outflow - AirOutlet.h_outflow);
WaterInlet.m_flow = - WaterOutlet.m_flow;
AirInlet.m_flow = -AirOutlet.m_flow;
AirInlet.p = AirOutlet.p;
WaterInlet.p = WaterOutlet.p;
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end HX1;
Can anyone help me with this? Are there any heat exchangers available for free?
Upvotes: 0
Views: 242
Reputation: 3413
You need to specify the outgoing enthalpy in all situations. Please take a look at how to use stream
variables — for example in Modelica.Fluid
or in the Wiki of this simple example package.
The free Modelica Buildings Library has a number of heat exchanger models.
Code modifications
Your code will work if you change the energy balance to:
...
Modelica.Units.SI.HeatFlowRate Q_flow;
equation
WaterInlet.m_flow*(actualStream(WaterOutlet.h_outflow) - actualStream(
WaterInlet.h_outflow)) = Q_flow;
Q_flow = AirInlet.m_flow*(actualStream(AirInlet.h_outflow) - actualStream(
AirOutlet.h_outflow));
WaterOutlet.h_outflow = WaterInlet.h_outflow;
AirInlet.h_outflow = AirOutlet.h_outflow;
...
Upvotes: 1