Software Architecture and Implementation of Modelica Buildings Library Coupling for Spawn of EnergyPlus
Keywords:Modelica Buildings Library, Spawn of EnergyPlus, Modelica External Object
AbstractSpawn of EnergyPlus is a next-generation energy simulation engine that targets control design and implementation workflows. Spawn reuses the weather, lighting, loads, and envelope modules from EnergyPlus implemented in C++. It couples these with HVAC and control models implemented in Modelica. Spawn has been designed to perform coupled simulation with any number of EnergyPlus envelope models, supporting simulation of a single building or multiple buildings as part of a district energy system. This paper describes how these Modelica objects are implemented and synchronized to allow the modular specification at the Modelica-level that uses a shared Functional Mockup Unit (FMU) for envelope simulation. A key feature of our implementation is that multiple instances of Modelica models call C functions, which jointly build a data structure that defines the configuration of the whole building model. This data structure is then used to generate a FMU that contains a fully configured EnergyPlus model. This FMU is then accessed by all these Modelica models to exchange with EnergyPlus values for parameters, inputs and outputs during the simulation. This setup allows the Modelica models to be instantiated in a modular, object-oriented manner, as is typical for Modelica, yet they jointly construct and use a shared building model. When compared to a native Modelica building envelope simulation of comparable level of detail, the coupled Modelica-EnergyPlus model translates about 35% faster and simulates about 50% faster.