Trying to make installable package
This commit is contained in:
64
EngieApi/Contracts.py
Normal file
64
EngieApi/Contracts.py
Normal file
@@ -0,0 +1,64 @@
|
||||
import datetime
|
||||
|
||||
import numpy as np
|
||||
|
||||
from EngieApi.DistributionCosts import Capaciteitstarief
|
||||
from EngieApi.EngieAPI import EngieAPI
|
||||
|
||||
|
||||
class Dynamic:
|
||||
def __init__(self, btw=1.21):
|
||||
|
||||
self.btw = btw
|
||||
self.vast = 100.7 # EUR / jaar
|
||||
|
||||
self.groene_stroom = 0.00530 # EUR / kWh
|
||||
self.wwk = 0.02544 # EUR / kWh
|
||||
|
||||
# Supplementen
|
||||
self.energiebijdrage = 0.0020417 # EUR / kWh
|
||||
# federale accijns
|
||||
# 0 < kwh < 20000: 1.44160 cent / kWh
|
||||
# 20000 < kwh < 50000: 1.22748 cent / kWh
|
||||
# 50000 < kwh < 100000: 1.15540 cent / kWh
|
||||
self.federale_accijns = 0.0144160 # EUR / kWh
|
||||
|
||||
def calculate_price_per_kwh(self, date, peak: float):
|
||||
"""calculate_price_per_kwh
|
||||
|
||||
:param date: date to calculate for
|
||||
:type date: date
|
||||
"""
|
||||
api = EngieAPI()
|
||||
epex_spot = np.array(api.get_epex_spot(date))
|
||||
|
||||
prijs = 0.2040 + 0.1 * (epex_spot) # zonder BTW per Cent/kWh
|
||||
# cent to eur
|
||||
prijs /= 100
|
||||
prijs += self.groene_stroom + self.wwk + self.energiebijdrage + self.federale_accijns
|
||||
|
||||
# distirbution costs
|
||||
d = Capaciteitstarief()
|
||||
p, yearly = d.calculate_per_kwh(peak=peak)
|
||||
prijs += p
|
||||
|
||||
# add btw
|
||||
prijs *= self.btw
|
||||
return prijs, yearly + self.vast
|
||||
|
||||
def calculate_total_price_for_day(self, verbruik: list[int], date: datetime.date, peak: float) -> float:
|
||||
"""calculate_total_price_for_day calculate total price for given usage
|
||||
|
||||
:param verbruik: a list of hourly usage values
|
||||
:type verbruik: list[int]
|
||||
:param date: the date for the energy prices
|
||||
:type date: datetime.date
|
||||
:param peak: the monthly peak for the distribution costs
|
||||
:type peak: float
|
||||
:return: the total calculated price
|
||||
:rtype: float
|
||||
"""
|
||||
prices, yearly = self.calculate_price_per_kwh(date, peak)
|
||||
|
||||
total = np.dot(prices, np.array(verbruik).T) + yearly / 365
|
||||
return total
|
||||
Reference in New Issue
Block a user