A Smart Building as a Cyber Physical System

: In recent years, systems consisting of both physical and computational elements, called Cyber Physical Systems (CPSs), have entered into our lives. These systems are becoming increasingly important because of their wide application area such as smart buildings, intelligent manufacturing processes, energy grids, healthcare devices, smart agriculture and etc. In this work, CPSs are considered by means of a smart building application. Firstly, CPSs are introduced and their features are explained. Then, a smart building is considered for emphasizing and illustrating the importance of CPSs. In order to display working mechanism of computational and physical components of the building and to provide easy trace of the evolution of overall system, some physical components (smart AC, lighting system and smart TV) are developed via Petri net, which is a mathematical and graphical tool for modelling and analysing discrete event systems.


Introduction
In recent years, systems consisting of both physical process and computational elements, called Cyber Physical Systems (CPSs), have entered into our lives. The physical process is monitored or controlled by the computational (cyber) system, which is a networked system of several devices with sensing, computing and communication capabilities. Developments in sensor and information technology, smaller and cheaper sensor solutions, development of cheap and different communication methods as well as more powerful embedded control system allow CPSs to become widespread rapidly. These systems are becoming increasingly important because of their wide application area such as smart buildings, intelligent manufacturing processes, energy grids, healthcare devices, smart agriculture and etc.
In the literature, many works have been presented on CPSs. Despite its wide-spread use, the term 'Cyber-Physical System' does not come with a uniform meaning. It is often used as a synonym for 'system in which computing interacts with the physical world' or 'networked embedded system', or 'system of systems'. The disruptive nature of cyber-physical systems has the potential to substantially change the way of addressing the key questions of modern societies, and specifically the European challenges including Well-Being, Clean Energy, Integrated Transport, and Resource Efficiency, by providing smart answers to these questions. In the CyPhERS project [1], the following five key areas were chosen to illustrate the potential of cyber-physical systems using future scenarios of 2030, and identify strengths, weaknesses, threats and opportunities of Europe: Transport, Energy, Well-Being, Industry, Infrastructure. Authors introduced model-based design methodology for cyber physical systems and evaluated it through the development of the Tunnelling Ball Device (such as automotive engine control) in [2]. In [3] a qualitative and quantitative empirical study of the state of the art in CPS verification and validation is conducted. An approach to increase resilience in a cyber-physical system from errors in the high-level control logic is presented in [4]. This approach, monitors runtime commands in order to maintain a safety invariant. Although this method seems to be general and powerful, the main drawback is the cost of performing part of the checking at run time. Hence, authors also introduce how to perform this operation offline. In [5], Petri net is used as a formal tool for nondeterministic non-interference security model specification of cyber-physical system and is shown to be applicable to abstract pipeline distribution flow network system. A generalized Petri net model is presented in [6] to formulate the manufacturing processes, and a traceability model is automatically built by model transformation. In that work, model-based algorithms are proposed for enabling back-tracking to the source of an item with detailed productive data. Authors of [7] focus on another important human-machine interaction problem for smart building systems, which concerns conflict detection during the interaction process between multiple users and the system. They design a rule conflicts detection algorithm, which can detect conflicts between two rules as well as cycle conflict/multi-cross contradiction among multiple rules. In [8], a smart Air Conditioner scheme is proposed and its adaptation to a Smart Home system is presented. Petri net model of the smart Air Conditioner is developed in order to enable a good general view of the operation of the Smart-Air Conditioner. In this work, CPSs are considered by means of a smart building application. Firstly, CPSs are introduced and their features are explained. Then a smart building is considered for emphasizing and illustrating the importance of CPSs. In order to display working mechanism of computational and physical components of the building and to provide easy trace of the evolution of overall system, models of building components are developed via Petri net.

