usnistgov / REFPROP-wrappers

Wrappers around NIST REFPROP for languages such as Python, MATLAB, etc.
193 stars 127 forks source link

Enthalpy differences when using R-717 #487

Closed R-744 closed 2 years ago

R-744 commented 2 years ago

Good afternoon

I’m new to Refprop and seem to be having problems calculating enthalpies and wondered of you could help. I’m making a model for a district cooling system and was checking my Refprop work as I’m new and not confident with it. . My district cooling system uses R-513a but in order to evaluate this against other programs, I used R-717 as this is available in all programs. The programs I used were CoolPack from Denmark and Danfoss Coolselector 2 both I believe have a been developed using EES. If you are not aware of these programs CoolPack is a refrigerant evaluation program and the Danfoss program is a component selection program with the added benefit of having refrigerant properties data. I understand that different datum points might be chosen but I don’t understand my large discrepancy for h2 with the given higher h1 in the R-717 example attached and screen shot below.

I would really appreciate some help on this. I’m available to discuss this over the phone or I can setup a Teams meeting if you prefer.

image

Figure 1Danfoss Program

image

Figure 2: CoolPack Program

image

Figure 3: m\Screen shot of comparison with Refprop

Note: I emailed this request earlier with pictures and files attached but was instructed to put my questions here. I hope it works

Kind regards

ianhbell commented 2 years ago

This is the most popular FAQ: https://pages.nist.gov/REFPROP-docs/#reference-states-enthalpy-and-entropy-differences

More info here: https://github.com/CoolProp/CoolProp/blob/master/FAQ.md#usage

R-744 commented 2 years ago

This is the most popular FAQ: https://pages.nist.gov/REFPROP-docs/#reference-states-enthalpy-and-entropy-differences

More info here: https://github.com/CoolProp/CoolProp/blob/master/FAQ.md#usage

Thanks Ian I appreciate that there is different datum points , my problem is, I'm getting different deltas in my enthalpy calculations. I'm confused if I'm doing something wrong. or if there is an issue with the Refprop. Either way I really just want to solve it so my model is reliable.

Kind regards

Andy Campbell

ianhbell commented 2 years ago

Can you pull out the isentropic enthalpy (h2s) from each library? It seems like somehow your isentropic work must be different.

ianhbell commented 2 years ago

I tried to replicate your calculations with:

import os 
root = os.getenv('RPPREFIX')
import ctREFPROP.ctREFPROP as ct
RP = ct.REFPROPFunctionLibrary(root)
RP.SETPATHdll(root)

r1 = RP.REFPROPdll('AMMONIA','TP','H;S', RP.MASS_BASE_SI,0,0,10.279+273.15,5.160e5,[1.0])
r2 = RP.REFPROPdll('AMMONIA','PS','H', RP.MASS_BASE_SI, 0, 0, 15.313e5, r1.Output[1], [1.0])

but I don't know the isentropic efficiency

R-744 commented 2 years ago

THanks Ian The isentropic efficiency I was working to was 0.9

ianhbell commented 2 years ago

REFPROP seems fine (compressor efficiency is probably too high by the way):

import os 
root = os.getenv('RPPREFIX')
import ctREFPROP.ctREFPROP as ct
RP = ct.REFPROPFunctionLibrary(root)
RP.SETPATHdll(root)

r1 = RP.REFPROPdll('AMMONIA','TP','H;S', RP.MASS_BASE_SI,0,0,10.279+273.15,5.160e5,[1.0])
h1, s1 = r1.Output[0:2]
r2 = RP.REFPROPdll('AMMONIA','PS','H', RP.MASS_BASE_SI, 0, 0, 15.313e5, s1, [1.0])
h2s = r2.Output[0]
eta_c = 0.9
h2 = h1 + (h2s-h1)/eta_c
print(f'h1: {h1}')
print(f'h2s: {h2s}')
print(f'h2: {h2}')
print(f'h2-h1: {h2-h1}')

yielding

h1: 1627020.6363631845
h2s: 1785115.9270992922
h2: 1802682.0705144152
h2-h1: 175661.4341512306
R-744 commented 2 years ago

