Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Trying to use ThermoPower Example with media from another Library

Trying to use ThermoPower Example with media from another Library

hello guys,

I'm new to modelica and I would like to simulate parts of a Heat Pump, that's why I'm using the example TestRefrigerantEvaporator with the Media R744 from the Library AixLib.
I really don't understand what I should do to make it work or why it doesnt work and I've been trying for a while now. Could someone please have a look?

You can download the AixLib here: https://github.com/RWTH-EBC/AixLib/tree … elsR744R32

R744.mo

Attachments:

Re: Trying to use ThermoPower Example with media from another Library

Hi,

May I know wich Modelica Simulation Environment are you using?
I have tried with OpenModelica 1.14 with not too much luck. The original model from ThermoPower runs in the old frontend but very slowly (it doesn't run in the new frontend). Your model fail seems related with inapropiate values for enthalpy.(when using Media packages it is a common problem, as proper start values are needed).  When I replaced in your model the Medium by the original Modelica.Media.R134a.R134a_ph I got the message fluidFlow.Kfnom=0, violating the assertion that must be over 0. After reviewing I see you changed the fluidFlow flow model from Cfnom to Kfnom without giving value to Kfnom. I see also that you changed the air temperature inlet to a quite low temperature.
Disortously it has been impossible for me to open the AixLib to examine the Media model (OpenModelica hangs). What I would try to do first is to be sure that the enthalpies in the liquid part are adequate for the temperatures in the gas part. This can be done by first checking which is the enthalpy reported by the Medium at your desired temperature. Probably it can be done also by specifying temperature in the liquid part, instead of enthalpy, but  I am not sure as I am not too familiar with ThermoPower library. And to correct the Kfnom problem.

Carlos

Re: Trying to use ThermoPower Example with media from another Library

From the annotations I see you are using Dymola. At the end I have been successful with your model, not using the AixLib, but using my own library. It is open source and you can download it from here
I attach your original model and a modification where I changed the Medium reference and I returned to the use of Cfnom.
Just to tell you how tricky is the enthalpy issue, I started extending the  CO2 package using “User” reference for enthalpy at 100K. It run, but stopped before arriving to 1e6 seconds. It was due to the fact that the gas was going down 200K that is the limit of its media model. I changed the reference to 120K for CO2 and the problem was solved. The reason is when you are specifying 250e3 for the liquid inlet, you are giving a number that is referenced to the base enthalpy.
The problem has been interesting for me, as I decided to check the compatibility of my library with ThermoPower and solve the remaining problems.

ModelicaTest5a.mo

Attachments:

Re: Trying to use ThermoPower Example with media from another Library

CTG wrote:


From the annotations I see you are using Dymola. At the end I have been successful with your model, not using the AixLib, but using my own library. It is open source and you can download it from here
I attach your original model and a modification where I changed the Medium reference and I returned to the use of Cfnom.
Just to tell you how tricky is the enthalpy issue, I started extending the  CO2 package using “User” reference for enthalpy at 100K. It run, but stopped before arriving to 1e6 seconds. It was due to the fact that the gas was going down 200K that is the limit of its media model. I changed the reference to 120K for CO2 and the problem was solved. The reason is when you are specifying 250e3 for the liquid inlet, you are giving a number that is referenced to the base enthalpy.
The problem has been interesting for me, as I decided to check the compatibility of my library with ThermoPower and solve the remaining problems.

ModelicaTest5a.mo

Oh wow! Thank you so much!
I'm actually using OpenModelica, not Dymola, but it's really nice to know that you could make this Model work. I have been struggling with it quite a lot because I couldn't make the Media work. I have already downloaded your Library and will try to work with it, thank you! current/smile

Trying to run your model I get these errors:

[1] 21:45:00 Scripting Error
Gtk-Message: 21:43:24.808: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: 21:43:54.911: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: 21:44:14.229: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: 21:44:18.379: GtkDialog mapped without a transient parent. This is discouraged.

[2] 21:45:00 Translation Notification
[FreeFluids.TMedia: 20:5-20:262]: From here:

[3] 21:45:00 Translation Error
[Modelica.Media: 5790:44-5791:66]: Trying to redeclare record FluidConstants but record not declared as replaceable.

[4] 21:45:00 Translation Error
[FreeFluids.TMedia: 868:105-868:162]: Variable FreeFluids.MediaCommon.MediaDataAL.CO2 not found in scope ThermoPower.Water.FlangeA$fluidSink$flange.Medium.

[5] 21:45:00 Translation Error
[FreeFluids.TMedia: 868:105-868:162]: Variable FreeFluids.MediaCommon.MediaDataAL.CO2 not found in scope ModelicaTest5a.Medium.

[6] 21:45:00 Translation Error
[FreeFluids.TMedia: 868:105-868:162]: Variable FreeFluids.MediaCommon.MediaDataAL.CO2 not found in scope FreeFluids.TMedia.Fluids.Medium.

[7] 21:45:00 Translation Error
[ThermoPower.Water: 11:5-12:93]: Variable Medium.nXi not found in scope ThermoPower.Water.FlangeA$fluidSink$flange.

[8] 21:45:00 Translation Error
Error occurred while flattening model ModelicaTest5a.R744

Re: Trying to use ThermoPower Example with media from another Library

Quite strange. I will try with the same files than you. I will download FreeFluids from Github, not the one I have in my computer.
Are you using OpenModelica 1.14?
I will tell you the result.

Re: Trying to use ThermoPower Example with media from another Library

All right. I downloaded every thing as you have done and it works on my computer. I have reviewed the error report and seems that the problem begin with the redeclaration of a no redeclarable record, that I do in the FreeFluids library. This makes me think that you are using Modelica 3.2.2 standard library, where the PartialTwoPhaseMedium has the FluidConstants record as not replaceable. This was change in Modelica 3.2.3 and now is replaceable.
Can you check this?

Re: Trying to use ThermoPower Example with media from another Library

Exactly that!

Could you tell me how to install the version 3.2.3? I'm on Ubuntu and cannot find how to do it...
Sorry if I'm asking silliness  current/hmm

Re: Trying to use ThermoPower Example with media from another Library

What version of OpenModelica do you have?

Code:


omc --version

To update OpenModelica just do the usual:

Code:


apt-get update
apt-get upgrade

will update to the new OpenModelica release 1.14 for you if you have added OpenModelica to your apt sources.

See here how:
https://openmodelica.org/download/download-linux

Edited by: adrpo - Dec-16-19 23:38:40

Re: Trying to use ThermoPower Example with media from another Library

Thank you! I updated to OpenModelica 14 and downloaded the ModelicaStandard Library 3.2.3 from Github and now it works current/smile

Edited by: lcsgoulart - Dec-17-19 11:41:38

Re: Trying to use ThermoPower Example with media from another Library

Happy about this  current/smile . Now take into account that OpenModelica 1.14 is not too stable, but I am sure they will improve this in a very short time.

Re: Trying to use ThermoPower Example with media from another Library

You shouldn't need to download MSL (Modelica Standard Library 3.2.3) from github.
Just install it for OpenModelica:

Code:


sudo apt-get install omlib-modelica-3.2.3

Is actually recommended to use this version as we have our own patches to it compared to the one from gihub.

There are 0 guests and 0 other users also viewing this topic
You are here: