how battery energy storage system works