Text this: Rechargeable battery modeling and lifetime optimization