From a7c99e7bed015db546969d5f9a87fc6ffd1f2ea8 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Fri, 28 Feb 2025 18:41:07 -0500 Subject: volume flow rate conversion functions --- unit.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'unit.c') diff --git a/unit.c b/unit.c index 316a39a..9e03abf 100644 --- a/unit.c +++ b/unit.c @@ -12,6 +12,12 @@ /* Metres per inch. */ #define M_PER_IN 0.0254 +/* Metres per foot. */ +#define M_PER_FT 0.3048 + +/* Seconds per minute. */ +#define SEC_PER_MIN 60.0 + AngularSpeed rad_per_sec(double x) { @@ -133,3 +139,34 @@ double as_cubic_inch(double x) { return x / 1.6387064e-5; } + + +VolumeFlowRate +cubic_metre_per_sec(double x) { + return x; +} + +VolumeFlowRate +cubic_metre_per_min(double x) { + return x / SEC_PER_MIN; +} + +VolumeFlowRate +cubic_foot_per_min(double x) { + return x * pow(M_PER_FT, 3) / SEC_PER_MIN; +} + +double +as_cubic_metre_per_sec(VolumeFlowRate x) { + return x; +} + +double +as_cubic_metre_per_min(VolumeFlowRate x) { + return x * SEC_PER_MIN; +} + +double +as_cubic_foot_per_min(VolumeFlowRate x) { + return x * SEC_PER_MIN / pow(M_PER_FT, 3); +} -- cgit v1.2.3