mr-manuel / venus-os_dbus-serialbattery

Battery Monitor driver for serial battery in VenusOS GX systems
https://mr-manuel.github.io/venus-os_dbus-serialbattery_docs/
MIT License
47 stars 17 forks source link

Internal calculation error -> battery.py line #609/#1131 #63

Closed frbuceta closed 3 months ago

frbuceta commented 3 months ago

Describe the bug

When the battery is reaching 100% of its charge, then the driver gives this error.

This screenshot shows that it is at 71% but this is not true. The smartshunt says it is at 99%. Error

How to reproduce

I don't know exactly what is going on but it gives it automatically when it is reaching 100% of its load.

Expected behavior

Do not give this error.

Driver version of the currently installed driver

v1.4.20240721dev

Driver version of the last known working driver

No response

Venus OS device type

Cerbo GX

Venus OS version

v3.50~11

BMS type

JKBMS (Heltec BMS)

Cell count

16

Battery count

1

Connection type

Serial USB adapter to RS485

Config file

[DEFAULT]

; --------- Battery Current limits ---------
MAX_BATTERY_CHARGE_CURRENT    = 115.0
MAX_BATTERY_DISCHARGE_CURRENT = 230.0

; --------- Cell Voltages ---------
; Description:
;     Cell min/max voltages which are used to calculate the min/max battery voltage
MIN_CELL_VOLTAGE   = 2.900
; Max voltage (can seen as absorption voltage)
MAX_CELL_VOLTAGE   = 3.450
; Float voltage (can be seen as resting voltage)
FLOAT_CELL_VOLTAGE = 3.375

; --------- SOC reset voltage ---------
SOC_RESET_VOLTAGE = 3.570

Relevant log output

