Skip to content

Commit 5a07046

Browse files
committed
Compute fuel duty from calibrated litres
1 parent b9a2173 commit 5a07046

5 files changed

Lines changed: 42 additions & 11 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Compute fuel duty directly as calibrated petrol and diesel litres multiplied by the statutory duty rate.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import pytest
2+
3+
from policyengine_uk import Microsimulation
4+
from policyengine_uk.system import system
5+
6+
7+
def test_fuel_duty_is_litres_times_statutory_rate():
8+
year = 2025
9+
situation = {
10+
"people": {
11+
"adult": {
12+
"age": {year: 35},
13+
},
14+
},
15+
"benunits": {
16+
"benunit": {
17+
"members": ["adult"],
18+
},
19+
},
20+
"households": {
21+
"household": {
22+
"members": ["adult"],
23+
"region": {year: "LONDON"},
24+
"petrol_spending": {year: 2_000.0},
25+
"diesel_spending": {year: 1_000.0},
26+
},
27+
},
28+
}
29+
simulation = Microsimulation(situation=situation)
30+
31+
fuel_duty = simulation.calculate("fuel_duty", year).values[0]
32+
litres = (
33+
simulation.calculate("petrol_litres", year).values[0]
34+
+ simulation.calculate("diesel_litres", year).values[0]
35+
)
36+
rate = system.parameters.gov.hmrc.fuel_duty.petrol_and_diesel(year)
37+
38+
assert fuel_duty == pytest.approx(litres * rate)
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
from policyengine_uk.model_api import *
22

3-
STATUTORY_CONSUMER_INCIDENCE = 0.5
4-
ECONOMIC_CONSUMER_INCIDENCE = 1
5-
63

74
class fuel_duty(Variable):
85
label = "Fuel duty (cars only)"
@@ -15,9 +12,4 @@ def formula(household, period, parameters):
1512
fd = parameters(period).gov.hmrc.fuel_duty
1613
petrol_litres = household("petrol_litres", period.this_year) / MONTHS_IN_YEAR
1714
diesel_litres = household("diesel_litres", period.this_year) / MONTHS_IN_YEAR
18-
return (
19-
fd.petrol_and_diesel
20-
* (petrol_litres + diesel_litres)
21-
/ STATUTORY_CONSUMER_INCIDENCE
22-
* ECONOMIC_CONSUMER_INCIDENCE
23-
)
15+
return fd.petrol_and_diesel * (petrol_litres + diesel_litres)

policyengine_uk/variables/household/consumption/diesel_litres.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class diesel_litres(Variable):
77
entity = Household
88
definition_period = YEAR
99
value_type = float
10-
unit = GBP
10+
unit = "litre"
1111

1212
def formula(household, period, parameters):
1313
return household("diesel_spending", period) / household("diesel_price", period)

policyengine_uk/variables/household/consumption/petrol_litres.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class petrol_litres(Variable):
77
entity = Household
88
definition_period = YEAR
99
value_type = float
10-
unit = GBP
10+
unit = "litre"
1111

1212
def formula(household, period, parameters):
1313
return household("petrol_spending", period) / household("petrol_price", period)

0 commit comments

Comments
 (0)