我是否在OpenModelica上正确地合并了这个嵌套函数?

我是否在OpenModelica上正确地合并了这个嵌套函数?,modelica,dymola,openmodelica,jmodelica,Modelica,Dymola,Openmodelica,Jmodelica,注:此问题是指位于ThermoPower.Examples.RankineCycle.Models.PrescriptedSpeedPump.mo中的PrescriptedSpeedPump.mo 我试图简化泵模型,因为我构建的所有包含该泵的模型都会产生相同的错误消息: [1] 16:02:01翻译错误 [ThermoPower.powerfants:2071:95-2071:108]:在范围ThermoPower.powerfants.HRSG.Components中未找到变量q_nom [2

注:此问题是指位于ThermoPower.Examples.RankineCycle.Models.PrescriptedSpeedPump.mo中的PrescriptedSpeedPump.mo

我试图简化泵模型,因为我构建的所有包含该泵的模型都会产生相同的错误消息:

[1] 16:02:01翻译错误 [ThermoPower.powerfants:2071:95-2071:108]:在范围ThermoPower.powerfants.HRSG.Components中未找到变量q_nom

[2] 16:02:01翻译错误 [ThermoPower.powerfants:2076:84-2076:132]:在范围{q_nom},{head_nom}中找到循环相关常数或参数,忽略-d=ignoreCycles

检查该规定的速度泵后,其由两类组成:流体介质和流动特性。导致错误的是函数流特性

为什么我感到困惑: 该错误表示在ThermoPower.powerfants.HRSG.Components路径中找不到变量q_nom。好的,前面提到过,我说它位于热电库的示例包中

我对这种情况感到困惑的另一个原因是,我能够手动输入q_nom和head_nom的参数值。它们都被赋予了{1,2,3}的伪值。但仍然找不到该变量

最后,我尝试自己手动编辑flowCharacteristic函数,然后尝试检查我的模型。仍然会出现相同的错误。我真的不知道如何在这一点上解决这个错误,并尝试了我能设法想到的

如果您有任何见解或建议,请随时在下面留言!感谢您阅读本文,我感谢您花时间和精力帮助社区内的其他人。下面我已将代码复制到我的泵模型中

代码更新:

model Pump_Verified


function flowCharacteristic =
ThermoPower.Functions.PumpCharacteristics.quadraticFlow (
q_nom = q_nom, head_nom = head_nom);

ThermoPower.PowerPlants.HRSG.Components.PrescribedSpeedPump
prescribedSpeedPump1(
redeclare package WaterMedium = ThermoPower.Water.StandardWater,
Np0 = 1,
V = 20,
head_nom = {1, 2, 3},
hstart = 451024,
n0 = 1200,
nominalFlow = 142.512,
nominalInletPressure=132000,
nominalOutletPressure=8581000,
q_nom = {1, 2, 3},
rho0=1000)
          annotation (
Placement(visible = true, transformation(origin = {2, 0}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));

ThermoPower.Examples.RankineCycle.Models.PrescribedPressureCondenser
Condenser(
Vtot = 50,
p = 132000)  annotation (
Placement(visible = true, transformation(origin = {-50, 40}, extent = 
{{-10,
-10}, {10, 10}}, rotation = 0)));

ThermoPower.PowerPlants.SteamTurbineGroup.Components.StateReader_water
stateReader_water1 annotation (
Placement(visible = true, transformation(origin = {-50, 70}, extent = 
{{-10,
-10}, {10, 10}}, rotation = -90)));

ThermoPower.PowerPlants.SteamTurbineGroup.Components.StateReader_water
stateReader_water2 annotation (
Placement(visible = true, transformation(origin = {-50, 10}, extent = 
{{-10,
-10}, {10, 10}}, rotation = -90)));

ThermoPower.Water.SourceMassFlow SourceSteamFlow(
T = 380.561 - 273,
h = 931235,
p0 = 1.32e5,
w0 = 142.512)  annotation (
Placement(visible = true, transformation(origin = {-72, 84}, extent = 
{{-10,
-10}, {10, 10}}, rotation = 0)));

ThermoPower.Water.SinkMassFlow SinkWaterFlow annotation (
Placement(visible = true, transformation(origin = {52, 0}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));

inner ThermoPower.System system annotation (
Placement(visible = true, transformation(origin = {90, 88}, extent = 
{{-10,
-10}, {10, 10}}, rotation = 0)));

ThermoPower.Water.SensP sensP_Inlet annotation(
Placement(visible = true, transformation(origin = {-32, 4}, extent = 
{{-10, -10}, {10, 10}}, rotation = 0)));

ThermoPower.Water.SensP sensP_Outlet annotation(
Placement(visible = true, transformation(origin = {26, 4}, extent = {{-10, 
-10}, {10, 10}}, rotation = 0)));

Modelica.Blocks.Sources.Constant const(k = 1200)  annotation(
Placement(visible = true, transformation(origin = {-10, 66}, extent = 
{{-10, -10}, {10, 10}}, rotation = 0)));

equation
connect(const.y, prescribedSpeedPump1.pumpSpeed_rpm) annotation(
Line(points = {{2, 66}, {10, 66}, {10, 30}, {-18, 30}, {-18, 6}, {-6, 6}, 
{-6, 6}}, color = {0, 0, 127}));
connect(sensP_Outlet.flange, SinkWaterFlow.flange) annotation(
Line(points = {{26, 0}, {42, 0}, {42, 0}, {42, 0}}, color = {0, 0, 255}));
connect(prescribedSpeedPump1.outlet, sensP_Outlet.flange) annotation(
Line(points = {{12, 0}, {26, 0}, {26, 0}, {26, 0}}, color = {0, 0, 255}));
connect(sensP_Inlet.flange, prescribedSpeedPump1.inlet) annotation(
Line(points = {{-32, 0}, {-8, 0}, {-8, 0}, {-8, 0}}, color = {0, 0, 
255}));
connect(stateReader_water2.outlet, sensP_Inlet.flange) annotation(
Line(points = {{-50, 4}, {-50, 4}, {-50, 0}, {-32, 0}, {-32, 0}}, color = 
{0, 0, 255}));
connect(Condenser.waterOut, stateReader_water2.inlet) annotation(
Line(points = {{-50, 30}, {-50, 16}}, color = {0, 0, 255}));
connect(stateReader_water1.outlet, Condenser.steamIn) annotation(
Line(points = {{-50, 64}, {-50, 50}}, color = {0, 0, 255}));
connect(SourceSteamFlow.flange, stateReader_water1.inlet) annotation(
Line(points = {{-62, 84}, {-50, 84}, {-50, 76}, {-50, 76}, {-50, 76}}, 
color = {0, 0, 255}));
annotation (
uses(ThermoPower(version = "3.1"), Modelica(version="3.2.2")));

end Pump_Verified;

您正在使用ThermoPower.powerfants.HRSG.Components.PrescriptedSpeedPump,但似乎您想对其进行修改,尤其是:

该模型中已经存在函数flowCharacteristic,但是 不可替换,因此您无法更改它,而且您无论如何也不能更改它 在重新声明中使用模型中的q_nom。但既然它已经是二次的,就没有必要改变它。 未为此组件指定媒体 假设我使用了正确的热电版本。 指定的PeedPump具有未连接的输入。 如果您只是想使用它:

删除功能流特性 重宣告培养基 将一些信号连接到泵上 至少在Dymola中,以下工作是有效的:

model Pump_Check

function flowCharacteristic =
ThermoPower.Functions.PumpCharacteristics.quadraticFlow (
q_nom = q_nom, head_nom = head_nom);

ThermoPower.PowerPlants.HRSG.Components.PrescribedSpeedPump
prescribedSpeedPump1(
    redeclare package WaterMedium = ThermoPower.Water.StandardWater,
Np0 = 1,
V = 20,
head_nom = {1, 2, 3},
hstart = 451024,
n0 = 1200,
nominalFlow = 142.512,
    nominalInletPressure=132000,
    nominalOutletPressure=8581000,
q_nom = {1, 2, 3},
    rho0=1000)
              annotation (
Placement(visible = true, transformation(origin = {2, 0}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));

ThermoPower.Examples.RankineCycle.Models.PrescribedPressureCondenser
Condenser(
Vtot = 50,
p = 132000)  annotation (
Placement(visible = true, transformation(origin = {-50, 40}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));

ThermoPower.PowerPlants.SteamTurbineGroup.Components.StateReader_water
stateReader_water1 annotation (
Placement(visible = true, transformation(origin = {-50, 70}, extent = {{-10,
-10}, {10, 10}}, rotation = -90)));

ThermoPower.PowerPlants.SteamTurbineGroup.Components.StateReader_water
stateReader_water2 annotation (
Placement(visible = true, transformation(origin = {-50, 10}, extent = {{-10,
-10}, {10, 10}}, rotation = -90)));

ThermoPower.Water.SourceMassFlow SourceSteamFlow(
T = 380.561 - 273,
h = 931235,
p0 = 1.32e5,
w0 = 142.512)  annotation (
Placement(visible = true, transformation(origin = {-72, 84}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));

ThermoPower.Water.SinkMassFlow SinkWaterFlow annotation (
Placement(visible = true, transformation(origin = {52, 0}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
inner ThermoPower.System system annotation (
Placement(visible = true, transformation(origin = {90, 88}, extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Interfaces.RealInput pumpSpeed_rpm1
    annotation (Placement(transformation(extent={{-46,66},{-6,106}})));
equation 
connect(prescribedSpeedPump1.outlet, SinkWaterFlow.flange) annotation (
Line(points = {{12, 0}, {42, 0}, {42, 0}, {42, 0}}, color = {0, 0, 255}));
connect(stateReader_water2.outlet, prescribedSpeedPump1.inlet) annotation (
Line(points = {{-50, 4}, {-50, 4}, {-50, 0}, {-8, 0}, {-8, 0}}, color = {0,
0, 255}));
connect(Condenser.waterOut, stateReader_water2.inlet) annotation (
Line(points={{-50,30},{-50,16}},                            color = {0, 0,
255}));
connect(stateReader_water1.outlet, Condenser.steamIn) annotation (
Line(points={{-50,64},{-50,50}},                            color = {0, 0,
255}));
connect(SourceSteamFlow.flange, stateReader_water1.inlet) annotation (
Line(points = {{-62, 84}, {-50, 84}, {-50, 76}, {-50, 76}, {-50, 76}}, color=
  {0, 0, 255}));

  connect(prescribedSpeedPump1.pumpSpeed_rpm, pumpSpeed_rpm1) annotation (Line(
        points={{-5.2,6},{-16,6},{-16,86},{-26,86}}, color={0,0,127}));
annotation (
uses(ThermoPower(version = "3.1"), Modelica(version="3.2.2")));
end Pump_Check;

嘿@HansOlsson,我只是想让你知道,你提供的代码实际上产生了一个检查过的模型,它可以实例化也可以模拟。谢谢虽然我仍然得到了与前面提到的相同的错误,但它终于起作用了,对此我表示感谢。但是,在模拟时,出口压力不会改变为I指定的值,并且相对于进口压力保持不变。你知道如何解决这个问题吗?这是通过在泵的入口和出口添加SensP或压力传感器来确定的。让我知道你的想法!谢谢第一个显而易见的问题是:你是否将一个正常的信号(如斜坡)连接到泵上。我认为0值用于此类输入,但效果不好。最初,我没有使用任何正常的信号连接进行模拟。我只是对你之前在这个线程中复制的代码进行模拟。最初,我没有使用任何正常的信号连接进行模拟。我只是对您在本线程前面复制的代码进行模拟。即使没有信号输入,模拟仍然在运行。但是,我对如何将输入信号连接到RealInput组件感到困惑。这是因为您上面发布的代码在Modelica.Blocks.Interfaces.RealInput和指定PeedPump的pumpSpeed_rpm之间有连接,它来自三角形的后面,而不是点。我的第一反应是用一个输入信号为RealInput组件提供源,然后RealInput组件将输入规定的PeedPump速度输入。让我知道你的想法。再次感谢。