Skip to content

Commit

Permalink
Use linear func to define awareness probability
Browse files Browse the repository at this point in the history
For the HP awareness intervention, the probability that an agent becomes heat pump aware increases linearly with time.
  • Loading branch information
charlotte-avery committed Oct 24, 2024
1 parent 53b956d commit 2460108
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions simulation/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
RETROFIT_COSTS_SMALL_PROPERTY_SQM_LIMIT,
SIGMOID_K,
SIGMOID_OFFSET,
HEAT_PUMP_AWARENESS_GDT,
BuiltForm,
ConstructionYearBand,
Element,
Expand Down Expand Up @@ -101,10 +102,9 @@ 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
def heat_pump_awareness_intervention(x: float, m: float = HEAT_PUMP_AWARENESS_GDT):

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


class Household(Agent):
Expand Down Expand Up @@ -426,7 +426,7 @@ 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)
return heat_pump_awareness_intervention(years_since_start)

def get_heating_system_options(
self, model: "DomesticHeatingABM", event_trigger: EventTrigger
Expand Down
1 change: 1 addition & 0 deletions simulation/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class HeatingFuel(enum.Enum):
MAX_BAN_LEAD_TIME_YEARS = 10
SIGMOID_K = 2
SIGMOID_OFFSET = 0
HEAT_PUMP_AWARENESS_GDT = 0.1


class ConstructionYearBand(enum.Enum):
Expand Down

0 comments on commit 2460108

Please sign in to comment.