# Context-Aware Wireless Sensor Networks for Smart Building Energy Management System
###### Abstract  
Energy Management Systems (EMS) are indispensable for Smart Energy-Efficient Buildings (SEEB). This paper proposes a Wireless Sensor Network (WSN)-based EMS deployed and tested in a real-world smart building on a university campus. The at-scale implementation enabled the deployment of a WSN mesh topology to evaluate performance in terms of routing capabilities, data collection, and throughput. The proposed EMS uses the Context-Based Reasoning (CBR) Model to represent different types of buildings and offices. We implemented a new energy-efficient policy for electrical heaters control based on a Finite State Machine (FSM) leveraging on context-related events. This demonstrated significant effectiveness in minimizing the processing load, especially when adopting multithreading in data acquisition and control. To optimize sensors' battery lifetime, we deployed a new Energy Aware Context Recognition Algorithm (EACRA) that dynamically configures sensors to send data under specific conditions and at particular times to avoid redundant data transmissions. EACRA increases the sensors' battery lifetime by optimizing the number of samples, used modules, and transmissions. Our proposed EMS design can be used as a model to retrofit other kinds of buildings, such as residential and industrial, and thus converting them to SEEBs. Smart Grid (SG); Microgrid (MG); Smart Energy-Efficient Buildings (SEEB); Internet of Things (IoT); Wireless Sensor Network (WSN); Wireless Mesh Network (WMN); Finite State Machine (FSM); XBee +
Footnote †: journal: Information  
0000.0  
and actuators, smart appliances, renewable energy resources, energy storage, control theory, big data processing, big data analytics. While an SG can cover a whole city, the Micro-Grid (MG) [6] is a \"small SG\" that groups multiple distributed generation points at the level of a neighborhood, e.g., university campus, village, and private residential or industrial areas. Still, an MG connects to the main grid via the Utility Interconnection Switch. Moreover, a typical feature of MGs is the ability to operate in islanded mode when the locally generated power is enough to power all loads in the MG. In such a situation, there is no need to get the power from the utility grid. Consequently, and to promote the island mode operation, an MG ought to effectively integrate various sources of distributed generation (DG), especially Renewable Energy Sources (RES), to supply needed emergency power when switching between islanded and connected modes. Most important, control and protection are becoming significant challenges. In the SG paradigm, an MG is a key element in the distributed generation of electricity. This MG needs that interoperability capability to communicate with the SG. Among the main challenges for implementing Smart MG is the integration of intermittent generation sources (renewable energies). This distributed generation also contains storage devices, loads, and Smart Buildings [7]. Buildings under the same entity in an MG participate in energy management either by optimizing their consumption and/or cooperating in the distributed generation using rooftop solar panels as an example. By adding a system that handles these two functionalities, energy consumption optimization, and energy production, we can start talking about a Smart Building that can host an energy management system. Technological advancement in the last decade has enabled objects around us to adopt a dynamic aspect, that is, sending data and taking actions based on the received commands from users. This is thanks to the processing of the intelligence layer that can be added to every object in the Internet of Things (IoT). The Smart MG relies on information and communication technologies (ICTs) [8] to enable real-time, two-way communication between utility and consumers, thus allowing more dynamic interaction on energy flow.