The paper presents an approach to the development of a distributed energy resources management platform based on the digital twin (DT). The platform employs advanced Industry 4.0 technologies to let users improve the power supply quality, reduce costs, and gain emerging market opportunities. The DT and the platform are designed with the viewpoint-based approach established by the systems engineering standard ISO/IEC/IEEE 42010. The typical power system DT architecture is described. The distributed energy domain ontology provides the unified semantic basis for interaction between heterogeneous models that constitute the DT. The DT-based platform architecture is represented from three key viewpoints: functional, information, and software. To formalize and ultimately automate the DT composition process, we propose novel mathematical methods based on category theory.