Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculation of the SOC based on coloumb-counting #868

Merged
merged 17 commits into from
Dec 23, 2023

Conversation

cflenker
Copy link
Contributor

SOC is calculated by integrating the current that flows in and out the battery.
The advantage of doing this in the driver is the ability to define the reset-conditions (current, voltage, debouncing-time).
This solves especially the problem of the famous jkbms that only resets the soc when you reach OVP (and the BMS switches off the charging-fets).

@mr-manuel
Copy link
Collaborator

Please do not merge with the master branch. You have to merge with the dev branch.

@mr-manuel mr-manuel changed the base branch from master to dev November 20, 2023 22:10
@mr-manuel
Copy link
Collaborator

I changed it, please update your branch to be up do date with the dev branch.

@cflenker
Copy link
Contributor Author

Dear @mr-manuel,
Thank you very much for your reply! I will update the branch to be up to date with the dev-Branch.

@gurkc006
Copy link

gurkc006 commented Nov 21, 2023

I just had the same idea today and glad to find the "solution" here in the pull requests. Perfect. I would like to test this new feature, if it is ready for testing. I have also a small request: My JKBMS seems to have a small offset in current measurement. Over time, my SOC gets lower and lower (by around 2-3% per day). In summer this is no problem, because it resets every day, but now my SOC drifts down over time. It would be nice, if in calculation of SOC it would be possible do correct for such an offset in the settings of the calculation (maybe offset and span). Thanks.

@gurkc006
Copy link

Maybe also a topic here: Wouldn't it be possible to calc a current-corrected cell voltage for supporting estimation of SOC? What I mean: Has someone tried to assume an internal resistance of cables/cells and correct cell voltage with actual current flowing. This should give a quite smooth cell voltage which is not (or much less) affected by current flowing. It also would be possible to "learn" the internal resistance of a system using the current flucuations at different SOC to get better information, what SOC is. Do you get the idea?

@cflenker
Copy link
Contributor Author

cflenker commented Nov 21, 2023

Hello @gurkc006,
I had the same issue. The current measurement of the JKBMS was about 5-8% higher than the measurement of the victron smartshunt. I doublechecked it with a clamp meter and it seems that the current of the smartshunt was quite correct and the jkbms was too high.
But there is a possibility to calibrate the current-measurement of the BMS in the jkbms-app. I just tried this and now smartshunt and bms seem to be much closer together.
I posted a picture of a day of soc measurement of the smartshunt and the bms-driver in this thread:
#869
Accordingly to the higher current measurement of the bms the soc of the bms drops faster than the soc of the smartshunt.
Let's wait if the SOC stays closer together now after the calibration of the bms.
If this works, we can perhaps do without an additional correction in the driver.
I assume, that the correction in the bms is only a factor on the measurement as the calibration can be done at a single operation point.

@gurkc006
Copy link

Hi cflenker,
thanks for your input. I already did a calibration right at the beginning when top balancing my battery for the very first time, because I had steady charge current from lab power supply. Now on the Multiplus II it's rather difficult to perform good calibration because current from or to battery is very unstable. Also I suspect, that I don't need a span calibration rather then an offset calibration and this is not possible with JKBMS app as far as I know. I see it, if my Multiplus is in idle, JKBMS thinks to see a small current flowing out of battery (around maybe 1 A). But that's 50 W... So over time this adds up. So for me it would be nice to see, if a offset/span calibration in the driver would lead to a better SOC calculation. But of course, if it's not necessary for many people I can understand, that you won't implement it in the driver. Maybe I try to fork for myself and try. But I never used github, so I hoped I can "attach" to guys like you, who are already doing gihub stuff :-) Thanks a lot

@cflenker
Copy link
Contributor Author

Hi @gurkc006,
I recorded the current values of the victron bms and the jkbms for about 24h. Each point is the average of 30s.
Here is the result:
image
Based on the regression-line the jkbms is about 3.7% too high.
The bigger problem is the big deviation at low discharging values (-6...0A). Here the jkbms shows much higher values.
That's typical the current that is consumed during the night (0...300W).
I trust the victron smartshunt much more than the jkbms.
But if you implement a correction curve: I wonder who does the effort to measure out the curve.

