gpt4 book ai didi

compiler-errors - Modelica.Fluid.Valves.Valve损坏的模型无法压缩?接收错误 “Function Utilities.regRoot2 not found in scope

转载 作者:行者123 更新时间:2023-12-02 10:56:47 24 4
gpt4 key购买 nike

我创建了一个基于2个二通阀的三通阀模型,这些模型被声明为可替换模型。这是它的开始...

within SHCLibrary;
model ThreeWayBallValveII

// Import section, AKA nicknames section. To (greately) improve readability.
import Modelica.Fluid.System;
import Modelica.Fluid.Interfaces.{FluidPort_a, FluidPort_b};
import Modelica.Blocks.Sources.Constant;
import Modelica.Blocks.Math.Add;
import Modelica.Blocks.Interfaces.RealInput;

// Definition of the fluid to be used in the component.
// replaceable package Medium = Modelica.Media.Interfaces.PartialMedium;
replaceable package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater;
// Allows for optional redefinition of junciton and valves model.
// replaceable model TeeJunction = Modelica.Fluid.Fittings.BaseClasses.PartialTeeJunction;
replaceable model TeeJunction = Modelica.Fluid.Fittings.TeeJunctionIdeal;
// replaceable model Valve = Modelica.Fluid.Valves.BaseClasses.PartialValve;
replaceable model Valve = Modelica.Fluid.Valves.ValveLinear;
// replaceable model Valve = Modelica.Fluid.Valves.ValveIncompressible;
// import Valve = Modelica.Fluid.Valves.ValveIncompressible;

...

我在修改 Valve声明的测试模型中使用了该阀。关键是,如果我使用 LinearValve模型,一切都会顺利进行。
  ThreeWayBallValveII V1(
redeclare package Medium = Medium,
redeclare model Valve = Modelica.Fluid.Valves.ValveLinear)
annotation(
Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

相反,如果我使用 ValveIncompressible模型
  ThreeWayBallValveII V1(
redeclare package Medium = Medium,
// redeclare model Valve = Modelica.Fluid.Valves.ValveLinear)
redeclare model Valve = Modelica.Fluid.Valves.ValveIncompressible)
annotation(
Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

我收到此错误:
[1] 12:40:08 Translation Error
[Modelica.Fluid.Valves: 38:9-40:80]: Function Utilities.regRoot2 not found in scope Valve.

我认为可以通过添加这样的行来解决
      import Modelica.Fluid.Utilities;

ValveIncompressible包中的 Valves模型,但是对我来说,这之前尚未得到修复似乎很奇怪,我想知道我做错了什么。你怎么看?

真诚的

最佳答案

似乎文件import Modelica.Fluid.Utilities;中需要Modelica 3.2.3/Fluid/Valves.mo。在我的机器上,相关类(class)的开头现在显示为:

within Modelica.Fluid;
package Valves "Components for the regulation and control of fluid flow"
extends Modelica.Icons.VariantsPackage;

model ValveIncompressible "Valve for (almost) incompressible fluids"
extends BaseClasses.PartialValve;
import Modelica.Fluid.Types.CvTypes;
import Modelica.Constants.pi;
import Modelica.Fluid.Utilities;

constant SI.ReynoldsNumber Re_turbulent = 4000
"cf. straight pipe for fully open valve -- dp_turbulent increases for closing valve";
parameter Boolean use_Re = system.use_eps_Re
"= true, if turbulent region is defined by Re, otherwise by m_flow_small"
annotation(Dialog(tab="Advanced"), Evaluate=true);
...

进行此修改后,我的模型就可以工作了。

关于compiler-errors - Modelica.Fluid.Valves.Valve损坏的模型无法压缩?接收错误 “Function Utilities.regRoot2 not found in scope <X>”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60900784/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com