Fewer no grid charge months
This commit is contained in:
@@ -10,12 +10,14 @@ class Entsoe
|
||||
|
||||
URL = 'https://transparency.entsoe.eu'
|
||||
|
||||
attr_accessor :no_grid_charge_months
|
||||
attr_reader :storage_cost
|
||||
|
||||
def initialize(api_key = "c2287e07-0c26-4950-b430-22b7f75a8f2e")
|
||||
@api_key = api_key
|
||||
@kwh_prices = {}
|
||||
@storage_cost = 0.05 # how much does it cost to store 1 kwh in battery
|
||||
@no_grid_charge_months = [5,6,7] # months where we assume there is enough surplus from sun power
|
||||
end
|
||||
|
||||
def price_at(formatted_hour)
|
||||
@@ -42,8 +44,8 @@ class Entsoe
|
||||
sorted_prices = prices_at(date).to_a.sort_by(&:last) # sort according to price
|
||||
highest_hour = sorted_prices.last[0]
|
||||
|
||||
# From Apr-Oct: do not charge; every hour that has cost > 0 is a high_hour
|
||||
if [4,5,6,7,8,9,10].include?(date.month)
|
||||
# Some months: do not charge; every hour that has cost > 0 is a high_hour
|
||||
if @no_grid_charge_months.include?(date.month)
|
||||
lowest_hour = "" # effectively no charging from grid
|
||||
high_hours = sorted_prices.select{|p| p[1] > 0}.to_h.keys
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user