You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Modelica双作用气缸无质量流量问题排查求助

Modelica双作用气缸模型问题排查求助

我基于Modelica.Fluid 4.0.0包开发了双作用气缸模型,并搭建再生液压回路开展测试。测试可正常运行,但port_a的质量流量为0(预期应为MassFlowSource_T的流量与port_b的流量之和),且因Aa=Ab导致输出力为0,无法定位错误,恳请协助排查。

双作用气缸模型代码

model DoubleActingCylinder 
  // Import
  import Modelica.Constants.small;
  // Medium
  replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the component";
  // Connectors
  extends
    Modelica.Mechanics.Translational.Interfaces.PartialElementaryOneFlangeAndSupport2
    (s(start=small));
  Modelica.Fluid.Interfaces.FluidPort_a port_a(redeclare package Medium = Medium) annotation(
    Placement(visible = true, transformation(origin = {-60, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {60, -98}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Interfaces.FluidPort_b port_b(redeclare package Medium = Medium) annotation(
    Placement(visible = true, transformation(origin = {60, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-60, -100}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  // Constants
  parameter Modelica.Units.SI.Area Aa "Area chamber a";
  parameter Modelica.Units.SI.Area Ab "Area chamber b";
  parameter Modelica.Units.SI.Length L "Cylinder length";
  parameter Medium.Density rho_nominal = Medium.density_pTX(Medium.p_default, Medium.T_default, Medium.X_default) "Density";
equation
  // Mass flow rate to chamber a and block
  port_a.m_flow = der(Aa*s*rho_nominal);
  port_b.m_flow = der(Ab*(L-s)*rho_nominal);
  // Cylinder force
  -flange.f = port_a.p*Aa-port_b.p*Ab;
  // Enthalpy port_a
  port_a.h_outflow=Medium.specificEnthalpy_pTX(Medium.p_default, Medium.T_default, Medium.X_default) ;
  port_b.h_outflow=Medium.specificEnthalpy_pTX(Medium.p_default, Medium.T_default, Medium.X_default) ;
annotation(
    uses(Modelica(version = "4.0.0")));
end DoubleActingCylinder;

测试回路模型代码

model TestCylinderModel
  replaceable package Medium = Modelica.Media.Water.StandardWater;
  DoubleActingCylinder doubleActingCylinder(replaceable package Medium = Medium, Aa = 0.01, Ab = 0.01, L = 1) annotation(
    Placement(visible = true, transformation(origin = {-6, -6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.Translational.Components.Mass mass(m = 1)  annotation(
    Placement(visible = true, transformation(origin = {26, -6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.MassFlowSource_T boundary( replaceable package Medium = Medium,m_flow = 1, nPorts = 1)  annotation(
    Placement(visible = true, transformation(origin = {-50, -46}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.FixedBoundary boundary1(nPorts = 1, p = 1e5, replaceable package Medium = Medium)  annotation(
    Placement(visible = true, transformation(origin = {-52, -12}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.Translational.Components.SpringDamper springDamper(c = 100, d = 15)  annotation(
    Placement(visible = true, transformation(origin = {54, -6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Mechanics.Translational.Components.Fixed fixed annotation(
    Placement(visible = true, transformation(origin = {76, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(doubleActingCylinder.flange, mass.flange_a) annotation(
    Line(points = {{4, -6}, {16, -6}}, color = {0, 127, 0}));
  connect(boundary1.ports[1], doubleActingCylinder.port_b) annotation(
    Line(points = {{-42, -12}, {-28, -12}, {-28, -30}, {-12, -30}, {-12, -16}}, color = {0, 127, 255}));
  connect(doubleActingCylinder.port_b, doubleActingCylinder.port_a) annotation(
    Line(points = {{-12, -16}, {-22, -16}, {-22, -24}, {-14, -24}, {-14, -22}, {-10, -22}, {-10, -24}, {0, -24}, {0, -16}}, color = {0, 127, 255}));
  connect(boundary.ports[1], doubleActingCylinder.port_a) annotation(
    Line(points = {{-40, -46}, {4, -46}, {4, -16}, {0, -16}}, color = {0, 127, 255}));
  connect(fixed.flange, springDamper.flange_b) annotation(
    Line(points = {{76, -40}, {76, -6}, {64, -6}}, color = {0, 127, 0}));
  connect(mass.flange_b, springDamper.flange_a) annotation(
    Line(points = {{36, -6}, {44, -6}}, color = {0, 127, 0}));
  annotation(
    uses(Modelica(version = "4.0.0")));
end TestCylinderModel;

内容的提问来源于stack exchange,提问作者otf

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 05:40:37