Thanks Ian

It's a centrifugal comp and the compressor manufacturer claims this high efficiency. I thought it was high too. My problem is it is different when comparing it with Coolpack's delta h

R-744 commented 2 years ago

I'm confused why I'm getting different numbers and would really appreciate a Teams meeting to discuss. This method is very clunky. Would that be possible

ianhbell commented 2 years ago

Where do the "REFPROP" numbers come from?

R-744 commented 2 years ago

Hi Ian

Here is the comparison sheet I’ve been using maybe you can help me see where I’m making a mistake

Kind regards

[Description: Description: Description: Description: Description: Description: @.***

ANDY CAMPBELL, BEng ,CEng, FInstR

From: Ian Bell @.> Sent: Wednesday, October 26, 2022 12:27 To: usnistgov/REFPROP-wrappers @.> Cc: Andy.Campbell @.>; Author @.> Subject: [EXTERNAL] Re: [usnistgov/REFPROP-wrappers] Enthalpy differences when using R-717 (Issue #487)

Where do the "REFPROP" numbers come from?

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/usnistgov/REFPROP-wrappers/issues/487*issuecomment-1292372367__;Iw!!Ba8_KKAT!LXn65rbHSjuqkXf57CbEvgz5j2kNGUPykEIGQkU0uX6Q6cmmaomj4pzl7n1PgZ4qjdc3h9NdfpCPUZnN8CnnrQSPfnvr$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/A32TPJEZWMGQJC23DPLCGFDWFFSXXANCNFSM6AAAAAARO75B6A__;!!Ba8_KKAT!LXn65rbHSjuqkXf57CbEvgz5j2kNGUPykEIGQkU0uX6Q6cmmaomj4pzl7n1PgZ4qjdc3h9NdfpCPUZnN8CnnrZ886OqJ$. You are receiving this because you authored the thread.Message ID: @.**@.>>

ianhbell commented 2 years ago

You are responding to the GitHub email, which doesn't do attachments.

ianhbell commented 2 years ago

I think you have a bug in your workbook, which you will have to find. REFPROP appears to be fine.

R-744 commented 2 years ago

Thanks Ian This leaves me stranded without a product I can use which my company has paid for. I'm not sure what a bug means and there is no way to discuss this other than this rudimentary way. This is beyond frustrating. I'm asking for help

ianhbell commented 2 years ago

If you can demonstrate a simple case where REFPROP gives the wrong answer (like the example I showed), then I can help.

ianhbell commented 2 years ago

There are far too many moving parts in your example to tease out where REFPROP fits into the picture.

R-744 commented 2 years ago

Thanks Ian This is why I requested a Teams meeting to demonstrate this. I will try and do it over this chat room method but it will be difficult. I will start another spreadsheet and see if that work by attaching it to the chat room. I could explain this in 2 minutes over a teams discussion

ianhbell commented 2 years ago

We do not in general provide custom user support. That is why the Github issues are used so that all users of the REFPROP community can learn from our correspondence.

ianhbell commented 2 years ago

On your side, put together an example that demonstrates these values, in particular h2s, as I am quite sure that is where the problem is:

h1: 1627020.6363631845
h2s: 1785115.9270992922
h2: 1802682.0705144152
h2-h1: 175661.4341512306
R-744 commented 2 years ago

221026 EXAMPLE IN EXCEL FOR REFPROP.xlsx

ianhbell commented 2 years ago

Typo in your code. You need PS inputs for isentropic state point 2.

R-744 commented 2 years ago

Super thanks Sorry I don't understand can you give me an example of what you are talking about

ianhbell commented 2 years ago

The isentropic outlet state of the compressor is based on the discharge pressure and the compressor inlet entropy.

R-744 commented 2 years ago

Yes Can you see what I'm trying to do in the sheet, can you offer an opinion or suggestion. Is there a person I can talk to about this, is there a class I can take to solve this. I will do what it takes but this chat room is so backward and piecemeal. I would really really appreciate some help please

ianhbell commented 2 years ago

This is outside the scope of REFPROP support, your problem is one of thermodynamics, not REFPROP. REFPROP is doing exactly what you asked it to.

In your particular case, in the cell K3 you need to first calculate the condensing pressure, and then use that in this call:

=REFPROP("H","Ammonia","PS","SI with C",CELLWITHPRESSURE,J4,0)

To match my example in Python:

import os 
root = os.getenv('RPPREFIX')
import ctREFPROP.ctREFPROP as ct
RP = ct.REFPROPFunctionLibrary(root)
RP.SETPATHdll(root)

r1 = RP.REFPROPdll('AMMONIA','TP','H;S', RP.MASS_BASE_SI,0,0,10.279+273.15,5.160e5,[1.0])
h1, s1 = r1.Output[0:2]
r2 = RP.REFPROPdll('AMMONIA','PS','H', RP.MASS_BASE_SI, 0, 0, 15.313e5, s1, [1.0])
h2s = r2.Output[0]
eta_c = 0.9
h2 = h1 + (h2s-h1)/eta_c
print(f'h1: {h1}')
print(f'h2s: {h2s}')
print(f'h2: {h2}')
print(f'h2-h1: {h2-h1}')
R-744 commented 2 years ago

Super thanks I don't use python I use excel but thank you for your support I'll try your suggestion with my limited data

ianhbell commented 2 years ago

Right, the point is the approach and the Python function is very similar to the Excel one. Note how I first do a TP call just like you, followed by a PS call with the discharge pressure.

R-744 commented 2 years ago

Thanks

I'll try don't really understand particularly confused by 'H;S' as opposed to 'H' Is there a commercial entity of Refprop where I can pay for actual live help, happy to pay to get my problem solved

ianhbell commented 2 years ago

H;S just means I want both enthalpy and entropy as outputs.

Nope, afraid not. But I would suggest you focus on thermodynamic help, the issue you raised had nothing to do with REFPROP.

ianhbell commented 2 years ago

Do you still not understand what I am recommending to fix this particular problem?

R-744 commented 2 years ago

The fact that I didn't know you could get two outputs would suggest I also have an issue is my knowledge of Refprop

R-744 commented 2 years ago

I'm working on it

ianhbell commented 2 years ago

You don't need to do it in the simplified way I did, you could also have made two calls, though this would be computationally wasteful if you care about computation speed.

R-744 commented 2 years ago

Does not seem to be an option in excel option. I need to talk to a person to solve this I think as chat rooms are not that easy to communicate in and flow information

ianhbell commented 2 years ago

Also your calculation of h3 is wrong, it should be at the condensing pressure and at a temperature corresponding to the subcooling.

ianhbell commented 2 years ago

So the steps you need are: 1) Calculate the condensing pressure with the refprop function 2) Do a calculation of enthalpy with REFPROP with the condensing pressure and the compressor inlet entropy. This gives you h2s (the isentropic enthalpy at compressor outlet)

R-744 commented 2 years ago
  1. Calculate the condensing pressure with the refprop function

I only have the condensing temperature available , that is why io was following my logic in the example I sent. In the excel unit it seem like it wont do a simple conversion from temperature to pressure without another property

ianhbell commented 2 years ago

If you know the condensing temperature, then you use the refprop function to calculate the saturation pressure. Something like this:

=refprop("P","Ammonia","TQ","SI with C",25,0,0)

Have you read over in detail the Excel workbook provided with REFPROP? You can also get a copy from here: https://github.com/usnistgov/REFPROP-wrappers/raw/master/wrappers/Excel/REFPROP.XLS

R-744 commented 2 years ago

Brilliant I'll have a read now thank you

R-744 commented 2 years ago

Thank you Ian I have worked through your comments and guidance and it makes perfect sense now thank you for all your help Kind regards Andy

ianhbell commented 2 years ago

Glad this is resolved.

For my reference, how did you get units in your Excel spreadsheet?

R-744 commented 2 years ago

Right click on a cell : format cell:Number : Custom : put in the amount of decimal places then " your units "

ianhbell commented 2 years ago

Learn something new every day... I thought you had an add-in for adding unit awareness to Excel

R-744 commented 2 years ago

That would be awesome