def maximize_charge_current(self): """ Max out the charge current of this solar charger by setting ChargeCurrent to the configured limit in settings. """ if self.monitor.seen(self.service, '/Link/ChargeCurrent'): copy_dbus_value(self.monitor, self.service, '/Settings/ChargeCurrentLimit', self.service, '/Link/ChargeCurrent')
def _update_battery_operational_limits(self, bms_service): """ This function writes the bms parameters across to the Multi if it exists. The parameters may be modified before being copied across. The modified current value is returned to be used elsewhere. """ cv = safeadd(bms_service.chargevoltage, self.invertervoltageoffset) mcc = safeadd(bms_service.maxchargecurrent, self.currentoffset) cv, mcc = self._adjust_battery_operational_limits(bms_service, cv, mcc) if self._multi.active: try: if cv is not None: self._multi.bol.chargevoltage = cv if mcc is not None: self._multi.bol.maxchargecurrent = mcc # Copy the rest unmodified copy_dbus_value(self._dbusmonitor, bms_service.service, '/Info/BatteryLowVoltage', self._multi.service, '/BatteryOperationalLimits/BatteryLowVoltage') copy_dbus_value( self._dbusmonitor, bms_service.service, '/Info/MaxDischargeCurrent', self._multi.service, '/BatteryOperationalLimits/MaxDischargeCurrent') return 1, cv, mcc except DBusException: logging.debug(traceback.format_exc()) return 0, cv, mcc
def test_copy_dbus_value(self): from sc_utils import copy_dbus_value copy_dbus_value(self._monitor, 'com.victronenergy.battery.ttyO2', '/Info/MaxChargeVoltage', 'com.victronenergy.vebus.ttyO1', '/BatteryOperationalLimits/MaxChargeVoltage') self.assertEqual( 55, self._monitor.get_value( 'com.victronenergy.vebus.ttyO1', '/BatteryOperationalLimits/MaxChargeVoltage')) copy_dbus_value(self._monitor, 'com.victronenergy.battery.ttyO2', '/Info/MaxChargeVoltage', 'com.victronenergy.vebus.ttyO1', '/BatteryOperationalLimits/MaxChargeVoltage', offset=-1) self.assertEqual( 54, self._monitor.get_value( 'com.victronenergy.vebus.ttyO1', '/BatteryOperationalLimits/MaxChargeVoltage'))
def test_copy_dbus_value(self): from sc_utils import copy_dbus_value copy_dbus_value(self._monitor, 'com.victronenergy.battery.ttyO2', '/Info/MaxChargeVoltage', 'com.victronenergy.vebus.ttyO1', '/BatteryOperationalLimits/MaxChargeVoltage') self.assertEqual(55, self._monitor.get_value('com.victronenergy.vebus.ttyO1', '/BatteryOperationalLimits/MaxChargeVoltage')) copy_dbus_value(self._monitor, 'com.victronenergy.battery.ttyO2', '/Info/MaxChargeVoltage', 'com.victronenergy.vebus.ttyO1', '/BatteryOperationalLimits/MaxChargeVoltage', offset=-1) self.assertEqual(54, self._monitor.get_value('com.victronenergy.vebus.ttyO1', '/BatteryOperationalLimits/MaxChargeVoltage'))
def _update_battery_operational_limits(self, bms_service, cv, mcc): """ This function writes the bms parameters across to the Multi if it exists. The parameters may be modified before being copied across. The modified current value is returned to be used elsewhere. """ if self._multi.active: if cv is not None: self._multi.bol.chargevoltage = cv if mcc is not None: self._multi.bol.maxchargecurrent = mcc # Copy the rest unmodified copy_dbus_value(self._dbusmonitor, bms_service.service, '/Info/BatteryLowVoltage', self._multi.service, '/BatteryOperationalLimits/BatteryLowVoltage') copy_dbus_value(self._dbusmonitor, bms_service.service, '/Info/MaxDischargeCurrent', self._multi.service, '/BatteryOperationalLimits/MaxDischargeCurrent') return 1 return 0
def maximize_charge_current(self): """ Max out the charge current of this solar charger by setting ChargeCurrent to the configured limit in settings. """ copy_dbus_value(self.monitor, self.service, '/Settings/ChargeCurrentLimit', self.service, '/Link/ChargeCurrent')