Battery Energy Storage Systems in Microgrids: Modeling and Design Criteria