From 7463a57c4eb7d3abf63d7d06a41d5a4f103f7883 Mon Sep 17 00:00:00 2001 From: Charlotte Avery Date: Wed, 20 Nov 2024 14:32:34 +0000 Subject: [PATCH] Log heat pump awareness over time in model --- simulation/agents.py | 3 +++ simulation/collectors.py | 7 ++++++- simulation/model.py | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/simulation/agents.py b/simulation/agents.py index 276c130..d67bd42 100644 --- a/simulation/agents.py +++ b/simulation/agents.py @@ -616,6 +616,9 @@ def make_decisions(self, model): self.update_heating_status(model) self.evaluate_renovation(model) + if self.is_heat_pump_aware: + model.households_heat_pump_aware_at_current_step += 1 + if self.is_renovating: if self.renovate_insulation: chosen_elements = self.get_chosen_insulation_costs( diff --git a/simulation/collectors.py b/simulation/collectors.py index 1f09ff0..c21555d 100644 --- a/simulation/collectors.py +++ b/simulation/collectors.py @@ -277,6 +277,10 @@ def model_heat_pump_installations_at_current_step(model) -> int: return model.heat_pump_installations_at_current_step +def model_heat_pump_awareness_at_timestep(model) -> float: + return model.heat_pump_awareness_at_timestep + + def is_first_timestep(model: "DomesticHeatingABM") -> bool: return model.current_datetime == model.start_datetime + model.step_interval @@ -303,7 +307,6 @@ def get_agent_collectors( collect_when(model, is_first_timestep)(household_discount_rate), collect_when(model, is_first_timestep)(household_renovation_budget), collect_when(model, is_first_timestep)(household_is_heat_pump_suitable), - collect_when(model, is_first_timestep)(household_is_heat_pump_aware), household_heating_system, household_heating_system_previous, household_heating_functioning, @@ -340,6 +343,7 @@ def get_agent_collectors( household_heating_system_costs_insulation_heat_pump_air_source, household_heating_system_costs_insulation_heat_pump_ground_source, household_boiler_upgrade_grant_used, + household_is_heat_pump_aware, ] @@ -355,4 +359,5 @@ def get_model_collectors( collect_when(model, is_first_timestep)(model_price_gbp_per_kwh_gas), collect_when(model, is_first_timestep)(model_price_gbp_per_kwh_electricity), collect_when(model, is_first_timestep)(model_price_gbp_per_kwh_oil), + model_heat_pump_awareness_at_timestep, ] diff --git a/simulation/model.py b/simulation/model.py index d4c0e2a..5aab797 100644 --- a/simulation/model.py +++ b/simulation/model.py @@ -74,6 +74,7 @@ def __init__( ) self.heat_pump_installations_at_current_step = 0 self.annual_new_builds = annual_new_builds + self.households_heat_pump_aware_at_current_step = 0 super().__init__(UnorderedSpace()) @@ -193,12 +194,17 @@ def boiler_upgrade_scheme_spend_gbp(self) -> int: ] ) + @property + def heat_pump_awareness_at_timestep(self) -> float: + return self.households_heat_pump_aware_at_current_step / self.household_count + def increment_timestep(self): self.current_datetime += self.step_interval self.boiler_upgrade_scheme_cumulative_spend_gbp += ( self.boiler_upgrade_scheme_spend_gbp ) self.heat_pump_installations_at_current_step = 0 + self.households_heat_pump_aware_at_current_step = 0 def create_household_agents(