Modeling And Control Of State Of Charge Of Modular And Second Life Battery Systems