question

joolster avatar image
joolster asked

How to force export solar

Hi, my export tariff is 15p/kwh and off-peak import of 7p/kwh, peak import is 30p/kwh. I have a 36 kwh battery capacity. I have a ~9.5 kwp solar system.

In the spring/summer, I want to charge overnight and then export as much solar during the day as this gives me a margin profit / kwh of 7p. On my system, this means I could make say £4/day, perhaps net benefit £2/day.

Ideally, I'd like to use the battery to power house loads when the solar coverage decreases in order to not pay the 30p/kwh for those periods, and when I do this I do not want the battery to then recharge from solar, until a lower SOC limit is reached (as would reduce the export revenue).

What is the simplest way I can achieve this using some combination of cerbo, nodered, modbus or similar setup?

Thanks!


ESS
2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

graham-willsher avatar image graham-willsher commented ·

Hi @joolster,


I have read your post with interest.

I was also looking for a way to exploit the maximum solar production.

I ended up going for a setup with just a couple of steps:

1. Charge the batteries fully during the cheap overnight import tariff (configured from within the VRM), during the day I use any solar production firstly within my propery and then to charge my batteries. I use any excess power before it is exported to the grid to power an Immersion heater.

2. Carry out a forced discharge of the batteries (the current discharge window is set from 16:00 - 23:15 - only chosen as peak usage load is on the grid from 16:00) or until I reach a specifiec SOC. (programmed in NodeRed on a Multiplus II GX - so that all of the logic is kept on the Victron).

Then repeat steps 1 & 2.

It is not as a dynamic system as you have suggested.

From a profit point of view does it make any difference to sell the excess solar when generated (as you do), or store in the batteries and sell later on in the day (as I do)? In my mind as long as I sell excess solar it works. Is this an incorrect assumption?

The only other way that I can think to maximise profit would be to ensure that at the end of the overnight charging period the batteries are 100% full which would mean doing the calculations so that you discharge the batteries during the import period if they reach 100%. But that did not appear to be in the spirit of the tariff.:)

I did try utilising solar forecasting with predicted home consumption to limit the amount that I charged the batteries from the grid, but with the overnight tariff being so good it made the maths worthless. Have you have any ideas on this?

Thanks,

Graham.

0 Likes 0 ·
joolster avatar image joolster graham-willsher commented ·
Hi Graham,

For me, the overnight tariff at 7p/kwh is the same as approx cost/kwh for my solar gen over the whole lifecycle of the solar system.

So, with 15p/kwh export tariff, I think it makes sense to charge batteries overnight (and water heating) and then maximise export during day from solar, whilst keeping enough SOC / capacity in the battery to avoid any material import (ie when cloudy or before material sun / later in day when sun less powerful).

This, I believe, maximises the financial return from solar and maximises offset for rest of the energy bill (1 kwh generated = 2 kwh imported), whilst maintaining battery health.

I think you still need some solar forecasting (I do a bit of this still) depending on size of battery / consumption (rainy day, need to run appliances etc) as this may determine whether you switch configuration for export or self-consumption.

Hope that makes sense - keen for challenge





0 Likes 0 ·
16 Answers
matt1309 avatar image
matt1309 answered ·

Hi @joolster


Take a look at this: GitHub - victronenergy/dynamic-ess


Lots of posts/chat about it in modifications section of the forum.


It's essentially some prebult node red nodes that help achieve what you're describing. ofc you can write from scratch if it's not exactly what you want.


You essentially want a node red function that reads solar and loads/what's going into battery and setting grid setpoint equals to that. but i imagine DESS has some similar solutions to this.
I've never used it but believe it's aim is similar to what you're looking to achieve.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

marv2097 avatar image
marv2097 answered ·

You can also do similar if you have node-red enabled on your GX device. It's a bit basic but it will keep your grid setpoint to the same level of your solar input:

1706866957641.png

Note. I have 2 solar sources so the join allows me to add them together but the join node also allows you to add more inputs (SoC etc) if you wanted. Just remember to set the 'after number of message parts' to the number of inputs you have like this:

1706867184855.png


Then in the function is where you have your logic. It can be as simple as:

1706867281333.png


