calculateBatteryEnergy
Calculates the battery energy for a given percentage.
This function uses linear interpolation to estimate the energy level corresponding to the given battery percentage, based on the SOC curve.
If the percentage is outside the range defined by the curve, the energy of the closest endpoint (minimum or maximum) is returned.
Return
The estimated battery energy (Energy) for the given percentage.
Parameters
percentage
The battery percentage (Float) for which to calculate the energy.