pulquero / DCSystemAggregator

Victron Venus D-bus service
MIT License
3 stars 0 forks source link

Aggregator with bus-serialbattery #1

Open seamaster101 opened 1 year ago

seamaster101 commented 1 year ago

I have JK-BMS with bus serial battery install. At the moment I'm testing on the bench with single BMS which data (battery voltage, current, temperature, etc) I can see on the Venus OS (running on RPI4) screen. I installed DCSystemAggregator hoping that i can see the combined values of multiple batteries that are connected in parallel in the same bank but equipped with their own BMS each. With one battery and BMS installed i don't see the aggregator showing me voltage of the battery. Is that how it suppose to work? does it expect to see multiple BMSs sending voltage and only then displaying the average?

pulquero commented 1 year ago

Currently, it registers a 'dcsystem' device that aggregates devices that report themselves as 'dcloads' or 'dcsources'. I suspect your bms' report as type 'battery'. I might be able to extend it to include batteries, though the bigger issue is how to represent the aggregated batteries to Venus. Can you include some screenshots of dbus-spy, so I can see how these bms' appear in Venus?

seamaster101 commented 1 year ago

Thank you, I will do that with pleasure, but excuse my ignorance - how do I install/run bus-spy?

pulquero commented 1 year ago

Log in to your Pi using ssh (https://www.victronenergy.com/live/ccgx:root_access), and run 'dbus-spy'.

seamaster101 commented 1 year ago

Here is what I got:

Alarms/CellImbalance 0 Alarms/HighCellVoltage - Alarms/HighChargeCurrent 0 Alarms/HighChargeTemperature 0 Alarms/HighDischargeCurrent 0 Alarms/HighTemperature 0 Alarms/HighVoltage 0 Alarms/InternalFailure - Alarms/LowCellVoltage 0 Alarms/LowChargeTemperature 0 Alarms/LowSoc 0 Alarms/LowTemperature 0 Alarms/LowVoltage 0 Balances/Cell1 0 Balances/Cell2 0 Balances/Cell3 0 Balances/Cell4 0 Balancing 0 Capacity 37.2 Connected 1 ConsumedAmphours 2.8 CustomName SerialBattery(Jkbms) Dc/0/Current 0 Dc/0/MidVoltage - Dc/0/MidVoltageDeviation - Dc/0/Power 0 Dc/0/Temperature 22 Dc/0/Voltage 13.32 DeviceInstance 1 FirmwareVersion 0.14.3 HardwareVersion JKBMS 4 cells Info/BatteryLowVoltage 11.6 Info/MaxChargeCurrent 25 Info/MaxChargeVoltage 13.8 Info/MaxDischargeCurrent 60 InstalledCapacity 40 Io/AllowToCharge 1 Io/AllowToDischarge 1 Mgmt/Connection Serial /dev/ttyUSB0 Mgmt/ProcessName /opt/victronenergy/dbus-serialbattery/dbushelper.py Mgmt/ProcessVersion Python 3.8.13 ProductId 0 ProductName SerialBattery(Jkbms) Soc 93 System/MaxCellTemperature 22 System/MaxCellVoltage 3.423 System/MaxVoltageCellId C4 System/MinCellTemperature 22 System/MinCellVoltage 3.172 System/MinVoltageCellId C2 System/NrOfCellsPerBattery 4 System/NrOfModulesBlockingCharge 0 System/NrOfModulesBlockingDischarge 0 System/NrOfModulesOffline 0 System/NrOfModulesOnline 1 Voltages/Cell1 3.409 Voltages/Cell2 3.172 Voltages/Cell3 3.317 Voltages/Cell4 3.423 Voltages/Diff 0.251 Voltages/Sum 13.321

pulquero commented 1 year ago

Thanks, and what's the dbus address on the main screen?

seamaster101 commented 1 year ago

I guess you will probably have to apply similar logic that you have in the current aggregator:- average all reporting BMSs voltages, add all BMSs currents, "cell differential in the battery" and possible another field "cell differential in the bank"

seamaster101 commented 1 year ago

com.victronenergy.battery.ttyUSB0

image
pulquero commented 1 year ago

Thanks, I think you need to see what happens with 2 batteries connected. I believe there is/will appear a setting in the venus UI to select which battery to use. If this is the case, then I can write a battery aggregator.

seamaster101 commented 1 year ago

Actually with 2 batteries connected, the second one will be reporting on com.victronenergy.battery.ttyUSB1 so both will be displayed. I don't have multiple battery setup at the moment and it is little cumbersome to setup on the desk for testing, but I believe the bus-serialbattery will display them both

pulquero commented 1 year ago

OK, I'll see what I can put together.

pulquero commented 1 year ago

Please checkout https://github.com/pulquero/BatteryAggregator.

seamaster101 commented 1 year ago

How do I install it? it does not show up in SetupHelper. When I manually added it it does not find it

On Jan 30, 2023, at 6:16 AM, pulquero @.***> wrote:

Please checkout https://github.com/pulquero/BatteryAggregator https://github.com/pulquero/BatteryAggregator.

— Reply to this email directly, view it on GitHub https://github.com/pulquero/DCSystemAggregator/issues/1#issuecomment-1408701169, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4H7P54ZIKKTBOYLWUXNP3WU7EMDANCNFSM6AAAAAAUKOQWYY. You are receiving this because you authored the thread.

pulquero commented 1 year ago

sry, forgot the 'latest' tag. Try it again.

seamaster101 commented 1 year ago

Still couldn’t do it:

It appears does not find it. No version shows available on GitHub field. Also if I try to add the tag when I’m. describing it in Inactive packages in SetupHelper, the tag is to long to fit in the field and gets truncated, therefore i need to enter the branch name BatteryAggregator. What am I doing wrong?

On Jan 30, 2023, at 9:59 AM, pulquero @.***> wrote:

sry, forgot the 'latest' tag. Try it again.

— Reply to this email directly, view it on GitHub https://github.com/pulquero/DCSystemAggregator/issues/1#issuecomment-1409071705, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4H7PZ7QNARDKNLP66XYC3WU76RVANCNFSM6AAAAAAUKOQWYY. You are receiving this because you authored the thread.

pulquero commented 1 year ago

Another option is to look in /data/SetupHelper and modify defaultPackageList, eg: https://github.com/pulquero/SetupHelper/blob/main/defaultPackageList.

seamaster101 commented 1 year ago

This did it. I successfully installed it and it shows values as expected. Thank you very much! this is Awesome! Some observations from quick testing: I thought I will be able to select the BatteryAggregator to be my Battery Monitor, but it does not show up on the list. instead I still see the data from the BMS there

But i see it on this page:

Also i noted the aggregator is not available as an option to select to use in the VRM

I will keep testing and reporting if you don't mind. I’m waiting for some connectors to come from Aliexpress to be able to connect to the BMSs and then I will try with multiple BMS and report the results

Jordan

On Jan 30, 2023, at 10:24 AM, pulquero @.***> wrote:

Another option is to look in /data/SetupHelper and modify defaultPackageList, eg: https://github.com/pulquero/SetupHelper/blob/main/defaultPackageList https://github.com/pulquero/SetupHelper/blob/main/defaultPackageList.

— Reply to this email directly, view it on GitHub https://github.com/pulquero/DCSystemAggregator/issues/1#issuecomment-1409108675, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4H7P4VVEVYXELH4CDL7FLWVABMVANCNFSM6AAAAAAUKOQWYY. You are receiving this because you authored the thread.

pulquero commented 1 year ago

Sure, and if you want any extra aggregated values adding, let me know. It might not be available, because I'm missing some key value. I'll dig deeper, too.

pulquero commented 1 year ago

Being able to select the aggregator should now work (v1.1).

seamaster101 commented 1 year ago

I did new install on docent RPI for testing. it installed ok after in /data/SetupHelper I modified defaultPackageList

but for some reason it is not picking up the values from SerialBattery(jkbms) did i miss some step in the setup?

Jordan

On Jan 31, 2023, at 9:59 AM, pulquero @.***> wrote:

Being able to select the aggregator should now work (v1.1).

— Reply to this email directly, view it on GitHub https://github.com/pulquero/DCSystemAggregator/issues/1#issuecomment-1410827838, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4H7P6L2EEMYXHAV5BMFO3WVFHIPANCNFSM6AAAAAAUKOQWYY. You are receiving this because you authored the thread.

pulquero commented 1 year ago

Run "cat /var/log/BatteryAggregator/current" to check for errors in the log. Also, try reinstalling it from the command line "/data/BatteryAggregator/setup".

seamaster101 commented 1 year ago

@4000000063dc1112353383b4 BatteryAggregator/setup: installing BatteryAggregator service - please wait @4000000063dc111c22fa5a74 INFO:root:registered ourselves on D-Bus as com.victronenergy.battery.aggregator @4000000063dc111c24f8f164 INFO:dbusmonitor:===== Search on dbus for services that we will monitor starting... ===== @4000000063dc111c254e607c INFO:dbusmonitor:Found: com.victronenergy.battery.ttyUSB0, scanning and storing items @4000000063dc111c25813fec INFO:dbusmonitor: com.victronenergy.battery.ttyUSB0 has device instance 1 @4000000063dc111c2688e034 INFO:dbusmonitor:===== Search on dbus for services that we will monitor finished ===== @4000000063dc111c269f236c INFO:battery:Registered Battery Aggregator @4000000063dc111c35d31f14 Traceback (most recent call last): @4000000063dc111c35d33a6c File "/data/BatteryAggregator/battery_service.py", line 217, in publish @4000000063dc111c35d34a0c self.update() @4000000063dc111c35d351dc File "/data/BatteryAggregator/battery_service.py", line 183, in update @4000000063dc111c35d3617c maxLowVoltage = _safe_max(maxLowVoltage, lowVoltage) @4000000063dc111c35d3711c File "/data/BatteryAggregator/battery_service.py", line 70, in _safe_max @4000000063dc111c35d384a4 return max(newValue, currentValue) if currentValue else newValue @4000000063dc111c35d4f3d4 TypeError: '>' not supported between instances of 'float' and 'NoneType' @4000000063dc111c3b45e1ac BatteryAggregator/setup: adding BatteryAggregator/setup to reinstallScriptsList @4000000063dc111d0407de34 BatteryAggregator/setup: completed @.***:~#

On Feb 2, 2023, at 7:48 AM, pulquero @.***> wrote:

Run "cat /var/log/BatteryAggregator/current" to check for errors in the log. Also, try reinstalling it from the command line "/data/BatteryAggregator/setup".

— Reply to this email directly, view it on GitHub https://github.com/pulquero/DCSystemAggregator/issues/1#issuecomment-1413956928, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4H7P7DAMLZPIIA5KEYSBDWVPJM7ANCNFSM6AAAAAAUKOQWYY. You are receiving this because you authored the thread.

seamaster101 commented 1 year ago

Device is reading one BMS but aggregatebattery shows 0. Also the Autoselect picks up aggregator now automatically not the BMS as it use to do before. This is actually good if aggregator was reading correct, but at the moment it appears to have some issue

here is the log: @4000000063dc1112353383b4 BatteryAggregator/setup: installing BatteryAggregator service - please wait @4000000063dc111c22fa5a74 INFO:root:registered ourselves on D-Bus as com.victronenergy.battery.aggregator @4000000063dc111c24f8f164 INFO:dbusmonitor:===== Search on dbus for services that we will monitor starting... ===== @4000000063dc111c254e607c INFO:dbusmonitor:Found: com.victronenergy.battery.ttyUSB0, scanning and storing items @4000000063dc111c25813fec INFO:dbusmonitor: com.victronenergy.battery.ttyUSB0 has device instance 1 @4000000063dc111c2688e034 INFO:dbusmonitor:===== Search on dbus for services that we will monitor finished ===== @4000000063dc111c269f236c INFO:battery:Registered Battery Aggregator @4000000063dc111c35d31f14 Traceback (most recent call last): @4000000063dc111c35d33a6c File "/data/BatteryAggregator/battery_service.py", line 217, in publish @4000000063dc111c35d34a0c self.update() @4000000063dc111c35d351dc File "/data/BatteryAggregator/battery_service.py", line 183, in update @4000000063dc111c35d3617c maxLowVoltage = _safe_max(maxLowVoltage, lowVoltage) @4000000063dc111c35d3711c File "/data/BatteryAggregator/battery_service.py", line 70, in _safe_max @4000000063dc111c35d384a4 return max(newValue, currentValue) if currentValue else newValue @4000000063dc111c35d4f3d4 TypeError: '>' not supported between instances of 'float' and 'NoneType' @4000000063dc111c3b45e1ac BatteryAggregator/setup: adding BatteryAggregator/setup to reinstallScriptsList @4000000063dc111d0407de34 BatteryAggregator/setup: completed @.***:~# reboot

On Feb 2, 2023, at 7:48 AM, pulquero @.***> wrote:

Run "cat /var/log/BatteryAggregator/current" to check for errors in the log. Also, try reinstalling it from the command line "/data/BatteryAggregator/setup".

— Reply to this email directly, view it on GitHub https://github.com/pulquero/DCSystemAggregator/issues/1#issuecomment-1413956928, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4H7P7DAMLZPIIA5KEYSBDWVPJM7ANCNFSM6AAAAAAUKOQWYY. You are receiving this because you authored the thread.

pulquero commented 1 year ago

Thanks, fixed, v1.2.

seamaster101 commented 1 year ago

Thank you I will test tonight and reportJordanOn Feb 2, 2023, at 16:32, pulquero @.***> wrote: Thanks, fixed, v1.2.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

seamaster101 commented 1 year ago

Unfortunately the i tried too install it says “incompatible” and there is no install button

On Feb 2, 2023, at 4:32 PM, pulquero @.***> wrote:

Thanks, fixed, v1.2.

— Reply to this email directly, view it on GitHub https://github.com/pulquero/DCSystemAggregator/issues/1#issuecomment-1414552268, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4H7P5XLZBYXBU7XWFG6BTWVRG2BANCNFSM6AAAAAAUKOQWYY. You are receiving this because you authored the thread.

pulquero commented 1 year ago

Not sure why that would suddenly happen. Try running setup from the command line: "/data/BatteryAggregator/setup".

seamaster101 commented 1 year ago

Yes That works now!

thank you! this is great!

On Feb 3, 2023, at 5:44 AM, pulquero @.***> wrote:

Not sure why that would suddenly happen. Try running setup from the command line: "/data/BatteryAggregator/setup".

— Reply to this email directly, view it on GitHub https://github.com/pulquero/DCSystemAggregator/issues/1#issuecomment-1415888173, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4H7P2XGGMEMAACMMSRU63WVUDSNANCNFSM6AAAAAAUKOQWYY. You are receiving this because you authored the thread.

seamaster101 commented 1 year ago

Hi,I just updated DCBatteryAggregator to the latest version from the initial version I had. It was working with the initial version (1.0) and stopped working after the update. Can you please look at the possible issue? I’m running venusOS RPI large version v3.00~37JordanOn Feb 3, 2023, at 05:44, pulquero @.***> wrote: Not sure why that would suddenly happen. Try running setup from the command line: "/data/BatteryAggregator/setup".

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

pulquero commented 1 year ago

Certainly, please attach the contents of the log.

seamaster101 commented 1 year ago

Where do I find the log? I’m logged in and looking into data/batteryaggregator but don’t see log file thereJordanOn May 4, 2023, at 13:19, pulquero @.***> wrote: Reopened #1.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

pulquero commented 1 year ago

/var/log/BatteryAggregator/current

seamaster101 commented 1 year ago

Here it @. INFO:root:registered ourselves on D-Bus as @. INFO:dbusmonitor:===== Search on dbus for services that we will monitor starting... @. INFO:dbusmonitor:Found: com.victronenergy.battery.aggregator, scanning and storing @. INFO:dbusmonitor:       com.victronenergy.battery.aggregator was skipped because it has no device @. INFO:dbusmonitor:===== Search on dbus for services that we will monitor finished @. INFO:battery:Registered Battery @. Traceback (most recent call @.   File "/data/BatteryAggregator/battery_service.py", line 148, in @.     @.   File "/data/BatteryAggregator/battery_service.py", line 144, in @.     self._local_values[alarm] = @. KeyError: @. INFO:dbusmonitor:Found: com.victronenergy.battery.ttyUSB0, scanning and storing @. INFO:dbusmonitor:       com.victronenergy.battery.ttyUSB0 has device instance @. BatteryAggregator/setup: ++ Installing Battery Aggregator @. BatteryAggregator/setup: ++ Install Python library velib_python (master) from https://github.com/pulquero/velib_python into @. BatteryAggregator/setup: restarting BatteryAggregator @. BatteryAggregator/setup: completedJordanOn May 4, 2023, at 14:18, pulquero @.***> wrote: /var/log/BatteryAggregator/current

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

seamaster101 commented 1 year ago

Actually I noticed that you reopen the issue for the DCSystemAggregator. The issue is for BatteryAggregator not for DCSystemAggregator. For first time now I connected 2 BMSs. It will be good to try the aggregation parameters. I’m available for the next 3-4 hour to do some testing if you give me some instructions. JordanOn May 4, 2023, at 13:19, pulquero @.***> wrote: Reopened #1.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

seamaster101 commented 1 year ago

![Uploading image.jpg…]()

seamaster101 commented 1 year ago

I have a good news! I don’t know what happen (no changes were made anywhere) and after number of reboots it stated to display values and appears to work now! I have 2 x JKBMS connected. It is displaying some of the parameters but not others. I wonder if this is shortcomings in the SerialBattery implementation. I’m most interested to see the possible alarms raised by the BMS being reported e.g. cell voltage more than x, cell voltage less than x, cell delta more than x etc. Is that something you can give me some instructions how to setup?JordanOn May 4, 2023, at 14:18, pulquero @.***> wrote: /var/log/BatteryAggregator/current

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

pulquero commented 1 year ago

Looks like it upgraded to a newer version. To see all the parameters, run dbus-spy, and attach a screenshot for the BMSes. I can then try to add them to the aggregator.