victronenergy / venus

Victron Energy Unix/Linux OS
https://github.com/victronenergy/venus/wiki
567 stars 70 forks source link

Vebus: Add prefer renewable energy setting #1052

Closed vejpasop closed 12 months ago

vejpasop commented 1 year ago

Add a new feature to our systems, mainly for boats and campers and such, that makes the system give priority to solar or wind when it comes to charging; rather than the Multi or Quattro doing the bulk of it from shore power.

In the implementation, this will consist of a few things:

  1. a new setting will in the inverter/chargers, making it (use shore power to-) charge up to the configured float voltage only. Instead of up to the, higher, configured absorption voltage.
  2. On the user interfaces of systems with that setting enabled, show an override button that allows the user to make the system charge fully. As a one time action, once fully charged, system goes back to solar and wind priority.
  3. On the user interfaces, it needs to be clear that the system is in this mode; so user understands why his system is not fully charging the batteries.

Details:

In the Multi firmware, a settable flag in the eeprom is added, which when enabled makes it:

  1. when not in BOL mode charge to float voltage, and skip bulk and absorption.
  2. when in BOL mode (canbus battery), charge with the lowest value of the CVL and Float voltage setting.
  3. for a Quattro, this will only work when connected to AC-in-2, since AC-in-1 is where a generator is connected and while that is running you want to charge with full power.

This setting will be added to both VEconfigure and VictronConnect.

About the override button:

When enabled, the UIs show the override button: when above eeprom setting is enabled in the Multi, the GUIs show the "override control", which when enabled, (a) lets the multi charge up to absorption again, and (b) make sure it starts doing that per immediate, even when already in float or absorption. Since thats what the user wants, its a "charge my batteries full for this time" button, or "I want my batteries full now" button. Reason to have it be a button, rather than a slider that you have to restore, are for example: when putting the boat in the winter storage, you want it to one time fully charge the battery. And then you don' twant to go back there the following day to set it back to float-only. And similarly if you get somewhere in a harbour, want to leave the following morning with full batteries, you want to then charge it fully; and not next day have to remember to set it back to float-only.

The user control will be made visible in all the UIs:

On dbus, the path /Dc/0/PreferRenewableEnergy will be invalid if either firmware is too old or firmware new enough but option not enabled in the settings/eeprom. When the setting is enabled in eeprom, then it will show a 1. To make it charge once, write a 0 in there. The Multi will then start charging (charge engine will be restarted) and the dbus path will remain 0 as long as thats going on. Once charge cycle is completed (state goes to float), it will self-reset to 1.

User interface (GX UI, HTML5, VRM):

BOL mode

When in BOL mode (canbus battery), charge with the lowest value of the CVL (Charge Voltage Limit) and Float voltage setting. For a Quattro, this will only work when connected to AC-in-2, since AC-in-1 is where a generator is connected and while that is running you want to charge with full power.

Todo:

Outsourced to El Nino:

kwindrem commented 1 year ago

Re the note regarding AC in 1 / 2: The generator is not always connected to AC in 1. AC in 1 gets the "priority" AC source which should sometimes be the grid. In fact, the generator start/stop logic that uses don't start generator when on AC 1 requires the grid on AC in 1.

mpvader commented 1 year ago

hi Kevin, Venus OS is being fixed up to support generators to be connected on AC in 1.

more details here:

https://professional.victronenergy.com/news/detail/178/

EDIT: and AC input 1 is really the way to go for generators. Above new feature will remain AC in 1 only for Quattros.

kwindrem commented 1 year ago

The other thing I have heard is that AC input presence (voltage and frequency) are only sensed on the active input and AC input 1. If that is the case then Quattro would not be able to detect mains on AC in 2 and therefore stop the generator. If this is not the case and AC in 2 presence can be detected then all is well.

mpvader commented 1 year ago

Yes, it can be detected on AC in 2.

vejpasop commented 1 year ago

User setting /Dc/0/PreferRenewableEnergy added to in mk2-dbus v3.52

mpvader commented 1 year ago

Short update, also @kwindrem , this is progressing quickly now. Above text has been updated, and see here:

https://www.victronenergy.com/live/ve.bus:skip-absorption

vejpasop commented 1 year ago

More changes are required for generator support.

