Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crates/python_api/docs/api/sfpe-handbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 2 additions & 0 deletions crates/python_api/src/sfpe_handbook/chapter_50.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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))?;
Expand Down
46 changes: 46 additions & 0 deletions crates/python_api/src/sfpe_handbook/chapter_50/equation_50_17.rs
Original file line number Diff line number Diff line change
@@ -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<f64> {
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(())
}
1 change: 1 addition & 0 deletions crates/sfpe_handbook/src/chapter_50.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/sfpe_handbook/src/chapter_50/equation_50_16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ mod tests {
let expected = 2.035971223;
assert!((result - expected).abs() < 1e-6);
}
}
}
20 changes: 20 additions & 0 deletions crates/sfpe_handbook/src/chapter_50/equation_50_17.rs
Original file line number Diff line number Diff line change
@@ -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);
}
}