Calculate the battery discarge time.
batteryDiscargeTime( 5 Ah, 2 A )
|capacity||the capacity of the battery.|
|k||Peukerts constant. It depends on battery type. If not given 1.3 is assumed.|
|dischargeRate||the discarge rate of the battery. If not given 20 hour rate is assumed (good for 99% of specifications).|
|return value||the discharge time of the battery.|
NOTE: The most of batteries have batteries have capacty specifications with 20 hour discharge rate (about 99% of them), so it is assumed to be the default. If Peukert's capacity is given, check out batteryDiscargeTime1H.
For more details, see https://en.wikipedia.org/wiki/Peukert's_law, http://www.smartgauge.co.uk/peukert2.html.