3

我正在尝试在 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;
4

1 回答 1

0

大约 4 周前,我在做同样的事情时遇到了同样的问题。尝试这是否可以作为更接近正确使用 inStream 的一个步骤。

  1. 去掉 Medium.EnthalpyFlowRate[2] H_flow "焓流" SI.HeatFlowRate Q_flow "热流率"; Interfaces.HeatPort 热端口;SI.HeatFlowRate Q_flow "热流量"; 中。温度 T_mean; T_mean = (Medium.temperature(state_a) + Medium.temperature(state_b))/2;

    heatPort.Q_flow = Q_flow; heatPort.T = T_mean; => 只是测试管道,没有 heatPort

  2. 使用 port_a.outflow*port_a.m_flow = inStream(port_b.outflow)*port_b.m_flow; port_b.outflow*port_b.m_flow = inStream(port_a.outflow)*port_a.m_flow;

而不是: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];

  1. 更改您的无热端口测试

=> 这行得通吗?

问候乌韦

于 2013-08-15T14:04:03.473 回答