Active balancing in hierarchical Battery Management Systems for large scale Li-ion batteries