Smart Company Digital Twin - Supporting Controller Development and Testing Using FMI

The challenges of reducing greenhouse gases (GHG) are approached on many fronts, from electrification of mobility to energy management in buildings, and smart grids for more efficient operation of energy production and distribution networks. Considered in isolation these efforts may be inefficient and might even result in severe instabilities of the grid. Fortunately, when integrating electric mobility, smart buildings and smart grids the integrated system can operate at a much larger efficiency. This type of integration has the potential to reduce operation costs of cars and buildings, to stabilize the grid, and to reduce GHGs. To develop products in such an environment it is necessary to model aspects of the total system – buildings, cars, and the grid. This requires a sophisticated simulation technology that can cover a variety of physical domains. For our project of a smart building complex (termed ‘Smart Company’) that links building energy production via PV, co-generation (CHP), and stationary batteries with electric mobility and the local grid, we have decided to develop a simulation model based on the Modelica standard. We are using the SimulationX [ESI-ITI] simulation system with the Green City extension for building and e-mobility modules. Modelica has been chosen since it allows a straightforward simulation of different modules and covers all relevant areas we are interested in. The model has been calibrated based on smart meter values recorded by 50+ sensors (electricity, heat and cold) that feed into a monitoring system to better understand the current state and the performance of the system. While the physical hardware is still under construction, our simulation model, the digital twin (see picture) , is already operational and can be used to simulate the performance of current and future states of the Smart Company system. The simulator can provide detailed results for some modules (for example battery ageing) while being still fast enough to simulate even longer periods of time. As an example in a standard configuration we can simulate a complete year in about 3 minutes on a standard PC. This allows us to perform a number of interesting tasks using the digital twin:
• Calculate the return-of-investment of a potential PV system
• Find the best possible configuration of the system, e.g. the best combination of PV, battery and heat storage size
• Identify problems in system operation by comparing simulation results and actual meter values (i.e. predictive maintenance)
• Test and develop basic and advanced energy management concepts for parts or the whole Smart Company system
The last item is one of the most important ones. We are actually performing Controller-in-the-Loop (CiL) tests using the simulation model since tests on the real building are too complicated, would take too long and might actually disturb work processes. In the simulator we can perform a huge number of tests of different controller configurations in different scenarios (and if necessary tests can be parallelized). While controllers can be modeled inside Modelica, it is very inconvenient and only feasible for a limited complexity of controllers. For example Model-Predictive Control (MPC) approaches are not easily implemented in Modelica. For this reason we are using an FMI interface to link the simulation model with an external program (written in the Python interpreter language) using a special FMI-based interface tool. The Python code receives status information from the simulator, computes a controller output and sends this back to the simulation. If necessary controller and simulation could even run on different computers. The interface is general and easy to set-up. In the mid-term we also plan to use the FMI-based interface system to not only connect controller software but also multi-agent simulations to better represent EV drivers and how they respond to different charging conditions.