CO-SIMULATION FOR BUILDING CONTROLLER DEVELOPMENT: THE CASE STUDY OF A MODERN OFFICE BUILDING

We report our experience from using co-simulation i n the context of a demanding building control study. The object under investigation was a 20’000 m newly-built office building in Munich. Considered was the control of radiant ceili ngs, heating convectors, mechanical ventilation, blinds and lighting for one floor that was subdivided in 28 building zones. We employed the Building Controls Virtual Test Bed (BC VTB) middleware to couple the EnergyPlus building energy performance simulation s ftware with the MATLAB numerical computing environment. We found that this set-up e nables a structured and flexible approach to controller development and building simulation, even for sophisticated control problems. On the downside, debugging of the simulations becam more difficult and simulation times were found to increase by a factor 2 to 10. Conside rabl know-how and effort are currently necessary to set up and operate the co-simulations. A newly developed software layer that helps minimizing this effort is presented. CONTROL IN BUILDING ENERGY PERFORMANCE SIMULATION TOOLS Improved building control is gaining increasing att ention as a means to improve energy efficiency and comfort of buildings, to handle the complexity of modern building systems, and to make optimal use of modern information and c ommunication technology. The development and testing of novel control technologi es can only be accomplished efficiently with the aid of computer simulations. Moreover, dy namic simulations are the only way to study the role of control already in a building’s p lanning phase. It is in this context that cosimulation provides an attractive option to combine existing building simulation software’s sophisticated capabilities with the extensive exper tis and software tools available from the field of control engineering. However, modern building energy performance tools w ere developed and optimized for building energy performance simulation in the first place. Although they can be customized in many ways their flexibility in terms of control is very limited. I.e. they often support building control only in a very rudimentary manner, .g. by allowing for simple manipulation of set-points or the setting of component availabil ity. Crawley et al. (2005) provide a summary of simulation tool capabilities. Advanced c ontrol requires programming features not available in most traditional building simulation t ools. Amongst others, this includes the needs for flexible I/O and manipulation of control parameters, matrix algebra, and calling of external optimization routines. One line of curren t research consists in developing a new generation of building simulation tools that overco mes these problems (Wetter, 2009). In this paper we consider as an alternative the combination of traditional tools by means of so-called co-simulation. COUPLING CONTROL AND BUILDING SIMULATION Co-simulation consists in the integration of differ ent software components by run-time coupling. Fundamentals for building simulation such as coupling strategies and data transfer are described in Tr čka et al. (2009). Several energy performance simulation tools already feature interfaces to other software, e.g. the well-known TRNSYS software offers an interface via the so-called Trnsys Type 155 for coupling to the MATLAB numerical computing environm ent and fourth-generation programming language (MATLAB, 2011). However, the value of such solutions is often limited by the fact that the building simulators wi ll typically maintain full run-time control over the course of a simulation. Efficient control ler development requires a different, much more flexible approach that supports structured and hierarchical coupling of subsystems into overall systems. Precisely this functionality is p rovided by the Building Controls Virtual Testbed (BCVTB) software developed by the Lawrence Berkeley National Laboratory (Wetter and Haves, 2008). BCVTB is a middleware that allows coupling of vario us software codes for distributed simulation. Currently, programs to be linked via th e BCVTB are EnergyPlus, MATLAB, Modelica and Radiance. Data exchange with BACnet bu ilding automation systems is also possible. Here we report our experiences from using BCVTB to couple the EnergyPlus building energy performance simulation software (En ergyPlus, 2011) with the MATLAB environment in the context of a demanding case stud y. CASE STUDY The object under investigation was a 20’000 m 2 newly-built office building in Munich (Figure 1). Our goals were (i) to assess the performance of present-day rule-based control (RBC) in terms of energy usage, thermal and light comfort, p eak electric power demand and (ii) to investigate possible advanced control approaches in cludi g Model Predictive Control (MPC; e.g., Maciejowski, 2001) with the aid of simulation s. In a first step we developed an EnergyPlus model co mprising 28 coupled zones that covered an entire floor of the office building. 24 zones we re controlled from within MATLAB, 4 auxiliary zones were controlled from within Energ yPlus using a simple two-point controller. The RBC strategies for plant equipment plus radiant ceilings, heating convectors, mechanical ventilation, blinds and lighting as specified by th e building planners were analyzed and translated into MATLAB codes such that they could b e simulated outside of EnergyPlus. BCVTB was used to close the control loop between th e MATLAB controller and the EnergyPlus model by exchange of input and output si gnals at each simulation time step (Figure 2). In the case study it was decided to only have highlevel control decisions outside of EnergyPlus. Low-level control of zone equipment (su ch as massflow rates) remained in the EnergyPlus controller domain. Temperature setpoints as well as plant and zone equipment availability signals were determined from within MA TLAB. By means of BCVTB, corresponding schedules related to equipment operat ion nd internal gains, as well and actuator manipulations were passed to EnergyPlus. T able 1 gives an overview of the signals involved in the RBC of the office floor. MATLAB to EnergyPlus EnergyPlus to MATLAB Controller Outputs: Temperature setpoints 101 – Controller Outputs: Plant and equipment availabili ty 45 – Controller Outputs: Blinds positions and slat angle s 62 – Internal Gains Status: Occupancy, equipment fractio n 48 – Controller Inputs: Zone temperatures, return temper atures – 53 Table 1: Overview of information flows managed by BCVTB for the rule-based control of 24 building zones. IMPLEMENTATION Implementation of the co-simulations required corre ct handling of a large number of software objects related to the exchanged signals (Table 1) plus the global simulation parameters (simulation begin and end time, time step etc.) in all three involved software components: BCVTB requires the specification of the global simu lation parameters, the co-simulation actors, their respective inand outputs, and their coupling. All this data had to be provided in an eXtensible Markup Language (XML) coded text file . EnergyPlus requires that the simulated building’s g eometry and construction details, the zone and plant equipment, the plant’s water and air loop s, the internal gain schedules, the control, and the definition of the requested outputs are spe cified in a so-called input data file (IDF). IDFs contain records defining various types of obje cts plus optional, non-standard control functions that are written in the EnergyPlus Runtim e Language (Erl). IDFs are human readable text files, but they can become very large – in our case the IDF without high-level controls had 28’000 lines of code. Including the h igh-level RBC controller would have added another ca. 3’000 lines of code. MATLAB offers a powerful programming language that supports among other things elementary typed variables, vectors and matrices, s tructured variables (consisting of elementary plus structured variables) and functions . I our case, all inputs to the MATLAB controller were provided by BCVTB at runtime in a r eal valued vector. Its elements had to be mapped to corresponding MATLAB data structures for processing by the control algorithms that in turn returned a real valued vector to be pr ovided by BCVTB as an input to EnergyPlus. Figure 3 shows the architecture of a general softwa re that was developed for the support of the co-simulations. It consisted of three main ele ments: (i) Preparation of EnergyPlus IDFs (“PrepEPIDF”). This program takes EnergyPlus objects from a model objects database as an input. The obj cts are defined in Excel files with predefined structures. The program produces the E nergyPlus simulation’s IDF as an output. (ii) Preparation of BCVTB and controller files (“Pr epBCVTB”). This program retrieves the specifications of all EnergyPlus control inputs and of all EnergyPlus outputs required by the external controller from the above-mentioned Excel database. It produces two kinds of outputs: the XML file required by BCVTB, and MATLAB codes that define all objects needed for the interaction of MATLAB with BCVTB. (iii) Running of the co-simulation and automated po st-processing of its results (“RunBCVTB”). All above programs were implemented as Unix/Linux s hell scripts. They were based on standard Unix/Linux tools plus some auxiliary scrip ts involving programs that were written in the Python and Perl programming languages. In order to assess the performance of the co-simula tions we considered annual simulation runs with two different building models. Each model was first run stand-alone to obtain a benchmark, and then it was run using BCVTB. All si mulation experiments were done with EnergyPlus 6.0.0 and BCVTB 1.0.0 under the Debian L inux 5.0 operating system on a computer with 8 Intel Xeon processors at 2.53GHz. From Table 2 can be seen that for the 28 zone model the co-simulation was ca. 2.5 times slow er than the stand-alone simulation, whereas for the