GithubHelp home page GithubHelp logo

psychrometry's Introduction

PsychroPy: Psychrometrics with Python

Presentation

PsychroPy is a python package dedicated to psychrometrics calculations, so dealing with humid or moist air. This package is (so far) mostly based on the CoolProp one, and more specifically on its humid air function called HAPropsSI. The main brick of this package is for the moment a class called MoistAir, which contain the complete physical state of a given humid air, so its temperature and its humidity, considered for example at a specific location within an HVAC system. The humidity of air can be entered using either:

  • its specific humidity (aka moisture content or mixing ratio), noted W and defined as the ratio of the mass of water vapour on the one of dry air it is mixed with, so mathematically: $$W = \frac{m_w}{m_{da}}$$
  • its relative humidity, noted R.
  • its wet bulb temperature, noted B.
  • its dew point temperature, noted D. From such parameters, all the other ones, as for instance the air specific enthalpy or its specific volume, can be directly obtained. Two parameters, as e.g. temperature and relative humidity (TR) or dry and wet bulb temperature (TB), are required to unambiguously define the state of any humid air.

Example

Consider for example an hypothetical HVAC system that extracts air from the outside and, after treatment, inject it into a given building in order to reach a humid air state corresponding to a temperature of 20°C and a relative humidity of 50%. To manipulate such an air, we can instance an object from the class MoistAir, called for example inside, which will contain what we know about this air:

from psychrometry import psychropy as psp
inside =  psp.MoistAir()
# Known parameters of outside air
inside.TR = 20.0 + 273.15, 0.5
# Requested specific humidity and enthalpy of the inside
Wi, Hi = inside.specific_humidity, inside.specific_enthalpy

The results are a specific humidity Wi = 7.29e-3 and a specific enthalpy Hi = 38.62 (in kJ/kg). Let us emphasize that:

  • Temperature is always expressed in Kelvin.
  • Parameters of the air are entered using a notation close the one used by CANTERA, and mentioning explicitely the two concerned parameters, here inside.TR for temperature and relative humidity. The same parameters may be entered in the reverse order using inside.RT, or using different ways to quantity humidity: inside.TB, inside.DT, inside.TW, and so on.
  • Specific humidity is expressed in kg of water vapour per kilogram of dry air, so dimensionless.
  • Specific enthalpy is expressed in kJ/kg or dry air. If the HVAC system is equipped with two temperature sensors, a usual one (that gives T) and a wet bulb one (that gives B), both measuring the state of the outside air. We can have for example (in winter):
outside = psp.MoistAir()
# Outside pressure of 1 bar
outside.pressure = 1.0 * 1e5
# Measured dry temperature of 5°C and Wet-Bulb one of 3°C
outside.TB = 5.0 + 273.15, 3.0 + 273.15
# Outside specific humidity and enthalpy 
W0, H0 = outside.specific_humidity, outside.specific_enthalpy

If the dry air mass flow rate of ventilation is known, and noted for example ma, the humidifying water mass flow rate to inject into this air stream is given by:

# Humidification mass flow rate, with the same unit of the dry air one 
humidification_flow_rate = ma*(Wi-W0)

In the very same way, the heat rate with have to supply to the same air stream is given by:

# Heating heat rate, expressed in kW if the dry air mass flow rate is in kg/s
heat_rate = ma*(Hi-H0)

Exergy calculations

Exergy of humid air, regarding to a reference or dead state can also be calculated by PsychroPy, using:

ex = inside.specific_exergy(ref_state=inside)

The used dead state has to be represented by an MoistAir object.

The fast computation option

Although very accurate and efficient, the CoolProp package involves sometimes quite long calculations, for example when the air parameters are entered using the wet bulb or the dew_point temperature. When large amounts of temperature measurements are involved, it is possible to switch the psychropy package into a fast computation mode, using the fast_computation boolean attribute, as:

outside.fast_computation = True

The CoolProp package is then not used anymore for calculations, which are led using the common explicit equations of psychrometry, as presented in the well known ASHRAE handbook.

Any question, remark or advice of improvement is welcome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.