英文:
Closed loop with water
问题
I want to simulate the circulation of water in a closed circular pipe in Modelica, but all models, that i`ve seen require Boundaries.
我想在Modelica中模拟闭合圆形管道中的水循环,但所有我看到的模型都需要边界。
Can i make something like that?
我可以创建类似的模型吗?
UPD: i have written this, but it doesn`t work. I will be glad to know what the error is
我已经编写了这个,但它不起作用。我将很高兴知道错误是什么。
replaceable package Medium =
Modelica.Media.CompressibleLiquids.LinearWater_pT_Ambient
constrainedby Modelica.Media.Interfaces.PartialMedium;
Modelica.Fluid.Machines.PrescribedPump pump(N_nominal = 1200,
redeclare replaceable function flowCharacteristic =
Modelica.Fluid.Machines.BaseClasses.PumpCharacteristics.quadraticFlow(V_flow_nominal = {0, 0.25, 0.5}, head_nominal = {100, 60, 0}),
N_const = 1500, checkValve = true, V = 0.05, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial,
massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, T_start = 293.15, allowFlowReversal = false, m_flow_start = 0.0001,
redeclare replaceable model HeatTransfer = Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer, redeclare replaceable package Medium = Medium) annotation(Placement(visible = true, transformation(origin = {-90, -55}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system annotation(Placement(visible = true, transformation(origin = {-125, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe pipe(redeclare replaceable model FlowModel = Modelica.Fluid.Pipes.BaseClasses.FlowModels.DetailedPipeFlow,
length = 2, diameter = 0.5, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial,
momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, T_start = 293.15, nNodes = 2,
redeclare replaceable model HeatTransfer = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.LocalPipeFlowHeatTransfer, use_HeatTransfer = false,
allowFlowReversal = false, redeclare replaceable package Medium = Medium) annotation(Placement(visible = true, transformation(origin = {-17.657, -55}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe pipe1(redeclare replaceable model FlowModel = Modelica.Fluid.Pipes.BaseClasses.FlowModels.DetailedPipeFlow, length = 2,
diameter = 0.5, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial,
momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, T_start = 293.15, nNodes = 2,
redeclare replaceable model HeatTransfer = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.LocalPipeFlowHeatTransfer, use_HeatTransfer = false,
allowFlowReversal = false, redeclare replaceable package Medium = Medium) annotation(Placement(visible = true, transformation(origin = {-17.982, -30}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Vessels.ClosedVolume volume(V = 0.0005, redeclare replaceable package Medium = Medium, nPorts = 3,
energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, use_T_start = true, T_start = 293.15, p_start = 100000) annotation(Placement(visible = true, transformation(origin = {-65, -5}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary(nPorts = 1, p = 100000, T = 293.15, redeclare replaceable package Medium = Medium) annotation(Placement(visible = true, transformation(origin = {40, -7.215}, extent = {{-10, -10}, {10, 10}}, rotation = -180)));
equation
connect(pump.port_b, pipe.port_a) annotation(Line(visible = true, origin = {-53.829, -55}, points = {{-26.171, 0}, {26.171, 0}}, color = {0, 127, 255}));
connect(pipe.port_b, pipe1.port_a) annotation(Line(visible = true, origin = {-6.488, -42.5}, points = {{-1.169, -12.5}, {1.331, -12.5}, {1.331, 12.5}, {-1.494, 12.5}}, color = {0, 127, 255}));
connect(pump.port_a, volume.ports[1]) annotation(Line(visible = true, origin = {-88, -41}, points = {{-12, -14}, {-17, -14}, {-17, 1}, {23, 1}, {23, 26}}, color = {0, 127, 255}));
connect(pipe1.port_b, volume.ports[2]) annotation(Line(visible = true, origin = {-52.661, -25}, points = {{24.679, -5}, {-12.339, -5}, {-12.339, 10}}, color = {0, 127, 255}));
connect(boundary.ports[1], volume.ports[3]) annotation(Line(visible = true, origin = {-40, -13.886}, points = {{70, 6.671}, {-10, 6.671}, {-10, -6.114}, {-25, -6.114}, {-25, -1.114}}, color = {0, 127, 255}));
annotation(Diagram(coordinateSystem(extent = {{-150, -90}, {150, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, lineColor = {0, 114, 195}, fillColor = {255, 255, 255}, extent = {{-100, -100},
<details>
<summary>英文:</summary>
I want to simulate the circulation of water in a closed circular pipe in Modelica, but all models, that i`ve seen require Boundaries.
Can i make something like that?[enter image description here](https://i.stack.imgur.com/eAynk.png)
UPD:
i have written this, but it doesn`t work. I will be glad to know what the error is
replaceable package Medium =
Modelica.Media.CompressibleLiquids.LinearWater_pT_Ambient
constrainedby Modelica.Media.Interfaces.PartialMedium;
Modelica.Fluid.Machines.PrescribedPump pump(N_nominal = 1200,
redeclare replaceable function flowCharacteristic =
Modelica.Fluid.Machines.BaseClasses.PumpCharacteristics.quadraticFlow(V_flow_nominal = {0, 0.25, 0.5}, head_nominal = {100, 60, 0}),
N_const = 1500, checkValve = true, V = 0.05, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial,
massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, T_start = 293.15, allowFlowReversal = false, m_flow_start = 0.0001,
redeclare replaceable model HeatTransfer = Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer, redeclare replaceable package Medium = Medium) annotation(Placement(visible = true, transformation(origin = {-90, -55}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
inner Modelica.Fluid.System system annotation(Placement(visible = true, transformation(origin = {-125, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe pipe(redeclare replaceable model FlowModel = Modelica.Fluid.Pipes.BaseClasses.FlowModels.DetailedPipeFlow,
length = 2, diameter = 0.5, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial,
momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, T_start = 293.15, nNodes = 2,
redeclare replaceable model HeatTransfer = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.LocalPipeFlowHeatTransfer, use_HeatTransfer = false,
allowFlowReversal = false, redeclare replaceable package Medium = Medium) annotation(Placement(visible = true, transformation(origin = {-17.657, -55}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Pipes.DynamicPipe pipe1(redeclare replaceable model FlowModel = Modelica.Fluid.Pipes.BaseClasses.FlowModels.DetailedPipeFlow, length = 2,
diameter = 0.5, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial,
momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, T_start = 293.15, nNodes = 2,
redeclare replaceable model HeatTransfer = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.LocalPipeFlowHeatTransfer, use_HeatTransfer = false,
allowFlowReversal = false, redeclare replaceable package Medium = Medium) annotation(Placement(visible = true, transformation(origin = {-17.982, -30}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
Modelica.Fluid.Vessels.ClosedVolume volume(V = 0.0005, redeclare replaceable package Medium = Medium, nPorts = 3,
energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyStateInitial, use_T_start = true, T_start = 293.15, p_start = 100000) annotation(Placement(visible = true, transformation(origin = {-65, -5}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Sources.Boundary_pT boundary(nPorts = 1, p = 100000, T = 293.15, redeclare replaceable package Medium = Medium) annotation(Placement(visible = true, transformation(origin = {40, -7.215}, extent = {{-10, -10}, {10, 10}}, rotation = -180)));
equation
connect(pump.port_b, pipe.port_a) annotation(Line(visible = true, origin = {-53.829, -55}, points = {{-26.171, 0}, {26.171, 0}}, color = {0, 127, 255}));
connect(pipe.port_b, pipe1.port_a) annotation(Line(visible = true, origin = {-6.488, -42.5}, points = {{-1.169, -12.5}, {1.331, -12.5}, {1.331, 12.5}, {-1.494, 12.5}}, color = {0, 127, 255}));
connect(pump.port_a, volume.ports[1]) annotation(Line(visible = true, origin = {-88, -41}, points = {{-12, -14}, {-17, -14}, {-17, 1}, {23, 1}, {23, 26}}, color = {0, 127, 255}));
connect(pipe1.port_b, volume.ports[2]) annotation(Line(visible = true, origin = {-52.661, -25}, points = {{24.679, -5}, {-12.339, -5}, {-12.339, 10}}, color = {0, 127, 255}));
connect(boundary.ports[1], volume.ports[3]) annotation(Line(visible = true, origin = {-40, -13.886}, points = {{70, 6.671}, {-10, 6.671}, {-10, -6.114}, {-25, -6.114}, {-25, -1.114}}, color = {0, 127, 255}));
annotation(Diagram(coordinateSystem(extent = {{-150, -90}, {150, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, lineColor = {0, 114, 195}, fillColor = {255, 255, 255}, extent = {{-100, -100}, {100, 100}}, radius = 25), Text(visible = true, textColor = {64, 64, 64}, extent = {{-150, 110}, {150, 150}}, textString = "%name")}));
答案1
得分: 1
是的,但类似电路一样,您需要指定一个“地面”,因为电路中的热力和液压组件仅描述焓或压力的变化,而不是绝对值。
一个简单的解决方案是添加一个Modelica.Fluid.Sources.Boundary_pT
来提供电路中某处的参考压力。
英文:
Yes, but as with an electric circuit you will need to specify a "ground" since the thermal and hydraulic components in your circuit only describe changes in enthalpy or pressure — not absolute values.
A simple solution would be to add a Modelica.Fluid.Sources.Boundary_pT
to provide a reference pressure somewhere in the circuit.
答案2
得分: 0
在我看来,你应该能够做到,但正如@renejustnielsen所说,你需要一个起始的参考电势。但与电路不同,你只需要一个初始压力(或者根据电路配置需要更多)。因此,你需要在回路中添加一个动态体积(其中压力和焓会动态评估)。
英文:
In my opinion, you should be able to do it, but as @renejustnielsen said, you would need a reference potential to start with. But unlike an electrical circuit, you would just need an initial pressure (or more depending on your circuit configuration). Therefore, you need to add a dynamic volume in the loop (where pressure and enthalpy are dynamically evaluated).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论