You can add more logic in this if you wish, such as only exporting if SoC is > 25% etc. Here you can see it roughly exports the solar and the battery is still running the AC loads, there is a few seconds lag which is expected.

1706867470964.png


I'm sure there are other ways to achieve a similar result but this works well on my system. Have fun.


1706866957641.png (28.5 KiB)
1706867184855.png (27.2 KiB)
1706867281333.png (26.0 KiB)
1706867470964.png (56.3 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

joolster avatar image
joolster answered ·

So, thanks for your comments ... i've been playing today as have had good solar for most of the day

Spring / Summar Scenario:

[This summer scenario my goal as (obviously) in winter, fully charge batteries overnight and all energy goes to house and electric heating]

Battery starts the day, well charged to 80% or greater - this will be plenty for the evening peak etc

I want to export as much solar as possible, not charge the battery above its SOC, but only while there is plenty of solar - effectively this is well post sun rise and well pre-sunset

When the solar is either side of daily peak, then revert to normal case - which is minimising import using stored energy in battery and any residual solar

Victron Cerbo Working Setup:

I've found that a combined use of a NEGATIVE Grid Set Point and a Scheduled Charge provides a working combination.

There are two options, depending on preferences.

Option 1 (values are obviously examples that work for my system size)

- Grid Set Point -4000

- Schedule - SOC 80%

Self Consumption above limit = PV

Start time - depends on time of year / sun rise

Duration - say sunset minus 2 hours, depending on time of year

In this scenario, what I have observed is:

[Export amount] = [PV generated] - [House Loads], and the Battery is IDLE

i.e. the battery is not discharged


Option 2 (values are obviously examples that work for my system size)

- Grid Set Point -4000

- Schedule - SOC 80%

Self Consumption above limit = PV + Battery

Start time - depends on time of year / sun rise

Duration - say sunset minus 2 hours, depending on time of year

In this scenario, what I have observed is:

[Export amount] = -4000 = [PV generated] + [Battery discharge] - [House Loads]


i.e. the battery is discharged to make the export 4000W until SOC limit reached


I've not checked what happens when the house load is very high, ie elec heating operating / dishwasher and washing machine and oven/hob etc are on ... will check at some point


Next step: node red / programmatic automation etc

Any thoughts?


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

marv2097 avatar image
marv2097 answered ·

If i understand correctly this looks like this will force export from your batteries if you dont have 4kw+ of Solar coming in. This may be what you want :)

Node Red would give you more control over this. I have been running the following for a week now and it works as expected. All house loads will come from the battery while the SoC > 50%. If the loads exceed the inverter max then Solar and/or Grid will be used.


This is the content of the function. I added the SoC value. as I have 2 inverters I add them together. This will force the solar export until the battery drops to 50% as this mean I always have enough charge once the sun has set to get me to the next cheap rate window.

var soc=msg.payload["Venus system - Battery State of Charge (%)"];
var pv_house=msg.payload["Solar - House Roof - L1 Power (W)"];
var pv_garden=msg.payload["Solar - Garden - L1 Power (W)"];

// Sum the Solar PVs
pv = pv_garden + pv_house;

// Adjust ESS based on Solar and SOC
if (pv > 100) {
    if (soc > 50){
        if (pv > 4600){
            // Solar greater than 4.6kW so limit
            msg.payload = -4600   
        } else {
            // Export all solar
            msg.payload = Math.floor(-pv)
        }
    } else {
        // Batt low. Allow charge from solar
        msg.payload = 0
    }
} else {
    // Not enough solar so leave setpoint at 0
    msg.payload = 0
}
return msg

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

joolster avatar image joolster commented ·
@marv2097 - yes, one option prevents the battery from discharging and the other forces discharge to a certain level - all depends on the economics you're looking for.
0 Likes 0 ·
daza avatar image
daza answered ·

Guys I asked @Guy Stewart (Victron Community Manager) For something like this but said it was niche. So I’ve been looking at this with help from @matt1309 I was thinking that I could change DVCC charge current for the battery basically lower it for day and return at nigh, but I’m a noob with nodered and I’ve not seen any DVCC settings. If it can be done this way you won’t get over shoot which the battery will have to cover in cloud cover and if you start using the solar ie kettle microwave that can eat the solar and save the battery from having to cover the full load. Any thoughts

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

