Designed a node red flow to increase profit and greater automation

This is going to be a long one, so bear with me, and hope you find it intertesting

First my system

12.6kWp, 32kWh DC batteries (soon adding another 18kWh), Multiplus 2 8000 and 2 x 250/85 MPPT’s.

I have not been happy with the Victron DESS system, it seems unreliable, and not very configurable, I then had somebody install a node red flow, which was slightly better, but again not configurable enough, and didnt quite seem to do what I needed, which was to maximise export, both from my solar system, and the batteries, while keeping export to a minimum, and only exporting when that export could be turned into profit. I always seemed to be tinkering with the grid setpoint too because the system didnt seem to be exporting at ideal times for example.

So i decided to write my own node red, with one problem, i have no idea how to do it.

The answer, to get AI to design it, I have used Grok, which i have to say is very good in this instance.

I started with a very basic idea of what i wanted, described it to Grok, and then improved on that, this is the bullet point of the system.

  • Optimizes energy export revenue by dynamically adjusting battery charging and discharging based on solar forecasts and time-of-use tariffs.
  • Charges the battery during off-peak periods (00:30-05:29) at a low import rate (£0.085/kWh) to maximize profit when exported during peak hours (£0.15/kWh).
  • Implements dynamic off-peak charging based on daily solar forecast (dailyPV):
    • Charges at 3000 W to 90% SOC on low forecast days (dailyPV < 15 kWh) for maximum evening export capacity.
    • Charges at 2000 W to 80% SOC on moderate forecast days (15 kWh <= dailyPV <= 30 kWh) for balanced energy management.
    • Charges at 1000 W to 60% SOC on high forecast days (dailyPV > 30 kWh) to prioritize daytime solar utilization.
  • Prevents overcharging by stopping off-peak charging when the dynamic SOC target (60%, 80%, or 90%) is reached.
  • Ensures sufficient battery SOC (minimum 20% via ESS setting) to cover overnight loads (e.g., 0.3 kW for 9 hours) and evening exports.
  • Exports excess solar power during charge windows (peak PV hours) when SOC exceeds safe levels (20%) or target SOC.
  • Maximizes morning exports (05:30-08:00) at 10%-20% of exportable energy, adjustable based on high generation days.
  • Supports evening peak exports (17:00-24:00) at up to 6400 W when SOC exceeds 60%, tapering off as SOC approaches 50%.
  • Minimizes peak imports (£0.2546/kWh) by relying on solar and battery reserves, importing only when SOC falls below critical levels (10%) or insufficient to reach 60% by evening.
  • Tracks daily financials (expenditure, earnings, profit) with real-time updates every 10 seconds.
  • Integrates Solcast forecast data, updating twice daily (00:00 and 12:00), with a fallback to historical average (15 kWh) if API limits are exceeded.
  • Provides real-time monitoring via gauges (PV generation, SOC, consumption, grid setpoint) and text displays (daily forecast, financials) on the Node-RED dashboard.
  • Adapts to system constraints with a maximum export/import limit of 6400 W, aligning with the MultiPlus-II 8000 inverter capacity.
  • Protects battery health by avoiding deep discharges below 10% SOC and maintaining a minimum ESS SOC of 20%.

In the images you will find the node red flow, and the dashboard, I still have some additions to make, and refinements, along with some other ideas to add

A simple explanation of what the system does

The “Davis Energy Control” flow helps manage a solar battery system to save money and make a profit by controlling when the battery charges and discharges. Here’s how it works in simple terms:

  • Checks the Weather Forecast: Twice a day (midnight and noon), the system looks at a solar forecast to predict how much energy your solar panels will make that day. This helps decide how much to charge the battery overnight.

  • Charges the Battery at Night (00:30-05:29):

    • During these “off-peak” hours, electricity is cheap (£0.085 per unit). The system charges the battery when the house isn’t using much power from the solar panels.
    • It adjusts how fast it charges and how full the battery gets based on the forecast:
      • If it’s a cloudy day (less than 15 kWh expected), it charges fast (3000 W) and fills the battery to 90% to have enough for later.
      • If it’s an average day (15-30 kWh expected), it charges at a medium speed (2000 W) to 80%.
      • If it’s a sunny day (more than 30 kWh expected), it charges slowly (1000 W) to 60%, saving space for solar power during the day.
  • Uses Solar Power During the Day:

    • When the sun is out, the system uses solar power to run the house. If there’s extra solar power and the battery isn’t full, it charges the battery. If the battery is full, it sends the extra power to the grid to earn money (£0.15 per unit).
  • Sends Power to the Grid at the Right Times:

    • Early in the morning (05:30-08:00), it sends some battery power to the grid if there’s enough charge, especially on sunny days.
    • In the evening (17:00-24:00), when electricity prices are high, it sends power to the grid at up to 6400 W if the battery has more than 60% charge, slowing down as the battery gets lower.
  • Keeps Enough Power for the House:

    • The system makes sure the battery always has at least 20% charge to cover the house’s needs overnight (like 0.3 kW for lights or appliances).
    • If the battery gets too low (below 10%), it buys power from the grid to avoid running out, even if it’s expensive (£0.2546 per unit during the day).
  • Shows You What’s Happening:

    • Every 10 seconds, the system updates a dashboard with info like how much solar power you’re making, the battery’s charge, how much power the house is using, and how much money you’re earning or spending.

In short, the flow charges the battery cheaply at night based on the next day’s weather, uses solar power during the day, and sells extra power to the grid when prices are high, all while making sure the house has enough power and the battery stays healthy.

And a yearly profit comparison (all things being equal) between DECS and DESS

I still have a lot to work on, at the moment DECS is only using static tariff with set off peak and peak times and rates, so i will integrate dynamic tariff system.

I also would like to apply some system to look after the battery health a little better.

But happy with my first attempt.