@mr-manuel
Copy link
Collaborator

And the question is, if the curve is the same for all... I have measured the base load on my system and then calibrated the JKBMS on the base load that matches 16 of 24 hours of the day

@gurkc006
Copy link

Hi cflenker!
That's a great plot. And I would definitly try to produce such a plut for my setup. Maybe then we learn something, if it looks the same or not. Problem is, I have no Smartshunt... At the moment I only have a Fluke clamp current meter without serial interface, so I have to take value manually. But the good thing: In the morning I can have only my 4 MPPTs loading the battery starting from 0A to around 20A when sun is shining - so not at the moment :-( - and I can then take very undisturbed calibration points. Maybe I also can use the wires from battery to first junction to measre voltage drop and calibrate this with the fluke. So then I can use a normal good multimeter to log much more points. This will take some days, but I will definitly do this to see, if I can correct for this offset problem. I think, it would be best, if I just can define a pair of values to produce a calibration curve, so the serialbattery-driver can just linear interpolate between these point-pairs to correct the JKBMS curent values.
Thanks a alot for your work! Great!

@gurkc006
Copy link

gurkc006 commented Nov 24, 2023

This morning I just had the chance to take some values manually. So here are my results from loading my battery with MPPT this morgning:
jkbms_calib1
As you can see, all points are on a good line. I thought about your data cflenker, and the "problem" is not the slope of your fit, because this should neutralize over time. So if JKBMS sees too high currents for charging and discharging, if you sum up all your (a little bit to high) positive and negative numbers, should still give 0 over time. But the offset of -0.25A is there all the time, so you should have also a drift down to lower values, because JKBMS has this offset for ALL values. And this results to a virtual self discharge rate of around 0.25A*24h = 6Ah/d = 2.1% per day (for a 280Ah battery).
For me this offset is around 0.32A*24h = 2.7% per day (for a 280Ah battery). This fits quite well with the numbers I see, if I don't charge my battery full ervery day. So potentially adding this offset to ALL current values coming from JKBMS should compensate for this offest and the virtual self discharge should be gone.
Will try to make some more measurements on sunday also for discharging the battery. Have a nice weekend.

@cflenker
Copy link
Contributor Author

Thank you very much for your measurements! Your measurements fit very good to a straight line. That's the right way to do it. My measurements have been taken normal operation and this is a very unsteady state. Your measurement quality seems to be much better.
Your conclusion, that the offset of the regression-curve (0.25A oder 0.32A) leads to soc-loss per day is only valid if all points fit to a straight line. In your measurement this seems to be the case.
In my measurement it seems that the low current points are relativly too high.
Anyway - for the first look it seems to be sensible to do a slope+offset-correction.
The only point is, that if I disconnect the battery the jkbms shows 0 Amps. WIth the correction it would show 0.25A.

@cflenker
Copy link
Contributor Author

I just added the option to make a current correction with offset and factor.
@gurkc006: If you want to try it, you can install this pre-release from my fork of the repo:
https://github.com/cflenker/dbus-serialbattery/releases/tag/v1.0.20231117dev_chfl231124

@cflenker
Copy link
Contributor Author

The more I think about it, it would perhaps be better to make a separate scaling factor for positiv (charging) and negativ (discharging) current.
That would ensure, that 0A will stay 0A.

@cflenker
Copy link
Contributor Author

cflenker commented Nov 25, 2023

I installed the driver on a friend's system. Here are the results of the last week. I installed the driver with coloumb-counting at late evening of 11/22:
image
I had no correction of the current applied.
For investigation-reasons I had no [0...100]-limitation of the soc.

@gurkc006
Copy link

