I'm trying to create a new model that involves introducing a gas into a pipe, through a source of constant volume. This pipe is connected at the outlet to a swept volume and there is a mass just after it. The purpose of this model is, first of all, to try and learn more about OpenModelica. I expect the piston to eject the mass at a certain pressure. However, I find that the pressure inside the piston does not change at all... Can you help me, please?
Thanks in advance for your help!
model Test
inner Modelica.Fluid.System system(p_ambient = 101325) annotation(
Placement(visible = true, transformation(origin = {-68, 74}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Fluid.Vessels.ClosedVolume volume( redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, V = 0.6e-3, use_portsData = false, nPorts = 1) annotation(
Placement(visible = true, transformation(origin = {66, 0}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2,diameter = 0.002, length = 0.005) annotation(
Placement(visible = true, transformation(origin = {30, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
Modelica.Fluid.Machines.SweptVolume sweptVolume( redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2,T_start = 293.15, clearance = 7.696902001e-4, nPorts = 1, p_start = 1e5, pistonCrossArea = 0.003848451, use_T_start = true, use_portsData = false) annotation(
Placement(visible = true, transformation(origin = {-8, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Mechanics.Translational.Components.Mass mass(m = 600) annotation(
Placement(visible = true, transformation(origin = {-50, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
equation
connect(pipe.port_a, sweptVolume.ports[1]) annotation(
Line(points = {{40, 0}, {2, 0}}, color = {0, 127, 255}));
connect(mass.flange_a, sweptVolume.flange) annotation(
Line(points = {{-40, 0}, {-18, 0}}, color = {0, 127, 0}));
connect(pipe.port_a, volume.ports[1]) annotation(
Line(points = {{40, 0}, {56, 0}}, color = {0, 127, 255}));
annotation(
uses(Modelica(version = "4.0.0")));
end Test;


The issue is, that
sweptVolumecannot have negative stroke, therefore settingmass.s(start=1, fixed=true)either in the code or in the GUI by double-clicking the mass and editing checkbox (fixed=true) and value (s.start=1) should solve the issue.