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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Psychrometry is derived from PsychroLib <https://github.com/psychrometrics/psychrolib>.
//!
//! This library should make it easy to integrate temperature and humidity sensors with
//! your rust based dashboards. Versions of PsychroLib for other languages are available
//! from the above repository. The names are as close to the original as possible. The one
//! major difference is that the function calls in this library is in snake_case while the original
//! repository uses CamelCase. This library will update when it merges upstream.
//!
//! # Quick Start
//! The following example lets you get the enthalpy of moist air with dry bulb temperature
//! and relative humidty.
//! ```
//! use psychrometry::psychrolib::*;
//! use psychrometry::quantities::{Pressure, SpecificEnthalpy, Temperature};
//! use psychrometry::units::{Atmosphere, Fahrenheit, JoulesPerKg, KilojoulesPerKg};
//! let rel_hum = 0.25;
//! let tdry_bulb = Temperature::<Fahrenheit>::from(86);
//! let pres_ambient = Pressure::<Atmosphere>::from(1);
//! let sp_enthalpy: SpecificEnthalpy<KilojoulesPerKg> =
//! get_moist_air_enthalpy_from_rel_hum(tdry_bulb, rel_hum, pres_ambient).unwrap();
//! let sp_enthalpy_exp = SpecificEnthalpy::<JoulesPerKg>::from(47015.61);
//! assert_eq!(sp_enthalpy_exp, sp_enthalpy);
//! ```
//! You can use any of the following units
//!
//! ## Quantities and units
//! - Temperature
//! - celcius
//! - kelvin
//! - fahrenheit
//! - Pressure
//! - pascal
//! - psi
//! - atmosphere
//! - Specific Enthalpy
//! - joules per kilogram
//! - kilojoules per kilogram
//! - btu per pound
//! # Functions implemented so far
//! - `get_trankine_from_tfahrenheit`
//! - `get_tfahrenheit_from_trankine`
//! - `get_tkelvin_from_tcelsius`
//! - `get_tcelsius_from_tkelvin`
//! - `get_sat_vap_pres`
//! - `get_moist_air_enthalpy`
//! - `get_vap_pres_from_hum_ratio`
//! - `get_moist_air_enthalpy_from_hum_ratio`
//! - `get_moist_air_enthalpy_from_rel_hum`
//! - `get_rel_hum_from_vap_pres`
//! - `get_vap_pres_from_rel_hum`
//! - `get_hum_ratio_from_vap_pres`
//! - `get_hum_ratio_from_rel_hum`
//TODO: Fix documentation formating for units with underscore
//TODO: Documentation for Result errors. The pedantic warning can be enabled after that.
// Too many false positives for now. Especially for cast_possible_truncation
// #![warn(clippy::pedantic)]
// #![warn(missing_docs)]
// TODO: Implement display and formatting for various quantities
// TODO: Implement pressure, relative humidity, humidity ratio, specific enthalpy
/// Funtions for psychrometric calculations.