joolster avatar image joolster commented ·
@daza - everything is niche until more people see it as something that may be economically worthwhile due to import vs export tariffs :-)
1 Like 1 ·
matt1309 avatar image
matt1309 answered ·

I've not confirmed this but I imagine if you're using MPPT if you lower DVCC it stops the charging rather than exporting more? AC coupled PV I imagine it just exports?


I think @marv2097 suggestion looks like it would work well. And it's got the 100w buffer built in. For others maybe deducting other loads from generated PV would be needed rather than just exporting all solar. ie same code but replacing PV with PV - loads.


@daza I think the overshoot issue is always going to be an issue. Only way to minimise it is to have the above code checked more frequently. so the grid setpoint is corrected faster to avoid drawing from battery. My only suggestion for this is something written in a faster languages that reads data directly from dbus. Maybe something written in c++ doing the exact same node red is just reading directly from dbus would be needed but I imagine node red is fast enough for most cases. I suspect the overshoot will be relatively small unless you have large loads turning on/off frequently during the export window.


I'm very much a c++ noob but i have seen some drivers from victron written (for fronius and other inverter integration) it's not really relevant but might be able to steel them as a guide for interacting with dbus from c++ the same way victron does.

8 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

daza avatar image daza commented ·
Yeah the only thing I’m thinking of is the constant adjustment that changing the grid point will have on the multi think DVCC would be the best of both worlds no it won’t force solar it will just export what you don’t use. I’ve really got to find out if there is such a DVCC adjustment
0 Likes 0 ·
matt1309 avatar image matt1309 daza commented ·

I cant imagine it'll have too much of an impact, the system dynamically adjusts for loads all the time. You're just updating via another system.



Yes there is a way to adjust DVCC in Node red. It's under ESS nodes.


1707955503297.png

1 Like 1 ·
1707955503297.png (16.5 KiB)
daza avatar image daza matt1309 commented ·

@matt1309 mate thanks for that but I don’t see logic settings or what I have to do to limit it and the other issue I can’t find the max settings to return it to norma the only setting is DVCC max voltage which isn’t the same as I need, If I can get max DVCC I wont need the winter months I can just do a crown through a switch for my off peak charge times. Any help guys?



img-4605.jpeg


img-4603.jpegimg-4602.jpegimg-4604.jpeg
img-4601.jpeg

0 Likes 0 ·
img-4605.jpeg (7.7 MiB)
img-4604.jpeg (7.0 MiB)
img-4603.jpeg (7.3 MiB)
img-4602.jpeg (7.5 MiB)
img-4601.jpeg (6.5 MiB)
matt1309 avatar image matt1309 daza commented ·

Hi @Daza when you say logic setting. Do you mean how do you pass in the limit?

I couldn't quite remember the criteria you mentioned you were after but the below might get you close enough so you can tweak it for exactly what you want.

I've assumed you want in summer solar to stop charging battery at 9am. And plan on doing this by limiting DVCC (rather than using the code marv provided above?)

And then in winter and at another time of the day during the summer you want to disable this?

If that's the case I would change you cronplus node (the first screenshot). To not pass "default payload" and instead pass a number. that number being the amps you want to limit DVCC current limit to.


1708106894595.png

You then connect the output of this node into the input of ESS control node

And that should set the DVCC current limit.


In regards to setting it back to the max. I've never really read into that so not sure if there's a proper way of doing it but personally as a alternative i would just set it to the max of what your system is technically able to charge the batteries with ie a limit that is never reached.


So it'll look something like this.


1708107304756.png


0 Likes 0 ·
1708106894595.png (29.7 KiB)
1708107304756.png (26.0 KiB)
daza avatar image daza matt1309 commented ·

@matt1309 how about something like this but I have no idea if it is going to conflict? solar is set for the morning 0900 and all the summer months so I’m assuming it will revert back to normal in the winter? If I set it up with a cron of the summer months with a start time of 2300 to switch back to max DVCC charge would that do? But I’m not sure how it it figures out what’s what on the switchimg-4610.jpeg


