3

I'm trying to simulate a simple case. One sweptVolume is connected to another one. Flange.b to flange.b like that: The picture

When the pressure in the OilChamber is rising, the volume expands, and the piston moves out. (So far, all good and logical).

The GasChamber volume should decrease, and the pressure should rise (we have a compression scenario). The Gas Chamber has no hydraulic output. It is Closed.

However, on the plot, I can see that the Gas chamber piston is moving out, the pressure is decreasing, and the volume is expanding.

I thought that If two hydraulic cylinders are connected, the first expands and the second collapses (this is what you usually expect in Matlab).

How can I inverse the second sweptVolume?

Here is my code:

model Jack1
  inner Modelica.Fluid.System system(energyDynamics = Modelica.Fluid.Types.Dynamics.FixedInitial) annotation(
    Placement(visible = true, transformation(origin = {0, 56}, extent = {{60, -96}, {80, -76}}, rotation = 0)));
  Modelica.Mechanics.Translational.Sources.Force force annotation(
    Placement(visible = true, transformation(origin = {-30, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Ramp ramp(duration = 6, height = -250, startTime = 1) annotation(
    Placement(visible = true, transformation(origin = {-70, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Machines.SweptVolume OilChamber(redeclare package Medium = Modelica.Media.Water.StandardWater, clearance = 0.00105, flange(s(start = 0.1)), nPorts = 1, pistonCrossArea = 0.0019625, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.014)}) annotation(
    Placement(visible = true, transformation(origin = {0, 8}, extent = {{10, -10}, {-10, 10}}, rotation = 180)));
  Modelica.Fluid.Machines.SweptVolume Jack(redeclare package Medium = Modelica.Media.Water.StandardWater, clearance = 0.00105, flange(s(start = 0.1)), nPorts = 1, pistonCrossArea = 0.0019625, portsData = {Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter = 0.01)}) annotation(
    Placement(visible = true, transformation(origin = {0, 48}, extent = {{10, 10}, {-10, -10}}, rotation = -180)));
  Modelica.Fluid.Machines.SweptVolume GasChamber(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, clearance = 0.00105, flange(s(start = 0.1)), nPorts = 0, pistonCrossArea = 0.0019625) annotation(
    Placement(visible = true, transformation(origin = {0, -30}, extent = {{10, 10}, {-10, -10}}, rotation = 180)));
equation
  connect(ramp.y, force.f) annotation(
    Line(points = {{-59, 70}, {-43, 70}}, color = {0, 0, 127}));
  connect(force.flange, Jack.flange) annotation(
    Line(points = {{-20, 70}, {0, 70}, {0, 58}}, color = {0, 127, 0}));
  connect(OilChamber.ports[1], Jack.ports[1]) annotation(
    Line(points = {{0, 18}, {0, 38}}, color = {0, 127, 255}));
  connect(OilChamber.flange, GasChamber.flange) annotation(
    Line(points = {{0, -2}, {0, -20}}, color = {0, 127, 0}));
  annotation(
    uses(Modelica(version = "4.0.0")),
    Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}})));
end Jack1;
  • It seems that SweptVolume lacks the support-flange for the translational motion; so one would have to build that - which will be a bit messy. I'll try to write something later in the week. – Hans Olsson Jun 05 '23 at 09:04
  • I appreciate any help you can provide. I also tested a simplified system with sweptVolume and a mechanical spring. Increasing the pressure in the sweptVolume the spring compresses. Also, I can see it can measure the flange movement. – Aleksandr Kozlenok Jun 06 '23 at 10:10

1 Answers1

0

The underlying problem is that SweptVolume should have two flanges (for the two sides) - not just one. It seems kind of possible to fix it by having an adapter that switches the orientation for the flanges, but I cannot fully get it to work.

However, it may be a start and for reversing the flange-orientation:

model ReverseSign
  parameter Real offset=1;
  Modelica.Mechanics.Translational.Interfaces.Flange_b flange_b
    annotation (Placement(transformation(extent={{90,28},{110,48}})));
  Modelica.Mechanics.Translational.Interfaces.Flange_b flange_b1
    annotation (Placement(transformation(extent={{90,-18},{110,4}})));
equation 
  flange_b.s=offset-flange_b1.s;
  flange_b.f=-flange_b1.f;
  annotation (
    Icon(coordinateSystem(preserveAspectRatio=false)),
    Diagram(coordinateSystem(preserveAspectRatio=false)),
    uses(Modelica(version="4.0.0")));
end ReverseSign;

And then use it in the updated model:

model Jack1
  inner Modelica.Fluid.System system(energyDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial)
    annotation (Placement(visible=true, transformation(
        origin={0,56},
        extent={{60,-96},{80,-76}},
        rotation=0)));
  Modelica.Mechanics.Translational.Sources.Force force annotation (Placement(
        visible=true, transformation(
        origin={-30,70},
        extent={{-10,-10},{10,10}},
        rotation=0)));
  Modelica.Blocks.Sources.Ramp ramp(
    duration=6,
    height=-250,
    startTime=1) annotation (Placement(visible=true, transformation(
        origin={-70,70},
        extent={{-10,-10},{10,10}},
        rotation=0)));
  Modelica.Fluid.Machines.SweptVolume OilChamber(
    redeclare package Medium = Modelica.Media.Water.StandardWater,
    clearance=0.00105,
    flange(s(start=0.1)),
    nPorts=1,
    pistonCrossArea=0.0019625,
    portsData={Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.014)})
    annotation (Placement(visible=true, transformation(
        origin={0,8},
        extent={{10,-10},{-10,10}},
        rotation=180)));
  Modelica.Fluid.Machines.SweptVolume Jack(
    redeclare package Medium = Modelica.Media.Water.StandardWater,
    clearance=0.00105,
    flange(s(start=0.1)),
    nPorts=1,
    pistonCrossArea=0.0019625,
    portsData={Modelica.Fluid.Vessels.BaseClasses.VesselPortsData(diameter=0.01)})
    annotation (Placement(visible=true, transformation(
        origin={0,48},
        extent={{10,10},{-10,-10}},
        rotation=-180)));
  Modelica.Fluid.Machines.SweptVolume GasChamber(
    redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2,
    clearance=0.00105,
    flange(s(start=0.1)),
    nPorts=0,
    pistonCrossArea=0.0019625) annotation (Placement(visible=true,
        transformation(
        origin={0,-30},
        extent={{10,10},{-10,-10}},
        rotation=180)));
  ReverseSign reverseSign(offset=0.2)
    annotation (Placement(transformation(extent={{-44,-22},{-24,-2}})));
equation 
  connect(ramp.y, force.f)
    annotation (Line(points={{-59,70},{-42,70}}, color={0,0,127}));
  connect(force.flange, Jack.flange)
    annotation (Line(points={{-20,70},{0,70},{0,58}}, color={0,127,0}));
  connect(OilChamber.ports[1], Jack.ports[1])
    annotation (Line(points={{0,18},{0,38}}, color={0,127,255}));
  connect(reverseSign.flange_b, OilChamber.flange)
    annotation (Line(points={{-24,-8.2},{0,-8.2},{0,-2}}, color={0,127,0}));
  connect(reverseSign.flange_b1, GasChamber.flange)
    annotation (Line(points={{-24,-12.7},{0,-12.7},{0,-20}}, color={0,127,0}));
  annotation (uses(Modelica(version="4.0.0")), Diagram(coordinateSystem(extent={
            {-100,-100},{100,100}})));
end Jack1;

But unfortunately the simulation stops after about 8s. There might be sign-errors, or some other logic error - but at least it is a starting point.

Hans Olsson
  • 11,123
  • 15
  • 38