Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Tanks in OMEdit

Tanks in OMEdit

Hi everyone,
i have a problem with extracting CO2 from closed volume.
The following example works perfectly fine:


model Test_Abfueller
  Modelica.Fluid.Pipes.StaticPipe pipe(diameter = 0.05, redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, length = 1) annotation(
    Placement(visible = true, transformation(origin = {-28, -46}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  inner Modelica.Fluid.System system annotation(
    Placement(visible = true, transformation(origin = {-80, -86}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.MassFlowSource_T boundary1(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, T = 278, m_flow = 1, nPorts = 1) annotation(
    Placement(visible = true, transformation(origin = {-86, -46}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, diameter = 0.05, length = 1)  annotation(
    Placement(visible = true, transformation(origin = {-28, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Vessels.ClosedVolume volume(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, V = 10, nPorts = 4, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)})  annotation(
    Placement(visible = true, transformation(origin = {26, 48}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe2(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, diameter = 0.05, length = 1)  annotation(
    Placement(visible = true, transformation(origin = {52, -46}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Vessels.OpenTank tank(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, crossArea = 1, height = 10, level_start = 0, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)})  annotation(
    Placement(visible = true, transformation(origin = {70, -2}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
//    Modelica.Fluid.Vessels.OpenTank tank_co2(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, crossArea = 1, height = 10, level_start = 0, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)})  annotation(
//      Placement(visible = true, transformation(origin = {-70, 68}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
//    Modelica.Fluid.Pipes.StaticPipe pipe3(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, diameter = 0.05, length = 1)  annotation(
//     Placement(visible = true, transformation(origin = {-24, 30}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, nPorts = 1, p = 600000)  annotation(
    Placement(visible = true, transformation(origin = {-86, -18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(boundary.ports[1], pipe1.port_a) annotation(
    Line(points = {{-76, -18}, {-38, -18}, {-38, -20}, {-38, -20}}, color = {0, 127, 255}, thickness = 0.5));
//  connect(volume.ports[4], pipe3.port_a) annotation(
//    Line(points = {{26, 38}, {22, 38}, {22, 30}, {-14, 30}, {-14, 30}}, color = {0, 127, 255}, thickness = 0.5));
//  connect(pipe3.port_b, tank_co2.ports[1]) annotation(
//    Line(points = {{-34, 30}, {-70, 30}, {-70, 48}, {-70, 48}}, color = {0, 127, 255}));
  connect(pipe.port_b, volume.ports[1]) annotation(
    Line(points = {{-18, -46}, {26, -46}, {26, 38}}, color = {0, 127, 255}));
  connect(pipe1.port_b, volume.ports[2]) annotation(
    Line(points = {{-18, -20}, {26, -20}, {26, 38}}, color = {0, 127, 255}));
  connect(volume.ports[3], pipe2.port_a) annotation(
    Line(points = {{26, 38}, {26, 1}, {42, 1}, {42, -46}}, color = {0, 127, 255}, thickness = 0.5));
  connect(pipe2.port_b, tank.ports[1]) annotation(
    Line(points = {{62, -46}, {70, -46}, {70, -22}, {70, -22}}, color = {0, 127, 255}));
  connect(boundary1.ports[1], pipe.port_a) annotation(
    Line(points = {{-76, -46}, {-38, -46}}, color = {0, 127, 255}, thickness = 0.5));
  annotation(
    uses(Modelica(version = "3.2.2")));
end Test_Abfueller;

But if i want to add a pipe and a open tank now to extract co2 from the volume, an error occurs and i dont understand why.
I'd really appreciate it if someone could tell me why this happens.
Here's the sourcecode of my try to add pipe and tank:


model Abfueller
  //Erstellung des Rohrs für die CO2-Ausführung
  inner Modelica.Fluid.System system annotation(
    Placement(visible = true, transformation(origin = {-80, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  //Erstellung des Rohrs für die Bierausführung
  Modelica.Fluid.Pipes.StaticPipe pipe_beer_out(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, diameter = 0.05, height_ab = -0.5, length = 1) annotation(
    Placement(visible = true, transformation(origin = {70, 18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  //Erstellung des Rohrs fpr die CO2-Einführung
  Modelica.Fluid.Pipes.StaticPipe pipe_co2_in(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, diameter = 0.05, length = 1) annotation(
    Placement(visible = true, transformation(origin = {-62, 18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  //Erstellung der Bierquelle
  Modelica.Fluid.Sources.Boundary_pT source_beer(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, T = 278, nPorts = 1, p = 560000) annotation(
    Placement(visible = true, transformation(origin = {-112, -42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Valves.ValveIncompressible valve_beer_in(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, CvData = Modelica.Fluid.Types.CvTypes.Kv, Kv = 40, checkValve = true, dp_nominal = 30000, m_flow_nominal = 1, rho_nominal = 1000) annotation(
    Placement(visible = true, transformation(origin = {-34, -42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Valves.ValveCompressible valve_co2_in(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, CvData = Modelica.Fluid.Types.CvTypes.Kv, Kv = 0.16, allowFlowReversal = false, checkValve = true, dp_nominal = 1000, m_flow_nominal = 1000, p_nominal = 0.3, show_T = true, show_V_flow = true) annotation(
    Placement(visible = true, transformation(origin = {-34, 18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe_co2_out(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, diameter = 0.05, length = 1) annotation(
    Placement(visible = true, transformation(origin = {8, -88}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  Modelica.Fluid.Valves.ValveCompressible valve_co2_out(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, CvData = Modelica.Fluid.Types.CvTypes.Kv, Kv = 0.16, dp_nominal = 1000, m_flow_nominal = 1000, p_nominal = 0.3) annotation(
    Placement(visible = true, transformation(origin = {38, -76}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  Modelica.Fluid.Vessels.ClosedVolume tank_beer(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, V = 0.42137, nPorts = 4, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05), Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)}) annotation(
    Placement(visible = true, transformation(origin = {22, 46}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe_co2_in2(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, diameter = 0.05, length = 1) annotation(
    Placement(visible = true, transformation(origin = {-2, 18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  //Erstellung desr Rohre für die Biereinführung
  Modelica.Fluid.Pipes.StaticPipe pipe_beer_in(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, diameter = 0.05, length = 1) annotation(
    Placement(visible = true, transformation(origin = {-62, -42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe_beer_in2(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, diameter = 0.05, length = 1) annotation(
    Placement(visible = true, transformation(origin = {-2, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  //Blöcke für Ventile
  Modelica.Blocks.Sources.Constant const2(k = 1) annotation(
    Placement(visible = true, transformation(origin = {40, -48}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const(k = 1) annotation(
    Placement(visible = true, transformation(origin = {-34, 44}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  //Erstellung der C02-Quelle
  Modelica.Fluid.Sources.Boundary_pT source_co2(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, T = 278, nPorts = 1, p = 600000) annotation(
    Placement(visible = true, transformation(origin = {-110, 18}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Vessels.OpenTank bottle(redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater, crossArea = 0.003, height = 0.3, level(start = 0), level_start = 0, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)}) annotation(
    Placement(visible = true, transformation(origin = {70, 58}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
  Modelica.Blocks.Sources.Step step1(offset = 1) annotation(
    Placement(visible = true, transformation(origin = {-34, -16}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Vessels.OpenTank tank_co2(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.CO2, crossArea = 1, height = 10, level_start = 0, nPorts = 1, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.05)})  annotation(
    Placement(visible = true, transformation(origin = {-80, -72}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
equation
  connect(pipe_co2_in2.port_b, tank_beer.ports[2]) annotation(
    Line(points = {{8, 18}, {18, 18}, {18, 36}, {22, 36}}, color = {0, 127, 255}));
  connect(pipe_beer_out.port_a, tank_beer.ports[4]) annotation(
    Line(points = {{60, 18}, {44, 18}, {44, 36}, {22, 36}}, color = {0, 127, 255}));
  connect(valve_co2_out.port_a, tank_beer.ports[3]) annotation(
    Line(points = {{28, -76}, {28, -23}, {22, -23}, {22, 36}}, color = {0, 127, 255}));
  connect(pipe_beer_in2.port_b, tank_beer.ports[1]) annotation(
    Line(points = {{8, -40}, {22, -40}, {22, 36}}, color = {0, 127, 255}));
  connect(pipe_co2_out.port_b, tank_co2.ports[1]) annotation(
    Line(points = {{-2, -88}, {-50, -88}, {-50, -98}, {-80, -98}, {-80, -92}, {-80, -92}}, color = {0, 127, 255}));
  connect(valve_beer_in.port_a, pipe_beer_in.port_b) annotation(
    Line(points = {{-44, -42}, {-52, -42}}, color = {0, 127, 255}));
  connect(pipe_beer_in.port_a, source_beer.ports[1]) annotation(
    Line(points = {{-72, -42}, {-102, -42}}, color = {0, 127, 255}));
  connect(pipe_beer_in2.port_a, valve_beer_in.port_b) annotation(
    Line(points = {{-12, -40}, {-18, -40}, {-18, -42}, {-24, -42}}, color = {0, 127, 255}));
  connect(step1.y, valve_beer_in.opening) annotation(
    Line(points = {{-23, -16}, {-18, -16}, {-18, -34}, {-34, -34}}, color = {0, 0, 127}));
  connect(valve_co2_out.port_b, pipe_co2_out.port_a) annotation(
    Line(points = {{28, -76}, {28, -89}, {18, -89}, {18, -88}}, color = {0, 127, 255}));
  connect(const2.y, valve_co2_out.opening) annotation(
    Line(points = {{51, -48}, {56, -48}, {56, -68}, {38, -68}}, color = {0, 0, 127}));
  connect(source_co2.ports[1], pipe_co2_in.port_a) annotation(
    Line(points = {{-100, 18}, {-72, 18}}, color = {0, 127, 255}, thickness = 0.5));
  connect(pipe_co2_in.port_b, valve_co2_in.port_a) annotation(
    Line(points = {{-52, 18}, {-44, 18}}, color = {0, 127, 255}));
//Verbindungen
  connect(pipe_beer_out.port_b, bottle.ports[1]) annotation(
    Line(points = {{80, 18}, {88, 18}, {88, 28}, {70, 28}, {70, 38}}, color = {0, 127, 255}));
  connect(const.y, valve_co2_in.opening) annotation(
    Line(points = {{-23, 44}, {-18, 44}, {-18, 26}, {-34, 26}}, color = {0, 0, 127}));
  connect(valve_co2_in.port_b, pipe_co2_in2.port_a) annotation(
    Line(points = {{-24, 18}, {-12, 18}}, color = {0, 127, 255}));
  annotation(
    uses(Modelica(version = "3.2.2")));
end Abfueller;


Best Regards
lwinklmann



There are 0 guests and 0 other users also viewing this topic