更改 Modelica 标准库的 ClosedVolume 的传热模型会导致模型不平衡
Changing the Heat transfer model of the ClosedVolume of the Modelica Standard Library lead to an unbalanced model
Modelica.Fluid.Vessels.ClosedVolume
的文档说默认考虑 IdealHeatTransfer
。我想改用 ConstantFlowHeatTransfer
。我在文本视图中声明它。然而,这样做会导致模型不平衡:939 个方程和 943 个变量。
这是模型:
这里是使用的代码:
model Closed_volume_test
replaceable package Medium=Modelica.Media.Water.ConstantPropertyLiquidWater constrainedby Modelica.Media.Interfaces.PartialMedium;
replaceable model HeatTransfer_1 = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.ConstantFlowHeatTransfer(alpha0=1800);
replaceable model HeatTransfer_2 = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.ConstantFlowHeatTransfer(alpha0=8000);
Modelica.Fluid.Vessels.ClosedVolume volume(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_1, V = 20, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nPorts= 2, use_HeatTransfer = true, use_portsData = false) annotation(
Placement(visible = true, transformation(origin = {0, -36}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Medium,diameter = 0.15, length = 1) annotation(
Placement(visible = true, transformation(origin = {26, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_T boundary1(redeclare package Medium = Medium, T = 328.15, m_flow = 1,nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {-56, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Medium,T = 328.15, nPorts = 1, p = 1e5) annotation(
Placement(visible = true, transformation(origin = {56, -54}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-88, 32}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Medium,diameter = 0.15, length = 1) annotation(
Placement(visible = true, transformation(origin = {-26, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe pipe2(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_2, diameter = 38e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 10, use_HeatTransfer = true) annotation(
Placement(visible = true, transformation(origin = {0, 28}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary2(redeclare package Medium = Medium,T = 311.15, nPorts = 1, p = 14.6e5) annotation(
Placement(visible = true, transformation(origin = {-36, 28}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_T boundary3(redeclare package Medium = Medium,m_flow = -0.25, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {36, 28}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Examples.HeatExchanger.BaseClasses.WallConstProps wallConstProps(area_h = 0.89, c_wall = 510, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, k_wall = 60.5, n = 10, rho_wall = 7850, s = 3e-3) annotation(
Placement(visible = true, transformation(origin = {0, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Components.ThermalCollector thermalCollector(m = 10) annotation(
Placement(visible = true, transformation(origin = {0, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(boundary1.ports[1], pipe1.port_a) annotation(
Line(points = {{-46, -54}, {-36, -54}}, color = {0, 127, 255}));
connect(pipe.port_b, boundary.ports[1]) annotation(
Line(points = {{36, -54}, {46, -54}}, color = {0, 127, 255}));
connect(volume.ports[1], pipe1.port_b) annotation(
Line(points = {{0, -46}, {-16, -46}, {-16, -54}}, color = {0, 127, 255}));
connect(volume.ports[2], pipe.port_a) annotation(
Line(points = {{0, -46}, {16, -46}, {16, -54}}, color = {0, 127, 255}));
connect(boundary2.ports[1], pipe2.port_a) annotation(
Line(points = {{-26, 28}, {-10, 28}}, color = {0, 127, 255}));
connect(pipe2.port_b, boundary3.ports[1]) annotation(
Line(points = {{10, 28}, {26, 28}}, color = {0, 127, 255}));
connect(pipe2.heatPorts, wallConstProps.heatPort_a) annotation(
Line(points = {{0, 24}, {0, 13}}, color = {127, 0, 0}, thickness = 0.5));
connect(wallConstProps.heatPort_b, thermalCollector.port_a) annotation(
Line(points = {{0, 3}, {0, 0}}, color = {191, 0, 0}, thickness = 0.5));
connect(thermalCollector.port_b, volume.heatPort) annotation(
Line(points = {{0, -20}, {-10, -20}, {-10, -36}}, color = {191, 0, 0}));
annotation(
uses(Modelica(version = "3.2.3")));
end Closed_volume_test;
是否可以使用其他模型来为 ClosedVolume 进行传热?如果是这样,有谁知道我该如何解决这个问题?
此致
马克西姆
ConstantFlowHeatTransfer
继承自 PartialFlowHeatTransfer
,它使用了诸如 length
和 nParallel
等量,这些量在体积模型中没有定义(并且没有意义)。这就是你不能使用它的原因。
ClosedVolume
使用继承自 PartialVesselHeatTransfer
的传热模型。您可以在此基础上建立自己的传热模型。
如果您需要考虑模型“下部”介质中的对流传热,您可以将 pipe
、pipe1
和 volume
替换为 DynamicPipe
模型(modelStructure=a_v_b
和 nNodes=1
)。
Modelica.Fluid.Vessels.ClosedVolume
的文档说默认考虑 IdealHeatTransfer
。我想改用 ConstantFlowHeatTransfer
。我在文本视图中声明它。然而,这样做会导致模型不平衡:939 个方程和 943 个变量。
这是模型:
这里是使用的代码:
model Closed_volume_test
replaceable package Medium=Modelica.Media.Water.ConstantPropertyLiquidWater constrainedby Modelica.Media.Interfaces.PartialMedium;
replaceable model HeatTransfer_1 = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.ConstantFlowHeatTransfer(alpha0=1800);
replaceable model HeatTransfer_2 = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.ConstantFlowHeatTransfer(alpha0=8000);
Modelica.Fluid.Vessels.ClosedVolume volume(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_1, V = 20, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nPorts= 2, use_HeatTransfer = true, use_portsData = false) annotation(
Placement(visible = true, transformation(origin = {0, -36}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Medium,diameter = 0.15, length = 1) annotation(
Placement(visible = true, transformation(origin = {26, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_T boundary1(redeclare package Medium = Medium, T = 328.15, m_flow = 1,nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {-56, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Medium,T = 328.15, nPorts = 1, p = 1e5) annotation(
Placement(visible = true, transformation(origin = {56, -54}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-88, 32}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Medium,diameter = 0.15, length = 1) annotation(
Placement(visible = true, transformation(origin = {-26, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe pipe2(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_2, diameter = 38e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 10, use_HeatTransfer = true) annotation(
Placement(visible = true, transformation(origin = {0, 28}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary2(redeclare package Medium = Medium,T = 311.15, nPorts = 1, p = 14.6e5) annotation(
Placement(visible = true, transformation(origin = {-36, 28}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.MassFlowSource_T boundary3(redeclare package Medium = Medium,m_flow = -0.25, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {36, 28}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Examples.HeatExchanger.BaseClasses.WallConstProps wallConstProps(area_h = 0.89, c_wall = 510, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, k_wall = 60.5, n = 10, rho_wall = 7850, s = 3e-3) annotation(
Placement(visible = true, transformation(origin = {0, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Components.ThermalCollector thermalCollector(m = 10) annotation(
Placement(visible = true, transformation(origin = {0, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(boundary1.ports[1], pipe1.port_a) annotation(
Line(points = {{-46, -54}, {-36, -54}}, color = {0, 127, 255}));
connect(pipe.port_b, boundary.ports[1]) annotation(
Line(points = {{36, -54}, {46, -54}}, color = {0, 127, 255}));
connect(volume.ports[1], pipe1.port_b) annotation(
Line(points = {{0, -46}, {-16, -46}, {-16, -54}}, color = {0, 127, 255}));
connect(volume.ports[2], pipe.port_a) annotation(
Line(points = {{0, -46}, {16, -46}, {16, -54}}, color = {0, 127, 255}));
connect(boundary2.ports[1], pipe2.port_a) annotation(
Line(points = {{-26, 28}, {-10, 28}}, color = {0, 127, 255}));
connect(pipe2.port_b, boundary3.ports[1]) annotation(
Line(points = {{10, 28}, {26, 28}}, color = {0, 127, 255}));
connect(pipe2.heatPorts, wallConstProps.heatPort_a) annotation(
Line(points = {{0, 24}, {0, 13}}, color = {127, 0, 0}, thickness = 0.5));
connect(wallConstProps.heatPort_b, thermalCollector.port_a) annotation(
Line(points = {{0, 3}, {0, 0}}, color = {191, 0, 0}, thickness = 0.5));
connect(thermalCollector.port_b, volume.heatPort) annotation(
Line(points = {{0, -20}, {-10, -20}, {-10, -36}}, color = {191, 0, 0}));
annotation(
uses(Modelica(version = "3.2.3")));
end Closed_volume_test;
是否可以使用其他模型来为 ClosedVolume 进行传热?如果是这样,有谁知道我该如何解决这个问题?
此致 马克西姆
ConstantFlowHeatTransfer
继承自 PartialFlowHeatTransfer
,它使用了诸如 length
和 nParallel
等量,这些量在体积模型中没有定义(并且没有意义)。这就是你不能使用它的原因。
ClosedVolume
使用继承自 PartialVesselHeatTransfer
的传热模型。您可以在此基础上建立自己的传热模型。
如果您需要考虑模型“下部”介质中的对流传热,您可以将 pipe
、pipe1
和 volume
替换为 DynamicPipe
模型(modelStructure=a_v_b
和 nNodes=1
)。