Petri Nets
A Petri net (PN) is a directed bi-partitate graph which consists of finite set of places represented by circles, finite set of transitions represented by bars and arcs directed from places to transitions or from transitions to places, which express the conditions required for an action to be feasible and its consequences when it occurs. The places from which an arc runs to a transition are called the input places of the transition; the places to which arcs run from a transition are called the output places of the transition. A place _______________________________________________________________________________________________________________________________________________________________ may contain tokens denoted by black dots. The distribution of tokens over the places of a net is called a marking that corresponds to a state of the modelled system. Model of a PN is denoted by a five-tuple ( , , , , m0), where := { 1, 2, . . . , | |} is the set of places, represented by circles, := { 1, 2, . . . , | |} is the set of transitions, represented by bars, ( ∩ = ∅ and ∪ ∕= ∅), : × → is the input matrix that specifies the arcs directed from places to transitions, O: × → is the output matrix that specifies the arcs directed from transitions to places and m0 is the initial marking. Here, is the set of nonnegative integer number. M : → is the marking vector, M( ) indicates the number of tokens, represented by black dots, assigned by marking M to place . A transition ∈ is enabled if and only if M( ) ≥ ( , ) for all ∈ . Here, N( , ) corresponds, the element of the input matrix, corresponding to ∈ and ∈ .
Under the assumption that transition firing occurs without taking time, an enabled transition ∈ may fire at M, yielding the new marking vector M′ such that: is a vector whose element corresponding to is one and all other elements are zero.

General Review
There are mainly two parts called as physical world and cyber world in CPSs. Physical world consists of sensors, devices and actuators as parts of a real physical process, while cyber world consists of a controller used to manage the physical process, a database storing data related to the physical system, an algorithm concerning the usage, safety and process of the data of the physical system, a scenario and security units. Each component of physical world and cyber world communicates through a wireless sensor and appliance (actuator) network. Information regarding physical process is received through various sensors and transmitted to cyber world. In order physical process to work better, this process is controlled in cyber world by means of developed algorithms and scenarios as well as data taken from sensors. In Fig. 2, corresponding structure of a CPS is given. Fig. 2 The structure of a cyber-physical system

Smart Building
In this work, the importance of CPS is introduced by means of considering a smart building as a CPS. Traditional works on smart building systems mainly focus on issues of automatic control and energy efficiency, but omit the human-machine interaction problem. In [9] and [10], the authors address human activity recognition in the home environment, which can inform the smart building systems from the perspective of humanmachine systems. In this work, considered smart building is composed by real and virtual sensors, appliances, a wireless communication network and a controller unit. Indoor and outdoor conditions of the smart building are detected via various real sensors, such as temperature, occupancy, light intensity and humidity. User requests concerning indoor conditions are taken via virtual sensors, thus user interfaces at different points, such as on-wall control panels, smart phones, tablets or computers. Data taken from real and virtual sensors are transmitted to the database and the controller unit via wireless communication network. All data related to the building are stored in the cloud or local database and used when required. Controller unit manages the appliances in the building according to sensor outputs, user requests, developed algorithms and scenarios. As diversity and number of sensors used in the building and variety of user requests increase, complexity of CPS increases which complicates the control and tracking of the system. In order to provide easy observation and tracing, computational and physical components of the building can be modelled via PNs which allow graphical representation as well as mathematical calculation of the evolution of the system. In this work, two different PN models are developed for two different types of sensors: True/False sensors (i.e., occupancy, proximity and touch sensors) and sensors which can make wider range measurements (i.e., temperature, humidity and vision sensors). PN model of True/False sensors is given in Fig. 3(a). In this model, places 1/ 2 represent sensor situations true(exist)/ false(non-exist) while transitions 1 and 2 represent sensor activities. For example, explanation of places and transitions of the PN model of an occupancy sensor, which is a kind of True/False sensor, are given in Table 1. Occupancy is lost PN model of sensors having wide range measurements, is given in Fig. 3(b). In this model, places, thus p1, p2, …, pn, represent the level of sensor measurement, while transitions, thus, t1, t2, …,tx represent switching the status of the sensor. As for appliances, 3 working modes and n program modes (working types), each of which offers different functionality and features, are considered for each appliance inside the building. Similar to sensors, appliances (in other words, actuators) inside the building can be modelled by PN based on the working status of these devices. In Fig. 4(a) and Fig. 4(b) general PN models of working and program modes of an appliance are given: In Fig.  4(a), places 1/ 2/ 3 correspond to on/stand-by/off working modes and transitions 1/ 2/ 3/ 4 represent switching the working modes of an appliance. In Fig. 4(b), places 1/ 2/…/ n represent the program modes of the appliance and transitions 1/ 2/…/tx represent the switching the program modes of an appliance. Working modes and program modes of any appliance are monitored by the cyber part of the building and controlled according to the predefined algorithms and scenarios. The cyber part of the building uses the information gathered from the sensors and responds quickly to the changes inside the building.

