So I have a multiplus running the charge current control assistant which sets charge current to zero when Aux input is closed and to 60A when aux input is open.
The aux input is switched by whether my generator is running or not.
configured so that if gen is running the multi will charge my batteries but if gen is stopped it will go into passthrough while on grid.
I also have a raspberry pi running venus with dvcc enabled.
dvcc tries to set the charge current to max and then the assistant tries to set it to 0 and they get in a fight about it.
So I am looking to get rid of the assistant and use dvcc to control the charge current.
I have startstop.py running on my pi which publishes the generator state on the dbus as com.victronenergy.generator.startstop0 /Generator0/State
My plan is to modify dvcc.py by-
writing 0 to /Dc/0/MaxChargeCurrent when Generator0/State == 0
and writing 60 to /Dc/0/MaxChargeCurrent when Generator0/State ==1
I have got as far as writing 0 to /Dc/0/MaxChargeCurrent when dvcc ccl is disabled and 60 when dvcc ccl is enabled (ignoring ccl setting)
But I’ve got stuck at importing com.victronenergy.generator.startstop0 /Generator0/State into dvcc.py
Can anyone help me with this please? my python programming is sketchy at best.
I’m running an older version of venus that uses python 2 if that changes the price of fish.
so far I have added-
(‘com.victronenergy.generator.startstop0’, [
‘/Generator0/State’])]
to the list of-
def get_input(self):
dbus paths in dvcc.py
Now I just need to figure out how to define that as a variable I can use to control /Dc/0/MacChargeCurrent
As a temporary solution I have stopped dvcc from writing the max charge current setting to the multiplus. this stops the fight between dvcc and the current control assistant but also stops CCL from being used.
to stop dvcc writing to multi-
edit /opt/victronenergy/dbus-systemcalc-py/delegates/dvcc.py
find this section and comment out the last line and type “pass” in the next line down.
Like this-
@maxchargecurrent.setter
def maxchargecurrent(self, v):
# If the Multi is not ready, don’t write to it just yet
if self.active and self.maxchargecurrent is not None:
# The maximum present charge current is 6-parallel 12V 5kva units, 6*220 = 1320A.
# We will consider 10000A to be impossibly high. #self.monitor.set_value_async(self.service, ‘/Dc/0/MaxChargeCurrent’, 10000 if v is None else v)
pass
Thanks LX, yes, node red would give me a lot of options but I’d have to re-build my venus os from scratch and I’ve already made a lot of modifications.
i tried reading the generator state within dvcc class using-
Generator_Running = self._dbusmonitor.get_value(‘com.victronenergy.generator.startstop0’, '/Generator0/State’)
and then using that to set my charge current but its value is “None”.
indicated by- if Generator_State is None: self._multi.maxchargecurrent = 0 elif Generator_State == 1: self._multi.maxchargecurrent = 90 else: self._multi.maxchargecurrent = 20
sets the charge current to 0.0A
but if I read it with dbus -y in a terminal it returns “1”
I’m confused.
OK, A little knowledge on my part is a dangerous thing. haha.
I have decided to use the digital input state that indicates that the generator is running rather than the generator state published by start_stop.py.
so here is plan B:
@property
def Generator_Stopped(self):
return self._dbusmonitor.get_value('com.victronenergy.digitalinput.input01', '/InputState') == 1
#Generator_Stopped is true when the input is pulled high and false when pulled low.
Generator_Stopped = self.Generator_Stopped
if Generator_Stopped:
self._multi.maxchargecurrent = 0 #do not charge
else:
self._multi.maxchargecurrent = 90 #charge at 90A
I’ll try it tonight when I get home.
EDIT: that didn’t work either, Generator_Stopped is still not true when digital input is pulled high.