From 86c09b6bf9114198113dc16595236d882b265af1 Mon Sep 17 00:00:00 2001 From: Aart van Halteren Date: Mon, 10 Jan 2022 21:27:09 +0100 Subject: [PATCH] Use sun power --- app/models/entsoe.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/entsoe.rb b/app/models/entsoe.rb index 7d9f3b5..fc681a8 100644 --- a/app/models/entsoe.rb +++ b/app/models/entsoe.rb @@ -42,10 +42,10 @@ 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 > charge_rate is a high_hour + # 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) lowest_hour = "" # effectively no charging from grid - high_hours = sorted_prices.select{|p| p[1] > storage_cost} + high_hours = sorted_prices.select{|p| p[1] > 0} else lowest_hour = sorted_prices.first[0]