A nonlinear circuit model for lithium-ion batteries