OPAL-RT and Nergica are working together in a research project on the optimisation of the integration of renewable energy in microgrids based on the development of digital twins of the physical systems present in microgrids and its integration under real operating conditions. Indeed, this project combines a real-time hardware-in-the-loop simulation platform, a four-quadrant amplifier and the full-scale Nergica microgrid. This approach allows the integration of energy production and storage sources to be validated even before deployment in the field, which is an advantage in terms of reducing technological risk, integrating new technologies and verifying technical and operational constraints.