forked from oscarcontrerasnavas/NIST-web-book-scraping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsaturation.py
30 lines (19 loc) · 805 Bytes
/
saturation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Import GetAntoineCoef because it return the antoine coefficients for using
# them into the calcs
from antoine import get_antoine_coef
# Import the log10 function from Math module
from math import log10
def get_saturation_pressure(Name, Temperature):
""" Return the value of the vapor pressure in bar at Temperature
:param Name:
String with the name of the substance in english.
:param Temperature:
float number of the temperature in Kelvin.
:rtype float
:return vapor_pressure
"""
# Obtaining the antoine coefficients [A,B,C]
[A, B, C] = get_antoine_coef(Name, Temperature)
# Calculating the vapor_pressure from log10(Psat) = A - B/(Temperature + C)
vapor_pressure = 10 ** (A - B/(Temperature + C))
return vapor_pressure