Search code examples
modelicaopenmodelica

Can't make the pump in Modelica standard library working


I want to fill an open tank (bacinella2) by extracting water from a source (Pozzetto) by means of a pumping system (Pompa). The problem is quite simple, but I can't implemement in openmodelica.

I tried to eliminate the pump, connecting directly the two pipes tubo1 and tubo2, and the system works, that's why I think the bug is in the pump object.

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;

Someone can help me? Thanks


Solution

  • The model works as it is in Dymola. It gives some warnings which lead to the solution of the problem in OpenModelica. There are actually two "problems" with the model:

    1. Start values for bacinella2: Setting the values to T_start(start=293.15), ports(p(start={101422.89174430574}))) avoids the warnings of to low pressure in the medium. But actually this should not solve the problem of the original model which occurs during translation.
    2. Settings for stateSelect in Pompa.medium. Dymola outputs warnings that it changed the settings from StateSelect.prefer to StateSelect.default because they cannot be differentiated. This is done for Pompa.medium.h and Pompa.medium.p. It seems OpenModelica cannot do this automatically, so changing it manually seems necessary.

    The code below is the extension of your example with the two changes mentioned above. It is tested in OpenModelica 1.13.2 (64-bit) and runs fine.

    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;