img-4613.jpeg

0 Likes 0 ·
img-4610.jpeg (5.9 MiB)
img-4613.jpeg (7.2 MiB)
matt1309 avatar image matt1309 daza commented ·

I can't quite make Out the screen shots.


But just to clarify, the cron nodes are just sending a number that you define in the node to the dvcc current limit at a defined time.


So if you say 9am during summer. It'll send one message of say 5amp at 9am.


No other messages will be sent to change the dvcc current limit until either the next 9am.


Or If you've got other nodes like one to change at 23.00 it won't conflict with 9am one as it's not constantly sending messages it's only sending 1 at 9am.


Is that the bit that wasn't making

Sense to you?



I think you've got a node for turning max dvcc on and another for turning dvcc down. Really you're just changing dvcc at defined times right?

So all you need is lots of crons with different amps being passed into the current limit node.


If you want to limit the cron node is set to pass a low number.


If you want max then you have another cron pass a big number.


That make sense?

1 Like 1 ·
daza avatar image daza matt1309 commented ·

Mate i think it might of just clicked in my brain lol ill post it in a sec

0 Likes 0 ·
daza avatar image daza matt1309 commented ·

@matt1309 Ok well only issue that i ca see now is Max DVCC it has no has no numerical settings am i to assume that once it gets any signal it just reverts to max DVCC charging @Guy Stewart (Victron Community Manager) is this how this victron node works.


So i started to lower the charge current every hour, the cron only starts at the times on it and that only happens in the UK summer months. I have the Return to max DVCC for 2100 just so it gives me a ping so i know its switched over this also only happens in UK Summer months

img-4617.jpeg

img-4618.jpeg

img-4620.png



0 Likes 0 ·
img-4617.jpeg (373.6 KiB)
img-4618.jpeg (312.6 KiB)
matt1309 avatar image
matt1309 answered ·

HI All,

I've thought about how you could natively add this feature into victron rather than automating it via node red (slow day at work....)

I'm far from a pro (especially when it comes to understanding the victron system) so please correct me if any of this is wrong.


My thinking was you'd ideally want this calculation that @marv2097 has done in node red to be done at the same time your load figures are calculated. That way you'd minimise the time you'd be in "overshoot" as @Daza mentioned. I assumed this would be done in C++ for speed but digging around on github i stumbled upon dbus-systemcal-py. Which seems to be the script that does it?

Can someone confirm if this is where the consumption calculations are done?

If so I would say this is the script that needs to be edited to add this functionality natively.

My plan would be add a settings option in gx device for the "Export all solar"

or "Export all solar less loads". You'd also need to defined a min SoC for the logic to be active. And then maybe also implement a schedule of sorts.

I think the lines we'd need to edit would be from around 888 onwards. So whenever consumption is updated we'd have to check ESS is enabled then if it is edit gridsetpoint via dbus at the same time.

WIth

gridsetpoint = c - consumption[phase]

where c is defined in the python script. as pvpower.

This probably gets more complex on multiphase but I think that's the basic logic.