2024-08-02 14:01:44.730730500 python: can't open file '/opt/victronenergy/dbus-serialbattery/dbus-serialbattery.py': [Errno 2] No such file or directory
2024-08-02 14:02:17.192223500 INFO:SerialBattery:
2024-08-02 14:02:17.211029500 INFO:SerialBattery:Starting dbus-serialbattery
2024-08-02 14:02:17.217619500 INFO:SerialBattery:Venus OS v3.50~11
2024-08-02 14:02:17.231404500 INFO:SerialBattery:dbus-serialbattery v1.4.20240721dev
2024-08-02 14:02:33.250878500 INFO:SerialBattery:-- Testing BMS: 1 of 3 rounds
2024-08-02 14:02:33.251952500 INFO:SerialBattery:Testing Daly at address "\x40"
2024-08-02 14:02:33.400744500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-08-02 14:02:33.402029500 INFO:SerialBattery:Testing Daly at address "\x80"
2024-08-02 14:02:33.554458500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-08-02 14:02:33.555420500 INFO:SerialBattery:Testing Ecs
2024-08-02 14:02:33.641451500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-08-02 14:02:33.642560500 INFO:SerialBattery:Testing EG4_Lifepower at address "\x01"
2024-08-02 14:02:33.956174500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-08-02 14:02:34.257163500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-08-02 14:02:34.563215500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-08-02 14:02:34.564711500 INFO:SerialBattery:Testing EG4_LL at address "\x01"
2024-08-02 14:02:34.871013500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-08-02 14:02:34.872656500 INFO:SerialBattery:Testing HeltecModbus at address "\x01"
2024-08-02 14:02:38.684925500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-08-02 14:02:38.684934500 INFO:SerialBattery:Testing HLPdataBMS4S
2024-08-02 14:02:47.723069500 ERROR:SerialBattery:>>> ERROR: No reply - returning
2024-08-02 14:02:47.723079500 INFO:SerialBattery:Testing Jkbms
2024-08-02 14:02:47.793541500 INFO:SerialBattery:Connection established to Jkbms
2024-08-02 14:02:51.015879500 INFO:SerialBattery:Found existing battery with DeviceInstance = 1
2024-08-02 14:02:51.371065500 INFO:SerialBattery:DeviceInstance = 1
2024-08-02 14:02:51.372727500 INFO:SerialBattery:PID file created successfully: /var/tmp/dbus-serialbattery_1.pid
2024-08-02 14:02:51.373409500 INFO:SerialBattery:Used DeviceInstances = ['1']
2024-08-02 14:02:51.374346500 INFO:SerialBattery:com.victronenergy.battery.ttyUSB1__0
2024-08-02 14:02:51.408283500 INFO:SerialBattery:publish config values = False
2024-08-02 14:02:51.414908500 INFO:SerialBattery:Polling data every 1.000 s
2024-08-02 14:02:51.419419500 INFO:SerialBattery:Battery JKBMS connected to dbus from /dev/ttyUSB1
2024-08-02 14:02:51.420294500 INFO:SerialBattery:========== Settings ==========
2024-08-02 14:02:51.422223500 INFO:SerialBattery:> Connection voltage: 55.52 V | Current: -1.86 A | SoC: 71%
2024-08-02 14:02:51.422233500 INFO:SerialBattery:> Cell count: 16 | Cells populated: 16
2024-08-02 14:02:51.422870500 INFO:SerialBattery:> LINEAR LIMITATION ENABLE: True
2024-08-02 14:02:51.424032500 INFO:SerialBattery:> MIN CELL VOLTAGE: 2.900 V | MAX CELL VOLTAGE: 3.450 V| FLOAT CELL VOLTAGE: 3.375 V
2024-08-02 14:02:51.455591500 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 115.0 A | MAX BATTERY DISCHARGE CURRENT: 230.0 A
2024-08-02 14:02:51.457711500 INFO:SerialBattery:> MAX BATTERY CHARGE CURRENT: 200.0 A | MAX BATTERY DISCHARGE CURRENT: 200.0 A (read from BMS)
2024-08-02 14:02:51.457722500 INFO:SerialBattery:> CVCM:     True
2024-08-02 14:02:51.458068500 INFO:SerialBattery:> CCCM CV:  True  | DCCM CV:  True
2024-08-02 14:02:51.458879500 INFO:SerialBattery:> CCCM T:   True  | DCCM T:   True
2024-08-02 14:02:51.459701500 INFO:SerialBattery:> CCCM SOC: False | DCCM SOC: False
2024-08-02 14:02:51.468062500 INFO:SerialBattery:> CHARGE FET: True | DISCHARGE FET: True | BALANCE FET: True
2024-08-02 14:02:51.468922500 INFO:SerialBattery:Serial Number/Unique Identifier: JK_B2A20S20P
2024-08-02 14:03:08.436977500 ERROR:SerialBattery:>>> ERROR: No reply - returning [len:85/40993]
2024-08-02 14:03:08.442204500 ERROR:SerialBattery:Non blocking exception occurred: TypeError("unsupported operand type(s) for -: 'NoneType' and 'NoneType'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/battery.py line #609
2024-08-02 14:03:08.443417500 WARNING:SerialBattery:calcMaxChargeCurrentReferringToCellVoltage(): get_max_cell_voltage() is None, using default current instead. If you don't see this warning very often, you can ignore it.
2024-08-02 14:03:08.444824500 WARNING:SerialBattery:calcMaxDischargeCurrentReferringToCellVoltage(): get_min_cell_voltage() is None, using default current instead. If you don't see this warning very often, you can ignore it.
2024-08-02 14:03:08.557871500 ERROR:SerialBattery:Non blocking exception occurred: TypeError("unsupported operand type(s) for -: 'NoneType' and 'NoneType'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/dbushelper.py line #1131

Any other information that may be helpful

No response

mr-manuel commented 3 months ago

The error is related to a wrong reading from the BMS.

As the log say If you don't see this warning very often, you can ignore it.. You see it very often?

frbuceta commented 3 months ago

It has never appeared until I updated a few days ago, and it appears every day several times a day.

I have managed to prevent the error from appearing by configuring the SOC by calculated mode

Some bug must have been introduced so that now it starts giving an error when before I never got this error.

mr-manuel commented 3 months ago

Additional error logging was added, therefore the error could have been there for a long time.

RickD880 commented 3 months ago

I also have this fault after updating to latest stable release. Daly BMS with UART-USB connection.

2024-08-05 00:51:16.187808500 DEBUG:SerialBattery:read_sentence \x91: no sentence start received
2024-08-05 00:51:16.188881500 DEBUG:SerialBattery:request_data: bad reply no. 0
2024-08-05 00:51:16.189518500 DEBUG:SerialBattery:No data received in read_cell_voltage_range_data()
2024-08-05 00:51:16.584722500 INFO:SerialBattery:refresh_data: result: False. If you don't see this warning very often, you can ignore it.
2024-08-05 00:51:16.611906500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:16.613389500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.456V [3]3.461V [4]3.455V
2024-08-05 00:51:17.593228500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:17.599846500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.457V [3]3.461V [4]3.455V
2024-08-05 00:51:18.573100500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:18.574442500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.455V [3]3.462V [4]3.455V
2024-08-05 00:51:19.590415500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:19.591704500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.457V [3]3.461V [4]3.455V
2024-08-05 00:51:20.584946500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:20.596285500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.457V [3]3.462V [4]3.455V
2024-08-05 00:51:21.597883500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:21.599399500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.456V [3]3.462V [4]3.455V
2024-08-05 00:51:22.587323500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:22.588887500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.457V [3]3.462V [4]3.455V
2024-08-05 00:51:23.584619500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:23.586344500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.456V [3]3.462V [4]3.455V
2024-08-05 00:51:24.407725500 DEBUG:SerialBattery:read_sentence \x92: no sentence start received
2024-08-05 00:51:24.408626500 DEBUG:SerialBattery:request_data: bad reply no. 0
2024-08-05 00:51:24.409335500 DEBUG:SerialBattery:No data received in read_temperature_range_data()
2024-08-05 00:51:24.658736500 INFO:SerialBattery:refresh_data: result: False. If you don't see this warning very often, you can ignore it.
2024-08-05 00:51:24.701554500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:24.711952500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.456V [3]3.462V [4]3.455V
2024-08-05 00:51:25.625601500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:25.627021500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.456V [3]3.462V [4]3.455V
2024-08-05 00:51:26.616057500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:26.621782500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.456V [3]3.462V [4]3.455V
2024-08-05 00:51:27.596375500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:27.604436500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.457V [3]3.462V [4]3.455V
2024-08-05 00:51:28.600465500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:28.601809500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.457V [3]3.462V [4]3.455V
2024-08-05 00:51:29.603009500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:29.619658500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.457V [3]3.462V [4]3.455V
2024-08-05 00:51:30.584945500 DEBUG:SerialBattery:logged to dbus [95.8]
2024-08-05 00:51:30.586219500 DEBUG:SerialBattery:Cells:[1]3.455V [2]3.457V [3]3.462V [4]3.455V
2024-08-05 00:51:31.296333500 DEBUG:SerialBattery:read_sentence \x98: no sentence start received
2024-08-05 00:51:31.297267500 DEBUG:SerialBattery:request_data: bad reply no. 0
2024-08-05 00:51:31.298524500 WARNING:SerialBattery:No data received in read_alarm_data()
2024-08-05 00:51:31.621788500 INFO:SerialBattery:refresh_data: result: False. If you don't see this warning very often, you can ignore it.
mr-manuel commented 3 months ago

This behaviour is changed with v1.4.20240806dev. Please install it and it will resolve your problem.

RickD880 commented 3 months ago

Same Internal Calculation Error persists with v1.4.20240806dev

2024-08-08 09:57:22.147791500 DEBUG:SerialBattery:current: -0.7476794051279643 - current_external: None
2024-08-08 09:57:22.148895500 DEBUG:SerialBattery:logged to dbus [98.7]
2024-08-08 09:57:22.151654500 DEBUG:SerialBattery:Cells:[1]3.335V [2]3.335V [3]3.335V [4]3.334V
2024-08-08 09:57:22.154229500 DEBUG:SerialBattery:Polling data took 0.734 seconds
2024-08-08 09:57:23.135578500 ERROR:SerialBattery:Non blocking exception occurred: TypeError("unsupported operand type(s) for -: 'NoneType' and 'float'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/battery.py line #634
2024-08-08 09:57:23.137696500 DEBUG:SerialBattery:current: -0.7529114646151678 - current_external: None
2024-08-08 09:57:23.138499500 DEBUG:SerialBattery:current: -0.7529114646151678 - current_external: None
2024-08-08 09:57:23.139347500 DEBUG:SerialBattery:current: -0.7529114646151678 - current_external: None
2024-08-08 09:57:23.140030500 DEBUG:SerialBattery:current: -0.7529114646151678 - current_external: None
2024-08-08 09:57:23.140708500 DEBUG:SerialBattery:current: -0.7529114646151678 - current_external: None
2024-08-08 09:57:23.147030500 DEBUG:SerialBattery:current: -0.7529114646151678 - current_external: None
2024-08-08 09:57:23.149918500 DEBUG:SerialBattery:current: -0.7529114646151678 - current_external: None
2024-08-08 09:57:23.152846500 DEBUG:SerialBattery:logged to dbus [98.7]
2024-08-08 09:57:23.153974500 DEBUG:SerialBattery:Cells:[1]3.335V [2]3.335V [3]3.335V [4]3.334V
2024-08-08 09:57:23.154895500 DEBUG:SerialBattery:Polling data took 0.735 seconds
2024-08-08 09:57:24.145617500 ERROR:SerialBattery:Non blocking exception occurred: TypeError("unsupported operand type(s) for -: 'NoneType' and 'float'") of type <class 'TypeError'> in /opt/victronenergy/dbus-serialbattery/battery.py line #634
2024-08-08 09:57:24.147680500 DEBUG:SerialBattery:current: -0.7576203181536509 - current_external: None
2024-08-08 09:57:24.152189500 DEBUG:SerialBattery:current: -0.7576203181536509 - current_external: None
2024-08-08 09:57:24.152200500 DEBUG:SerialBattery:current: -0.7576203181536509 - current_external: None
2024-08-08 09:57:24.152204500 DEBUG:SerialBattery:current: -0.7576203181536509 - current_external: None
2024-08-08 09:57:24.152208500 DEBUG:SerialBattery:current: -0.7576203181536509 - current_external: None
2024-08-08 09:57:24.179045500 DEBUG:SerialBattery:current: -0.7576203181536509 - current_external: None
2024-08-08 09:57:24.182722500 DEBUG:SerialBattery:current: -0.7576203181536509 - current_external: None
2024-08-08 09:57:24.184162500 DEBUG:SerialBattery:logged to dbus [98.7]
mr-manuel commented 3 months ago

@RickD880 this error tells only, that there are errors in the logs. Please open a new issue and compile all needed informations.