Text this: A Logic-Driven Battery Balancing Technique for Second-Life Battery Application in Small-Scale Grid System