aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
blob: 1646e172fc0a5d940c735b5457c9c0e694488010 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
pub mod app;
pub mod input;
pub mod unit_of_measurement;

use crate::unit_of_measurement::{Pressure, Temperature, Volume};

const GAS_CONSTANT: f64 = 8.314472;
const MOLAR_MASS_OF_AIR: f64 = 0.0289647; // Kg/mol

fn moles_from_gas_law(pres: Pressure, vol: Volume, temp: Temperature) -> f64 {
    (pres.as_pascals() * vol.as_cubic_metres()) / (GAS_CONSTANT * temp.as_kelvin())
}