I will install your driver tomorrow, when I'm at home again. Personally I would prefer a table solution for the correction. Something like in the other tables in the driver:
I_JKBMS = -20, -10, -1, 0, 1, 5, 10, 25, 70
I_ref = -19.75, -9.75, -0.75, 0.25, 1.25, 5.25,10.25, 25.25, 70.25
Then just linear interpolate between the values and use the last slope for bigger values than in the table. That would be the most flexible solution and maye it's also the easiest, because you don't have to caluclato gain and offset. Just take measurements at different currents and put it into table. What do you think?

@cflenker
Copy link
Contributor Author

cflenker commented Nov 25, 2023

I agree. That would be the most flexible solution. But I would never calibrate it with someting else than 0Amps at 0Amps. When the Battery is disconnected the JKBMS measures 0Amps. And I would not want the driver to calculate a rising SOC over time when the battery is disconnected.
I will have a look how the interpolation can be done.
@mr-manuel: What do you think about that? Would you agree to spend the computing-time for that?

@cflenker
Copy link
Contributor Author

cflenker commented Nov 25, 2023

I think it is a known fact, that the capacity of a battery depends on the discharge rate. This effect is much smaller at lifepo4 than at lead-batteries, but it is also present. It is called the peukert-exponent.
The smartshunt takes this into account (I calibrated it to 1.01). Theoretical it would be able to calibrate this effect into the correction-curve, but you can't do this with plain current-measurement.
Maybe we should think about taking this into account in a future version. (I did not completely understand how to take Peukert into account during charging).

This would explain, why the driver-soc ends up to low at low discharging current (yesterday) and quite correct at high discharging current (today).

@mr-manuel
Copy link
Collaborator

The correction with a table should be the simplest one for the end users. So they can measure the current at different values and compare the value with the BMS provided.

Most of them does not have even a current measurement tool. We try to keep it as simple as possible for the user. The question is also, how does this work, if you have multiple batteries? Is this very CPU intensive? Will a weak GX device also be able to handle that?

@cflenker
Copy link
Contributor Author

cflenker commented Nov 25, 2023

Thank you @mr-manuel for your quick reply.
I will make a proposal for that. I would use the utils.calcLinearRelationship-Function.
And I would set the default of the look-up as short as possible:
SOC_CALC_CURRENT_MEASURED = -300, 300
SOC_CALC_CURRENT_REAL = -300, 300
It is calculated every second for the jkbms.
For my understanding it is calculated for every battery separately.

@gurkc006
Copy link

You can make it disabled as default so only users who want to use this feature can enable it in the ini- file?! Should be no problem as it's only maybe once per second to calculate the correction.

@cflenker
Copy link
Contributor Author

I made a "prerelease" last night: https://github.com/cflenker/dbus-serialbattery/releases/tag/v1.0.20231117dev_chfl231125c
This is based on the official dev-branch from 17.11.2023.
It includes the latest "Calculation of the SOC based on coloumb-counting"-Feature and an alternative method for dynamic CVL I am just working on. Both are switched of by default.

I am just doing a few tests on my system with this v1.0.20231117dev_chfl231125c.

My configuration concerning soc_calc is the following:

SOC_CALCULATION = True
SOC_RESET_CURRENT = 7
SOC_RESET_TIME = 60
SOC_CALC_CURRENT_CORRECTION = True
SOC_CALC_CURRENT_MEASURED = -300.0, 300.0
SOC_CALC_CURRENT_REAL = -289.0, 289.0
SOC_CALC_INIT_VALUE = 25.0

@mr-manuel
Copy link
Collaborator

Until the merge you can use https://github.com/cflenker/dbus-serialbattery/tree/cflenker/soccalc

@gurkc006
Copy link

gurkc006 commented Dec 6, 2023

Installed this version two days ago, had a litle trouble with the installation because I didn't find a way to get the proper venus-data.tar.gz file. Had to build one on my own, but finally it seemed to work. Driver is running now, but nearly no sunlight at all in these days in germany... So only very little variation in SOC as my battery rests on 60% at the moment. Thanks for the great work!

@mr-manuel
Copy link
Collaborator