When a generator is running the override should be active as long as the generator runs to ensure proper charging. In a systems system with a DMC the DMC can communicate the generator state trough the "transfer switch" input of the DMC. In a system with a Venus device only we need to communicate generator run state. For this we will need to add an extra dbus path to mk2dbus to communicate the generator state. @Izak will than have to write this path.

jepefe commented 1 year ago

I added this to the GUI. The battery shows new icons to reflect that the prefer renewable option is enabled, then when a full charge is forced a red strip with icons is added, red is used to maximice the contrast so user can see it from the distance.

Changes are ready to be added to the todo but first I'll like to get some feedback.

Here is a short video:

https://github.com/victronenergy/venus/assets/6424631/bc62a6e7-b912-45d0-88c6-f1a147ec49c6

jepefe commented 1 year ago

Handle edge case when 506 firmware settings file is used to restore settings on fw 504 / 505. Use /Ac/State/RemoteGeneratorSelected item to for the logic.

https://github.com/victronenergy/venus/assets/6424631/6c251cb1-d78c-4a13-a87c-e5b7540bac54

When external generator is selected charge to 100% can't be stopped:

Screenshot 2023-06-27 at 12 32 15
vejpasop commented 1 year ago

mk2-dbus v3.57 is on the Venus TODO

vejpasop commented 1 year ago

@izak The "Notify Multi when generator is running" is inverted. Tested on a Venus GX By reading your code I don't know why (yet)

image

jepefe commented 1 year ago

gui added to the ToDo

vejpasop commented 1 year ago

@jepefe I noticed an issue with the GUI radio buttons for "Charge the battery to 100%". When you select this option for the first time (after a clean start of the GUI service) the yes / no buttons are selected like image

After selecting yes the recharge starts correctly. However when you revisit the screen to return to normal operation the "yes" button is selected like image Now if you click "yes" the "yes" buttons selection clears and we return to normal operation. The next time we want to start charging the "yes" button is already pre-selected. This looks a bit awkward. See video

https://github.com/victronenergy/venus/assets/10847324/58942304-94e8-42f3-80b1-6d4d66b2e954

izak commented 1 year ago

@vejpasop, we have sites now that think they have a generator when they don't have one. I think the reason is this:

  • /Ac/State/RemoteGeneratorSelected will be 1 when either of the following is true:
    • On Quattro while we are connected to AC input 1
    • When the DMC generator switch input is closed
    • When '/Ac/Control/RemoteGeneratorSelected' is set to 1

Sites with the grid connected to AC-in-1 of a Quattro now set this path to 1. The GUI then shows that the AC input is a generator.

Probably the simplest solution is to drop that first condition. Or will that lose something important?

kwindrem commented 1 year ago

There is also a problem with the override of preferred renewable energy if the AC input type is set to generator in the GX device. In this case, the system does not automatically recharge the battery to 100%.

The "generator" digital input to say the generator is running sets /Ac/Control/RemoteGeneratorSelected. However this does not happen of the AC input type is manually set to Generator.

Also, are there cases where if the GX device's configuration changes that the /Ac/Control/RemoteGeneratorSelected state isn't updated properly?

My thought is that this all should be handled elsewhere. startstop.py seemed the likely spot however mpvader mentioned that not all users use the generator control logic in the GX device. So maybe in systemcalc?

mpvader commented 1 year ago

The GUI then shows that the AC input is a generator.

As discussed, we’re going to remove/revert that out of the gui. @jepefe .

and @vejpasop is going to change mk2dbus to no longer use Ac/Control/RemoteGeneratorSelected when the device is a quattro. Since that relates to external transfer switches, which really is for Multis

vejpasop commented 1 year ago

We should remove the the corresponding generator section of Solar & Wind Feature video also.

vejpasop commented 1 year ago

Since the Ac/State/RemoteGeneratorSelected was also used by the GUI to determine if we could stop the charge cycle manually we need to add an "overridden" state to Dc/0/PreferRenewableEnergy in case of a running remote generator or a Quattro on AC in 1

vejpasop commented 12 months ago

In mk2-dbus v3.58 changes

  1. "sustain" is now reported through the State item.

  2. Ac/State/RemoteGeneratorSelected remains invalid on Quattro's. The current GUI relies on this to determine if the "charge to 100%" can be manually stopped. In case of a generator running or a Quattro on ACin 1 it cannot be stopped. To solve this Dc/0/PreferRenewableEnergy now reports "overridden' in this case.

Todo:

jepefe commented 12 months ago

Changes added in gui: fix_solar_and_wind