Skip to content

Commit

Permalink
Increase HP awareness over time
Browse files Browse the repository at this point in the history
- Initial HP awareness at t=0 defined as input using arg `heat-pump-awareness`
- Add intervention which, when applied, increases the number of agents that become HP aware over time
- This is achieved using a sigmoid probability function to determine the probability of a given agent becoming heat pump aware if they are not already
  • Loading branch information
charlotte-avery committed Oct 24, 2024
1 parent c6e8843 commit 2da06b7
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 0 deletions.
31 changes: 31 additions & 0 deletions k8s/job.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ local job(name, args_excl_output) = {
'--price-gbp-per-kwh-electricity',
'0.182',
]),
job('03g-%s-awareness-intervention-policy' % std.extVar('SHORT_SHA'), [
'--intervention',
'heat_pump_awareness',
'--air-source-heat-pump-price-discount-date',
'2026-01-01:0.3',
'--price-gbp-per-kwh-gas',
'0.0682',
'--price-gbp-per-kwh-electricity',
'0.182',
]),
job('04a-%s-max-policy' % std.extVar('SHORT_SHA'), [
'--intervention',
'boiler_upgrade_scheme',
Expand Down Expand Up @@ -158,6 +168,27 @@ local job(name, args_excl_output) = {
'0.182',
'--include-new-builds'
]),
job('04d-%s-max-policy-awareness-intervention' % std.extVar('SHORT_SHA'), [
'--intervention',
'boiler_upgrade_scheme',
'--intervention',
'heat_pump_awareness',
'--intervention',
'gas_oil_boiler_ban',
'--gas-oil-boiler-ban-date',
'2035-01-01',
'--gas-oil-boiler-ban-announce-date',
'2025-01-01',
'--heat-pump-awareness',
'0.5',
'--air-source-heat-pump-price-discount-date',
'2026-01-01:0.3',
'--price-gbp-per-kwh-gas',
'0.0682',
'--price-gbp-per-kwh-electricity',
'0.182',
'--include-new-builds',
]),
job('05-%s-max-industry' % std.extVar('SHORT_SHA'), [
'--heat-pump-awareness',
'0.5',
Expand Down
19 changes: 19 additions & 0 deletions simulation/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ def reverse_sigmoid(x: float, k: float = SIGMOID_K, offset: float = SIGMOID_OFFS
return 1 / (1 + math.exp(k * (x + offset)))


def sigmoid(x: float, k: float = SIGMOID_K):
# Sigmoid function with y bounded between 0 & 1

return 2 * 1 / (1 + math.exp(-k * (x / 10))) - 1


class Household(Agent):
def __init__(
self,
Expand Down Expand Up @@ -416,6 +422,12 @@ def get_proba_rule_out_banned_heating_systems(self, model):

return reverse_sigmoid(years_to_ban)

def get_proba_becomes_heat_pump_aware(self, model):

years_since_start = (model.current_datetime - model.start_datetime).days / 365

return sigmoid(years_since_start)

def get_heating_system_options(
self, model: "DomesticHeatingABM", event_trigger: EventTrigger
) -> Set[HeatingSystem]:
Expand All @@ -440,6 +452,13 @@ def get_heating_system_options(
[HeatingSystem.BOILER_GAS, HeatingSystem.BOILER_OIL]
)

if InterventionType.HEAT_PUMP_AWARENESS in model.interventions:
# if awareness intervention used, allow for more agents to become aware of heat pumps
if not self.is_heat_pump_aware:
self.is_heat_pump_aware = true_with_probability(
self.get_proba_becomes_heat_pump_aware(model)
)

if not is_gas_oil_boiler_ban_announced:
# if a gas/boiler ban is announced, we assume all households are aware of heat pumps
if not self.is_heat_pump_aware:
Expand Down
1 change: 1 addition & 0 deletions simulation/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class InterventionType(enum.Enum):
BOILER_UPGRADE_SCHEME = 1
GAS_OIL_BOILER_BAN = 2
EXTENDED_BOILER_UPGRADE_SCHEME = 3
HEAT_PUMP_AWARENESS = 4


# Source: https://www.ons.gov.uk/peoplepopulationandcommunity/birthsdeathsandmarriages/families/datasets/householdsbytypeofhouseholdandfamilyregionsofenglandandukconstituentcountries
Expand Down
35 changes: 35 additions & 0 deletions simulation/tests/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,41 @@ def test_household_ability_to_choose_heat_pump_as_option_depends_on_model_heat_p

assert all(heat_pump in heating_system_options for heat_pump in HEAT_PUMPS)

def test_households_increasingly_likely_to_become_heat_pump_aware(
self,
):
household = household_factory()
model = model_factory(
start_datetime=datetime.datetime(2025, 1, 1),
interventions=[InterventionType.HEAT_PUMP_AWARENESS],
)

proba_becomes_heat_pump_aware = household.get_proba_becomes_heat_pump_aware(
model
)

model.increment_timestep()
proba_becomes_heat_pump_aware_updated = (
household.get_proba_becomes_heat_pump_aware(model)
)

assert proba_becomes_heat_pump_aware < proba_becomes_heat_pump_aware_updated

def test_heat_pump_awareness_increase_is_zero_in_first_year(
self,
):
household = household_factory()
model = model_factory(
start_datetime=datetime.datetime(2024, 1, 1),
interventions=[InterventionType.HEAT_PUMP_AWARENESS],
)

proba_becomes_heat_pump_aware = household.get_proba_becomes_heat_pump_aware(
model
)

assert proba_becomes_heat_pump_aware == 0


class TestAgentsWithBoilerBan:
def test_households_increasingly_likely_to_rule_out_heating_systems_that_will_be_banned_as_time_to_ban_decreases(
Expand Down
3 changes: 3 additions & 0 deletions simulation/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,16 @@ def test_intervention_argument(self, mandatory_local_args):
"boiler_upgrade_scheme",
"--intervention",
"extended_boiler_upgrade_scheme",
"--intervention",
"heat_pump_awareness",
]
)

assert args.intervention == [
InterventionType.RHI,
InterventionType.BOILER_UPGRADE_SCHEME,
InterventionType.EXTENDED_BOILER_UPGRADE_SCHEME,
InterventionType.HEAT_PUMP_AWARENESS,
]

def test_gas_oil_boiler_ban_date_returns_datetime(self, mandatory_local_args):
Expand Down

0 comments on commit 2da06b7

Please sign in to comment.