Did anyone track the CPU usage before and after this commit? That would be interesting.

@gurkc006
Copy link

How do I check? htop? Nothing to see. But haven't checked before.

@mr-manuel
Copy link
Collaborator

If you have an InfluxDB and Grafana you can run Telegraf with this version and the normal version.

@mr-manuel mr-manuel merged commit 1500b1b into Louisvdw:dev Dec 23, 2023
Comment on lines +177 to +182
if "SocCalc" in value:
self.battery.soc_calc = float(value["SocCalc"])
logger.info(f"Soc_calc read from dbus: {int(self.battery.soc_calc)}")
else:
logger.info(f"Soc_calc not found in dbus")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a check before this lines get executed:

                    # load SOC from dbus only if SOC_CALCULATION is enabled
                    if utils.SOC_CALCULATION:
                        if "SocCalc" in value:
                            self.battery.soc_calc = float(value["SocCalc"])
                            logger.info(
                                f"Soc_calc read from dbus: {int(self.battery.soc_calc)}"
                            )
                        else:
                            logger.info("Soc_calc not found in dbus")

@mr-manuel
Copy link
Collaborator

@cflenker relooking at the values after a bit of time the naming is a somehow not very clear.

SOC_CALC_CURRENT_MEASURED is this the value measured by the user or by the BMS?
SOC_CALC_CURRENT_REAL is this the real value from the BMS or the value measured by the user?

I will rename
SOC_CALC_CURRENT_MEASURED to SOC_CALC_CURRENT_REPORTED_BY_BMS
and
SOC_CALC_CURRENT_REAL to SOC_CALC_CURRENT_MEASURED_BY_USER
after you confirm me, that this is correct.

@cflenker
Copy link
Contributor Author

Hello @mr-manuel , that is correct. Your proposal is perfect an very clear! Thank you!

@cflenker
Copy link
Contributor Author

Thanks a lot for merging this PR!

@mr-manuel
Copy link
Collaborator

mr-manuel commented Dec 23, 2023

I tested the changes a bit further and made some little improvements. One thing is that you are currently saving the SocCalc as int to the dbus on change. Since you are calculating the SocCalc from self.soc_calc_capacity_remain would it maybe make more sense to save this value to the dbus instead? The bigger the battery is the more inaccurate the soc is.

Regardless of this, I changed the code in order that the soc has two decimals, so there is a smoother graph.

grafik

@cflenker
Copy link
Contributor Author

Ohh, I did not know that you are reading the soc directly from the dbus. Then integer is surely not precise enough. I thought dbus is only to preserve the soc for a reset. Please feel free to change whatever you want. You are much experienced than I am with the driver. Thank you very much for your enhancements!

@mr-manuel
Copy link
Collaborator

I merged my changes. I would be glad, if you could also test the current nightly of the dev branch.

@cflenker
Copy link
Contributor Author

I have some problems with the nightly. Please see #898

@mr-manuel
Copy link
Collaborator

@cflenker have you an idea how we could best add a method to reset also the SOC to 0%? Now one cell in my system reached 2.700 V, the SOC is 9 % and DCL is below 0.1 A.

@cflenker
Copy link
Contributor Author

cflenker commented Feb 1, 2024

@mr-manuel : calibrating the soc at 0% is not very common. Most of the bms and also the smartshunt does not do this (afaik). But I do not see a reason why not. The reset should only be done if the lowerst cell drops below a voltage limit at low current for a certain time. If you want me to make a proposal, just tell me. But I am on a business-trip till the end of next week.

@mr-manuel
Copy link
Collaborator

The new JKBMS do this and the smartshunt does not see the cell voltages.

The reset should only be done if the lowerst cell drops below a voltage limit at low current for a certain time.

What if my battery is nearly depleeted and then a bigger load turns on and the whole system crashes because the BMS disconnect the battery? In this case I don't think that it has to be at this voltage for a certain amount of time. Once reached lowest disconnect voltage then it should be se to 0 %. Another thing would be, if you are using a voltage above the BMS under voltage protection. What would be the better value to use in your opinion?
On electric cars the 0% SOC is always above the BMS disconnect voltage from what I know.