Case Study
In this work, smart Air Conditioner (AC), lighting systems and smart TV of the smart building are considered in detail.
The lighting system of the smart building is controlled according to the room usage inside the building. Occupancy sensors and day light sensors are integrated to the rooms. Users shall use wall control panel, smart phones, and etc. control units to send their request to open the lighting system. When any request to open the lighting system is detected, the controller switches the working mode of the lighting system from off to standby and monitors the status of occupancy and daylight sensor. If the occupancy sensor in the environment senses occupancy, and the daylight sensor detects that the illumination of the environment is insufficient, the controller switches the working mode of the lighting system from standby to on, thus the lamp turns on. As the controller controls the on, standby and off modes based on the user request and the outputs of occupancy and daylight sensors, unnecessary energy use in the lighting system is prevented. Program modes of a lighting system are specified by dimmable levels that are set due to the level of illumination. These illumination levels affect the users comfort. For this reason, the users determine the dimmable levels by using different user interfaces. PN model of lighting system is given in Fig. 5. Explanations of places and transitions are given in Table 2 and Table 3, respectively.  Change the working mode from standby to on 3 User request is received 4 User request is lost 5 Natural lighting level < set value (natural lighting) 6 Natural lighting level >= set value (natural lighting) 7 Occupancy is detected 8 Occupancy is lost. 9 Change the working status from on to standby 10 Change the working status from on to off In this study, the cooling and heating needs of the smart building are provided by an AC, which has 3 working modes as on, standby and off ; and 4 program modes as cooling-normal (set value: ), cooling-economic (set value: ), heating-normal (set value: ℎ ) and heating-economic (set value: ℎ ) . Note that, compared to the normal program modes, the temperature set value for the economic mode is higher in cooling mode; and lower in the heating mode ( > , ℎ < ℎ ) According to the information received from occupancy sensors, temperature sensors and smart meter, working status, thus working mode and program mode of AC is determined by the controller, for protecting unnecessary operation of the device, thus reducing the cost, and improving user comfort. Working mode of this AC is determined according to user request and room occupancy. Working mode of AC in off mode is changed to stand-by mode, if user request is received. If room occupancy is detected afterward, working mode is set to on. If the occupancy disappears, while AC is working in on mode, it turns back to stand-by mode. If user request disappears afterward, AC turns back to off, whatever its present working mode is. Program mode of AC is determined according to outer temperature value taken from outer temperature sensor, tariff rate information taken from grid. If outer temperature is higher than 24 0 C, AC works for cooling, otherwise it works for heating. Program mode of AC switches between economic and normal modes according to the information taken from the grid (smart meter). If the tariff rate is expensive, AC is switched to economic mode otherwise it works in normal mode. PN model of the considered AC system is given in Fig. 6. The TV system of the smart building is controlled according to the room usage inside the building. TV model uses occupancy sensor and ambient light sensor to control its working status and program modes. Users shall use wall control panel, smart phones, and etc. control units to send their request to open the TV system. When any request to open the TV system is detected, the controller switches the working mode of the TV system from off to standby and monitors the status of occupancy. If the occupancy sensor in the environment senses occupancy, the controller switches the working mode of the TV system from standby to on, thus the TV turns on. Program modes of a TV system show the brightness level of TV monitor. They are specified by the levels of ambient light sensor or user selection.

Conclusion
In this work, CPSs are considered by means of a smart building application. In order to display working mechanism of computational and physical elements of the building, some component models (AC, lighting system and TV) are developed via PN formalism, which is a mathematical and graphical tool for modelling and analysing discrete event systems. These models provide easy trace of the evaluation of the system. In future works, other parts of smart building will be modelled by using PNs and all developed models will be used to monitor and control the real applications. Scenarios and the corresponding centralized control algorithms will also be developed.