-
Notifications
You must be signed in to change notification settings - Fork 172
Description
Hi foxBMS team. I was going through the soc counting algorithm under the soc_counting.c file. I spotted this code snippet under the SE_CalculateStateOfCharge function which i think has incorrect scaling.
float_t deltaSOC_perc = (((float_t)soc_tableCurrentSensor.current_mA[s] * timeStep_s) / SOC_STRING_CAPACITY_mAs) * 100.0f / 1000.0f; /* ((mA) * 1s) / 1As) * 100% */
Here the numerator is mA x S and the denominator is also in mA x s. This value is then multiplied by 100 to get the SoC percentage. However it can be seen that there is an additional scaling of 0.001. Why is this there?
The comments on that line suggest that the SOC_STRING_CAPACITY needs to be in As. If this is the case the scaling is correct. However SOC_STRING_CAPACITY in the above code is in mAs.
If the above snippet is incorrect in the source code this leads to a very critical bug.