Skip to content

Commit

Permalink
Add user inputs for heat pump awareness campaign
Browse files Browse the repository at this point in the history
  • Loading branch information
charlotte-avery committed Nov 20, 2024
1 parent cf705ee commit 0c2e58c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions simulation/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@ def check_string_is_isoformat_datetime(string) -> str:
parser.add_argument("--price-gbp-per-kwh-electricity", type=float, default=0.245)
parser.add_argument("--price-gbp-per-kwh-oil", type=float, default=0.068)

parser.add_argument(
"--heat-pump-awareness-campaign-date",
default=datetime.datetime(2028, 1, 1),
type=convert_to_datetime,
)

parser.add_argument(
"--campaign-target-heat-pump-awareness",
default=0.8,
type=float_between_0_and_1,
)

return parser.parse_args(args)


Expand All @@ -187,6 +199,11 @@ def validate_args(args):
f"Boiler ban announcement date must be on or before ban date, got gas_oil_boiler_ban_date:{args.gas_oil_boiler_ban_date}, gas_oil_boiler_ban_announce_date:{args.gas_oil_boiler_ban_announce_date}"
)

if args.campaign_target_heat_pump_awareness < args.heat_pump_awareness:
raise ValueError(
f"Campaign target awareness must be greater than or equal to the population heat pump awareness, got campaign_target_heat_pump_awareness:{args.campaign_target_heat_pump_awareness}, heat_pump_awareness:{args.heat_pump_awareness}"
)


if __name__ == "__main__":

Expand Down Expand Up @@ -226,6 +243,8 @@ def validate_args(args):
args.heat_pump_installer_count,
args.heat_pump_installer_annual_growth_rate,
ENGLAND_WALES_ANNUAL_NEW_BUILDS if args.include_new_builds else None,
args.campaign_target_heat_pump_awareness,
args.heat_pump_awareness_campaign_date,
)

with smart_open.open(args.history_file, "w") as file:
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_CAMPAIGN = 4


# Source: https://www.ons.gov.uk/peoplepopulationandcommunity/birthsdeathsandmarriages/families/datasets/householdsbytypeofhouseholdandfamilyregionsofenglandandukconstituentcountries
Expand Down
18 changes: 18 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_campaign",
]
)

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

def test_gas_oil_boiler_ban_date_returns_datetime(self, mandatory_local_args):
Expand Down Expand Up @@ -289,3 +292,18 @@ def test_ban_date_before_announcement_date_raises_value_error(
)
with pytest.raises(ValueError):
validate_args(args)

def test_campaign_target_less_than_heat_pump_awareness_raises_value_error(
self, mandatory_local_args
):
args = parse_args(
[
*mandatory_local_args,
"--campaign-target-heat-pump-awareness",
"0.1",
"--heat-pump-awareness",
"0.5",
]
)
with pytest.raises(ValueError):
validate_args(args)

0 comments on commit 0c2e58c

Please sign in to comment.