So I'm messing about in the (5-minute) wholesale energy market, manually selling back little bits of my home battery.
I have 20kwh of batteries, 7kwh of solar, I can import power from the grid at up to 3kw and I can export to the grid at 5kw.
I'm interested in using node-red, I already have the relevant sensors in there:
PV watts input
Battery SoC
Home power usage
Power price
Grid watts in/out
Time to full charge
Time to discharge
So I basically want a flow that will either buy, sell or do nothing for the current 5-minute window:
(daytime) Buy if there isn't enough solar and when the price is under say 30c to get my battery full by 4pm, with my grid charge of 3kw and no solar it would take around 6 hours. Say 40â„… by 10am and 10% per hour at 3kw (taking house power load into account). On a really sunny day the batteries can charge in 2-3 hours.
(anytime) Sell when I have a decent amount of charge and the price is over say 50c
At all times I would want to maintain a minimum SoC of 30% (the one exception would be if the price was over say 60c), so I have some reserve in case the power spikes, so would I start the "mega" flow by evaluating SoC, perhaps:
0-9%
10-19%
20-29%
30-39%
40-49%
50-59%
60-69%
70-79%
80-89%
90-99%
And then maybe time of day, time to charge/discharge & price. The result being buy/sell/nothing. Reevaluating every 5 minutes.
Basically I cant really get my head around the "order" of the flow, what to evaluate first.
Atm I don't want to complicate this by taking forecasting (solar or price) into account, mainly because they're both pretty inaccurate.
I've probably muddled some things up but hopefully you get the idea.
What type of inverter/charger are you using?
Victron has devised something, that is exacly what you are looking after, called "Dynamic Energy Storage System (DESS).
Fun thing is, they started with a Node-Red implementation (Node-Red is part of their VenusOS, used on their main controler platform, the "GX")-> here
This is now available on their cloud based portal, without the need for Node-Red, available for free for all victron users.
So, you can have a look at their Node-Red Implementation, although what you want to achieve is not for beginners, I think...so a steep learning curve is required.
Or you can try and integrate (or maybe migrate parts of) your gear into a victron GX and then simply use their implementation.
Thanks, I'll take look, my gear is a real mess (MPP, Growatt, Goodwe, Shelly and a Victron Smartshunt on the battery) but it can all be monitored and controlled through node-red.
OK, what I missed was, that you are looking to wholesale prices and 5min intervals....DESS is for retail prices 1h/30mins cadence.
But have a look nonetheless, to get some concepts.
Based on your rules, start with the "golden path", which is based on simple parameters to when to sell or not to sell or when to start buying - golden means without other exceptions from your golden rules
From what I gathered, You'll want to evaluate SoC as a master on/of switch and have the actual price ready for the actual or next 5min period.
Your decision to sell will depend on price and how much you sell will depend on "allowed" power over 5mins (which will lead to ja depletion of your SoC, which should not reach the minSoC after the 5mins period - note that SoC and Energy charged/discharged is not necessarily a linear function/dependency).
Exceptions based on other rules would break/override your golden path or flow.
Look into the simple gate node...add a gate node into the section of your golden path, where an exception should interrupt it...trigger the gate note with a (sub-)flow based on your exception rule....you can also combine execptions into a single one, with logic nodes or add more gates into the golden path.