ฉันกำลังรวมฟังก์ชันที่ซ้อนกันนี้เข้ากับ OpenModelica อย่างถูกต้องหรือไม่

หมายเหตุ: คำถามนี้อ้างอิงถึง PrescribedSpeedPump.mo ซึ่งอยู่ที่ ThermoPower.Examples.RankineCycle.Models.PrescribedSpeedPump

ฉันกำลังพยายาม เรียบง่าย โมเดลปั๊ม เนื่องจากทุกรุ่นที่ฉันสร้างโดยใช้ปั๊มนี้มักจะให้ข้อความแสดงข้อผิดพลาดเดียวกันเสมอ:

[1] 16:02:01 ข้อผิดพลาดในการแปล [ThermoPower.PowerPlants: 2071:95-2071:108]: ไม่พบตัวแปร q_nom ในขอบเขต ThermoPower.PowerPlants.HRSG.Components

[2] 16:02:01 ข้อผิดพลาดในการแปล [ThermoPower.PowerPlants: 2076:84-2076:132]: ค่าคงที่หรือพารามิเตอร์ที่ขึ้นอยู่กับวงจรที่พบในขอบเขต : {q_nom}, {head_nom} (ละเว้นด้วย -d=ignoreCycles)

จากการตรวจสอบ PrescribedSpeedPump นี้ ประกอบด้วยสองคลาส: A "FluidMedium" และ "flowCharacteristic" มันคือฟังก์ชัน - "FlowCharacteristic" ที่ทำให้เกิดข้อผิดพลาด

เหตุใดฉันจึงสับสน: ข้อผิดพลาดแจ้งว่าไม่พบตัวแปร q_nom ภายในเส้นทางของ ThermoPower.PowerPlants.HRSG.Components ตามที่กล่าวไว้ก่อนหน้านี้ ฉันบอกว่าสิ่งนี้อยู่ภายในแพ็คเกจตัวอย่างของ ThermoPower Library

อีกเหตุผลหนึ่งที่ฉันสับสนเกี่ยวกับสถานการณ์นี้คือ ฉันสามารถป้อนค่าพารามิเตอร์สำหรับทั้ง 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;

person finnahuss    schedule 05.03.2019    source แหล่งที่มา


คำตอบ (1)


คุณกำลังใช้ ThermoPower.PowerPlants.HRSG.Components.PrescribedSpeedPump แต่ดูเหมือนว่าคุณต้องการแก้ไขโดยเฉพาะ:

  • ฟังก์ชัน flowCharacteristic มีอยู่แล้วในโมเดลนั้น - แต่ไม่สามารถทดแทนได้ ดังนั้นคุณจึงไม่สามารถเปลี่ยนแปลงได้ และคุณไม่สามารถใช้ q_nom จากโมเดลในการประกาศซ้ำได้ แต่เนื่องจากมันเป็นกำลังสองอยู่แล้ว จึงไม่จำเป็นต้องเปลี่ยนมัน
  • ไม่ได้ระบุสื่อสำหรับส่วนประกอบนี้ (สมมติว่าฉันใช้เวอร์ชัน ThermoPower ที่ถูกต้อง)
  • speedpump ที่กำหนดมีอินพุตที่ไม่ได้เชื่อมต่อ

หากคุณต้องการใช้มัน:

  • ลบฟังก์ชันflowCharacteristic
  • ประกาศสื่ออีกครั้ง
  • เชื่อมต่อสัญญาณบางอย่างเข้ากับปั๊ม

งานต่อไปนี้อย่างน้อยใน 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;
person Hans Olsson    schedule 06.03.2019
comment
เฮ้ @HansOlsson แค่อยากแจ้งให้คุณทราบว่ารหัสที่คุณให้มานั้นส่งผลให้มีโมเดลที่ได้รับการตรวจสอบ มันสร้างอินสแตนซ์และจำลองได้ ขอบคุณ! แม้ว่าฉันจะยังคงได้รับข้อผิดพลาดแบบเดียวกับที่กล่าวไว้ก่อนหน้านี้ แต่ในที่สุดก็ใช้งานได้ซึ่งฉันรู้สึกขอบคุณ อย่างไรก็ตาม จากการจำลอง แรงดันทางออกจะไม่เปลี่ยนเป็นค่าที่ฉันกำหนด และจะคงที่ตามแรงดันขาเข้า คุณมีความคิดเห็นเกี่ยวกับวิธีแก้ไขปัญหานี้หรือไม่? สิ่งนี้ถูกกำหนดโดยการเพิ่ม SensP หรือเซ็นเซอร์ความดันที่ทางเข้าและทางออกของปั๊ม แจ้งให้เราทราบสิ่งที่คุณคิด! ขอบคุณ! - person finnahuss; 06.03.2019
comment
สิ่งแรกที่ชัดเจน: คุณได้เชื่อมต่อสัญญาณปกติ เช่น ทางลาด เข้ากับปั๊มหรือไม่ ฉันเชื่อว่ามีการใช้ค่า 0 สำหรับอินพุตดังกล่าวซึ่งทำงานได้ไม่ดี - person Hans Olsson; 07.03.2019
comment
ในตอนแรกฉันไม่ได้จำลองการเชื่อมต่อสัญญาณปกติใดๆ ฉันจะเรียกใช้การจำลองจากโค้ดที่คุณคัดลอกไว้ก่อนหน้าในชุดข้อความนี้ - person finnahuss; 07.03.2019
comment
ในตอนแรกฉันไม่ได้จำลองการเชื่อมต่อสัญญาณปกติใดๆ ฉันจะเรียกใช้การจำลองจากโค้ดที่คุณคัดลอกไว้ก่อนหน้าในชุดข้อความนี้ การจำลองนั้นดำเนินไปแม้ว่าจะไม่มีสัญญาณเข้าก็ตาม - person finnahuss; 07.03.2019
comment
อย่างไรก็ตาม ฉันสับสนว่าจะเชื่อมต่อสัญญาณอินพุตเข้ากับส่วนประกอบ RealInput ได้อย่างไร เนื่องจากโค้ดที่คุณโพสต์ด้านบน มีการเชื่อมต่อระหว่าง Modelica.Blocks.Interfaces.RealInput และ pumpSpeed_rpm ของ SpeedPump ที่กำหนดนั้นมาจากด้านหลังสามเหลี่ยม ไม่ใช่จุดสำคัญ สัญชาตญาณแรกของฉันคือการจัดหาส่วนประกอบ RealInput ด้วยอินพุต singnal โดยที่ส่วนประกอบ RealInput จะป้อนเข้าสู่อินพุตความเร็ว SpeedPump ที่กำหนด แจ้งให้เราทราบสิ่งที่คุณคิด. ขอบคุณอีกครั้ง. - person finnahuss; 07.03.2019
comment
ฉันได้อัปเดตโค้ดด้านบนเป็นสิ่งที่ฉันกำลังทำงานด้วย - person finnahuss; 07.03.2019