diff --git a/crates/python_api/docs/api/sfpe-handbook.rst b/crates/python_api/docs/api/sfpe-handbook.rst index b44b787..8253ffd 100644 --- a/crates/python_api/docs/api/sfpe-handbook.rst +++ b/crates/python_api/docs/api/sfpe-handbook.rst @@ -108,6 +108,14 @@ Equation 50.16 - Flow Area Factor for Pressurization Systems :undoc-members: :show-inheritance: +Equation 50.17 - Stairwell Temperature for Untreated Pressurization Air +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: ofire.sfpe_handbook.chapter_50.equation_50_17 + :members: + :undoc-members: + :show-inheritance: + Equation 50.18 - Fractional Effective Dose ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/crates/python_api/src/sfpe_handbook/chapter_50.rs b/crates/python_api/src/sfpe_handbook/chapter_50.rs index 9d0a733..21d5959 100644 --- a/crates/python_api/src/sfpe_handbook/chapter_50.rs +++ b/crates/python_api/src/sfpe_handbook/chapter_50.rs @@ -2,6 +2,7 @@ pub mod equation_50_1; pub mod equation_50_14; pub mod equation_50_15; pub mod equation_50_16; +pub mod equation_50_17; pub mod equation_50_18; pub mod equation_50_19; pub mod equation_50_2; @@ -24,6 +25,7 @@ pub fn chapter_50(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_wrapped(wrap_pymodule!(equation_50_14::equation_50_14))?; m.add_wrapped(wrap_pymodule!(equation_50_15::equation_50_15))?; m.add_wrapped(wrap_pymodule!(equation_50_16::equation_50_16))?; + m.add_wrapped(wrap_pymodule!(equation_50_17::equation_50_17))?; m.add_wrapped(wrap_pymodule!(equation_50_18::equation_50_18))?; m.add_wrapped(wrap_pymodule!(equation_50_19::equation_50_19))?; m.add_wrapped(wrap_pymodule!(equation_50_20::equation_50_20))?; diff --git a/crates/python_api/src/sfpe_handbook/chapter_50/equation_50_17.rs b/crates/python_api/src/sfpe_handbook/chapter_50/equation_50_17.rs new file mode 100644 index 0000000..3a72c4f --- /dev/null +++ b/crates/python_api/src/sfpe_handbook/chapter_50/equation_50_17.rs @@ -0,0 +1,46 @@ +use pyo3::prelude::*; +use pyo3::wrap_pyfunction; + +use openfire::sfpe_handbook::chapter_50::equation_50_17 as rust_equation_50_17; + +#[pyfunction] +/// Stairwell temperature calculation for untreated pressurization air. +/// +/// .. math:: +/// +/// T_S = T_0 + \eta (T_B - T_0) +/// +/// where: +/// +/// - :math:`T_S` is the stairwell temperature (°C) +/// - :math:`T_0` is the outdoors temperature (°C) +/// - :math:`\eta` is the heat transfer factor (dimensionless) +/// - :math:`T_B` is the building temperature (°C) +/// +/// Args: +/// t_0 (float): Outdoors temperature (°C) +/// eta (float): Heat transfer factor (dimensionless) +/// t_b (float): Building temperature (°C) +/// +/// Returns: +/// float: Stairwell temperature (°C) +/// +/// Assumptions: +/// None stated. +/// +/// Limitations: +/// This equation applies to untreated pressurization air. A heat transfer factor of :math:`\eta = 0.15` is suggested in the absence of better data. +/// +/// Example: +/// >>> import ofire +/// >>> result = ofire.sfpe_handbook.chapter_50.equation_50_17.stairwell_temperature(-10.0, 0.15, 15.0) +/// >>> print(f"{result:.2f}") +fn stairwell_temperature(t_0: f64, eta: f64, t_b: f64) -> PyResult { + Ok(rust_equation_50_17::stairwell_temperature(t_0, eta, t_b)) +} + +#[pymodule] +pub fn equation_50_17(m: &Bound<'_, PyModule>) -> PyResult<()> { + m.add_function(wrap_pyfunction!(stairwell_temperature, m)?)?; + Ok(()) +} \ No newline at end of file diff --git a/crates/sfpe_handbook/src/chapter_50.rs b/crates/sfpe_handbook/src/chapter_50.rs index f7dde78..203a463 100644 --- a/crates/sfpe_handbook/src/chapter_50.rs +++ b/crates/sfpe_handbook/src/chapter_50.rs @@ -2,6 +2,7 @@ pub mod equation_50_1; pub mod equation_50_14; pub mod equation_50_15; pub mod equation_50_16; +pub mod equation_50_17; pub mod equation_50_18; pub mod equation_50_19; pub mod equation_50_2; diff --git a/crates/sfpe_handbook/src/chapter_50/equation_50_16.rs b/crates/sfpe_handbook/src/chapter_50/equation_50_16.rs index 7f839be..b0a0a9f 100644 --- a/crates/sfpe_handbook/src/chapter_50/equation_50_16.rs +++ b/crates/sfpe_handbook/src/chapter_50/equation_50_16.rs @@ -28,4 +28,4 @@ mod tests { let expected = 2.035971223; assert!((result - expected).abs() < 1e-6); } -} +} \ No newline at end of file diff --git a/crates/sfpe_handbook/src/chapter_50/equation_50_17.rs b/crates/sfpe_handbook/src/chapter_50/equation_50_17.rs new file mode 100644 index 0000000..79c8523 --- /dev/null +++ b/crates/sfpe_handbook/src/chapter_50/equation_50_17.rs @@ -0,0 +1,20 @@ +pub fn stairwell_temperature(t_0: f64, eta: f64, t_b: f64) -> f64 { + t_0 + eta * (t_b - t_0) +} + +#[cfg(not(coverage))] +pub fn stairwell_temperature_equation(t_s: String, t_0: String, eta: String, t_b: String) -> String { + format!("{} = {} + {} \\times ( {} - {} )", t_s, t_0, eta, t_b, t_0) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_stairwell_temperature() { + let result = stairwell_temperature(-10.0, 0.15, 15.0); + let expected = -6.25; + assert!((result - expected).abs() < 1e-6); + } +}