Low level interface for Air, humid air, and mixtures

341 views
Skip to first unread message

Mark335

unread,
Sep 8, 2016, 7:00:03 PM9/8/16
to coolprop-users
I am attempting to expand my code and use the low level interface for calling properties for dry air, humid air, and mixtures.

Coding the example for the Methane and Ethane mixture, I am unable to compute a value and Matlab 2015b will hard crash with the following code when calculating the last line. 

backend = 'HEOS';

[handle, sh] = calllib('coolprop','AbstractState_factory',backend,'Methane&Ethane',ierr,herr,buffer_size);

calllib('coolprop','AbstractState_set_fractions',handle,([0.2 0.8]),8,ierr,herr,buffer_size);

calllib('coolprop','AbstractState_update',handle,2,101325,1,ierr,herr,buffer_size);

output=calllib('coolprop','AbstractState_keyed_output',handle, 33, ierr,herr,buffer_size)



1. I would like some help to understand if I am properly using the low level functionality. I want to use the fastest property call features of Coolprop and am using the AbstractState function to make property calls for a fluid. Is that the proper method or have it made it more difficult on myself?


2. When I use that same function call to generate a handle for air using the BICUBIC&HEOS backend, I get a handle of -1 and no calculated value. Changing the backend to HEOS, I am able to calculate values, but I assume it is not the fastest method and need help to understand if there is a way to calculate values for Air using Tabular Interpolation.


backend = 'BICUBIC&HEOS';

[handle, sh] = calllib('coolprop','AbstractState_factory',backend,'Air',ierr,herr,buffer_size);

calllib('coolprop','AbstractState_update',handle,9,101325,293,ierr,herr,buffer_size);

output=calllib('coolprop','AbstractState_keyed_output',handle, 33, ierr,herr,buffer_size)


3. For humid air, what is the best methodology to use the low level to calculate humid air properties? I have not been able to find an example to explain how to do this in Matlab. I assume the AbstractState function is not correct and I should use HAPropsSI at the low level, but want to confirm if this is the correct thought and also obtain an example of how to do this in the low level as I am not sure how to do it.



Ian Bell

unread,
Sep 9, 2016, 5:00:25 PM9/9/16
to coolpro...@googlegroups.com
1. Yes, you have the right idea.  With respect to the Methane&Ethane example, where does it fail?  You should ABSOLUTELY NOT (!!!) be hard-coding the values for the input keys.  They are subject to change if we change the internal enumeration in the C++.  That is why we have the accessor functions available.  You should(!) obtain them once and store them somewhere so that you don't do that on every call to your property function

2. There is an open issue about using "Air" or "Air.mix" with tabular interpolation(https://github.com/CoolProp/CoolProp/issues/1186), and I haven't dug into the details of it to figure out what is not working.  "Air" is a pseudo-pure fluid, which causes all manner of problems when you try to do table  construction.  

3. There is no special method for HAPropsSI or humid air properties in general in the low-level interface. In MATLAB you are going to be hit hard with a speed penalty when doing psychrometric property evaluations, your best bet is to call the HAPropsSI function from the DLL.

Best,
Ian


--
You received this message because you are subscribed to the Google Groups "coolprop-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-users+unsubscribe@googlegroups.com.
To post to this group, send email to coolprop-users@googlegroups.com.
Visit this group at https://groups.google.com/group/coolprop-users.
For more options, visit https://groups.google.com/d/optout.

Mark335

unread,
Sep 9, 2016, 6:09:16 PM9/9/16
to coolprop-users
1. I am hard coding both the input and output keys. Should both of those be programmatically assigned? Is there a penalty to add accessor function for every call?

2. I will keep an eye on this. I checked R410A which is also a mixture, and that worked fine

3. Could you share a command line to return humid air density giving it an input of temperature, pressure, and humidity ratio?
To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-user...@googlegroups.com.
To post to this group, send email to coolpro...@googlegroups.com.

Ian Bell

unread,
Sep 16, 2016, 12:22:04 AM9/16/16
to coolpro...@googlegroups.com
1. Try it! I think you will see the speed penalty for calling the accessors is not negligible

To unsubscribe from this group and stop receiving emails from it, send an email to coolprop-users+unsubscribe@googlegroups.com.
To post to this group, send email to coolprop-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages