如何反转 SweptVolume 块?

How to reverse the SweptVolume block?

提问人:Aleksandr Kozlenok 提问时间:6/1/2023 最后编辑:Aleksandr Kozlenok 更新时间:6/13/2023 访问量:80

问:

我正在尝试模拟一个简单的案例。一个 sweptVolume 连接到另一个 sweptVolume。Flange.b 到 flange.b 是这样:The picture

当油室中的压力上升时,体积扩大,活塞向外移动。(到目前为止,一切都很好,很合乎逻辑)。

气室容积应该减小,压力应该上升(我们有一个压缩场景)。气室没有液压输出。它已关闭。

但是,在图上,我可以看到气室活塞正在向外移动,压力在降低,体积在扩大。

我认为,如果连接两个液压缸,第一个液压缸会膨胀,第二个液压缸会塌陷(这是您在 Matlab 中通常期望的)。

如何反转第二个 sweptVolume?

这是我的代码:

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;
OpenModelica 流体动力学

评论

0赞 Hans Olsson 6/5/2023
SweptVolume 似乎缺少用于平移运动的支撑法兰;所以人们必须建造它 - 这会有点混乱。我会在本周晚些时候尝试写一些东西。
0赞 Aleksandr Kozlenok 6/6/2023
感谢您提供的任何帮助。我还测试了一个带有 sweptVolume 和机械弹簧的简化系统。增加后扫体积中的压力,弹簧压缩。此外,我可以看到它可以测量法兰运动。

答:

0赞 Hans Olsson 6/13/2023 #1

根本问题是 SweptVolume 应该有两个法兰(用于两侧),而不仅仅是一个。似乎可以通过一个适配器来切换法兰的方向来修复它,但我无法完全让它工作。

但是,这可能是一个开始,并且用于反转法兰方向:

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;

然后在更新的模型中使用它:

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;

但不幸的是,模拟在大约 8 秒后停止。可能存在符号错误或其他一些逻辑错误 - 但至少这是一个起点。