ALGORITHMS FOR BATTERY MANAGEMENT SYSTEMS