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

OpenModelica液压库管道分流计算方程变量失衡问题求助

OpenModelica液压计算库分流模型符号错误排查

问题背景

基于OpenModelica构建液压计算库,单管道搭配两个边界条件时计算正常,但构建分流模型(根据水力特性分配质量流量)时出现符号错误。模型全局检查显示方程数与变量数匹配,但符号处理阶段提示局部独立子集的方程数(18)与变量数(17)不匹配。

模型代码

管道模型(pipe_v0)

model pipe_v0

import Modelica.Units.SI;

  parameter SI.Area muF = 8e-5;
  parameter SI.Density rho = 998;
  parameter SI.SpecificHeatCapacityAtConstantPressure cp = 4200;
  SI.Pressure dp;
  parameter Real dt = 10;

SI.MassFlowRate G;
SI.Pressure pin, pout;
SI.Temperature tin, tout;

  Port.port_b port_b annotation(
    Placement(transformation(origin = {-100, 0}, extent = {{-5, -5}, {5, 5}}), iconTransformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}})));
  Port.port_a port_a annotation(
    Placement(transformation(origin = {100, 0}, extent = {{-5, -5}, {5, 5}}), iconTransformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}})));
equation
G = muF*sqrt(2*rho*dp);
 
  pout = pin - dp;
  tout = tin + dt;
  
  port_b.p = pin;
  port_a.p = pout;

  port_b.h = tin*cp;
  port_a.h = tout*cp;

port_b.m = G;
port_a.m = -G;

port_b.H + port_a.H = 0;

annotation(
    Icon(graphics = {Rectangle( lineColor = {144, 144, 144}, fillColor = {190, 190, 190}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100, 10}, {100, -10}})}));
end pipe_v0;

边界条件模型1(bound_PT)

model bound_PT
extends Librero.Sourse.bound_base;
import Modelica.Units.SI;

parameter SI.Pressure p;
parameter SI.Temperature T;
SI.SpecificHeatCapacityAtConstantPressure cp = 4200;

equation
port_a.p = p;
T = port_a.h/cp;

annotation(
    Diagram,
    Icon(graphics = {Text(origin = {13, -61}, rotation = 30, extent = {{-100, 20}, {100, -20}}, textString = "%name", fontName = "GOST Common")}));
end bound_PT;

边界条件模型2(bound_mH)

model bound_mH
extends Librero.Sourse.bound_base;
import Modelica.Units.SI;

parameter SI.MassFlowRate m;
parameter SI.EnthalpyFlowRate H;


equation
port_a.m = m;
port_a.H = H;

annotation(
    Diagram,
    Icon(graphics = {Text(origin = {45, -49}, rotation = 33, extent = {{-100, 20}, {100, -20}}, textString = "%name", fontName = "GOST Common")}));
end bound_mH;

连接器代码(port_base)

connector port_base
  import Modelica.Units.SI;
    SI.Pressure p;
    SI.SpecificEnthalpy h;
    flow SI.MassFlowRate m;
    flow SI.EnthalpyFlowRate H;
end port_base;

错误信息

  • 符号处理错误:
[1] 18:07:22 Symbolic Error An independent subset of the model has imbalanced number of equations (18) and variables (17). variables:
  • 全局模型检查结果:
[1] 18:07:21 Scripting Notification Check of Librero.poligon.st completed successfully. Class Librero.poligon.st has 56 equation(s) and 56 variable(s). 37 of these are trivial equation(s).

核心排查方向

  • Flow变量的冗余约束:连接器中的H是flow变量,Modelica会自动为连接的flow变量生成sum(flow)=0的方程,而pipe_v0中手动添加的port_b.H + port_a.H = 0属于冗余方程。单管道场景下符号处理可能自动忽略该冗余,但分流模型中多个管道连接时,冗余方程会导致局部子集的方程数多于变量数。
  • 焓流量的物理关联缺失:焓流量H的物理定义是H = m * h,当前所有模型都未建立这个关键约束,导致H变量在分流场景下缺乏有效约束,引发局部变量与方程的失衡。
  • 管道能量方程不符合物理规律:pipe_v0中tout = tin + dt直接给固定温度差,未关联能量传递(如与质量流量、焓的关系),导致能量相关变量的约束逻辑不完整,在多管道分流时暴露问题。
  • 全局检查与局部子集的差异:全局统计的方程变量数匹配不代表每个局部求解子集都平衡,符号处理会拆分模型为独立子集,局部的冗余/缺失约束会触发错误。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.22 03:14:55