Anyone (preferably someone that knows what they're on about unlike me) confirm I'm understanding how the system works/the above high level proposal would work or if I'm miles off please?


I'd love to help on a project like this but I'm not a software dev and would be afraid my edits would impact an aspect of the system that I'm not aware of, so probably need someone more in the know to do what i describe above in a safe and reliable manner.

Would be interested to know if im miles off or not though.




2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image
matt1309 answered ·

Tldr: use node red solution


I've thought about this more.

More than I should have. I've concluded node red is just the best solution


That python script assuming that's the right one. Runs once per second, even if we upped that to ever 100ms to match the fastest energy meters available. Assuming no other latency you'd update the gridsetpoint every 100ms


Node reds refresh rate is in theory whenever dbus is updated. So odds are it's not much different. But even if we assume it's 1second vs 100ms.


Say you turned on a big load of say 4kw.

The time difference between python and node red would be 1 watt hour of usage. (4000/(60*60*.9))


The losses are probably more in the Ess algorithm ie how fast the inverter covers loads that are turned on. I have seen threads on that in the past but definitley above my pay grade.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

joolster avatar image joolster commented ·
So, in summary ...


@Guy Stewart (Victron Community Manager) - could we have a feature that allowed the ESS to 'optimise solar export above a particular ESS SOC, either with or without battery assisted export' ? this would be great for summer peak gen


And, as per this thread, node red easiest to make it work until then!

0 Likes 0 ·
marv2097 avatar image
marv2097 answered ·

@matt1309

Some interesting points, i had a similar journey and went down the route of putting ESS in external control mode and then using an external golang app to read/write setpoints via modbus. It's not really any slower/quicker than standard ESS and the limitation appears to be how fast the inverter is allowed to respond based on grid-code.

Using node red may be a little slower but its hardly noticeable and as you say ESS already has to deal with reacting to large loads turning off/on so there is not much of a way around that unless you decouple your AC system fully from the Grid (sure i saw a thread about it) but thats not really what im going for.

All depends on your use case but im hoping to export most of my solar at 15p/kwh and run my loads mostly of off-peak electricity at 7.5p. Im sure with charging/inverting/wear losses its not much in it but I also like to tinker with these things :)


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image
matt1309 answered ·

Hi @Daza


I've just worked it out the value to disable dvcc current limit (ie set it to max is -1).


So you do the exact same as what you've done on the others. Where cron node send a number like this:

1708195472876.png



Except you use -1. Rather than 50. this should disable any dvcc current limit when passed into the DVCC system max charge current.


(I worked this out by seeing what using ESS node to see what DVCC max charge current was set to when manually disabled in gx device. it showed -1.)


1708195472876.png (30.6 KiB)
3 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

daza avatar image daza commented ·
@matt1309 Thank you i think that is now complete I haven't stuck any state of charge as its summer months enabled and the battery should get a little top up until 0900 before it drops to 5 Amps at 1000am as I'm not forcing solar export so if i need to use the solar production i can and what i don't use all goes to the grid. As i'm not forcing the ESS to do it via grid setpoint i shouldn't get any additional discharge of the battery to the grid other than my -10 standard grid set point.
0 Likes 0 ·
matt1309 avatar image matt1309 daza commented ·
Sounds good. You can ay least see how it manages and add SoC into the mix if needed (either using function node or even basic switch node should do)
1 Like 1 ·
daza avatar image daza matt1309 commented ·

@matt1309 Mate that worked a treat i just changed it to feb months and the time and it dropped it twice and gave me the push notifications I'm just testing again with different labels on the push to tell me what its doing. But i saw it go down to 10amps and saw -1 return it to no limit DVCC so thanks a lot for that.


Edit it’s working as per the test of trigger in theory it will do the job very well I’ve changed the point it hits 5amps to 0930 but I won’t know how it performs yet as it’s only activating in the UK summer months I’ve cleaned it up a little.

@joolster you seem like you have more sun where you are if you want to try this but it appears the simplest way you would have to add your state of charge is you wanted it though.

img-4622.jpeg

img-4623.jpeg

img-4624.jpeg


0 Likes 0 ·
img-4622.jpeg (375.8 KiB)
daza avatar image
daza answered ·

@matt1309 or anyone else that knows nodeRed well so with the help of @matt1309 i have made a flow but something that sprung to mind is what happens in the event of a grid down situation, i want to make a fail safe, ie my flow won't trigger in a grid down situation so it will just charge the battery as normal, so i thought i could use the AC input with a cron on to say grid available take it to a joining node and then to another cron and then to the DVCC output? Im not sure if AC input is what i can use to say if grid is available lower DVCC? and then a failsafe to return to Max charge if the grid goes down in the day? I'm wired to AC 1 output on the multiplus for PV. I have no idea if the multiplus reverts by itself in this type of situation any victron staff members know if the victron system operates this way in this scenario?

@Guy Stewart (Victron Community Manager) @Matthias Lange - DE @mvader (Victron Energy)

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image matt1309 commented ·
I'll have a look at node red options tonight but yes very doable. I imagine you could use acin voltage but there may also be grid down alerts somewhere you could use.


In terms of setup. I'd have a separate flow that has acin voltage or grid down notification and if grid down a global variable is set. Then your dvcc changing flow you just add in a switch node to check if the global variable grid down is flagged. If it is then get it to not progress for example.

