Although digital twins are gaining traction in both literature and industry, their development and widespread adoption face significant challenges. A primary issue in digital twins, especially those involving heterogeneous simulation models, is the integration of their diverse components. This study introduces a method designed to enhance reusability and streamline the glue code generation necessary to interface with different models in a digital twin. Our method follows a four-stage process, employing a compositional approach to define interfaces. The approach distinctly separates the composition of the model, its simulation engine and orchestration engine functional interfaces, its communication approach and technology, and the functional verification of interfaces. To ensure broad applicability, these operations are standardized into a common format, facilitating the seamless interchange of models. The effectiveness of the method is validated by generating interfaces for four different simulation engines across three distinct formalisms within a co-simulation framework. The results underscore the method's functional capability to efficiently generate interfaces.