无法使 Modelica 标准库中的泵工作
Can't make the pump in Modelica standard library working
我想通过抽水系统 (Pompa) 从水源 (Pozzetto) 中抽水来填充开放式水箱 (bacinella2)。问题很简单,但我无法在 openmodelica 中实现。
我试图消除泵,直接连接两个管道 tubo1 和 tubo2,系统工作,这就是为什么我认为错误在泵对象中。
model Pompaggio
Modelica.Fluid.Machines.ControlledPump Pompa(
redeclare package Medium = Modelica.Media.Water.StandardWater,
//N_nominal=1500,
use_T_start=true,
T_start=Modelica.SIunits.Conversions.from_degC(40),
m_flow_start=0.1,
control_m_flow=true,
allowFlowReversal=false,
p_a_start=110000,
p_b_start=130000,
p_a_nominal=110000,
p_b_nominal=130000,
m_flow_nominal=0.1
);
Modelica.Fluid.Sources.Boundary_pT Pozzetto(redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1, T=Modelica.SIunits.Conversions.from_degC(40), p = 101325 );
Modelica.Fluid.Vessels.OpenTank bacinella2(redeclare package Medium = Modelica.Media.Water.StandardWater,
crossArea = 4, height = 100, level(start = 0.01), nPorts = 1,
portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1)}, use_portsData = true);
Modelica.Fluid.Pipes.StaticPipe tubo1(redeclare package Medium = Modelica.Media.Water.StandardWater,
allowFlowReversal = true, diameter = 0.1, height_ab = 0, isCircular = true, length = 200, nParallel = 1);
Modelica.Fluid.Pipes.StaticPipe tubo2(redeclare package Medium = Modelica.Media.Water.StandardWater,
allowFlowReversal = true, diameter = 0.1, height_ab = 0, isCircular = true, length = 200, nParallel = 1);
equation
connect(Pozzetto.ports[1], tubo1.port_a);
connect(Pompa.port_a, tubo1.port_b);
connect(Pompa.port_b, tubo2.port_a);
//connect( tubo1.port_b, tubo2.port_a);
connect(bacinella2.ports[1], tubo2.port_b);
end Pompaggio;
有人可以帮助我吗?谢谢
该模型与在 Dymola 中一样工作。它给出了一些警告,这些警告导致了 OpenModelica 中问题的解决。跟型号其实有两个"problems":
-
bacinella2
的起始值:将值设置为 T_start(start=293.15)
、ports(p(start={101422.89174430574})))
可避免介质压力过低的警告。但实际上这应该不能解决翻译时出现的原始模型问题。
Pompa.medium
中 stateSelect
的设置。 Dymola 输出警告,它已将设置从 StateSelect.prefer
更改为 StateSelect.default
,因为它们无法区分。这是为 Pompa.medium.h
和 Pompa.medium.p
完成的。 OpenModelica 似乎无法自动执行此操作,因此似乎有必要手动更改它。
下面的代码是您的示例的扩展,其中包含上述两个更改。它在 OpenModelica 1.13.2(64 位)中测试并且运行良好。
model Pompaggio_modified
Modelica.Fluid.Machines.ControlledPump Pompa(
redeclare package Medium = Modelica.Media.Water.StandardWater,
medium(h(stateSelect = StateSelect.default), p(stateSelect = StateSelect.default)),
use_T_start=true,
T_start=Modelica.SIunits.Conversions.from_degC(40),
m_flow_start=0.1,
control_m_flow=true,
allowFlowReversal=false,
p_a_start=110000,
p_b_start=130000,
p_a_nominal=110000,
p_b_nominal=130000,
m_flow_nominal=0.1);
//N_nominal=1500,
Modelica.Fluid.Sources.Boundary_pT Pozzetto(redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1, T=Modelica.SIunits.Conversions.from_degC(40), p = 101325);
Modelica.Fluid.Vessels.OpenTank bacinella2(redeclare package Medium = Modelica.Media.Water.StandardWater,
crossArea = 4, height = 100, level(start = 0.01), nPorts = 1,
portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1)}, use_portsData = true,
T_start(start=293.15),
ports(p(start={101422.89174430574})));
Modelica.Fluid.Pipes.StaticPipe tubo1(redeclare package Medium = Modelica.Media.Water.StandardWater,
allowFlowReversal = true, diameter = 0.1, height_ab = 0, isCircular = true, length = 200, nParallel = 1);
Modelica.Fluid.Pipes.StaticPipe tubo2(redeclare package Medium = Modelica.Media.Water.StandardWater,
allowFlowReversal = true, diameter = 0.1, height_ab = 0, isCircular = true, length = 200, nParallel = 1);
equation
connect(Pozzetto.ports[1], tubo1.port_a);
connect(Pompa.port_a, tubo1.port_b);
connect(Pompa.port_b, tubo2.port_a);
//connect( tubo1.port_b, tubo2.port_a);
connect(bacinella2.ports[1], tubo2.port_b);
annotation (uses(Modelica(version="3.2.3")));
end Pompaggio_modified;
我想通过抽水系统 (Pompa) 从水源 (Pozzetto) 中抽水来填充开放式水箱 (bacinella2)。问题很简单,但我无法在 openmodelica 中实现。
我试图消除泵,直接连接两个管道 tubo1 和 tubo2,系统工作,这就是为什么我认为错误在泵对象中。
model Pompaggio
Modelica.Fluid.Machines.ControlledPump Pompa(
redeclare package Medium = Modelica.Media.Water.StandardWater,
//N_nominal=1500,
use_T_start=true,
T_start=Modelica.SIunits.Conversions.from_degC(40),
m_flow_start=0.1,
control_m_flow=true,
allowFlowReversal=false,
p_a_start=110000,
p_b_start=130000,
p_a_nominal=110000,
p_b_nominal=130000,
m_flow_nominal=0.1
);
Modelica.Fluid.Sources.Boundary_pT Pozzetto(redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1, T=Modelica.SIunits.Conversions.from_degC(40), p = 101325 );
Modelica.Fluid.Vessels.OpenTank bacinella2(redeclare package Medium = Modelica.Media.Water.StandardWater,
crossArea = 4, height = 100, level(start = 0.01), nPorts = 1,
portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1)}, use_portsData = true);
Modelica.Fluid.Pipes.StaticPipe tubo1(redeclare package Medium = Modelica.Media.Water.StandardWater,
allowFlowReversal = true, diameter = 0.1, height_ab = 0, isCircular = true, length = 200, nParallel = 1);
Modelica.Fluid.Pipes.StaticPipe tubo2(redeclare package Medium = Modelica.Media.Water.StandardWater,
allowFlowReversal = true, diameter = 0.1, height_ab = 0, isCircular = true, length = 200, nParallel = 1);
equation
connect(Pozzetto.ports[1], tubo1.port_a);
connect(Pompa.port_a, tubo1.port_b);
connect(Pompa.port_b, tubo2.port_a);
//connect( tubo1.port_b, tubo2.port_a);
connect(bacinella2.ports[1], tubo2.port_b);
end Pompaggio;
有人可以帮助我吗?谢谢
该模型与在 Dymola 中一样工作。它给出了一些警告,这些警告导致了 OpenModelica 中问题的解决。跟型号其实有两个"problems":
-
bacinella2
的起始值:将值设置为T_start(start=293.15)
、ports(p(start={101422.89174430574})))
可避免介质压力过低的警告。但实际上这应该不能解决翻译时出现的原始模型问题。 Pompa.medium
中stateSelect
的设置。 Dymola 输出警告,它已将设置从StateSelect.prefer
更改为StateSelect.default
,因为它们无法区分。这是为Pompa.medium.h
和Pompa.medium.p
完成的。 OpenModelica 似乎无法自动执行此操作,因此似乎有必要手动更改它。
下面的代码是您的示例的扩展,其中包含上述两个更改。它在 OpenModelica 1.13.2(64 位)中测试并且运行良好。
model Pompaggio_modified
Modelica.Fluid.Machines.ControlledPump Pompa(
redeclare package Medium = Modelica.Media.Water.StandardWater,
medium(h(stateSelect = StateSelect.default), p(stateSelect = StateSelect.default)),
use_T_start=true,
T_start=Modelica.SIunits.Conversions.from_degC(40),
m_flow_start=0.1,
control_m_flow=true,
allowFlowReversal=false,
p_a_start=110000,
p_b_start=130000,
p_a_nominal=110000,
p_b_nominal=130000,
m_flow_nominal=0.1);
//N_nominal=1500,
Modelica.Fluid.Sources.Boundary_pT Pozzetto(redeclare package Medium = Modelica.Media.Water.StandardWater,
nPorts = 1, T=Modelica.SIunits.Conversions.from_degC(40), p = 101325);
Modelica.Fluid.Vessels.OpenTank bacinella2(redeclare package Medium = Modelica.Media.Water.StandardWater,
crossArea = 4, height = 100, level(start = 0.01), nPorts = 1,
portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.1)}, use_portsData = true,
T_start(start=293.15),
ports(p(start={101422.89174430574})));
Modelica.Fluid.Pipes.StaticPipe tubo1(redeclare package Medium = Modelica.Media.Water.StandardWater,
allowFlowReversal = true, diameter = 0.1, height_ab = 0, isCircular = true, length = 200, nParallel = 1);
Modelica.Fluid.Pipes.StaticPipe tubo2(redeclare package Medium = Modelica.Media.Water.StandardWater,
allowFlowReversal = true, diameter = 0.1, height_ab = 0, isCircular = true, length = 200, nParallel = 1);
equation
connect(Pozzetto.ports[1], tubo1.port_a);
connect(Pompa.port_a, tubo1.port_b);
connect(Pompa.port_b, tubo2.port_a);
//connect( tubo1.port_b, tubo2.port_a);
connect(bacinella2.ports[1], tubo2.port_b);
annotation (uses(Modelica(version="3.2.3")));
end Pompaggio_modified;