Post Reply 
Compresibility factor, residual entropy and residual enthalpy calculator.
01-03-2019, 11:32 AM (This post was last modified: 01-04-2019 07:17 AM by DevilGladiator.)
Post: #1
Compresibility factor, residual entropy and residual enthalpy calculator.
Hi, I'm an aeronautical engeering student in spain. Today I would like to share with you the program that I've just created, it's a compresibility factor, residual entropy and residual enthalpy calculator using the Leee Kesler method.

How it works:
I'm tired of looking for the values of the compresibility factor and residual entropy/enthalpy in tables/charts. For this reason I copied the data from the tables of my textbook using an OCR scanner into the HP Prime and made a little program that interpolates the values if they fall between two data points. By the way the tables that I've copied are shared among many books like Advanced Thermodynamics For Engineers McGraw-Hill and are extracted from this paper: http://dns2.asia.edu.tw/~ysho/YSHO-Engli...%20510.pdf.

The calculation of the compresibility factor is done as follows:
Z = Z0 + w*Z1
(H*-H)/(R*Tc) = H0 + w*H1
(S*-S)/(R) = S0 + w*S1
Where Z0, Z1, S0, S1, H0 and H1 are looked in the table and w, the accentric factor, is provided by the user.

Usage:
The program comes with three four functions, all of them have the same inputs
Inputs:
-Pr: Reducced pressure of the gas (P/Pr):
-Tr: Reducced temperature of the gas (T/Tr):
-w: Accentric factor of the gas
  • STATE_DATA(): Outputs the value of Z, (H*-H)/(R*Tc), (S*-S)/(R)
  • FACTOR_Z(Pr,Tr,w): Outputs the value of Z
  • DESV_H(Pr,Tr,w): Outputs the value of (H*-H)/(R*Tc)
  • DESV_S(Pr,Tr,w): Outputs the value of (S*-S)/R

NOTES:
Many textbooks provide charts for Z, (H*-H)/(R*Tc) and (S*-S)/(R) instead of tables, you should notice that these charts are independent of the accentric factor. I know that this is not scientific at all but I've found out that if you input the value of w=0.175 (If for some reason a student from my university, ETSIAE is reading this with that value of 'w' you will get enough precission in the exam) you get a result that is really close to the one obtained from the charts. If someone with a true knowledge on the matter knows how to calculate 'w' to get the same results as on the charts please tell share your knowledge.

Limitations/Potential improvements:
  • One of the main limitations of the program is that it doesn't work for values of Tr<0.3 because the tables don't contain any data points for reduced pressures below that value. If someone knows of a source with more data points different that the ones already included in the program please share them.
  • The interpolation system that I've implemented is linear and I'm sure that it is not optimal. If someone knows how to improve it please do it and share it.
  • Keep in mind that I know little programming so the code of the program should be improved.

Licence:
You are free to use, modify and share the program as long as you keep it free, don't modify the licence and reference me and any other contributor as the original authors.


Attached File(s)
.hpprgm  TablasTermodinamica.hpprgm (Size: 28.12 KB / Downloads: 10)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)