1 Like 1 ·
matt1309 avatar image matt1309 commented ·

Hi @Daza


To anyone else reading this. The answer is probably shorter when written in js function node. However I think Daza you're just getting used to node red (correct me if wrong)? So using nodes without needing javascript code is probably more user friendly? (I've gone with that approach below anyway).


So I've had a look, if you look in VE Bus system node. There's a few options that will give you status/notification if grid goes down.


The one that stands out is Grid lost Alarm. Which outputs 0 if ok and 2 if Alarm.

However you could also look at checking a few other things like voltage or AC In active, the above looks like the best to me though (happy to be proven wrong there).


I would have an additional flow that checks grid status like this: Which is the grid lost alarm from VE BUS node going into a change node (snip of change node is below). What this is doing is saving the status of the grid into a global variable in node red. So other nodes can access the variable easily.

It then moves onto check if the grid is down then set DVCC to -1 (note that last node Dazza can just be your current DVCC changer you wont need another one)

1708626642781.png

Change node:

1708625691942.png


switch node:


1708626992070.png


Another change node to set payload to -1

1708627021257.png



This will remove dvcc limit if the grid goes down. If there is a scenario where grid goes down at 8.59am. And your 9am flow then runs it will set DVCC to whatever limit you've set. (Which you dont want). The above node will correct this within 5 seconds when it pulses.


However if you wont want the 9am (or any other time) nodes changing it if grid is down you simply need to add the below switch node inbetween the cron and the rest of your flows. It's essentially saying if the global variable grid_down isnt equal to 2 then progress. ie if grid not down keep going otherwise stop.



1708626799779.png



Hope this helps/explains each step. shout if not.

1 Like 1 ·
1708625691942.png (17.6 KiB)
1708626642781.png (15.2 KiB)
1708626799779.png (13.1 KiB)
1708626992070.png (13.3 KiB)
1708627021257.png (12.8 KiB)
daza avatar image
daza answered ·

Brilliant mate thanks a lot I’ll set it up and try and put it in the flow so it doesn’t trigger at all, this is awesome @matt1309 thanks a lot much appreciated mate.

img-4629.png
img-4630.png
img-4631.png


img-4629.png (744.4 KiB)
img-4630.png (705.9 KiB)
img-4631.png (619.8 KiB)
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image matt1309 commented ·
No worries shout if there's anything else. Tried typing out each step of what i was doing/why just in case you want to tweak certain elements or add more functionality using the same methods.


Once you've done this a few times you'll be making all sorts of cool/weird stuff in node red.
0 Likes 0 ·
daza avatar image
daza answered ·

@matt1309 so i've followed it and had a good hack at it but for the life of me i can't get the grid to trigger i did manage to stop the message on the cron but now appears i can't even do that again :(

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image matt1309 commented ·

@Daza

Add a few debug nodes in. These tell you what's being passed out of each node. This should help you trace through what's causing the issue.


However I think i can spot it though. You've combined what I've provided into what you've got but not quite in the right way. You're passing the grid alarm into the cron nodes.

