Multi-functional battery energy storage systems are getting popular since they can offer not only self-consumption but other services that contribute to the stability of supply of power grids. Furthermore, those storages may also participate in market services, demand response, among others. They are usually implemented in corresponding energy management systems. Therefore, those systems should carry out a simultaneous operation of services and be interoperable with different other actors and devices in the domain of power and energy systems. The implementation of the referred systems becomes a challenging task since unattended couplings across services may harm their overall operation. Furthermore, current engineering approaches are not flexible enough to accept an easy and rapid integration of new components. In addition, since a massive deployment of battery energy storage system is expected in a near future, a rapid prototyping of their corresponding services becomes a requirement. The mentioned issues should be addressed during the engineering process of the energy management systems, which goes from specification to realization. Existing engineering approaches support certain stages of this development process. However, an integrated solution that fully covers the identified issues is still missing. In this context, the present work proposes an adaptable engineering framework which covers all the mentioned open issues. The proposed solution is based on model-driven engineering and ontologies concepts. The core part of this solution is an ontology that represents a common understanding of energy management systems of a storages which is aligned with domain standards. Moreover, inference procedures, an important feature of ontologies, are being used to identify inconsistencies at the design level. The resulting ontology is considered as a reference for a platform independent model to achieve a rapid prototyping of the applications under study. The main result of this work is an engineering approach that support the implementation of an error-free and interoperable energy management system as well as a rapid and flexible prototyping of it. A prototype implementation of the approach is developed in this work to assess its effectiveness. Hence, the approach is validated on selected battery energy storage systems by performing pure software simulations and lab-based experiments. A comparison between the proposed approach and others existing show a promising results.