HOW TO DESIGN A BATTERY MANAGEMENT SYSTEM FOR ENERGY STORAGE