aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorsam-anthony <samanthony6@protonmail.com>2022-01-15 20:31:04 -0330
committersam-anthony <samanthony6@protonmail.com>2022-01-15 20:31:04 -0330
commitef3980225a0a0ed5bea0d748709c1f227e33c851 (patch)
treeeafe6e82c02224ea62b5c7acdf75ae2fd93f2187 /src/lib.rs
downloadvolute-ef3980225a0a0ed5bea0d748709c1f227e33c851.zip
units of measurement
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..79dda37
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,14 @@
+pub mod flow_rate;
+pub mod mass;
+pub mod pressure;
+pub mod temperature;
+pub mod volume;
+
+use crate::{pressure::Pressure, temperature::Temperature, volume::Volume};
+
+const GAS_CONSTANT: f64 = 8.314472;
+const MOLAR_MASS_OF_AIR: f64 = 0.0289647; // Kg/mol
+
+fn moles_from_gas_law(pressure: Pressure, volume: Volume, temperature: Temperature) -> f64 {
+ (pressure.as_pascals() * volume.as_cubic_metres()) / (GAS_CONSTANT * temperature.as_kelvin())
+}