interventions package
interventions.Loans module
Provides a class to model and calculate loan conditions for financing.
This module contains the Loan class, which is used to determine the terms of a loan for purchasing a heating system.
- Authors:
Ivan Digel <ivan.digel@uni-kassel.de>
- class Loan(weekly_income, system_price, funds, interest=0.0221, years=10)[source]
Bases:
objectRepresents a loan for purchasing a heating system. This class encapsulates the logic for determining the terms of a loan. When an instance is created, it automatically calculates the loan amount, which is the lesser of the required amount (system price minus available funds) and the maximum affordable amount (based on income). It then computes the total repayment and monthly payment based on the loan term and interest rate using standard financial formulas.
- Parameters:
- weekly_incomefloat
The borrower’s weekly net income in EUR.
- system_pricefloat
The total price of the heating system in EUR.
- fundsfloat
The amount of personal funds the borrower has available to put towards the purchase.
- interestfloat, optional
The annual interest rate as a decimal (e.g., 0.0221 for 2.21%), by default 0.0221.
- yearsint, optional
The loan term in years, by default 10.
- Attributes:
- interestfloat
The annual interest rate.
- yearsint
The loan term in years.
- loan_amountfloat
The calculated principal amount of the loan in EUR.
- total_repaymentfloat
The total amount that will be paid back over the life of the loan.
- monthly_paymentfloat
The calculated monthly payment amount in EUR.
Initialises a Loan instance and calculates its terms.
The constructor determines the affordable loan amount based on income, calculates the required loan (price minus funds), and takes the minimum of the two as the principal. It then computes the total and monthly repayments.
- Parameters:
- weekly_incomefloat
The borrower’s weekly net income in EUR.
- system_pricefloat
The total price of the heating system in EUR.
- fundsfloat
The amount of personal funds the borrower has available.
- interestfloat, optional
The annual interest rate, by default 0.0221.
- yearsint, optional
The loan term in years, by default 10.
interventions.Subsidy module
Defines the data structures for subsidies applicable to heating systems.
This module uses Python’s dataclasses to create a representation for various subsidies. It includes a base Subsidy class that defines the common attributes, such as the subsidy amount and any application conditions.
Several specific subclasses are defined for different types of subsidies. These objects are used throughout the model to calculate the final, subsidized price of a new heating system.
- Authors:
Sören Lohr
Ivan Digel <ivan.digel@uni-kassel.de>
- class Subsidy(name: str, abbr: str, subsidy: float, heating_system: str, condition: Callable[[Any], bool] | None = None, target: str | None = None)[source]
Bases:
objectA dataclass representing a generic subsidy for a heating system.
This class serves as the primary data structure for all subsidies. It holds information about the subsidy’s name, amount, and the system(s) it applies to. It also supports conditional application, allowing a subsidy to be contingent on specific properties of the agent or the heating system itself.
- Attributes:
- namestr
The full name of the subsidy.
- abbrstr
A short abbreviation for the subsidy.
- subsidyfloat
The subsidy amount, typically as a decimal fraction of the total cost (e.g., 0.3 for 30%).
- heating_systemstr or tuple[str, …]
The name(s) of the heating system classes this subsidy can apply to.
- conditionCallable[[Any], bool], optional
A callable (e.g., a lambda function) that returns True if the subsidy conditions are met, by default None.
- targetstr, optional
Specifies whether the condition should be applied to the ‘System’ or the ‘Agent’, by default None.
- name: str
- abbr: str
- subsidy: float
- heating_system: str
- condition: Callable[[Any], bool] | None = None
- target: str | None = None
- check_condition(system, agent)[source]
Checks if the conditions for this subsidy are met.
This method evaluates the condition function against the specified target (either the heating system or the agent). If no condition is defined, it automatically returns True.
- Parameters:
- systemHeating_system
The heating system being considered for the subsidy.
- agentHouseowner
The agent applying for the subsidy.
- Returns:
- bool
True if the subsidy is applicable, False otherwise.
- class Subsidy_district(name: str = 'District', abbr: str = 'DSTR', subsidy: float = 0.3, heating_system: str = 'Heating_system_network_district', condition: None = None, target: str = None)[source]
Bases:
SubsidyA subsidy specifically for district heating connections.
- name: str = 'District'
- abbr: str = 'DSTR'
- subsidy: float = 0.3
- heating_system: str = 'Heating_system_network_district'
- target: str = None
- class Subsidy_heat_pump(name: str = 'Heat_pump', abbr: str = 'HTPMP', subsidy: float = 0.3, heating_system: str = 'Heating_system_heat_pump', condition: None = None, target: str = None)[source]
Bases:
SubsidyA subsidy specifically for air-source heat pumps.
- name: str = 'Heat_pump'
- abbr: str = 'HTPMP'
- subsidy: float = 0.3
- heating_system: str = 'Heating_system_heat_pump'
- target: str = None
- class Subsidy_heat_pump_brine(name: str = 'Heat_pump_brine', abbr: str = 'HTPMPBR', subsidy: float = 0.3, heating_system: str = 'Heating_system_heat_pump_brine', condition: None = None, target: str = None)[source]
Bases:
SubsidyA subsidy specifically for heat pump-based local cold network.
- name: str = 'Heat_pump_brine'
- abbr: str = 'HTPMPBR'
- subsidy: float = 0.3
- heating_system: str = 'Heating_system_heat_pump_brine'
- target: str = None
- class Subsidy_pellet(name: str = 'Pellet', abbr: str = 'PLLT', subsidy: float = 0.3, heating_system: str = 'Heating_system_pellet', condition: None = None, target: str = None)[source]
Bases:
SubsidyA subsidy specifically for pellet heating.
- name: str = 'Pellet'
- abbr: str = 'PLLT'
- subsidy: float = 0.3
- heating_system: str = 'Heating_system_pellet'
- target: str = None
- class Subsidy_network_local(name: str = 'Hot_network', abbr: str = 'HTNTWRK', subsidy: float = 0.3, heating_system: str = 'Heating_system_network_local', condition: None = None, target: str = None)[source]
Bases:
SubsidyA subsidy specifically for local hot network.
- name: str = 'Hot_network'
- abbr: str = 'HTNTWRK'
- subsidy: float = 0.3
- heating_system: str = 'Heating_system_network_local'
- target: str = None
- class Subsidy_GP_Joule(name: str = 'GP_Joule', abbr: str = 'GPJL', subsidy: float = 0.3, heating_system: str = 'Heating_system_GP_Joule', condition: None = None, target: str = None)[source]
Bases:
SubsidyA subsidy specifically for local hot network provided by GP Joule.
- name: str = 'GP_Joule'
- abbr: str = 'GPJL'
- subsidy: float = 0.3
- heating_system: str = 'Heating_system_GP_Joule'
- target: str = None
- class Subsidy_climate_speed(name: str = 'Climate_speed', abbr: str = 'CLMSPD', subsidy: float = 0.2, heating_system: tuple[str, ...] = ('Heating_system_heat_pump', 'Heating_system_heat_pump_brine', 'Heating_system_pellet'), condition: ~typing.Callable[[~typing.Any], bool] = <factory>, target: str = 'Agent')[source]
Bases:
SubsidyA bonus subsidy for replacing an oil or gas heating system.
This subsidy acts as a bonus for houseowners who switch from a fossil-fuel system (oil or gas) to a renewable alternative.
- name: str = 'Climate_speed'
- abbr: str = 'CLMSPD'
- subsidy: float = 0.2
- heating_system: tuple[str, ...] = ('Heating_system_heat_pump', 'Heating_system_heat_pump_brine', 'Heating_system_pellet')
- target: str = 'Agent'
- class Subsidy_income(name: str = 'Income', abbr: str = 'INC', subsidy: float = 0.3, heating_system: tuple[str, ...] = ('Heating_system_heat_pump', 'Heating_system_heat_pump_brine', 'Heating_system_pellet'), condition: ~typing.Callable[[~typing.Any], bool] = <factory>, target: str = 'Agent')[source]
Bases:
SubsidyA subsidy for low-income households.
This subsidy can be applied to any heating system but is conditional on the agent’s annual income being below a specific threshold.
- name: str = 'Income'
- abbr: str = 'INC'
- subsidy: float = 0.3
- heating_system: tuple[str, ...] = ('Heating_system_heat_pump', 'Heating_system_heat_pump_brine', 'Heating_system_pellet')
- target: str = 'Agent'
- class Subsidy_efficiency(name: str = 'Efficiency', abbr: str = 'EFF', subsidy: float = 0.05, heating_system: tuple[str, ...] = ('Heating_system_heat_pump', 'Heating_system_heat_pump_brine'), condition: None = None, target: str = None)[source]
Bases:
SubsidyA bonus subsidy for highly efficient heat pump systems.
- name: str = 'Efficiency'
- abbr: str = 'EFF'
- subsidy: float = 0.05
- heating_system: tuple[str, ...] = ('Heating_system_heat_pump', 'Heating_system_heat_pump_brine')
- target: str = None