Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update household heat pump awareness over time #149

Merged
merged 10 commits into from
Nov 21, 2024

Conversation

charlotte-avery
Copy link
Collaborator

Add heat pump awareness campaign intervention:

  • Intervention is set up to model a sudden increase in heat pump awareness throughout the population as a result of, for example, some widespread campaign.
  • User inputs the date of the campaign (heat-pump-awareness-campaign-date) and the target heat pump awareness for the campaign (campaign-target-heat-pump-awareness).
  • If the user inputs campaign-target-heat-pump-awareness > heat-pump-awareness a ValueError is raised (campaign should never decreases awareness).
  • Agents in the population are randomly assigned to be either aware or not aware on the campaign date with a probability given by campaign-target-heat-pump-awareness.

Code no longer updates to 100% awareness at the boiler ban announcement date:

  • Instead, 100% awareness only happens after the ban is in place.
  • If this is effect is desired, one can set the campaign date to the boiler ban announcement date, and set campaign-target-heat-pump-awareness=1.

@charlotte-avery charlotte-avery self-assigned this Nov 20, 2024
@charlotte-avery charlotte-avery marked this pull request as ready for review November 20, 2024 15:55

if InterventionType.HEAT_PUMP_CAMPAIGN in model.interventions:
if (
model.current_datetime == model.heat_pump_awareness_campaign_date
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this hard == safe? If user input is say '2028-01-31' will this work?

Maybe a safer one would be model.current_datetime >= model.heat_pump_awareness_campaign_date..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change the logging to implement this. See latest commit.

In summary: we want to say "if the target HP awareness has not been met in the previous timestep (t-1), give a suitable probability of converting agents to becoming HP aware to meet the target at timestep t", however, before the HP awareness was recalculated every timestep (every timestep, HP awareness set to value of zero, then using the line of code in agents.py: model.households_heat_pump_aware_at_current_step += 1 we count the HP awareness in that timstep). Remember, the simulation loops over each agent every timestep. So if you are on agent num. 3 in the loop, the HP awareness is calculated by looking at how many of the 3 agents are heat pump aware so far, and on timestep 5, we see the HP awareness by looking at how many of the 5 agents are heat pump aware so far etc. So we need to store the HP awareness at t-1, to access it at t, so we can convert a suitable number of households to become HP aware to meet the target.

shengy90
shengy90 previously approved these changes Nov 20, 2024
Copy link
Member

@shengy90 shengy90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice - much cleaner and straightforward implementation. Just 1 small comment on the very strict date comparison!

@charlotte-avery charlotte-avery force-pushed the update-household-heat-pump-awareness-over-time branch from bc959fd to cfabbf5 Compare November 21, 2024 10:08
if (
InterventionType.HEAT_PUMP_CAMPAIGN in model.interventions
and model.current_datetime == model.heat_pump_awareness_campaign_date
and model.current_datetime >= model.heat_pump_awareness_campaign_date
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How confident are you with this implementation? Is it worth having a test to test this logic? Up to you to decide!

shengy90
shengy90 previously approved these changes Nov 21, 2024
Copy link
Member

@shengy90 shengy90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a suggest for test but leave it up to you to decide!

shengy90
shengy90 previously approved these changes Nov 21, 2024
Copy link
Member

@shengy90 shengy90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

The probability of becoming HP aware needs to be calcuated at the beginning of the timestep and stay fixed throughout the timestep. Here a correction term is added to the probability to account for agents becoming HP aware during the timestep.
@charlotte-avery charlotte-avery force-pushed the update-household-heat-pump-awareness-over-time branch from 8af572a to 11d7580 Compare November 21, 2024 12:19
@charlotte-avery charlotte-avery merged commit 9ce9d5f into main Nov 21, 2024
4 checks passed
@charlotte-avery charlotte-avery deleted the update-household-heat-pump-awareness-over-time branch November 21, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants