我正试图在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;
发布于 2013-08-15 14:04:03
大约4周前,我也遇到了同样的问题。如果这是接近正确使用inStream的一个步骤,那么试一试。
H_flow1 = semiLinear(port_a.m_flow,inStream(port_a.h_outflow),inStream(port_b.h_outflow)),H_flow2 = semiLinear(port_b.m_flow,inStream(port_b.h_outflow),inStream(port_a.h_outflow)),0= Q_flow + H_flow1 + H_flow2;
=>能做到这一点吗?
问候Uwe
https://stackoverflow.com/questions/17867152
复制相似问题