@Vitalic66
Copy link

Hi, thanks for your work, just installed dev driver, because I also have big differences between Victron shunt SOC an JK SOC. Thinking about this solution, might give it a try. But why do you use -300,0,0,300? My JK can only handle up to 200A.

Another idea, isn‘t it possible to use the SOC meassured and calculated from the Smartshunt instead? So if it is allready installed why not using this SOC directly?

So using the charge and discharge logic from the driver with the SOC reported from the Victron smartshunt.

@Honusnap
Copy link

Honusnap commented Feb 7, 2024

The new JKBMS do this and the smartshunt does not see the cell voltages.

The reset should only be done if the lowerst cell drops below a voltage limit at low current for a certain time.

What if my battery is nearly depleeted and then a bigger load turns on and the whole system crashes because the BMS disconnect the battery? In this case I don't think that it has to be at this voltage for a certain amount of time. Once reached lowest disconnect voltage then it should be se to 0 %. Another thing would be, if you are using a voltage above the BMS under voltage protection. What would be the better value to use in your opinion? On electric cars the 0% SOC is always above the BMS disconnect voltage from what I know.

You can't really set the "0% SOC" on a cell reaching a minimum voltage setting, as you said a high load at 5% SOC could maybe let the weakest cell drop under this voltage and set the SOC to 0%. Maybe a combination of total battery voltage and current, like 45V and under one Amp. => We are at 0% SOC usable.
Like you said, we... at least most people, will use their battery in a safe zone, i'm using mine between 10% and 95% REAL SOC. Now, to reset the coulomb counting we need to reach those limits( 10% and 95% REAL SOC), a 10kWh battery would then only have 85% usefull capacity (in my case) and those 85% are now the 0%-100% displayed SOC.

lifepo4-voltage-chart 1

@Honusnap
Copy link

Honusnap commented Feb 10, 2024

@mr-manuel : calibrating the soc at 0% is not very common. Most of the bms and also the smartshunt does not do this (afaik). But I do not see a reason why not. The reset should only be done if the lowerst cell drops below a voltage limit at low current for a certain time. If you want me to make a proposal, just tell me. But I am on a business-trip till the end of next week.

In your config.ini there are 2 values... is this config valid : (stock unmeasured device)

SOC_CALC_CURRENT_MEASURED = -200, -100, -50, -25, -10, -5, 0, 5, 10, 25, 50, 100, 200
SOC_CALC_CURRENT_REAL = -200, -100, -50, -25, -10, -5, 0, 5, 10, 25, 50, 100, 200

Can we use decimal numbers : 0.5 ?

@mr-manuel
Copy link
Collaborator

Your config is valid for an example, but would make no sense for a real config.

Yes you can use decimal numbers, as you see in the config.default.ini:

; Example to set small currents to zero
; SOC_CALC_CURRENT_REPORTED_BY_BMS = -300, -0.5, 0.5, 300
; SOC_CALC_CURRENT_MEASURED_BY_USER = -300, 0, 0, 300

@Vitalic66
Copy link

So to have valid values we'd need a USB DC Amp data logger to have some values we can feed to the config.ini? Any good recommendations?

@Honusnap
Copy link

So to have valid values we'd need a USB DC Amp data logger to have some values we can feed to the config.ini? Any good recommendations?

I use values seen on the shunt, you can also use an hall effect current meter.

@Honusnap
Copy link

Honusnap commented Feb 13, 2024

Here is what i got after some experiments :
2024-02-13_102937

Also trying with that :

2024-02-13_185528

Louisvdw pushed a commit that referenced this pull request Feb 28, 2024
* fix Sinowealth not loading
#702

* fix unique identifier function

* enable BMS over config, if disabled by default
Now you can also add more then one BMS for BMS_TYPE

* show battery port in log

