No charging at some days
This commit is contained in:
@@ -20,6 +20,7 @@ class Entsoe
|
||||
|
||||
def price_at(formatted_hour)
|
||||
unless @kwh_prices.key?(formatted_hour)
|
||||
p "Fetching Entsoe tariffs for %s" % formatted_hour
|
||||
@kwh_prices.merge!(query_day_ahead_prices(Date.parse(formatted_hour)))
|
||||
end
|
||||
@kwh_prices[formatted_hour]
|
||||
@@ -45,6 +46,10 @@ class Entsoe
|
||||
charge_rate = sorted_prices.first[1] # assume we charge at lowest hour
|
||||
high_hours = sorted_prices.select{|p| p[1] > charge_rate + storage_cost}.to_h.keys
|
||||
|
||||
# reset lowest_hour (effectively not charging), when price difference smaller than storage_cost
|
||||
highest_price = sorted_prices.last[1]
|
||||
lowest_hour = "" if (highest_price-charge_rate) < storage_cost
|
||||
|
||||
return lowest_hour,highest_hour,high_hours
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user