OK a bit of a long winded explanation here - but here goes
We have an electricity provider that exposes us to wholesale electricity rates in the Australian market - so when the sun shines and the wind blows we get ultra cheap power - when it doesn't we are hit with higher rates.
On top of the wholesale rate we are also exposed to Network fees by the operators of the power poles and lines etc
Bottom line this all ends up being a fee that varies every 1/2 hour through the day and night.
To enable us to take advantage of this and insulate ourselves from peak hour price spikes (and other unforseen issues that force the price higher) we have a battery system.
All of this is in an running and controlled by Node Red and doing a great job.
The electricity retailer provides an API that allows us to do realtime queries and capture the foreward looking ESTIMATED prices for each 1/2 hour block - upto 16 hours in advance.
I currently do this and store it in an array in a global context object that looks like this
So i know the proposed rate every 1/2 hour for the next 16 hours
What i am trying to wrap my head around is how to scan forward through the list and sort it in some sort of fashion with (i guess) highest to lowest projected prices, i can then make some decisions based on (say) stop discharinging my battery now and save it for the higher price period (or maybe even turn off some discretionary loads (such as our crypto miners) to make sure the battery last through
I understand how to extract the data from the array and sort it using JS - i am more looking at an approach to address the overall solution
Should i do something like
Sort the array by highest to lowest prices
Work out the difference/range between these and decide if it is worthwhile delaying the battery discharge or not
In terms of when to use the battery, is it not just a matter of using it during the most expensive periods? If you can estimate how much energy you will use in those periods then you will know how much battery you have available for each of the expensive ones.
Colin - in a nutshell yes - lets say we have a farily static base load with all our computers and our crypto miners of 3KW per hour
So the first imperative is to say that we want maximum cycling from the batteries - so essentially want to use 90% each evening. I also know that this translates (on average) to approx 8% of the battery capacity used each hour to service the base use of the house.
So what i am thinking is
Scan through the array for the next 16 hours and sort it from highest to lowest cost
Work out the difference between highest and lowest (round trip cost on the battery use is 8c per KW/h - so if i find somewhere where there is going to be a bigger difference than this - and i do not have enough capacity to get through the whole night and morning peak - then it is worth charging from the grid at the cheapest amount to enable peak shaving at the other times)
Allocate the battery to this highest times and turn if off in the lowest times
My advise would be to switch those off unless the battery is charged and you have surplus renewable energy, so as to avoid contributing to climate change.
Based on the purchase cost of the battery, expected (warrantied) lifetime this is the cost for me to cycle each KW of energy through the system.
So i can arbitrage the grid if the difference between me purchasing power to charge the battery and then shave peak charges is more than 8c - however due to the fact that the wholesale power prices fluctuate continually - i actually set this in my calculations as 10c