Skip to content

Commit

Permalink
fix(window): layer thickness in mm
Browse files Browse the repository at this point in the history
  • Loading branch information
TammieYu committed Nov 29, 2023
1 parent e495ce9 commit 117c01a
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions frads/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Layer:
ir_transmittance: IR transmittance of the layer.
rgb: PaneRGB object.
"""

product_name: str
thickness: float
product_type: str
Expand All @@ -63,6 +64,7 @@ class Gas:
gas: Gas type.
ratio: Gas ratio.
"""

gas: str
ratio: float

Expand All @@ -81,6 +83,7 @@ class Gap:
gas: List of Gas objects.
thickness: Thickness of the gap.
"""

gas: List[Gas]
thickness: float

Expand Down Expand Up @@ -228,15 +231,20 @@ def create_pwc_gaps(gaps: List[Gap]):
pwc_gaps = []
for gap in gaps:
_gas = pwc.create_gas(
[[g.ratio, getattr(pwc.PredefinedGasType, g.gas.upper())] for g in gap.gas]
[
[g.ratio, getattr(pwc.PredefinedGasType, g.gas.upper())]
for g in gap.gas
]
)
_gap = pwc.Layers.gap(gas=_gas, thickness=gap.thickness)
pwc_gaps.append(_gap)
return pwc_gaps


def create_glazing_system(
name: str, layers: List[Union[Path, bytes]], gaps: Optional[List[Gap]] = None
name: str,
layers: List[Union[Path, bytes]],
gaps: Optional[List[Gap]] = None,
) -> GlazingSystem:
"""Create a glazing system from a list of layers and gaps.
Expand Down Expand Up @@ -281,7 +289,8 @@ def create_glazing_system(
if product_data is None:
raise ValueError("Invalid layer type")
layer_data.append(product_data)
thickness += product_data.thickness / 1000.0 or 0 # mm to m
product_data.thickness = product_data.thickness / 1000.0 or 0 # mm to m
thickness += product_data.thickness

glzsys = pwc.GlazingSystem(
solid_layers=layer_data,
Expand All @@ -303,10 +312,12 @@ def create_glazing_system(
layers=get_layers(layer_data),
gaps=gaps,
solar_front_absorptance=[
alpha.front.absorptance.angular_total for alpha in solres.layer_results
alpha.front.absorptance.angular_total
for alpha in solres.layer_results
],
solar_back_absorptance=[
alpha.back.absorptance.angular_total for alpha in solres.layer_results
alpha.back.absorptance.angular_total
for alpha in solres.layer_results
],
visible_back_reflectance=vissys.back.reflectance.matrix,
visible_front_reflectance=vissys.front.reflectance.matrix,
Expand Down

0 comments on commit 117c01a

Please # to comment.