review: clearer room-in-roof area variable names in heat_transmission

PR feedback (dancafc): the simplified room-in-roof branch used cryptic
locals. Rename for clarity (behaviour-unchanged; the geom dict keys and
the builder-function locals are untouched):

  rr_a_rr      -> rr_roof_area          (the worksheet's simplified A_RR)
  rr_common    -> rr_common_wall_area
  rr_gable     -> rr_gable_area
  a_rr_final   -> rr_residual_roof_area  (leftover roof-going area after
                                          deducting perimeter walls/gables
                                          /rooflights — takes the roof U)

Names now mirror the `rr_*_area_m2` geom keys they read from and say
"area of what". Added a one-line note that `rr_roof_area` is the RdSAP 10
§3.10.1 A_RR. Pyright unchanged; 1087 heat-transmission/cascade-pin tests
pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-05 10:18:58 +00:00
parent 77f90e144e
commit 86b875af35

View file

@ -980,21 +980,28 @@ def heat_transmission_from_cert(
# U_main_wall per spec page 23 ("Common wall U-value is inferred
# from the U-value of the main wall in the building part below";
# gables fall under the same Table 4 rule).
rr_a_rr = geom["rr_simplified_a_rr_m2"]
rr_common = geom["rr_common_wall_area_m2"]
rr_gable = geom["rr_gable_area_m2"]
# `rr_roof_area` is the worksheet's simplified A_RR (the notional
# room-in-roof roof area, RdSAP 10 §3.10.1). Its perimeter common
# walls + gables are billed to walls; the leftover residual is the
# roof-going area that takes the roof U-value.
rr_roof_area = geom["rr_simplified_a_rr_m2"]
rr_common_wall_area = geom["rr_common_wall_area_m2"]
rr_gable_area = geom["rr_gable_area_m2"]
rr_detailed_area = 0.0
if rr_a_rr > 0:
if rr_roof_area > 0:
rir = part.sap_room_in_roof
assert rir is not None # rr_a_rr > 0 ⇒ rir present per _part_geometry
walls += uw * (rr_common + rr_gable)
assert rir is not None # rr_roof_area > 0 ⇒ rir present per _part_geometry
walls += uw * (rr_common_wall_area + rr_gable_area)
# Deduct any "Roof of Room" rooflights piercing the RR shell
# (see `rw_area_on_rr` rationale at the gross-roof block).
a_rr_final = max(0.0, rr_a_rr - rr_common - rr_gable - rw_area_on_rr)
rr_residual_roof_area = max(
0.0,
rr_roof_area - rr_common_wall_area - rr_gable_area - rw_area_on_rr,
)
u_rr = u_rr_default_all_elements(
country=country, age_band=rir.construction_age_band,
)
roof += u_rr * a_rr_final
roof += u_rr * rr_residual_roof_area
elif part.sap_room_in_roof is not None and part.sap_room_in_roof.detailed_surfaces:
# RdSAP10 §3.10 Detailed RR — iterate per-surface lodgement.
# Slope / flat_ceiling / stud_wall route to roof (worksheet
@ -1007,7 +1014,8 @@ def heat_transmission_from_cert(
# band". Wall-going RIR surfaces (gable_wall, gable_wall_
# external, common_wall) deduct from the simplified A_RR
# to leave the residual area, mirroring the Simplified
# branch's `a_rr_final = rr_a_rr - rr_common - rr_gable`.
# branch's `rr_residual_roof_area = rr_roof_area -
# rr_common_wall_area - rr_gable_area`.
# Roof-going surfaces (slope / flat_ceiling / stud_wall)
# do NOT deduct — they sit inside the RR shell rather than
# forming its perimeter walls.
@ -1179,7 +1187,7 @@ def heat_transmission_from_cert(
main_wall_area
+ (alt_walls_total_area - alt_window_area)
+ roof_area + floor_area_total
+ w_area + d_area + rw_area_part + rr_a_rr + rr_detailed_area
+ w_area + d_area + rw_area_part + rr_roof_area + rr_detailed_area
+ cantilever_area
)
total_external_area += part_external_area