However the issue is in the corn nodes are editing the payload (the data that's passed between nodes). So the grid alarm isn't getting passed out of the cron node (as we're changing the payload to be a current number or -1 that's then passed to the dvcc).


So what you want is two separate flows.

For ease of explaining say Flow B: sets the variable grid_down.

And then Flow A does your normal timed current limit changes.

However the only addition to your Flow A you previously had working is you're going to add in a check to see if grid is down by reading the variable that was set in FLow B.


Flow A: is your old setup of lots of cron nodes that each set different currents. The only change is you want all these cron's to go into a switch node which checks if grid is down using the variable set in flow B (explained below)


This will only let the current number stored in payload through to the dvcc max current node if the variable globa.grid_down is not equal to 2.


The output of the switch goes to dvcc current limit.


However your next question will be but we've not set the variable that tells us if grid is down (which is stored here global.grid_down)


This is where you need Flow 2:


Flow 2:

Is going to be you quattro grid alarm passed into a new change node that's going to set the variable global.grid_down equal to the grid down alarm value (which is 0 for normal, 2 for grid down).

You then want to continue the flow and check if grid_down = 2 then disbale dvcc current limit. Which you'd do by using switch node to check if grid_down =2

1708689211883.png

Then if it is the next node you want to set the payload equal to -1 which is then passed into the DVCC current limit.

1708689255329.png

The end of flow 2. Could be linked into the last node in flow 1 (the DVCC current limit node).


Hope this helps.


I've tried to replicate roughly your setup to show you what it should look like.


With Flow A i described above being in the top half of the below screenshot. With the new swtich that checks if grid is down

And Flow B (the new part) being in the bottom half


1708689791721.png

0 Likes 0 ·
1708689211883.png (14.5 KiB)
1708689255329.png (14.0 KiB)
1708689791721.png (65.7 KiB)
daza avatar image
daza answered ·

@matt1309 so I got the grid down to work which is great thanks a lot but my flow doesn’t look like yours but work, I would love the switch node that breaks the crown up to work so it just stops them from running but end of the day the grid down will always return it to max so this is great. Thank you very much mate.


img-4632.pngimg-4633.png
img-4634.png


img-4632.png (529.3 KiB)
img-4633.png (454.1 KiB)
img-4634.png (466.7 KiB)
2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image matt1309 commented ·
@Daza

No worries your code will work. And the grid alarm should pulse every 5secs (max). So worse case it'll be wrong for 5seconds if grid goes down.


If those 5seconds bother you so much you need a way of telling your grid down checking flow data into the main cron flows.

The way i did this was setting a global variable. This means every node can access the variable without it needing to be passed in via other nodes. So if you want to add that feature in you need to set the global variable by adding a change not where you set global.grid_down = msg.payload (assuming it's connecting to output of grid down alarm node.



Then you need a switch in your mainflows after the cron's to check if grid_down != 2

(ie no grid alarm so it'll pass through the existing payload from cron. ).

1 Like 1 ·
Show more comments
daza avatar image
daza answered ·

@matt1309 i couldn’t leave it alone lol done it now. So it will only allow the amps to go down if the grid is available and will go back to max if the grid is down thanks again mate
img-4635.png


Ive added it to GitHub so people can just jump in and mess about with it maybe adding SOC before limiting DVCC https://github.com/dazza120/Victron-Solar-Export-NodeRED.git @matt1309 much appreciated for your help buddy.


img-4635.png (437.8 KiB)
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image matt1309 commented ·

Glad it's worked @Daza . If you want a hand adding SoC elements. Let me know the plan/how you want it to work. Happy to pull request the changes for you to review if you let me know how you want it to work.


Tonnes of options of how you could do this but one way of implementing SoC and the time based limits that would be to have a factor/rate list that's applied depending on SoC.


So you have your normal cron's that send the DVCC limit based on time of day. but they then go into the SoC checker.

The SoC checker just adjusts the DVCC limit by a factor based on SoC.


So say your SoC factors look like this:

  • At SoC 10%: 0% factor applied,
  • at 50% SoC apply a 40% and
  • at 80% SoC apply 90% factor.

(These would be user defined)


For example if it's 6am your cron is saying limit 40amps:

  • However if SoC is 10% you'd apply 0% factor so DVCC set to 40amps..
  • If SoC is 40% apply factor applied so DVCC set to 24amps (logic being you're almost full)
  • If SoC 80% factor of 90% applied so DVCC set to 4amps as you're almost full anyway.


This might not be the best option depending on how you envisage it.

But would be a quick way to add SoC limits and time based limits at the same time. The code would be Cron -> grid down checker -> SoC factor adjustment -> dvcc.

SoC Factor adjustment would just do a lookup based on SoC to a table (in programming a map) to get the factor then apply it. Which users could edit.


The other options of course are more manual to but just the same as what you've done already but you add in SoC and still have time.



1 Like 1 ·
markess avatar image
markess answered ·

I basically did this using Node-RED, modulating the grid setpoint. House loads are covered by the battery. Then added a few other controls relevant to my tarrif.


1000008981.png



1000008985.png


1000008981.png (160.7 KiB)
1000008985.png (149.5 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.