I'm a first year chemical engineering student. We've learned to use python over the semester and now have a project to do. For a part of this project, i am using a module called Thermo, which can be used to obtain infromation about certain chemicals. You first need to specify the name of the molecule, the pressure and the temperature as follow:
import thermo as th
x = th.Chemical('H2O', T = 273, P = 101325)
You can then use this x variable followed by a function to obtain the value of let's say, the density of said susbstance at these conditions. Here's an example:
x.phase
x.rho
And such. There's a wide variety of properties which you can get using this module. However, I encounter a problem when the property for which i want to know the value is stored in a variable:
x = th.Chemical('H2O', T = 100, P = 10000) w = 'MW' (stands for molar weight)
print(x.w)
This is followed by this error message : AttributeError: 'Chemical' object has no attribute 'w' Someone on reddit told me it had something to do with class attributes, but didn't tell me how to solve the issue.
Any help with that would be greatly appreciated