mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Added new R value util function
This commit is contained in:
parent
9bb9b0707a
commit
4f83c85077
1 changed files with 34 additions and 17 deletions
|
|
@ -10,13 +10,15 @@ external_wall_insulation_parts = [
|
|||
# -slab-ewi-render-fire/
|
||||
"type": "external_wall_insulation",
|
||||
"description": "Mineral Wool External Wall Insulation",
|
||||
"depths": [],
|
||||
"depths": [30, 50, 70, 80, 90, 100],
|
||||
"depth_unit": "mm",
|
||||
"cost": None,
|
||||
"cost_unit": None,
|
||||
# The u-value here is just a placehoder for now and we probably want to have multiple
|
||||
# options for internal wall insulation (e.g. 50mm, 100mm, 150mm), with different material types
|
||||
# and costs
|
||||
"u_value": None
|
||||
"r_value_per_mm": 0.0278,
|
||||
"r_value_unit": "m2K/W"
|
||||
},
|
||||
{
|
||||
"type": "external_wall_insulation",
|
||||
|
|
@ -198,23 +200,38 @@ class WallRecommendations:
|
|||
return u_value_uplift, new_u_value
|
||||
|
||||
@staticmethod
|
||||
def convert_r_value_to_mm(r_value_wmk):
|
||||
def rvalue_per_mm(total_r_value: float, thickness_mm: float) -> float:
|
||||
"""Return R-value per mm.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
total_r_value : float
|
||||
Total R-value (in m2K/W).
|
||||
thickness_mm : float
|
||||
Thickness of the material in mm.
|
||||
|
||||
Returns
|
||||
-------
|
||||
float
|
||||
R-value per mm.
|
||||
"""
|
||||
Converts an R-value from units of W/m·K to per millimeter (mm).
|
||||
return total_r_value / thickness_mm
|
||||
|
||||
:param r_value_wmk: R-value in units of W/m·K.
|
||||
:type r_value_wmk: float
|
||||
|
||||
:return: Converted R-value per mm.
|
||||
:rtype: float
|
||||
|
||||
:notes:
|
||||
- This function utilizes the 'pint' library to handle units and perform the conversion.
|
||||
@staticmethod
|
||||
def r_value_per_mm_to_u_value(depth_mm: int, r_value_per_mm: float):
|
||||
"""
|
||||
Converts R-value per mm to U-value in W/m²K.
|
||||
|
||||
ureg = pint.UnitRegistry()
|
||||
Parameters
|
||||
----------
|
||||
depth_mm : int
|
||||
Depth of the material in mm.
|
||||
r_value_per_mm : float
|
||||
R-value per mm.
|
||||
|
||||
r_value = r_value_wmk * ureg.watt / (ureg.meter * ureg.kelvin)
|
||||
r_value_per_mm = r_value.to(1 / ureg.millimeter)
|
||||
|
||||
return r_value_per_mm.magnitude
|
||||
Returns
|
||||
-------
|
||||
float
|
||||
U-value in W/m²K.
|
||||
"""
|
||||
return 1 / (depth_mm * r_value_per_mm)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue