打开 MOdelica Pumping Fluid through Swept volume

Open MOdelica Pumping Fluid through Swept volume

我有以下代码,它抛出与翻译警告相关的错误。我正在使用扫掠体积将流体从储罐泵送到管道和水槽。任何帮助将不胜感激。

model Trial2 "Model of a pumping system"
  import Modelica.Fluid;
  inner Modelica.Fluid.System system annotation(
    Placement(visible = true, transformation(origin = {30, -42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, allowFlowReversal = true, diameter = 0.3, height_ab = 100, length = 100) annotation(
    Placement(visible = true, transformation(origin = {46, -6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sensors.Pressure pressuretranducer annotation(
    Placement(visible = true, transformation(origin = {37, 29}, extent = {{-11, -11}, {11, 11}}, rotation = 0)));
  Modelica.Fluid.Sources.FixedBoundary sink(redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, nPorts = 1, p = 0, use_p = true) annotation(
    Placement(visible = true, transformation(origin = {48, 66}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  Modelica.Fluid.Machines.SweptVolume sweptVolume1(redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, T_start = system.T_start, clearance = 5, nPorts = 2, pistonCrossArea = 50, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.3), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.3)}, use_HeatTransfer = false, use_T_start = true, use_portsData = true) annotation(
    Placement(visible = true, transformation(origin = {6, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Sine sine1(amplitude = 50, freqHz = 5) annotation(
    Placement(visible = true, transformation(origin = {-62, 62}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.Translational.Sources.Force force1(useSupport = false) annotation(
    Placement(visible = true, transformation(origin = {-18, 62}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Vessels.OpenTank tank(redeclare package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater, crossArea = 50, height = 60, level(start = 50), level_start = 50, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.3)}, use_HeatTransfer = false, use_T_start = true, use_portsData = true) annotation(
    Placement(visible = true, transformation(origin = {-37, 23}, extent = {{-9, -9}, {9, 9}}, rotation = 0)));
equation
  connect(tank.ports[1], sweptVolume1.ports[1]) annotation(
    Line(points = {{-37, 14}, {4, 14}, {4, 20}, {6, 20}}, color = {0, 127, 255}, thickness = 0.5));
  connect(pressuretranducer.port, pipe.port_a) annotation(
    Line(points = {{37, 18}, {16, 18}, {16, -6}, {36, -6}}, color = {0, 127, 255}));
  connect(force1.flange, sweptVolume1.flange) annotation(
    Line(points = {{-8, 62}, {6, 62}, {6, 40}, {6, 40}}, color = {0, 127, 0}));
  connect(sine1.y, force1.f) annotation(
    Line(points = {{-50, 62}, {-30, 62}, {-30, 62}, {-30, 62}}, color = {0, 0, 127}));
  connect(pipe.port_b, sink.ports[1]) annotation(
    Line(points = {{56, -6}, {73, -6}, {73, 66}, {38, 66}}, color = {0, 127, 255}));
  connect(sweptVolume1.ports[2], pipe.port_a) annotation(
    Line(points = {{6, 20}, {9, 20}, {9, -6}, {36, -6}}, color = {0, 127, 255}, thickness = 0.5));
  annotation(
    uses(Modelica(version = "3.2.2")));
end Trial2;

您忘记在压力传感器中将介质设置为水(与在所有其他组件中类似)。

我还没有用 OpenModelica 检查过 - 但至少用 Dymola 足以让它模拟。