## 3 Monitoring System and Optimized Building Operation  
Within the Plus-Energy settlement \"Vordere Viehweide\", the building owners had clearly defined targets regarding building efficiency, heating systems, and PV systems (every owner had to install a PV system of sufficient size in order to reach the Plus-Energy status on a yearly balance). Despite this, the individual system components and layouts could be freely chosen, leading to a variety of hydraulic layouts and different types of manufacturers. This made the installation of monitoring equipment quite difficult, as each building system is different. Conversely, it also offers the opportunity to obtain the data of and experience various system combinations. Within six buildings, all the thermal and electrical energy flows and temperatures are monitored in high resolution (5 s electrical, 30 s thermal) and their energy systems, especially their heat pumps, are controllable by a local energy management system. For those six buildings, an implementation of DR and DSM measures is carried out with various goals:  
* Optimization of self-consumption
* Application of flexible electricity tariffs
* Aggregated power market participation  
Thereby, flexibility is provided by overloading the thermal storages and buildings. This requires simulation-based prediction and optimization. In the literature, for prediction and optimization purposes, various approaches exist, ranging from black box self-learning algorithms over gray box RC models to dynamic white box building models, providing different advantages and disadvantages regarding computational time, prediction accuracy, and adaptability [30]. In the field of energy engineering and science, three different optimization approaches are widely in use: mixed-integer linear programming (MILP), dynamic programming (DP), and metaheuristic algorithms such as genetic algorithms (GA) [31]. One approach is to use dynamic building models such as EnergyPlus to create optimized set point schedules for the following day, allowing significant electricity cost savings [32; 33]. In the case of the Plus-Energy settlements' individual buildings, a hybrid approach is implemented. Thereby, a local energy management system together with a cloud-based simulation and prediction software prototype is used to enable DR and DSM measures. Within that, the heat pump operation is optimized and scheduled according to the predicted PV yield, heating, and electrical household demand and partly by external activation or pricing signals.  
For monitoring and control purposes, the communication protocols at the level of the devices are the following:  
* For the heat pumps, either the potential-free contact to switch them on or off (historically used by grid operators to switch off the heat pump for a certain time period per day) or ModBus TCP being the most advanced external control interface;* For the battery charge control, a ModBus TCP protocol is used for the communication with battery inverter and to gain the charging level of the battery;
* For the PV Systems, ModBus TCP is also used.  
To collect the data from the various installed monitoring devices, different interfaces from simple thermocouples that are connected to the I/o-modules over analogue interfaces up to different bus protocols such as ModBus TCP and ModBus RTU as well as proprietary bus protocols are used.  
All monitoring data is stored in a cloud-based MySQL database with dedicated structure to be accessed via the monitoring software MoniSoft [34].