Skip to content

Commit

Permalink
Tidy up code
Browse files Browse the repository at this point in the history
  • Loading branch information
charlotte-avery committed Nov 20, 2024
1 parent 9425931 commit 10b360f
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions simulation/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,29 +624,26 @@ def proba_of_becoming_heat_pump_aware_required_to_reach_campaign_target(

def update_heat_pump_awareness(self, model) -> None:

if InterventionType.HEAT_PUMP_CAMPAIGN in model.interventions:
if (
model.current_datetime == model.heat_pump_awareness_campaign_date
and model.heat_pump_awareness_at_timestep
< model.campaign_target_heat_pump_awareness
and not self.is_heat_pump_aware
):
proba_to_become_heat_pump_aware = self.proba_of_becoming_heat_pump_aware_required_to_reach_campaign_target(
model
)
self.is_heat_pump_aware = true_with_probability(
proba_to_become_heat_pump_aware
)
if (
InterventionType.HEAT_PUMP_CAMPAIGN in model.interventions
and model.current_datetime == model.heat_pump_awareness_campaign_date
and model.heat_pump_awareness_at_timestep
< model.campaign_target_heat_pump_awareness
and not self.is_heat_pump_aware
):
proba_to_become_heat_pump_aware = self.proba_of_becoming_heat_pump_aware_required_to_reach_campaign_target(
model
)
self.is_heat_pump_aware = true_with_probability(
proba_to_become_heat_pump_aware
)

def make_decisions(self, model):

self.update_heat_pump_awareness(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(
Expand Down Expand Up @@ -717,3 +714,6 @@ def make_decisions(self, model):
self.heating_system_costs_subsidies = costs_subsidies
self.heating_system_costs_insulation = costs_insulation
self.insulation_element_upgrade_costs = chosen_insulation_costs

if self.is_heat_pump_aware:
model.households_heat_pump_aware_at_current_step += 1

0 comments on commit 10b360f

Please sign in to comment.