Opened 6 years ago

Last modified 6 years ago

#5414 new defect

Unsolvable Error pertaining to variable not found within model

Reported by: KieranF <kieran.fung@…> Owned by: Lennart Ochel
Priority: high Milestone: Future
Component: OMSimulator Version: v1.13.2
Keywords: Cc:

Description

I'm currently working on building a heat recovery steam generator and have just started building from the ThermoPower Library and connect an evaporator to the economizer.

When trying to simulate an error occurs within the OMEdit Simulator:

division by zero at time 0, (a=-458389.9207317767) / (b=0), where divisor b expression is: 8.75988806777792 * Economizer.metalTube.Am * Economizer.metalTube.rhomcm * /*Real*/(Economizer.metalTube.Nt)

I'm not the best at debugging my models but I have an idea and I have some confusion trouble shooting this. My initial confusion was to verify which variable resulted in b=0. However, upon inspection I noticed how the variable Economizer.metalTube.Nt, Economizer.metalTube.Am did not exist within my the economizer class. I knew it had to be rooted into my class through extensions and partial classes and tried to define these "missing" variables in the text view of my economizer model, but this simply resulted in an error saying:

[1] 11:46:14 Translation Error
[ThermoPower_HRSG_Econ_Evap: 68:3-92:112]: Variable Economizer: In modifier (Nt = 3), class or component Nt not found in <ThermoPower.Examples.RankineCycle.Models.HE$Economizer>.

How exactly do I trouble shoot this error if I cannot define or locate the needed variables that are causing b=0?

Please let me know what you think about this. Your time and energy is greatly appreciated.

Attachments (1)

ThermoPower_HRSG_Econ_Evap.mo (6.2 KB ) - added by KieranF <kieran.fung@…> 6 years ago.

Download all attachments as: .zip

Change History (3)

by KieranF <kieran.fung@…>, 6 years ago

in reply to:  description comment:1 by Francesco Casella, 6 years ago

Replying to KieranF <kieran.fung@…>:

I'm currently working on building a heat recovery steam generator and have just started building from the ThermoPower Library and connect an evaporator to the economizer.

When trying to simulate an error occurs within the OMEdit Simulator:

division by zero at time 0, (a=-458389.9207317767) / (b=0), where divisor b expression is: 8.75988806777792 * Economizer.metalTube.Am * Economizer.metalTube.rhomcm * /*Real*/(Economizer.metalTube.Nt)

which means that either Economizer.metalTube.Am or Economizer.metalTube.rhomcm (or both) are zero.

I'm not the best at debugging my models but I have an idea and I have some confusion trouble shooting this. My initial confusion was to verify which variable resulted in b=0. However, upon inspection I noticed how the variable Economizer.metalTube.Nt, Economizer.metalTube.Am did not exist within my the economizer class. I knew it had to be rooted into my class through extensions and partial classes

Yes, so you should look into them, and if they don't have a non-zero default, then you need to define them in the derived class via a modifier.

comment:2 by KieranF <kieran.fung@…>, 6 years ago

After reading what you and others have said about my issue on OpenModelica I have come to a better understanding of the situation. However, I am still confused as to what is the best way to move forward to debug my model.

So my "Economizer" model, or a heat exchanger located in ThermoPower.Examples.RankineCycles.Models.HE, was having the error associated with the divisor "b=0".

When debugging, the error hyperlinked me to the package "thermal" which pointed me towards the line of code that is being flagged:

 (L/Nw*Nt)*rhomcm*Am*der(Tvol) = int.Q + ext.Q "Energy balance";

This line of code is also being used in the Economizer HE class (ThermoPower.Examples.RankineCycles.Models.HE). Here in the HE.mo, the same flagged line of code from the thermal package that is causing the error is also located here. What's making my model cause the divider "b=0" are the variables: L, Nw, Nt, Am and Tvol. These variables are not defined/found in the model I am using when defining system parameters.

What's confusing for me as a OpenModelica user is that those variables just mentioned above (L, Nw, Nt, Am and Tvol) are coded/defined in the ThermoPower.Examples.RankineCycles.Models.HE text view of the component, but when I try to define/add them into my Economizer.mo belonging to the ThermoPower.Examples.RankineCycles.Models.HE class, errors are triggered claiming:

[ThermoPower_HRSG_Econ_Evap: 69:3-94:112]: Variable Economizer: In modifier (Nt = 1), class or component Nt not found in <ThermoPower.Examples.RankineCycle.Models.HE$Economizer>.

Essentially, the errors causing the divider "b=0" are located in the base class of the economizer I am using. However, due to the absence or in-ability to define these needed variables within my Economizer.mo model, the equation:

 (L/Nw*Nt)*rhomcm*Am*der(Tvol) = int.Q + ext.Q "Energy balance";

Is now being violated. How do I fix this issue properly?

Note: See TracTickets for help on using tickets.