Battery stability simulator with custom recharge functions and instantaneous discharges