finnahuss
finnahuss

Reputation: 307

Am I incorporating this nested Function properly on OpenModelica?

NOTE: This question is referencing PrescribedSpeedPump.mo located ThermoPower.Examples.RankineCycle.Models.PrescribedSpeedPump

I'm trying to simple pump model since all models I build incorporating this pump always yield the same error message:

[1] 16:02:01 Translation Error [ThermoPower.PowerPlants: 2071:95-2071:108]: Variable q_nom not found in scope ThermoPower.PowerPlants.HRSG.Components.

[2] 16:02:01 Translation Error [ThermoPower.PowerPlants: 2076:84-2076:132]: Cyclically dependent constants or parameters found in scope : {q_nom}, {head_nom} (ignore with -d=ignoreCycles).

Upon inspection of this PrescribedSpeedPump, its composed of two classes: A "FluidMedium" & "flowCharacteristic". It is the Function - "FlowCharacteristic" that is resulting in the error.

Why I am confused: The error says that it cannot find Variable q_nom within the path of ThermoPower.PowerPlants.HRSG.Components. Well, mentioned earlier, I said this was located within the Examples package of the ThermoPower Library.

Another reason I am confused about this situation, is that I am able to manually enter in parameter values for both q_nom and head_nom. They have been given dummy values of {1,2,3} for both of them. Still, the variable "cannot be found".

Finally, I've tried manually editing the "flowCharacteristic" function myself and then trying to check my model. Still the same error appears. I really do not know how to troubleshoot this error at this point and have tried what I can manage to think of.

If you have any insight or suggestions, please feel free to leave a comment below! Thank you for reading this far, I appreciate your time and effort in trying to help others within this community. Below I have copied the code to my pump model.

CODE UPDATED:

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;

Upvotes: 0

Views: 106

Answers (1)

Hans Olsson
Hans Olsson

Reputation: 12517

You are using ThermoPower.PowerPlants.HRSG.Components.PrescribedSpeedPump, but it almost seems as though you want to modify it, in particular:

  • The function flowCharacteristic already exist in that model - but is not replaceable so you cannot change it, and you could anyway not use q_nom from the model in a redeclaration. But since it is already quadratic there is no need to change it.
  • The media isn't specified for this component (assuming I used the correct ThermoPower version).
  • The prescribedspeedpump has an unconnected input.

If you just want to use it:

  • Remove the function flowCharacteristic
  • Redeclare medium
  • Connect some signal to the pump

The following works at least in 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;

Upvotes: 1

Related Questions