Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(window): layer thickness in mm #49

Merged
merged 2 commits into from
Nov 29, 2023
Merged
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
24 changes: 17 additions & 7 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 All @@ -330,8 +341,7 @@ def get_layer_rgb(layer: pwc.ProductData) -> PaneRGB:
coated_side=None,
)
hemi = {
d.wavelength
* 1e3: (
int(round(d.wavelength * 1e3)): (
d.direct_component.transmittance_front,
d.direct_component.transmittance_back,
d.direct_component.reflectance_front,
Expand Down