我正在尝试在 Modelica 中构建一个非常简单的分布式热流体体积模型,并且正在努力使用流运算符正确实现它。这个体积使用 DryAirNasa 作为介质,我希望它没有大容量存储、没有压降和没有能量存储(很像 Modelica.Fluid.Pipes.StaticPipe 模型)。但是,我想明确执行能量平衡,以便可以进行热传递相互作用。我也不想在这个模型中定义质量流量,而是让它在连接到管道末端的边界之一中定义(例如,Modelica.Fluid.Sources.MassFlowSource_h)。
我已经创建了这样一个模型的测试实现,但是这个模型显然缺少一个根据 Dymola 的方程。我将不胜感激有关如何修复此模型以使其正确的任何见解。如果我添加等式
port_a.h_outflow = Medium.specificEnthalpy(state_a)
在方程部分,模型具有相同数量的方程和未知数,但我没有任何充分的理由来添加这样的方程。
model AirFlowTemp
// Objective: create a component that has no pressure drop, no mass storage,
and no energy storage, but that has a heat input.
import SI=Modelica.SIunits;
final replaceable package Medium=Modelica.Media.Air.DryAirNasa;
AirFlow.AirFlowPort port_a(redeclare package Medium
= Medium);
AirFlow.AirFlowPort port_b(redeclare package Medium
= Medium);
Interfaces.HeatPort heatPort;
Medium.EnthalpyFlowRate[2] H_flow "enthalpy flow";
SI.HeatFlowRate Q_flow "heat flow rate";
Medium.Temperature T_mean;
Medium.ThermodynamicState state_a;
Medium.ThermodynamicState state_b;
equation
// no pressure drop across the component.
port_a.p = port_b.p;
// Assume that there is no mass storage in the volume
0 = port_a.m_flow + port_b.m_flow;
// Energy balance
H_flow[1] = semiLinear(port_a.m_flow, inStream(port_a.h_outflow), inStream(port_b.h_outflow));
H_flow[2] = semiLinear(port_b.m_flow, inStream(port_b.h_outflow), inStream(port_a.h_outflow));
0 = Q_flow + H_flow[1] + H_flow[2];
state_a = Medium.setState_ph(port_a.p, inStream(port_a.h_outflow));
state_b = Medium.setState_ph(port_b.p, inStream(port_b.h_outflow));
T_mean = (Medium.temperature(state_a) +
Medium.temperature(state_b))/2;
heatPort.Q_flow = Q_flow;
heatPort.T = T_mean;
end AirFlowTemp;
connector AirFlowPort
replaceable package Medium = Modelica.Media.Interfaces.PartialMedium;
Medium.AbsolutePressure p;
flow Medium.MassFlowRate m_flow;
stream Medium.SpecificEnthalpy h_outflow;
stream Medium.MassFraction Xi_outflow[Medium.nXi];
end AirFlowPort;
connector HeatPort
extends Modelica.Thermal.HeatTransfer.Interfaces.HeatPort;
end HeatPort;