mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
added total calcs
This commit is contained in:
parent
85f73eda5c
commit
8c711c9658
1 changed files with 37 additions and 3 deletions
|
|
@ -487,7 +487,8 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
data=epcs_for_scoring,
|
||||
bucket=get_settings().DATA_BUCKET,
|
||||
model_prefixes=["heating_kwh_predictions", "hotwater_kwh_predictions"],
|
||||
extract_ids=False
|
||||
extract_ids=False,
|
||||
batch_size=SCORING_BATCH_SIZE
|
||||
)
|
||||
|
||||
# Insert the spatial data
|
||||
|
|
@ -797,7 +798,13 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
ASHP_COP = 3
|
||||
descriptions_to_fuel_types = {
|
||||
"Air source heat pump, radiators, electric": {"fuel": "Electricity", "cop": ASHP_COP},
|
||||
"Boiler and radiators, mains gas": {"fuel": 'Natural Gas', "cop": 0.9}
|
||||
"Boiler and radiators, mains gas": {"fuel": 'Natural Gas', "cop": 0.9},
|
||||
'Electric storage heaters': {"fuel": 'Electricity', "cop": 1},
|
||||
"Electric immersion, off-peak": {"fuel": 'Electricity', "cop": 1},
|
||||
"Electric storage heaters, radiators": {"fuel": 'Electricity', "cop": 1},
|
||||
"Room heaters, electric": {"fuel": 'Electricity', "cop": 1},
|
||||
"Electric immersion, standard tariff": {"fuel": 'Electricity', "cop": 1},
|
||||
"Portable electric heaters assumed for most rooms": {"fuel": 'Electricity', "cop": 1},
|
||||
}
|
||||
|
||||
def map_descriptions_to_fuel(heating_description, hotwater_description):
|
||||
|
|
@ -810,7 +817,12 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
"heating_cop": mapped["cop"], "hotwater_cop": mapped["cop"]
|
||||
}
|
||||
|
||||
raise NotImplementedError("Implement me")
|
||||
mapped_hotwater = descriptions_to_fuel_types[hotwater_description]
|
||||
|
||||
return {
|
||||
"heating_fuel_type": heating_fuel, "hotwater_fuel_type": mapped_hotwater["fuel"],
|
||||
"heating_cop": mapped["cop"], "hotwater_cop": mapped_hotwater["cop"]
|
||||
}
|
||||
|
||||
# For heating system recommendations, this could result in a fuel type change so we reflect that
|
||||
fuel_mapping = pd.DataFrame([
|
||||
|
|
@ -820,6 +832,9 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
} for epc in property_instance.updated_simulation_epcs
|
||||
])
|
||||
|
||||
for epc in property_instance.updated_simulation_epcs:
|
||||
map_descriptions_to_fuel(epc["mainheat-description"], epc["hotwater-description"])
|
||||
|
||||
fuel_mapping = pd.concat(
|
||||
[
|
||||
pd.DataFrame(
|
||||
|
|
@ -911,6 +926,25 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
rec["kwh_savings"] = total_kwh_savings
|
||||
rec["energy_cost_savings"] = energy_cost_savings
|
||||
|
||||
# Finally, we set the current energy bill
|
||||
starting_figures = kwh_impact_table[kwh_impact_table["id"] == starting_dummy_id_value].squeeze()
|
||||
gas_standing_charge = 0
|
||||
if (
|
||||
(starting_figures["heating_fuel_type"] == "Natural Gas") or
|
||||
(starting_figures["hotwater_fuel_type"] == "Natural Gas")
|
||||
):
|
||||
gas_standing_charge = AnnualBillSavings.DAILY_STANDARD_CHARGE_GAS * 365
|
||||
|
||||
electricity_standing_charge = AnnualBillSavings.DAILY_STANDARD_CHARGE_ELECTRICITY * 365
|
||||
|
||||
property_instance.current_energy_bill = (
|
||||
starting_figures["heating_cost"].values[0] +
|
||||
starting_figures["hotwater_cost"].values[0] +
|
||||
property_instance.energy_cost_estimates["unadjusted"]["lighting"] +
|
||||
property_instance.energy_cost_estimates["unadjusted"]["appliances"] +
|
||||
gas_standing_charge + electricity_standing_charge
|
||||
)
|
||||
|
||||
# Insert the predictions into the recommendations and run the optimiser
|
||||
# TODO: If a recommendation has a negative impact on SAP, we should remove it - this seems to have become a
|
||||
# possibility with heating system
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue