simulationvolumemodelicaopenmodelica

Assertion has been violated Pipe/ClosedVolume


I made a model on OpenModelica, simply linking a fixed-volume source with a constant-pressure source. However, I'm getting an error and can't set it. Can you please help me, I'm new to this software?Thank you for your help, Emma

model TestComposant
Modelica.Fluid.Vessels.ClosedVolume volume(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, V = 6e-4, nPorts = 1, p_start = 40e5, use_portsData = false) annotation(
    Placement(visible = true, transformation(origin = {-84, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  inner Modelica.Fluid.System system annotation(
    Placement(visible = true, transformation(origin = {-170, 150}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.Boundary_pT boundary1(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, nPorts = 1, p = 100000) annotation(
    Placement(visible = true, transformation(origin = {82, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, diameter = 8e-3, length = 351.4e-3, nParallel = 1) annotation(
    Placement(visible = true, transformation(origin = {-44, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  CurvedBendModel curvedBendModel(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, geometry = Modelica.Fluid.Fittings.BaseClasses.Bends.CurvedBend.Geometry(d_hyd = 8e-3, R_0 = 25.5e-3, delta = 90)) annotation(
    Placement(visible = true, transformation(origin = {-2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, diameter = 8e-3, length = 166e-3, nParallel = 1) annotation(
    Placement(visible = true, transformation(origin = {38, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(volume.ports[1], pipe.port_a) annotation(
    Line(points = {{-74, 0}, {-54, 0}}, color = {0, 127, 255}));
  connect(pipe.port_b, curvedBendModel.port_a) annotation(
    Line(points = {{-34, 0}, {-12, 0}}, color = {0, 127, 255}));
  connect(curvedBendModel.port_b, pipe1.port_a) annotation(
    Line(points = {{8, 0}, {28, 0}}, color = {0, 127, 255}));
  connect(pipe1.port_b, boundary1.ports[1]) annotation(
    Line(points = {{48, 0}, {72, 0}}, color = {0, 127, 255}));
end TestComposant;

Screenshot of model

I had tweaked the code of the existing "CurvedBend" component (because I couldn't get it to work). Which explains why it doesn't exist for you.

model CurvedBendModel
 extends Modelica.Fluid.Dissipation.Utilities.Icons.PressureLoss.Bend_i;
  extends Modelica.Fluid.Interfaces.PartialPressureLoss;
  
  parameter Modelica.Fluid.Fittings.BaseClasses.Bends.CurvedBend.Geometry geometry
    "Geometry of curved bend"
      annotation (Placement(transformation(extent={{-20,0},{0,20}})));

protected
  parameter Medium.AbsolutePressure dp_small(min=0)=
              Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_DP(
               Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_con(
                   d_hyd=geometry.d_hyd,
                   delta=geometry.delta,
                   K=geometry.K,
                   R_0=geometry.R_0),
                Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_var(
                  rho=Medium.density(state_dp_small),
                  eta=Medium.dynamicViscosity(state_dp_small)),
                m_flow_small)
    "Default small pressure drop for regularization of laminar and zero flow (calculated from m_flow_small)";

equation
  if allowFlowReversal then
     m_flow =  Modelica.Fluid.Fittings.BaseClasses.Bends.CurvedBend.massFlowRate(
                dp, geometry, d_a, d_b, eta_a, eta_b, dp_small, m_flow_small);
  else
     m_flow = Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_MFLOW(
               Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_con(
                   d_hyd=geometry.d_hyd,
                   delta=geometry.delta,
                   K=geometry.K,
                   R_0=geometry.R_0),
                Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_var(rho=d_a, eta=eta_a), dp);
  end if;
end CurvedBendModel;

And the error is like: Screenshot of error message


Solution

  • You have a quite high mass flow out of the volume which results in a steep pressure drop inside the volume (deltap=30 bar in 0.1s). If a gas is relaxed, its temperature decreases: this leads to the too low temperature for the medium model and the simulation stops.

    The volume is adiabatic, enable heat transfer in the assumptions tab and connect e.g. a temperature source (Modelica.Thermal.HeatTransfer.Sources.FixedTemperature) to it in order to model the heat transfer into the tank from the surroundings. The simulation runs then for 1s without problems.

    There is no real error here.