Make storage_cost configurable

This commit is contained in:
Aart van Halteren
2022-01-11 15:38:34 +01:00
parent 28a806f584
commit 3ed8ea5f8a
2 changed files with 5 additions and 5 deletions

View File

@@ -6,8 +6,8 @@ class Cost
attr_accessor :max_charge_kwh
attr_reader :battery, :entsoe
def initialize(battery_capacity=10.0, max_charge=5.0)
@entsoe = Entsoe.new
def initialize(battery_capacity=10.0, max_charge=5.0, storage_cost=0.05)
@entsoe = Entsoe.new(storage_cost)
@max_charge_kwh = max_charge
@battery = Battery.new(battery_capacity)
end
@@ -197,7 +197,7 @@ class Cost
oxxio_rate,
oxxio_cost]
p "%s,%s,%s,%s,%s,%s,%s,%0.02f,%s,%s,%s,%s,%s" % (one_hour[0..7] + one_hour[8..12].map{|c| format_cost(c)})
p "%s,%s,%s,%s,%s,%s,%s,%0.1f,%s,%s,%s,%s,%s" % (one_hour[0..7] + one_hour[8..12].map{|c| format_cost(c)})
result << one_hour
hour_start = hour_start.advance(:hours => 1)

View File

@@ -13,10 +13,10 @@ class Entsoe
attr_accessor :no_grid_charge_months
attr_reader :storage_cost
def initialize(api_key = "c2287e07-0c26-4950-b430-22b7f75a8f2e")
def initialize(storage_cost = 0.05, 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
@storage_cost = storage_cost # 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