* ANT BMS fixes
Fixed that other devices are recognized as ANT BMS

* Sinowealth BMS fixes
Fixed that other devices are recognized as Sinowealth BMS

* improved publish_battery error handling
switched from error count to seconds

* Improve Battery Voltage Handling in Linear Absorption Mode

* Refactor change time() to int(time()) for consistency in max_voltage_start_time and tDiff calculation
* Refactor battery voltage calculations for efficiency and clarity
* Remove penalty_buffer
* Reset max_voltage_start_time wenn we going to bulk(dynamic) mode

* updated changelog

* fix reply processing

* Reduce the big inrush current, if the CVL jumps
from Bulk/Absorbtion to Float
fix #659

* Check returned data lenght for Seplos BMS

Be stricter about the return data we accept, might fix the problem of grid meters accidently being recognized as a Seplos

* Validate current, voltage, capacity and SoC for all BMS
This prevents that a device, which is no BMS, is detected as BMS

* removed double check

* bump version

* fix validation if None

* updated changelog

* proposal to #659 formatted :)

* bugfix proposal to #659

* refactor setting float charge_mode

* fix type error, removed bluetooth cronjob

* updated changelog

* fix rs485 write communication errors by inserting sleeps, add debug print for charge mode and fix crash on write soc failures

* fix write problem on set_soc. also changed the switch charge/discharge function, just in case

* debug msg

* Bluetooth optimizations

* Fixes by @peterohman
#505 (comment)

* fix #712

* fix meaningless time to go values

* fix meaningless time to go values

* Duration of transition to float depends on number of cells

* Float transition - Voltage drop per second

* Update hlpdatabms4s.py

* Validate setting of FLOAT_CELL_VOLTAGE and avoid misconfiguration

* consider utils.LINEAR_RECALCULATION_EVERY to refresh CVL

* cleanup

* consider utils.LINEAR_RECALCULATION_EVERY to refresh CVL

* small refactor, introduced set_cvl_linear function to set CVL only once every LINEAR_RECALCULATION_EVERY seconds

* fix typo

* updated changelog

* remove debug msg

* remove debug msg

* undo debug change

* Daly BMS make auto reset soc configurable

* added debug and error information for CVL

* fix proposal for #733 (#735)

* Added: Tollerance to enter float voltage once the timer is triggered

* Add bulk voltage
Load to bulk voltage every x days to reset the SoC to 100% for some BMS

* JKBMS disable high voltage warning on bulk
reenable after bulk was completed

* fixed error

* disable high voltage warning for all BMS
when charging to bulk voltage

* fix error and change default value
measurementToleranceVariation from 0.025 to 0.5 else in OffGrid mode max voltage is always kept

* Added temperature names to dbus/mqtt

* Use current avg of last 300 cycles for TTG & TTS

* Calculate only positive Time-to-SoC points

* added current average of last 5 minutes

* make CCL and DCL more clear

* fix small error

* bugfix: LLTJBD BMS SOC different in Xiaoxiang app and dbus-serialbattery

* black formatting

