How to calculate the failure voltage of a battery pack