通过管道的流体模型不能在 openmodelica 上 运行
Model of a fluid through a pipe can't run on openmodelica
我正在尝试在 OpenModelica 上进行模拟,这是一种流体(这里是水),它流过具有入口压力和温度的管道。我想考虑管道壁和流体之间的对流交换、壁之间的对流交换、环境和壁中的传导交换以及随温度变化的介质特性。 . 模型的检查没问题,但是当我 运行 模拟时我有一个错误。
这是我的代码:
model Water_flow
replaceable package Medium=Modelica.Media.Water.StandardWater constrainedby
Modelica.Media.Interfaces.PartialMedium;
output Modelica.SIunits.MassFlowRate mass_flow_rate=abs(pipe.port_b.m_flow);
Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Medium, T = 318.45, nPorts = 1, p = 14.6e5) annotation(
Placement(visible = true, transformation(origin = {-24, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary1(redeclare package Medium = Medium, T = 328.15, nPorts = 1, p = 14e5) annotation(
Placement(visible = true, transformation(origin = {60, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
Modelica.Fluid.Pipes.DynamicPipe pipe(redeclare package Medium = Medium, redeclare model HeatTransfer=Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.LocalPipeFlowHeatTransfer, T_start = 318.15, allowFlowReversal = false, diameter = 13e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, height_ab = 0, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, nNodes = 5, use_HeatTransfer = true) annotation(
Placement(visible = true, transformation(origin = {18, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system(T_ambient = 290.15, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial) annotation(
Placement(visible = true, transformation(origin = {-84, 84}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Components.Convection convection annotation(
Placement(visible = true, transformation(origin = {-50, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Blocks.Sources.Constant const(k = 358) annotation(
Placement(visible = true, transformation(origin = {-88, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {-50, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Thermal.HeatTransfer.Components.Convection convection1 annotation(
Placement(visible = true, transformation(origin = {-16, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature1(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {-16, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Examples.HeatExchanger.BaseClasses.WallConstProps wallConstProps(T_start = 318.15, area_h = 0.9, c_wall = 420, dT = 283.15, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, k_wall = 60.5, n = 5, rho_wall = 7850, s = 6e-3) annotation(
Placement(visible = true, transformation(origin = {18, -44}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Components.Convection convection2 annotation(
Placement(visible = true, transformation(origin = {18, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature2(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {18, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature3(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {50, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature4(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {82, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Thermal.HeatTransfer.Components.Convection convection3 annotation(
Placement(visible = true, transformation(origin = {50, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Thermal.HeatTransfer.Components.Convection convection4 annotation(
Placement(visible = true, transformation(origin = {82, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
equation
connect(boundary.ports[1], pipe.port_a) annotation(
Line(points = {{-14, -80}, {8, -80}}, color = {0, 127, 255}));
connect(pipe.port_b, boundary1.ports[1]) annotation(
Line(points = {{28, -80}, {50, -80}}, color = {0, 127, 255}));
connect(const.y, convection.Gc) annotation(
Line(points = {{-77, -2}, {-60, -2}}, color = {0, 0, 127}));
connect(fixedTemperature.port, convection.fluid) annotation(
Line(points = {{-50, 34}, {-50, 8}}, color = {191, 0, 0}));
connect(fixedTemperature.port, convection.fluid) annotation(
Line(points = {{-50, 34}, {-50, 8}}, color = {191, 0, 0}));
connect(fixedTemperature1.port, convection1.fluid) annotation(
Line(points = {{-16, 34}, {-16, 8}}, color = {191, 0, 0}));
connect(const.y, convection1.Gc) annotation(
Line(points = {{-77, -2}, {-26, -2}}, color = {0, 0, 127}));
connect(convection.solid, wallConstProps.heatPort_a[1]) annotation(
Line(points = {{-50, -12}, {-50, -24}, {18, -24}, {18, -39}}, color = {191, 0, 0}));
connect(fixedTemperature2.port, convection2.fluid) annotation(
Line(points = {{18, 34}, {18, 8}}, color = {191, 0, 0}));
connect(convection2.solid, wallConstProps.heatPort_a[3]) annotation(
Line(points = {{18, -12}, {18, -39}}, color = {191, 0, 0}));
connect(const.y, convection2.Gc) annotation(
Line(points = {{-77, -2}, {8, -2}}, color = {0, 0, 127}));
connect(const.y, convection3.Gc) annotation(
Line(points = {{-76, -2}, {40, -2}, {40, -2}, {40, -2}}, color = {0, 0, 127}));
connect(const.y, convection4.Gc) annotation(
Line(points = {{-76, -2}, {72, -2}, {72, -2}, {72, -2}}, color = {0, 0, 127}));
connect(convection3.solid, wallConstProps.heatPort_a[4]) annotation(
Line(points = {{50, -12}, {50, -24}, {18, -24}, {18, -39}}, color = {191, 0, 0}));
connect(convection4.solid, wallConstProps.heatPort_a[5]) annotation(
Line(points = {{82, -12}, {82, -24}, {18, -24}, {18, -39}}, color = {191, 0, 0}));
connect(convection1.solid, wallConstProps.heatPort_a[2]) annotation(
Line(points = {{-16, -12}, {-16, -24}, {18, -24}, {18, -39}}, color = {191, 0, 0}));
connect(wallConstProps.heatPort_b, pipe.heatPorts) annotation(
Line(points = {{18, -49}, {18, -76}}, color = {191, 0, 0}, thickness = 0.5));
connect(fixedTemperature3.port, convection3.fluid) annotation(
Line(points = {{50, 34}, {50, 8}}, color = {191, 0, 0}));
connect(fixedTemperature4.port, convection4.fluid) annotation(
Line(points = {{82, 34}, {82, 34}, {82, 8}, {82, 8}}, color = {191, 0, 0}));
annotation(
uses(Modelica(version = "3.2.3")),
Diagram);
end Water_flow;
错误信息在图片中。
如果有人知道模型有什么问题。
谢谢,祝你有美好的一天,
马克西姆
在 Dymola 中,您的代码 运行s 但有很多警告。初始化管道压力使其 运行 没有警告——例如,pipe.p_a_start=1460000
和 pipe.p_b_start=1400000
.
另一件事,您可以将对流元素和固定温度声明为数组,如下所示:
Modelica.Thermal.HeatTransfer.Components.Convection[pipe.nNodes] convection
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature[pipe.nNodes] fixedTemperature(each T = 328.15)
如果您选择其他离散化,例如pipe.nNodes=10
.
我正在尝试在 OpenModelica 上进行模拟,这是一种流体(这里是水),它流过具有入口压力和温度的管道。我想考虑管道壁和流体之间的对流交换、壁之间的对流交换、环境和壁中的传导交换以及随温度变化的介质特性。 . 模型的检查没问题,但是当我 运行 模拟时我有一个错误。
这是我的代码:
model Water_flow
replaceable package Medium=Modelica.Media.Water.StandardWater constrainedby
Modelica.Media.Interfaces.PartialMedium;
output Modelica.SIunits.MassFlowRate mass_flow_rate=abs(pipe.port_b.m_flow);
Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Medium, T = 318.45, nPorts = 1, p = 14.6e5) annotation(
Placement(visible = true, transformation(origin = {-24, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary1(redeclare package Medium = Medium, T = 328.15, nPorts = 1, p = 14e5) annotation(
Placement(visible = true, transformation(origin = {60, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
Modelica.Fluid.Pipes.DynamicPipe pipe(redeclare package Medium = Medium, redeclare model HeatTransfer=Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.LocalPipeFlowHeatTransfer, T_start = 318.15, allowFlowReversal = false, diameter = 13e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, height_ab = 0, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, nNodes = 5, use_HeatTransfer = true) annotation(
Placement(visible = true, transformation(origin = {18, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system(T_ambient = 290.15, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial) annotation(
Placement(visible = true, transformation(origin = {-84, 84}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Components.Convection convection annotation(
Placement(visible = true, transformation(origin = {-50, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Blocks.Sources.Constant const(k = 358) annotation(
Placement(visible = true, transformation(origin = {-88, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {-50, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Thermal.HeatTransfer.Components.Convection convection1 annotation(
Placement(visible = true, transformation(origin = {-16, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature1(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {-16, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Examples.HeatExchanger.BaseClasses.WallConstProps wallConstProps(T_start = 318.15, area_h = 0.9, c_wall = 420, dT = 283.15, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, k_wall = 60.5, n = 5, rho_wall = 7850, s = 6e-3) annotation(
Placement(visible = true, transformation(origin = {18, -44}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Components.Convection convection2 annotation(
Placement(visible = true, transformation(origin = {18, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature2(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {18, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature3(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {50, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature4(T = 328.15) annotation(
Placement(visible = true, transformation(origin = {82, 44}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Thermal.HeatTransfer.Components.Convection convection3 annotation(
Placement(visible = true, transformation(origin = {50, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Thermal.HeatTransfer.Components.Convection convection4 annotation(
Placement(visible = true, transformation(origin = {82, -2}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
equation
connect(boundary.ports[1], pipe.port_a) annotation(
Line(points = {{-14, -80}, {8, -80}}, color = {0, 127, 255}));
connect(pipe.port_b, boundary1.ports[1]) annotation(
Line(points = {{28, -80}, {50, -80}}, color = {0, 127, 255}));
connect(const.y, convection.Gc) annotation(
Line(points = {{-77, -2}, {-60, -2}}, color = {0, 0, 127}));
connect(fixedTemperature.port, convection.fluid) annotation(
Line(points = {{-50, 34}, {-50, 8}}, color = {191, 0, 0}));
connect(fixedTemperature.port, convection.fluid) annotation(
Line(points = {{-50, 34}, {-50, 8}}, color = {191, 0, 0}));
connect(fixedTemperature1.port, convection1.fluid) annotation(
Line(points = {{-16, 34}, {-16, 8}}, color = {191, 0, 0}));
connect(const.y, convection1.Gc) annotation(
Line(points = {{-77, -2}, {-26, -2}}, color = {0, 0, 127}));
connect(convection.solid, wallConstProps.heatPort_a[1]) annotation(
Line(points = {{-50, -12}, {-50, -24}, {18, -24}, {18, -39}}, color = {191, 0, 0}));
connect(fixedTemperature2.port, convection2.fluid) annotation(
Line(points = {{18, 34}, {18, 8}}, color = {191, 0, 0}));
connect(convection2.solid, wallConstProps.heatPort_a[3]) annotation(
Line(points = {{18, -12}, {18, -39}}, color = {191, 0, 0}));
connect(const.y, convection2.Gc) annotation(
Line(points = {{-77, -2}, {8, -2}}, color = {0, 0, 127}));
connect(const.y, convection3.Gc) annotation(
Line(points = {{-76, -2}, {40, -2}, {40, -2}, {40, -2}}, color = {0, 0, 127}));
connect(const.y, convection4.Gc) annotation(
Line(points = {{-76, -2}, {72, -2}, {72, -2}, {72, -2}}, color = {0, 0, 127}));
connect(convection3.solid, wallConstProps.heatPort_a[4]) annotation(
Line(points = {{50, -12}, {50, -24}, {18, -24}, {18, -39}}, color = {191, 0, 0}));
connect(convection4.solid, wallConstProps.heatPort_a[5]) annotation(
Line(points = {{82, -12}, {82, -24}, {18, -24}, {18, -39}}, color = {191, 0, 0}));
connect(convection1.solid, wallConstProps.heatPort_a[2]) annotation(
Line(points = {{-16, -12}, {-16, -24}, {18, -24}, {18, -39}}, color = {191, 0, 0}));
connect(wallConstProps.heatPort_b, pipe.heatPorts) annotation(
Line(points = {{18, -49}, {18, -76}}, color = {191, 0, 0}, thickness = 0.5));
connect(fixedTemperature3.port, convection3.fluid) annotation(
Line(points = {{50, 34}, {50, 8}}, color = {191, 0, 0}));
connect(fixedTemperature4.port, convection4.fluid) annotation(
Line(points = {{82, 34}, {82, 34}, {82, 8}, {82, 8}}, color = {191, 0, 0}));
annotation(
uses(Modelica(version = "3.2.3")),
Diagram);
end Water_flow;
错误信息在图片中。
如果有人知道模型有什么问题。
谢谢,祝你有美好的一天, 马克西姆
在 Dymola 中,您的代码 运行s 但有很多警告。初始化管道压力使其 运行 没有警告——例如,pipe.p_a_start=1460000
和 pipe.p_b_start=1400000
.
另一件事,您可以将对流元素和固定温度声明为数组,如下所示:
Modelica.Thermal.HeatTransfer.Components.Convection[pipe.nNodes] convection
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature[pipe.nNodes] fixedTemperature(each T = 328.15)
如果您选择其他离散化,例如pipe.nNodes=10
.