Opened 5 years ago

Last modified 5 years ago

#5341 new defect

OMEdit claiming flowrate variable is not constant

Reported by: KieranF <kieran.fung@…> Owned by: lochel
Priority: high Milestone: Future
Component: Initialization Version:
Keywords: variable, constant, ThermoPower, translation, error Cc: kieran.fung@…

Description

I've been trying to model a Rankine Power Cycle on Modelica for a while now and keep running into a error that always stems from the use of a water pump imported from the ThermoPower Library.

I receive the error:
[2] 12:46:39 Translation Error
Variable Pump.q_single0 in package ThermoPower.Water.Pump is not constant

But it makes no sense because I directly input a value for the flow rate q_single on the "component parameters" interface before instantiating.

I've tried to allow the program to calculate this parameter on its own via the embedded equation within the cell which pulls values from other assigned parameters. Also, since this value needs to be "constant" I made sure that all of the other parameters being used in this equation are staying constant, which they are. No luck.

I've also tried using dummy values for this flow rate in hopes that an assigned numerical value will over ride the error of constant. No luck.

Finally, I've tried going into the Text View of the model and located the Pump associated with this error. Once there, I've tried editing the code ...

ThermoPower.Water.Pump Pump(

Np0 = 1,
V = 10,
dp0 = 0,
hstart = 1e5,
n0 = 150,
n_const = 150,
q_single(fixed = true, start = 10),
w0 = 50,
w_single(fixed = false),
wstart = 50)

where I would switch fixed = true. This did not work as well.

I feel like I have tried all options at my disposal as a 1 month user of OpenModelica but none of these solutions satisfies what the program actually wants. I am also curious as to why this code error is always associated with pump models.

Please let me know what you think of the situation, I'm open to all ideas! I've attached the .mo file below for anyone curious. Thanks!

Attachments (1)

Rankine_HRSG.mo (7.2 KB) - added by KieranF <kieran.fung@…> 5 years ago.
Rankine Power Cycle

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by KieranF <kieran.fung@…>

Rankine Power Cycle

comment:1 Changed 5 years ago by sjoelund.se

-d=newInst gives me:

[ThermoPower 3.1/Water.mo:5778:7-5778:63:writable] Warning: An inner declaration for outer component system could not be found and was automatically generated.
[ThermoPower 3.1/Water.mo:5778:7-5778:63:writable] Notification: The diagnostics message for the missing inner is: The System object is missing, please drag it on the top layer of your model
[ThermoPower 3.1/package.mo:1889:7-1889:40:writable] Error: Output parameter head was not assigned a value

Which I assume is a partial function not being redeclared properly or newInst not redeclaring.

comment:2 Changed 5 years ago by KieranF <kieran.fung@…>

Thanks for the feedback @sjoelund.se

How exactly do you execute that line of code? Should I put that line of code into the beginning of the text view of the main body of code?

comment:3 Changed 5 years ago by casella

In OMEdit, Tools|Options|Simulation|OMC command line option

Or, you can add the following annotation to your model

annotation(
__OpenModelica_commandLineOptions = "-d=newInst"
);

comment:4 Changed 5 years ago by casella

You also need to drag a System object in the diagram, and use it to set system-wide properties such as allowFlowReversal (I'd suggest to set it to false) as well as the type of initialization.

comment:5 Changed 5 years ago by casella

The following parameters haven't been set:

  • Economizer.rhomcm
  • SteamTurbine.Kt
  • Superheater.rhomcm
Note: See TracTickets for help on using tickets.