* JDB BMS - Control FETs for charge, discharge and disable / enable balancer (#761)

* feature: Allow to control charge / discharge FET
* feature: Allow to enable / disable balancer

* bugfix: Cycle Capacity is in 10 mAh

Fixes SoC with factor 100 * 100% percentage

* JBD BMS show balancer state in GUI page IO (#763)

* Bump version

* Fix typos

* Smaller fixes
- fixes #792 (comment)

* Removed comments from utils.py
This should make more clear that there are no values to change

* Updated changelog

* possible fix for LLT/JBS connection problems
#769
#777

* bugfix: LLT/JBD BMS general packet data size check

* improved reinstall and disable script

* LLT/JBD BMS - Improved error handling and automatical driver restart
in case of error. Should fix:
- #730
- #769
- #777

* Fixed Building wheel for dbus-fast won't finish on weak systems
Fixes #785

* Support for Daly CAN Bus (#169)

* support for Daly CAN Bus
* fix constructor args
* revert port, needs fix
* add can filters
* comment logger

Some changes are still needed to work with the latest version. They will follow in a next PR.

---------

Co-authored-by: Samuel Brucksch <[email protected]>
Co-authored-by: Manuel <[email protected]>

* JKBMS BLE - Introduction of automatic SOC reset (HW Version 11) (#736)

* Introduction of automatic SOC reset for JK BMS (HW Version 11)
* Fixed value mapping
* Rework of the code to make it simpler to use without additional configuration.
Moved execution of SOC reset. It's now executed while changing from "Float" to "Float Transition".
* Implementation of suggested changes
Persist initial BMS OVP and OVPR settings
Make use of max_cell_voltage to calculate trigger value for OVP alert

* Added: Daly CAN and JKBMS CAN

* added CAN bms to installation script
optimized CAN drivers

* smaller fixes

* Trigger JK BLE SOC reset when using Step Mode

* Moved trigger_soc_reset()

* fixes LLT/JBD SOC > 100%
#769

* changed VOLTAGE_DROP behaviour

* Fix JKBMS not starting if BMS manuf. date is empty

* corrected bulk, absorption and soc reset terms

* fix typo

* add JKBMS_BLE debugging data

* fix small error

* Some changes for lost bluetooth connection / hci_uart stack restart

* added logging to config

* add sleep before starting driver
prevents lot of timeouts after reinstalling the driver, since the restart is now much faster than before

* changed post install info

* fix error

* Daly BMS fixed embedded null byte
#837

* added info for SoC reset to default config file

* fix for #716
#716

* fix for #716 and JKBMS model recognition
#716

* optimized logging

* fix JKBMS recognition

* added debugging

* fixes #716
#716

* Bind device instance to unique_identifier
#718

* added data types to battery class
disabled unused variables

* save current charge state
#840

* correct file permissions

* updated changelog

* added periodic saveChargeDetails

* fix some small errors

* fix issue with ruuvi tags
When there are hundreds of unused ruuvi tags in the settings list that where added because thei where nearby the driver does not start correctly. These stale entries are disabled on the driver startup.
The issue was already filed to Victron developers

* CVL with i-controller instead of penaltysum

* cvl_controller: switch to choose PenaltySum or ICOntroller + documentation

* docu enhancement

* Add setting and install logic for usb bluetooth module

* round temperatures

* changed battery disconnect behaviour

* Fixes #891
#891

* updated changelog

* Add bluetooth device note to config.default.ini

* Fix typo in bluetooth note in config.default.ini

* fixed error in new cvl_controller

* fixed float division by zero and code optimization

* Restart MAX_VOLTAGE_TIME_SEC if cell diff > CELL_VOLTAGE_DIFF_KEEP_MAX_VOLTAGE_TIME_RESTART

* Calculation of the SOC based on coloumb-counting (#868)

* Calculation of the SOC in the driver based on coloumb-counting

* soc_calc: add current correction before integration

* soc_calc: correction map for current

* Soc_calc: CorrectionMap, switch to turn on/off correction, selectable initial value

* soc_calc: Bugfix

* soc_calc: Bugfix

* store soc in dbus for restart

* store soc in dbus for restart (formatted)

* store soc in dbus for restart (bugfix)

* save soc_calc only after change > 1.0

* store soc in dbus for restart (bugfix)

* logger does not work this way. do not know why

* writing and reading to dbus works

* Removed options: SOC_CALC_CURRENT_CORRECTION, SOC_CALC_RESET_VALUE_ON_RESTART, SOC_CALC_INIT_VALUE
sort soc_calc alphabetically

* fixed comments

* Updated changelog, small fixes

* Changed: PUBLISH_CONFIG_VALUES from 0/1 to True/False

* Changed: Code optimizations
- Changed some variables to be more clear
- Added comments for easier code understanding

* Calculated SOC: Added two decimals, added BMS SOC for MQTT & Node-RED

* Updated changelog, small fixes

* Changed: PUBLISH_CONFIG_VALUES from 0/1 to True/False

* Changed: Code optimizations
- Changed some variables to be more clear
- Added comments for easier code understanding

* Calculated SOC: Added two decimals, added BMS SOC for MQTT & Node-RED

* Fix #898
#898

* Changed: Fix issue loading settings from dbus

* Added nightly install option
makes it easier for users to pretest fixes

* Changed: more detailed error output when an exception happens

* Possible fix for #912
#912

* Fixes #919
#919

* Changed: Exit script with error, if port excluded
else the serialstarter stops at the dbus-serialbattery

* Fixed some smaller errors

* Updated pre-release workflow

* Fix JK BMS connection restart when bluetooth fails.

This fix installs a new thread to monitor the state of the original
scraping thread.
If scraping thread dies, it verifies that it did not because the
scraping was intentionally stopped by calling stop_scrapping.
When restarting the scrapper, it first calls the bluetooth
reset lambda function that was passed in the class contructor, such that
bluetooth is ready to make a proper connection.

* Fixes #916
#916

* Added Venus OS version to logfile

* Fix #840
#840

* Small code formatting fixes

* Optimized reinstall script. Restart GUI only on changes.

* Display debugging data in GUI when DEBUG enabled

* Install script now shows repositories and version numbers

* Update daly_can.py

Fixing #950 for DalyBMS

* Update jkbms_can.py

Fixing #950 for Jk BMS

* Fix black lint check

* Fixes #970
#970

* Fixed some errors in restoring values from dbus settings

* Moved sleep on start for all BMS

* Update config description

* Reworked a part of the default config

* fix typo in stopping services when reinstalling

* Fix Time-to-SoC and Time-to-Go calculation

* Add changelog info

* Round sum and diff voltage

* Temperature limitation variables where changed

* SoC limitation variables where changed

* Added error messages

* Remove unneeded code

* Reset SoC to 0% if empty

* Add GUIv2 for dbus-serialbattery

* Check free space before installing

* Added new GUIv2 version

* Removed Python 2 compatibility

* Changelog update

* Code cleanup
- Removed: get_temperatures()
- Removed: update_last_seen()

* Bluetooth code optimizations

* Fixed some JKBMS BLE not starting
#819

* Check if packages are already installed before install

* Fixed some SOC calculation errors

* Fixed None SOC on driver start

* Do not show and allow button change when callback is missing for:
- ForceChargingOff
- ForceDischargingOff
- TurnBalancingOff

* Check if a device instance is already used by creating a PID file

* Log and execute SOC reset to 100% or 0% only once

* Update GitHub workflow and issue templates

* Fixed LLT/JBD BMS with only on temperature sensor #791
#971

* Fix warning on reinstall

* Fix missing IO control for JBDBMS #992
#992

* Prepare for removing dev branch

---------

Co-authored-by: ogurevich <[email protected]>
Co-authored-by: Bernd Stahlbock <[email protected]>
Co-authored-by: wollew <[email protected]>
Co-authored-by: Oleg Gurevich <[email protected]>
Co-authored-by: peterohman <[email protected]>
Co-authored-by: Strawder, Paul <[email protected]>
Co-authored-by: Paul Strawder <[email protected]>
Co-authored-by: Samuel Brucksch <[email protected]>
Co-authored-by: Samuel Brucksch <[email protected]>
Co-authored-by: ArendsM <[email protected]>
Co-authored-by: Meik Arends <[email protected]>
Co-authored-by: Marvo2011 <[email protected]>
Co-authored-by: cflenker <[email protected]>
Co-authored-by: cflenker <[email protected]>
Co-authored-by: Cupertino Miranda <[email protected]>
Co-authored-by: Martin Polehla <[email protected]>
@Huuh-17
Copy link

Huuh-17 commented Aug 27, 2024

Hello, i need some help to create a code for a circuit with current sensor arduino lithium ion battery usb charger and lcd monitor i need to display the SOC using the coloumb counting method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants