costPowerDischargeTime(C, Umax, Umin, P, ESR)

import electronics.rlc.dischargetime-1

Calculate the discharge time of a capacitor under constant power load.

import electronics.rlc.dischargetime-1;
costPowerDischargeTime( 1.4F, // capacitance 2V, // carged voltage 1.0V, // discharged voltage 50mA*3.3V, // used power 1.5Ohm // ESR of the cap )
CThe capacitance of the capacitor.
UmaxThe carged voltage of the capacitor. Discharging beginns from here.
UminThe discarged voltage of the capacitor. Discharging ends here (for example the buck-boost converter shuts down at this voltage level).
PThe loading power.
ESRThe equivalent series resistance of the capacitor. Optional. If not given, 0 is assumed.
return valueThe discharge time of the capacitor.

This is the case for example when a buck-boost converter is running from the capacitor powering electronics that uses a constant power, for example 20mA at 3.3V.