mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Rename SapEnergySource.mains_gas to gas_connection_available 🟩
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a174301136
commit
9b58bebfb8
8 changed files with 17 additions and 17 deletions
|
|
@ -32,8 +32,8 @@ _FUEL_CODES: dict[str, int] = {
|
|||
}
|
||||
|
||||
# A "mains gas" main fuel asserts the dwelling has a mains-gas connection, so the
|
||||
# overlay must also flip `sap_energy_source.mains_gas` — not just the fuel code.
|
||||
# Without it the effective EPC says "fuel = mains gas" while `mains_gas` stays
|
||||
# overlay must also flip `sap_energy_source.gas_connection_available` — not just the fuel code.
|
||||
# Without it the effective EPC says "fuel = mains gas" while `gas_connection_available` stays
|
||||
# False, which (a) gates out the gas-boiler-upgrade Measure and (b) makes the
|
||||
# heating Generator read the dwelling as off-gas and wrongly offer HHRSH storage
|
||||
# (property 728513). Only the **private** mains-gas connection (code 26) sets it;
|
||||
|
|
@ -51,7 +51,7 @@ def fuel_overlay_for(
|
|||
code = _FUEL_CODES.get(main_fuel_value)
|
||||
if code is None:
|
||||
return None
|
||||
mains_gas = True if main_fuel_value in _MAINS_GAS_FUEL_VALUES else None
|
||||
gas_connection_available = True if main_fuel_value in _MAINS_GAS_FUEL_VALUES else None
|
||||
return EpcSimulation(
|
||||
heating=HeatingOverlay(main_fuel_type=code, gas_connection_available=mains_gas)
|
||||
heating=HeatingOverlay(main_fuel_type=code, gas_connection_available=gas_connection_available)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ _SAP_HEATING_FIELDS: tuple[str, ...] = (
|
|||
"cylinder_thermostat",
|
||||
"immersion_heating_type",
|
||||
)
|
||||
_ENERGY_SOURCE_FIELDS: tuple[str, ...] = ("meter_type", "mains_gas")
|
||||
_ENERGY_SOURCE_FIELDS: tuple[str, ...] = ("meter_type", "gas_connection_available")
|
||||
|
||||
|
||||
def _is_off_peak_meter(meter_type: object) -> bool:
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ class HeatingOverlay:
|
|||
(`water_heating_*`, cylinder size + insulation);
|
||||
- the top-level `EpcPropertyData` — `has_hot_water_cylinder`;
|
||||
- ``sap_energy_source`` — `meter_type` (an off-peak tariff for storage) and
|
||||
`mains_gas` (cleared when the dwelling goes all-electric).
|
||||
`gas_connection_available` (cleared when the dwelling goes all-electric).
|
||||
|
||||
The values are **absolute target states**, not deltas (the bundle replaces
|
||||
the system regardless of the before). A `None` field means "leave the
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ def make_minimal_sap10_epc(
|
|||
photovoltaic_arrays: Optional[list[PhotovoltaicArray]] = None,
|
||||
photovoltaic_supply_percent_roof_area: Optional[int] = None,
|
||||
pv_connection: Optional[int] = None,
|
||||
mains_gas: bool = True,
|
||||
gas_connection_available: bool = True,
|
||||
electricity_smart_meter_present: bool = False,
|
||||
gas_smart_meter_present: bool = False,
|
||||
is_dwelling_export_capable: bool = False,
|
||||
|
|
@ -319,7 +319,7 @@ def make_minimal_sap10_epc(
|
|||
list(sap_roof_windows) if sap_roof_windows is not None else None
|
||||
),
|
||||
sap_energy_source=SapEnergySource(
|
||||
gas_connection_available=mains_gas,
|
||||
gas_connection_available=gas_connection_available,
|
||||
meter_type="Single",
|
||||
pv_connection=pv_connection,
|
||||
pv_battery_count=pv_battery_count,
|
||||
|
|
|
|||
|
|
@ -1020,7 +1020,7 @@ def test_to_row_extracts_energy_source_booleans() -> None:
|
|||
# Arrange — gas + electricity smart meters, export capable
|
||||
epc = make_minimal_sap10_epc(
|
||||
energy_rating_current=82,
|
||||
mains_gas=True,
|
||||
gas_connection_available=True,
|
||||
electricity_smart_meter_present=True,
|
||||
gas_smart_meter_present=True,
|
||||
is_dwelling_export_capable=True,
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ def test_community_mains_gas_is_a_distinct_fuel_code() -> None:
|
|||
|
||||
def test_mains_gas_fuel_sets_the_mains_gas_connection_flag() -> None:
|
||||
# A "mains gas" fuel means the dwelling has a mains-gas connection, so the
|
||||
# overlay must set sap_energy_source.mains_gas too — not only the fuel code.
|
||||
# Without it the effective EPC says "fuel = mains gas" yet mains_gas=False,
|
||||
# overlay must set sap_energy_source.gas_connection_available too — not only the fuel code.
|
||||
# Without it the effective EPC says "fuel = mains gas" yet gas_connection_available=False,
|
||||
# which suppresses the gas-boiler-upgrade path and wrongly offers HHRSH
|
||||
# storage (the off-gas path). (Property 728513.)
|
||||
simulation = fuel_overlay_for("mains gas", 0)
|
||||
|
|
|
|||
|
|
@ -190,9 +190,9 @@ def test_gas_boiler_house_yields_an_ashp_bundle() -> None:
|
|||
cylinder_insulation_type=1,
|
||||
cylinder_insulation_thickness_mm=50,
|
||||
cylinder_thermostat="Y",
|
||||
gas_connection_availableater_cylinder=True,
|
||||
has_hot_water_cylinder=True,
|
||||
meter_type="Single",
|
||||
mains_gas=False,
|
||||
gas_connection_available=False,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -336,11 +336,11 @@ def test_apply_folds_a_heating_overlay_across_all_five_locations() -> None:
|
|||
cylinder_insulation_thickness_mm=120,
|
||||
has_hot_water_cylinder=True,
|
||||
meter_type="18 Hour",
|
||||
mains_gas=False,
|
||||
gas_connection_available=False,
|
||||
)
|
||||
)
|
||||
|
||||
# Actgas_connection_available
|
||||
# Act
|
||||
result: EpcPropertyData = apply_simulations(baseline, [simulation])
|
||||
|
||||
# Assert — every targeted field routed to its home object.
|
||||
|
|
@ -413,11 +413,11 @@ def test_baseline_heating_is_not_mutated_by_a_heating_overlay() -> None:
|
|||
main_heating_control=2404,
|
||||
water_heating_code=903,
|
||||
has_hot_water_cylinder=True,
|
||||
mains_gas=False,
|
||||
gas_connection_available=False,
|
||||
)
|
||||
)
|
||||
],
|
||||
)gas_connection_available
|
||||
)
|
||||
|
||||
# Assert — the baseline's heating is untouched.
|
||||
assert baseline.sap_heating.main_heating_details[0].main_fuel_type == original_fuel
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue