Towards an Occupancy-Oriented Digital Twin for Facility Management: Test Campaign and Sensors Assessment

: This study focuses on calibration and test campaigns of an IoT camera-based sensor system to monitor occupancy, as part of an ongoing research project aiming at deﬁning a Building Management System (BMS) for facility management based on an occupancy-oriented Digital Twin (DT). The research project aims to facilitate the optimization of building operational stage through advanced monitoring techniques and data analytics. The quality of collected data, which are the input for analyses and simulations on the DT virtual entity, is critical to ensure the quality of the results. Therefore, calibration and test campaigns are essential to ensure data quality and efﬁciency of the IoT sensor system. The paper describes the general methodology for the BMS deﬁnition, and method and results of ﬁrst stages of the research. The preliminary analyses included Indicative Post-Occupancy Evaluations (POEs) supported by Building Information Modelling (BIM) to optimize sensor system planning. Test campaign are then performed to evaluate collected data quality and system efﬁciency. The method was applied on a Department of Politecnico di Milano. The period of the year in which tests are performed was critical for lighting conditions. In addition, spaces’ geometric features and user behavior caused major issues and faults in the system.Incorrect boundary deﬁnition: areas that are not covered by boundaries; thus, they are not monitored


Introduction
The operation and maintenance (O&M) phase of buildings and civil infrastructures ranges between 20-30 years for buildings, but it can cover more than 50 years of the whole lifecycle [1]. It is essential to ensure an actual and efficient management of buildings during the O&M phase. Occupancy and actual use of spaces strongly affect the organizational effectiveness and functioning during the operational phase [2,3]. Typically, standardized and fixed values of occupancy are considered during design phases, e.g., maximum occupancy values from fire regulations or scheduled occupancy for energy models [4]. Consequently, actual occupancy and space use levels may significantly vary from and rarely correspond to the values considered during the design phase. Occupancy strongly influences use and cleanness of spaces, which in turn are related to well-being, satisfaction, and productivity of users [5,6]. In recent years, a consistent number of studies investigated the segment of the performance gap between expected energy consumptions, defined during the design phase, and actual consumptions, due to human-building interaction and variable occupancy [6][7][8][9][10][11][12][13][14][15][16][17]. However, other promising fields in building management include security, safety, cleanness, and space management. These aspects can have a crucial role, especially in light of current sanitary emergencies related to the spread of the COVID-19 pandemic: space monitoring is a key aspect to guarantee safety in existing buildings [18].
In this context, the aim of the ongoing research project here presented is to define a Building Management Systems (BMS) based on an occupancy-oriented Digital Twin (DT), evolving from and enriching the Building Information Model (BIM) and integrating occupancy levels and additional relevant data from Post-Occupancy Evaluations (POEs). Analyses and simulations of the occupancy-oriented DT would support the decisionmaking processes during the O&M phase.
The case study for the application of the methodology is an existing office building hosting the Department of Architecture, built environment, and construction engineering (DABC) at Politecnico di Milano, Italy, used by people working at the university and performing their research and administrative activities in the indoor spaces of the building. The maintenance and cleanness of the distribution spaces and offices is a very important aspect in the facility management of the building and department business plan; strong variations in occupants' flows are experienced by the users and particularly during the pandemic.
The IoT network of sensors that represents the source of data for the occupancyoriented DT and that was tested and calibrated as described in this article was provided and installed by an external consulting company (Laser Navigation srl). They provided the hardware part of the system that is the camera-based sensors with an embedded deep learning algorithm, the installation, and the technical settings of the sensors. They also provided an online platform named SophyAI and integrated with the IoT system, that allows to visualize, store, and download collected data.
This paper focuses on the preparatory phases for the definition of the DT, i.e., sensor system calibration and collected data quality validation. In fact, a fundamental characteristic of a DT is the connection, alignment, and reciprocity between the physical and virtual part [19]. Therefore, a key aspect is the data collection process, ensuring data quality on which the correct digital representation of the physical phenomenon depends [20,21], since, in order to obtain satisfactory results, is essential to ensure the quality of input data [22]. In this perspective, fundamental steps are the selection of sensor types that are most suitable for the specific application [23], the spatial distribution of sensors in the indoor spaces [24], and the setting and calibration of the IoT sensor system [25,26], to allow a correct detection and collection of data.
Given the importance of data quality for the proper digital representation of the building occupancy phenomenon, the objectives of the research are: optimization of spatial distribution and orientation of sensors for system planning and installation, identification of issues and faults of the detection system, and resolution of issues and faults by performing an assessment of the detection system through test campaigns. This study proposes method and evaluation criteria for system calibration and data quality validation, also defining parameters for occupancy analysis. Two test campaigns were performed until all major faults have been checked and solved, allowing for the verification and validation of collected data quality to monitor building occupancy. The study also describes and tests the use of the platform SophyAI for real-time visualization of data during the test campaigns.

Evolution, Main Applications, and Features of Post-Occupancy Evaluations
Post-Occupancy Evaluations (POEs) aim at assessing building performances, users' behavior, and feedback regarding existing buildings during the operational phase and once the building has been occupied for some time [27][28][29][30][31]. POEs were first introduced in the UK and US in the 1960s in order to assess building performances from user perspective, by means of interviews, questionnaires, photographic surveys, and walk-through surveys [27,28]. The major developments of POEs were during the 1980s, aiming at analyzing and optimizing the facility management and design [29]. POEs had been performed in the US, mainly in the public sector, UK, New Zealand, and Canada [32], and, since a correlation between workplace features and worker productivity was proposed in 1985, they have been also applied in the private sector to improve costumer and worker satisfaction and to optimize the workplaces [30]. In the mid-90s, the interest moved from analyses during the operational phase alone to an entire building life cycle process, i.e., Building Performance Evaluation (BPE) [33,34]. Insights and findings from POEs could be applied in the subsequent design and building life cycle process [34][35][36].
In the last two decades, POEs have mainly been applied to assess and optimize building energy performances, and to reduce the building environmental impacts [37]. A less investigated but promising research field is the optimization of occupancy patterns, and cleaning activities and contracts. Space features and workplace cleanness have been classified as basic factors affecting user satisfaction [5], and, consequently, user productivity. The variable "interior use of space" can account for around 43% of the variance in employees' enjoyment at work, well-being, and perceived productivity [6].
As above mentioned, POEs are analyses of the built environment, aiming at defining the effectiveness and functionality of spaces for users, building performances, and user satisfaction and perception regarding facilities in general and workplaces in particular [27,38]. There are three levels of POEs depending on accuracy, time needed to be performed, tools, and levels of invasiveness of user privacy [7,30]:

•
Indicative POEs enable to perform overall non-invasive analyses of the building, with selected interviews and photographic surveys to detect critical areas of the building. • Investigative POEs are more in-depth analyses, and more invasive, with questionnaires, video recordings, and measurement, and they are meant to find causes and consequences of the building performances. • Diagnostic POEs are the most in-depth analyses, with high levels of user privacy invasiveness and high costs, since they can imply the use of sensor systems to monitor the building, providing data to analyze and optimize building performances and future designs.
Despite being expensive and invasive for user privacy, especially when performing diagnostic analyses, POEs can have several benefits, ranging from the optimization of the operational phase in terms of performances and user satisfaction, to an increased facility adaptation to organizational change and growth over time [27,30], and to the definition of design criteria and requirements based on actual user and space needs for similar buildings [39].

From Building Information Models to Digital Twins for Asset Management
In recent years, a major evolution of Building Information Modelling (BIM) occurred in the construction sector. BIM models are parametric models, centralized sources of information mostly for the design and construction phases, and instruments to improve collaboration among specialists and document management [40]. The application of BIM for facility management can result in several benefits: customer services improvement, time and cost reduction resulting from better planning capabilities, and higher consistency of data [41,42]. The integration of POEs in a BIM approach enables the connection between POE data and the digital model [8,12,43], with the advantages of defining a single source and storage of POE and building data, integrating structured data into the BIM, and identifying POE data and related issues in a visual representation of the building space [8,44,45]. Despite the advantages of adopting BIM during the operational phase, a BIM approach for asset management lacks of information richness, analysis, and simulation capability, which are usually manually implemented and time-consuming when using a BIM model [20]. In addition, an effective and efficient management of buildings during the operational phase strongly rely on continuous flows of real time data regarding the building, its performances, and conditions [20,46]. However, BIM models present limitations for the integration with different data sources and systems, e.g., sensor data, and lack of automatic updating and evolution over time [20]. Therefore, in order to overcome these limitations, the definition of a Digital Twin is investigated.

Evolution of the Digital Twin Concept
The Digital Twin (DT) concept dates back in 2002 when the idea of a virtual space containing the information of and linked to the real space emerged in the field of study of complex systems, in particular regarding the Product Lifecycle Management (PLM) [19]. When the concept emerged, it was not referred to as DT, but it was presented as the "Conceptual Ideal for PLM" [19], evolved then to Mirrored Spaces Model in 2005 [47] and to Information Mirroring Model in 2006 [48] and 2011, when also the term Digital Twin was first used to describe the model [49]. In recent years, the concept of a DT has been studied also in the aerospace sector: the DT represents an ultra-realistic digital replica of real flying vehicles, considering one or more interconnected systems allowing for probabilistic simulations that take into account physical characteristics and models, sensor data, and history of previous flights and vehicles [50][51][52]. Recent definitions of DTs can be found in various sectors, with a wide use and diffusion of the concept of a virtual replica of physical entities whose purpose is to manage, optimize, and control the physical asset itself. In the infrastructure sector, DT was defined as a realistic virtual representation of the corresponding infrastructure, adding the built or natural context in which the object is contained and to which it is connected [53]. In the manufacturing sector, the idea of the connection between physical components and virtual models is widened, adding the necessary mono-or bi-directional flow of data between the physical asset and its virtual counterpart in order to real-time monitoring the actual object, supporting simulations, analytics, and control capabilities of the dynamic virtual model [54]. The construction industry can be still considered in its beginning regarding the definition of a DT for buildings. Despite the various attempts to define a DT in construction industry [21,24,53,55,56], a comprehensive definition was proposed by Al-Sehrawy and Kumar [57]: "an approach for connecting a physical system to its virtual representation via bidirectional communication (with or without human in the loop) using temporally updated Big Data [ . . . ] to allow for exploitation of Artificial Intelligence and Big Data Analytics by harnessing this data to unlock value through optimization and prediction of future state". This definition includes all the fundamental parts of a DT, which are described in detail in the following paragraph.

Elements and Characteristics of a Digital Twin
As stated, a DT is composed by some elements. A list of components for DTs in construction industry is provided as follows: • A physical asset and its virtual counterpart, and data connecting them [23]; • Platform to visualize and manage sensor data, e.g., data and virtual model visualization, analysis, and simulation, which is a key aspect for real-time remote monitoring [23]. The platform should return insights, alerts, or predictions regarding the physical object, thus supporting the decision-making process for the definition of O&M objectives and plans [40,58]; • An acquisition layer such as an IoT system [40,46,53,59], since sensing is a vital component of a DT [60][61][62][63], allowing for continuous monitoring of the physical asset. The virtual component enriched with real-time data regarding the real object represents a dynamic digital replica of the physical asset [46,53]; • BIM model as a starting point, especially as regards the geometrical virtual replica of the building, allowing for the evolution and information enrichment of the BIM model itself [20,23]; • Artificial intelligence (AI) tools to analyze data and provide predictions, simulations, and data analytics [20,46].
In addition, some characteristics are fundamental for the correct definition of a DT: • Synchronization between physical and virtual component [40], with data flowing at least in one direction allowing for analyses, control, and simulation on the virtual model [20,46,64]. Any change in the monitored characteristics or conditions of the asset is detected and, through data flow, is reflected in the virtual counterpart [20,21]; • Bidirectional communication between physical and virtual part, either with or without humans in the loop, defining a Passive DT or an Active DT, respectively [57]. The knowledge regarding the asset provided by the virtual part results in either human intervention of direct actuation in the real asset [21]; • A DT represents specific and selected aspects of the physical asset, i.e., the subjects of monitoring, simulating, and analyzing, so it does not represent an exact duplication of reality [57]; • Data or status visualization capabilities in order to support the monitoring and decision-making processes by the actors that are in charge of the asset O&M phase [46].
As previously specified, one of the main characteristics of a DT is the direct connection between physical and virtual entity, with the concept of twinning as alignment and reciprocity between the two components [19]. Therefore, a fundamental aspect for the definition of a DT is the data collection process, i.e., data quantity, quality, and granularity, on which depends the correct detection of changes of the real object over time, and thus the correspondence of the digital object to the real one and its continuous evolution through the building lifecycle [20][21][22]. A first fundamental step is the selection of sensor types that are most suitable for each specific application [23]. In addition, the spatial distribution of sensor network, i.e., the spatial distribution of sensors in the indoor spaces, is another theme that should be faced [24]. Furthermore, in order to allow a correct detection and collection of data, the IoT sensor system should be properly set and calibrated [25,26] to ensure the quality of data collected. In fact, the output of an analysis strongly depends on the data that are used as input for the system or algorithm; therefore, to obtain satisfactory results, data quality is essential [22]. Nonetheless, existing studies tend to focus on different phases and aspects of the DT definition and creation, while IoT sensor system definition is a less investigated aspect, almost taken for granted [23].
As stated above, a fundamental preliminary step is a detailed analysis of sensor types in order to identify the most suitable ones for the research objectives. Such analysis is described in the following paragraph, in which existing studies regarding types of sensors for occupancy detection are analyzed, highlighting features, pros, and cons. In addition, a brief review of the concept of occupancy detection is provided. The investigation supported the selection of the sensor type for the case study, as explained in the following methodology section.

Occupancy Detection: Analysis of Occupancy Monitoring Systems
Occupancy detection consists in the definition of occupancy levels and patterns of buildings during the operational phase. Occupancy patterns consist of occupancy values at room-level and user movements inside the building [65]. Monitoring occupancy patterns and optimizing the use of spaces and cleaning activities, based on occupancy data, can increase user satisfaction and productivity at work. In fact, occupancy levels of buildings have a strong influence on cleanness and use of spaces that, in turn, are strongly related to well-being, satisfaction, and productivity of users [5,6]. Table 1 focuses on IoT monitoring sensor systems studies, highlighting main features, pros, and cons.
As shown in Table 1, camera-based sensors and PIR (Passive Infra-Red) sensors present the best accuracy levels, followed by CO 2 sensors, but they are also affected by detecting and privacy issues [9], such as the Hawthorne effect for camera-based sensors. It mainly causes alterations of behavior when users are aware of being observed and, if ignored, can affect the reliability of collected data [26]. One strategy implies the combination of more types of sensors, some of which may already exist in the building, having been previously installed for other purposes [9]. Additionally, system implementation costs can be reduced by previously analyzing the building with Indicative POE analyses in order to identify the most critical areas to be further analyzed [27,32] by means of sensor systems and other techniques. Table 1. Sensor systems and related features to monitor occupancy.

Sensor Type Main Aspects Pros Cons
Camera-based sensors [25,26] Average accuracy of 97% The highlighted advantages and disadvantages of existing sensor types supported the selection of the type of sensors for the methodology and case study, as described in the following section.

Research Project Stages
This paper presents some stages of an ongoing research project. The aim of the research project is to define a Building Management Systems (BMS) based on an occupancyoriented Digital Twin (DT), evolving from and enriching the Building Information Model (BIM) and integrating occupancy levels and additional relevant data from Post-Occupancy Evaluations (POEs). The expected results of the research project are: monitoring occupancy and defining building occupancy patterns, optimizing current O&M management, building space use and organization, cleaning activities, and, as possible future implementations, applying Smart Contract to cleaning and maintenance services and extending the IoT network with other kind of sensors for safety and quality control. The research project stages are presented in Figure 1.
The first two stages, "definition of BIM guidelines" and "BIM model creation", have been previously analyzed in a publication by Di Giuda et al. [75]. "Preliminary analyses", "system installation", and "test campaigns" are presented in this paper, as they are critical to provide the foundations upon which the occupancy-oriented DT should be based.
The "occupancy-oriented DT" set of activities is currently under development. In future steps of the research, collected data will be analyzed to identify occupancy patterns of the building spaces, and evaluate current management of spaces in terms of people permanence and cleaning frequency. In addition, benchmarks to evaluate optimization strategies will be defined together with the subjects in charge of O&M in the case study building, a fundamental step to evaluate advantages and results of the methodology [76]. The defined occupancy-oriented DT will be the base for the subsequent phase, i.e., "FM scenario definition and optimization", that will allow the optimization of cleaning activities and contracts that are currently based on the building floor areas, and to reach a better organization and planning of space usage.  The integration of other kinds of sensors, such as "sensors for safety (man down) and quality control" will allow the monitoring and optimization of different aspects of the building management, resulting in a complete report of building conditions and indoor environmental quality. In addition, a possible future implementation of the system will be the definition of "smart contracts for facility management and cleaning activities" that would be based on the actual need of cleaning defined in previous stages. Smart Contract based on Blockchain technologies and on the occupancy-oriented DT data will provide relevant advantages, i.e., increased network security, reliable data storage, traceability [77], and the possible automation of payments for cleaning activities [78,79].

Method
This section provides the methodology applied for the "preliminary analyses" and "test campaigns" stages, analyzed in detail in this article. The "system installation" task was performed by an external consulting company that provided and installed the IoT sensor network, and the platform SophyAI for visualization, storage, and download of collected data.

IoT Network of Camera-Based Sensors
The "sensors analysis and selection" phase relies on the proposed literature review. As previously stated, most analyzed recent applications aimed at optimizing energy performances and consumptions rather than building operation and use [9,12,16]. Nonetheless, existing studies allowed objectively comparing several available sensor types, supporting the selection of the most suitable type for occupancy monitoring.
Camera-based sensors were selected considering their high accuracy and the possibility to perform other kind of analyses, such as security and safety monitoring, thus allowing for further implementations of new features in the system, increasing the scalability of the system itself.
The limitations of camera-based sensors that have been presented in the literature review section, and how they have been overcome, are described as follows: • Detection only within field-of-view of the sensors: the BIM model was used to ensure the best positioning and orientation of sensors and to maximize the area covered by the sensors' field-of-view; • Privacy issues and Hawthorne effect: the system was set to anonymously monitor users and not to store any images. The user is recognized as a human by the deep learning algorithm embedded in the camera-based sensors and translated into an anonymous agent that cannot be linked to a specific user identity. Consequently, the movements of the user can be anonymously monitored in real time and visualized in the online platform SophyAI, without storing any real image or video recording.
The sensors can detect occupancy; in particular, they can visualize real time movements of users that are instantaneously transformed into anonymous virtual agents.
The detection of anonymous real-time movements of users is limited to common spaces, i.e., circulation areas and corridors, and they can be visualized in the online platform SophyAI, but are not stored in the database (DB), to protect the users' privacy. On the contrary, sensors count and store the number of agents that are entering or leaving rooms, which are the main objects of monitoring.
Two values are recorded by the sensors for each monitored room: • O: Occupancy values at room-level, i.e., the number of people (p) occupying a room in a certain period of time; • T: Period of time in which one or more virtual agents occupy a room (minutes/hours).

Visualization and Analysis Platform
A critical theme for real-time monitoring is the possibility of plotting sensors data for visualization, verification, and analyses [23]. Data visualization is a primary subject to support decision-making processes and to help people who are in charge of O&M in reaching management goals, since they may not possess the technical ability to effectively use the indexes and information directly extracted by the sensor system [58].
As shown in Figure 2, the described monitoring system is intertwined with the online platform SophyAI. The platform can: Data stored in the online platform DB can then be downloaded as CSV files that contain the values of O and T for all days of a specified period of time, which could be a week, a month, or a year. In addition, data can be processed in graphs and diagrams and visualized through the online platform.
The online platform displays a 2D visualization of the spaces. Each monitored area is contained in a 2D boundary, which defines the contours of the area itself. The check between the area displayed in the 2D visualization and the 3D view of the same area detected by cameras is a key aspect to correct the optical distortion between the 3D view of the camera and the 2D view of the online platform. The check between 2D boundary and 3D view was performed as a part of the study during the system test and calibration, as described in following paragraphs.

Preliminary Analyses Based on Post-Occupancy Evaluations and Building Information Modelling
This phase applies Indicative POEs to preliminary analyze the building by means of general and low-invasive analyses, using the BIM model:

•
Analysis of the geometry of spaces: identification of number of levels of the building and number and geometry of rooms. The geometry of spaces influences the number and position of cameras that are needed to monitor the whole space. In addition, the height of spaces represents the maximum height at which the sensor can be installed, and in turn influences the field-of-view of the sensor; • Analysis of the functions of spaces: identification of the function of spaces, e.g., bathroom, office, equipment room, etc. The function of spaces influences the definition of the area to be monitored. For example, an equipment room with no variable occupancy, since only technicians can enter the rooms for planned maintenance, does not represent a critical area for occupancy monitoring. As a result, the critical areas whose variable occupancy needs to be monitored are identified. The installation of sensors is limited to the identified critical areas, thus reducing implementation costs of the overall system; • Analysis of electrical and data and communication systems: analysis of presence, distribution, and equipment of electrical equipment. A non-homogeneous distribution of the electrical and data wiring can in fact represent a limitation for sensors installation; • Simulation of sensors location and orientation: virtual objects representing the sensors are placed into the BIM model, and each virtual sensor is linked to a field-of-view to simulate the area covered and seen by the sensor itself. The height of installation of the sensor also influences the field-of-view. The simulation of several configurations allows the optimization of number, position, and orientation of sensors, maximizing the area covered by sensors.
The use of the BIM model as a source of information and simulation tool to perform the Indicative POE ensures the minimization of user privacy invasiveness. In addition, the sensor system plan is optimized by comparing different configurations.

Test Campaign Methodology for Data Quality Evaluation
The preliminary analyses allow for an efficient planning and installation of sensors, selecting critical areas to be monitored, and optimizing spatial distribution, orientations, and fields-of-view of sensors. Nonetheless, after the first phases of data collection, some errors and faults, described in the following paragraph, may occur, and the system needs to be calibrated to ensure data quality. An incorrect calibration would lead to incorrect data collection and to an erroneous modelling of the occupancy patterns of the spaces, with repercussions on the whole BMS.
The iterative process to perform the "test campaigns" (Figure 1) is presented in detail in Figure 3 and described in the following paragraphs. Once the system is installed as planned with the support of preliminary analyses, data are collected for a representative period of time that should be identified for each case study. Then collected data are downloaded in CSV format from the online platform DB. Collected data are analyzed in order to identify the possible data errors and related system faults, as described in Table 2. If no faults that could compromise the following analyses are detected, the system is properly functioning and calibrated. Otherwise, test campaigns are performed to verify the errors detected in the collected data.
The real time test campaign involves two operators. One operator (operator A) monitors through the online platform the position and movements of the other operator (operator B) inside the building. The two operators are constantly connected via earphones to communicate and coordinate with each other. In particular, operator A guides operator B towards the areas where errors were previously detected in the collected data. Moving inside the building and entering/exiting the rooms, operator B tests the detection of user movements and the room occupancy count (O) by the system. At the same time, operator A monitors the response of the system by checking the real-time displayed user movements and instantaneous values of O of the rooms through the online platform. Consequently, the operators search for detection errors and system faults in order to identify the causes, as described in Table 2. System faults can be classified as missing data, outliers, stuck values, and noise. Each fault can be identified in collected data or during test campaigns according to specific values of O. In addition, noise can be detected only during real-time test campaigns, by comparing the movements of operator B and his anonymous digital counterpart displayed on the online platform. Some examples of the causes of the errors and faults are camera malfunctioning in the case of missing data and extreme lighting contrast in the monitored area, which impedes a correct detection and causes noisy data. Once the causes of data errors and faults are identified, some adjustments are proposed and applied to the system. Then the system must be verified again, in an iterative process, until no errors are detected and consequently the required data quality level is reached. This iterative process is also useful to check overtime the effectiveness of improvement solutions or to check the system after geometry changes in the building, e.g., in the case of refurbishments.
Regarding the possible adjustments to solve the errors and the related causes, some general rules were identified to define a hierarchy of possible solutions.
Generally, the most preferable solution would be not acting on the hardware of the system: in the case of a recently added physical obstacle that prevents the camera-based sensor from detecting, the most preferable solution would be moving the object before moving the sensor. In addition, before acting on the hardware part of the system (e.g., adding or replacing cameras), the camera settings could be checked, and the software system would be improved. An example of camera setting adjustment is the modification of contrast and luminance settings of the camera in the case of extreme lighting contrast in the monitored area. In addition, modifying the software is faster, less invasive, and cheaper than working on the hardware. Specifically, the deep learning algorithms of the embedded artificial intelligence system of the cameras for image recognition could be improved and optimized with the support of the external consulting company Laser Navigation srl. Consequently, the adjustments are hierarchized based on those general rules using the following symbols: from the most preferable solution, identified with (++), to the least preferable one, identified with (-).

Case Study
The building chosen as case study hosts the Department of Architecture, Built Environment and Construction Engineering (DABC) of Politecnico di Milano, and is located in Milan (Italy). It is a four-story building, hosting administrative offices, research spaces, and university staff offices, for a total of 4300 square meters of gross floor area. Rooms have variable dimensions depending on their use. The building has a symmetrical layout, with a common space in the center and two side corridors. The offices and workspaces are located on either sides of the corridors. Each floor houses at least one bathroom. Before the current study, the building has never been monitored. Therefore, neither data regarding the actual occupancy patterns, nor information about actual cleaning and maintenance activities are currently analyzed and optimized. Furthermore, no space optimization has been performed in relation to the use of available rooms and the actual occupancy indexes at room-level in the building. This case study building acts as prototype for a future application of the proposed method to other university's buildings.
The case study section is divided in two subsections: the first one describes the application and results of preliminary analyses on the building that supported the planning and installation of the IoT sensor system; the second subsection describes the two test campaigns with specific focus on the detected system faults and related proposed adjustments.

Preliminary Analyses: Sensors Spatial Distribution and Orientation
A preliminary study of the building ("Indicative POE supported by BIM model" phase as in Figure 1) was performed to identify critical areas to be monitored and to optimize number, position, and orientation of sensors, which in turn allowed the reduction of implementation costs and proper planning of the IoT sensor system.
As described in the methodology section, the preliminary analyses included the following activities that are analyzed in detail in the following paragraphs: • Analysis of the functions of spaces; • Analysis of the geometry of spaces; • Simulation of sensors location and orientation; • Analysis of electrical and data and communication systems.

Analysis of the Functions of Spaces
The analysis of the building through the BIM model allowed the identification of number and type of rooms of the building, as shown in Table 3. The BIM model had been previously defined and modeled, as described in Di Giuda et al. [75], who also performed a complete survey to update the as-built documents and to ensure the correspondence between the BIM model and the building. Equipment rooms, storage closets, and archives were excluded, since the only users are cleaning services employees or technicians in charge of maintenance activities. The analyses highlighted that sensors installed in common spaces, i.e., corridors, would be sufficient to monitor room occupancy, i.e., the count of users entering and leaving rooms. Anonymous real-time agent movements are detected only in corridors and can be visualized in the online platform, but are not stored in the DB, to ensure and protect the privacy of users. On the contrary, as regards rooms, the count of number of users (O) and time of occupancy (T) is recorded, as shown in Table 3. The occupancy of critical rooms is monitored to optimize their use, cleanness, and maintenance, while corridors are considered only as circulation areas. As shown in Table 3, 70 rooms out of 87 were selected as critical areas to be monitored.

Analysis of the Geometry of Spaces and Simulation of Sensors Location and Orientation
During the preliminary phases regarding the system planning, the BIM model of the building was used to optimize locations and orientations of the camera-based sensors. The geometry analysis highlighted that the building corridors are long, low ceiling, and narrow (length: 32 m; height: 2.40-2.70 m; width: 1.60 m). Three simulations of the interrelated position of the sensors in a corridor have been performed to define the best configuration. Virtual objects representing the sensors were added to the BIM model in different locations according to the three possible configurations. Each virtual sensor was then linked to a field-of-view that allowed to virtually check through the model the area covered by each sensor. The BIM-based simulation analyzed three possible configurations, as shown in Figure 4:

•
The first solution considered two standard cameras at the two opposite sides of the corridor. Each corridor would be entirely monitored by two sensors at the same time, but in the central area, the detection could be less precise due to the distance from the sensors. In addition, cameras would have difficulty in monitoring areas near the end of the corridor, i.e., the area close to each sensor. Users passing through a door near the end of the corridor would be extremely distorted in the view of the nearby camera, making recognition difficult.

•
The second solution considered two standard camera-based sensors located at 1/3 and 2/3 of the corridor. This solution allows for a better monitoring of the end areas of corridors, but limits the simultaneous monitoring by both sensors to the central area only.

•
The third solution implied the use of a single 360-degree camera at the center of the corridor. Those kind of sensors are more expensive than standard cameras, but the total cost would be comparable, since this solution would consider only one sensor instead of two. This solution results in the corridor being entirely monitored by a single camera.
The chosen solution was the second one, since in many cases there are doors near the end of corridors, thus excluding the first solution. In addition, due to the reduced width of the corridors, one single camera could struggle in identifying two people walking lined up. Therefore, the third solution, which involved only one camera, was also less preferable than the second one.
The chosen sensors are High Quality Bullet Pro Camera PoE, with the following features: they provide HD quality images; the Power over Ethernet (PoE) allows to supply power and network connection to the camera with a single cable; a Wide Dynamic Range (WDR) allows to compensate problems due to exposure to light; the view angle of the camera reaches a maximum of 110 degrees. The system is installed in a dedicated Virtual Local Area Network (VLAN), and a static IP is provided for each element of the system. As stated in the Introduction, the sensor system was provided by a third-party organization, Laser Navigation Srl, who operated in full compliance with EU General Data Protection Regulation (GDPR). In fact, the deep learning algorithm does not record images, but only metadata regarding the anonymous movements and count of users are processed by the system, inhibiting the recognition of the observed subjects.
The 20 sensors were installed directly in the ceiling, i.e., at height 2.40/2.70 m depending on the level of the building, ensuring the maximum coverage area. Figure 5 shows the plan of the IoT sensors system in the case study building. The BIM model also allowed for an optimization of the field-of-view of the sensors, as shown in Figure 6. The virtual camera field-of-view simulation supported the definition of the best orientation, i.e., the best tilt angle of each camera on x-and y-axis. This ensured that all the offices and bathrooms defined as critical, whose occupancy needed to be monitored, were correctly detected by the sensors.

Analysis of Electrical and Data and Communication Systems
The last preliminary analysis performed with the BIM model was the check of the electrical and data system equipment and wiring distribution already available in the building. The analysis showed that since cameras would be installed in corridors, all the necessary wiring was already available. Therefore, no implementation was needed to install the system.

Test Campaigns
Once the preliminary analyses had been performed, the system had been installed. First data collection was performed, and collected data were analyzed to identify issues and faults. Data were collected during a three-month period, i.e., the representative period, as it is the minimum period of time to encounter all possible activities conducted by the users of the department. A qualitative analysis was conducted on the collected dataset to identify rough errors. Figure 7 shows a graph of collected data about a bathroom during one day. Stuck values are identified since 4 p.m., because the occupancy raises but never decreases. It is a stuck value because the bathroom can host only one person at a time; therefore, a continuous occupancy of four people represents without any doubt a blunder in the detection. The solution to this specific problem is provided in Table 4.
After faults of the system were detected, a first test campaign was performed to understand the causes and propose improvements for the system. Detected data were tested in real time by two operators, as described in the method, to identify the causes of system faults. An example of the visualization of real time data in the online platform is shown in Figure 8.  This first test campaign was followed by a second test campaign, to properly calibrate the system and ensure detected data quality, as shown in Figure 9. The two test campaigns were carried out during different periods of the year. This represented a key aspect for the recognition of lighting contrast issues. The first test campaign was performed in June 2020, with data collection for a three-month period from November 2019 to January 2020. The first test campaign was performed after the end of the first Italian shutdown period due to COVID-19 pandemic (early March-early June 2020). The second test campaign was performed in November 2020, with data collected for another three-month period from July to October 2020, excluding August, during which the building is usually under-occupied due to summer holidays. After the shutdown period March-June 2020, administrative and research activities have been resumed. Therefore, all the data collected for system test and calibration can be considered reliable. Table 4. Identified issues and effects on the data collecting system during the test campaigns. Table legend: (a): data collection phase; (b): real-time test campaign phase; O: occupancy values at room-level, number of people occupying the room (p); T: period of time in which users occupy a room (minutes/hours); adjustments hierarchy scale ranging from (++) most preferable system adjustment to (-) least preferable system adjustment.

Cause Identification and Effects on the System Proposed Hierarchized Adjustments
Data are not detected and collected. Behaviors of users that deceive the detection system: difficulty in counting users when they are standing in front of the door opening the room or talking right in front of the entry of a room (++) Add an automatic routine to the algorithm that records the occupancy data after a minimum user presence (+) Add an automatic routine to the algorithm that brings the count back to 0 when the displayed count is negative. (-) Enrich the system with the possibility of manually resetting rooms occupancy values in the presence of a wrong count (only in Administrator mode).
Unexpected length of the period of time the room is occupied (for bathrooms).(An example is shown in Figure 7) The system detects: Too high distance of the camera from the to-be-detected area: irregular detection of users with a continuous detection/disappearance of a moving user, resulting in wrong collected data, as if there were multiple users closely entering the room one after the other (++) Improve the deep learning algorithms for image recognition (-) Add new cameras and re-verify the system Elevated lighting contrast between different areas of corridors: irregular detection of users with a continuous detection/disappearance of a moving user, resulting in wrong collected data, as if there were multiple users closely entering the room one after the other (++) Review the camera settings regarding lighting and contrast (-) Add a new camera in the brighter zone and re-verify the system Table 4. Cont.

Cause Identification and Effects on the System Proposed Hierarchized Adjustments
Unexpected moment of the day in which the room is continuously occupied (for offices) The system detects:  Table 4 provides a resume of errors, related evaluation criteria, fault identification and classification, causes of the faults, and proposed solutions, hierarchized and listed from the most preferable one (++) to the least preferable one (-) of the two test campaigns.

Results and Discussion
The first test campaign highlighted the following issues: • Difficulty of the system in detecting two people entering in a room close together and/or quickly; • Issues in the detection of two people walking in a corridor towards a sensor, since the person further away from the camera is not detected. The error occurs in all areas not covered by the fields of view of two cameras at the same time; • Irregular detection of users with a continuous detection/disappearance of a moving user due to the high distance between the camera and the to-be-detected area. This issue was in fact detected mainly in areas far from the sensors.
The identified issues are mainly due to the geometry of corridors, which are low ceiling, long, and narrow. Due to the limited height of the corridor, the cameras struggle in detecting people walking in groups or lined up ( Figure 10). The issues led to an incorrect user detection affecting the displayed data in the online platform. However, while the possibility of having people walking lined up or in groups in corridors is relatively high, the probability of two or more people entering a room simultaneously is low, due to the standard dimensions of the doors, that allow the entrance of one person at a time. For this reason, it is possible to ignore these issues. To overcome the issue related to irregular detection of users due to the distance of areas from the camera, improvement in the deep learning algorithms for image recognition were implemented. Considering the online platform, a major issue was related to the values indicating the presence of people in the rooms showing a negative value or a high positive value. This means that, according to the collected data, many people were entering or leaving the room in a very short time. Automatic routines to solve and mitigate incorrect data have been implemented to the software:

•
Automatism that brings the count back to 0 when the displayed count is negative; • Possibility to manually reset rooms that present a wrong count; • Automatic routine that records the occupancy data after a minimum user presence (i.e., 5 min) for office spaces only.
The improvement of the automatic routine solves the related problem of users' behavior that deceive the detection system, such as standing in front of the door when opening the office or talking right in front of the entry of a room.
After the modifications and improvements applied, data have been collected for a period of three months from July to October 2020, excluding August for lower building occupancy due to summer holidays, to verify the effectiveness of the strategies adopted.
The qualitative analysis of the second dataset highlighted a general improvement in detection capabilities of the system, since technical issues were not identified anymore, but some faults occurred anyway. Therefore, a second real-time test campaign was carried out in November 2020, resulting in the following sensor-related issues: • Difficulty in detecting users at the end of the corridors due to the presence of windows.  Figure 11). The issue can only be managed by adding new cameras to cover the unexpected blind spots. The issue was unexpected, since doors are usually kept closed when offices are occupied. • Issues in the recognition of cleaning service company employees. The system struggled in detecting the workers due to the presence of the cleaning trolley, which impeded a complete view of the operator. The cleaning trolley provoked an incorrect counting of entries, exits, and occupancy of the rooms. To overcome the issue, the recognition algorithm can be optimized and trained to correctly recognize the cleaning service operator, by recognizing the cleaning trolley. Figure 11. Unexpected blind zone generated by unusual occupants' behavior. Figure 12 presents the percentages of error types detected during the two test campaigns. During the first test campaign, 30 out of 70 monitored rooms presented detection faults, while during the second test campaign, 38 rooms presented detection issues. The reason of the higher number of faults during the second test campaign is mainly due to the lighting issues that emerged only during the second test campaign.
During the first test campaign, 70% of errors were related to technical issues: 17% of errors due to not-working cameras, and 53% of errors due to difficulty detecting users in areas too far from the camera-based sensors. As shown in Figure 12, these types of technical issues were completely fixed by adjusting the system settings. Once all cameras were properly working and correctly set, those issues did not occur in subsequent analyses.
Another type of issue detected in the first test campaign was related to unexpected user behavior, resulting in 30% of errors. These errors could be adjusted with some improvements in the system. However, a 3% of errors due to unexpected user behavior occurred also during the second test campaign. Despite the error percentage being significantly lower in the second test campaign, this type of error could not be completely avoided because of the unpredictable nature and high variability of user behavior.
Regarding the second test campaign, elevated lighting contrasts between different areas of corridors caused 68% of errors. This kind of error was never detected during the first test campaign because of the different period of the year when the test was performed, a key aspect for proper calibration of a camera-based sensors system. The remaining 30% of errors of the second test campaign were related to difficulties detecting the cleaning employee (18%) and to obstructions and obstacles that impeded the detection (11%). Cleaning employee detection issues were classified as a technical error in the first campaign. After the resolution of technical issues, the error persisted, and the actual cause was identified, highlighting the importance of a multi-stage testing of the system. Detection issues related to obstacles and obstructions appeared because some pieces of furniture were moved or spaces were reorganized. The frequent check of the correct functioning of the system overtime is fundamental to verify newly appeared issues and consequently adjust and improve the system.
A comparison of these results with other systems could be helpful to provide an assessment of the proposed system. As previously underlined, the setting and calibration of monitoring system has frequently been neglected in existing literature, and the accuracy of IoT systems applied to DTs is often taken for granted. Available data regard, as shown in Table 1, the accuracy of specific sensors' typologies, but do not address the accuracy of systems, which depends on several variables, e.g., building features and use, number of sensors, etc. The test campaigns here presented have been used to explore and improve the efficiency of the entire systems of DT.
For this reasons, these results obtained from the case-study building cannot be compared to other systems, based on different typologies of sensors. The provided case study application is useful to define guidelines to calibrate IoT camera-based sensors system.

Conclusions and Further Developments
This work presents the development of first steps of an ongoing research project to define a Building Management System (BMS) for facility management, especially regarding the occupancy and cleaning activities in office buildings that would be based on an occupancy-oriented Digital Twin (DT). The proposed BMS would ensure better space management, organization, and cleaning, since the system would detect actual occupancy levels and related needs for cleaning activities. The advantages result in optimizations of cost and space use, as well as customized cleaning activities and contracts.
In particular, this study presented the IoT system calibration phases, i.e., the preliminary analyses to optimize the planning of the IoT camera-based sensors system, and the test campaigns, in order to ensure the system efficiency and accuracy to monitor occupancy.
A key aspect of the definition of a DT has been in fact identified in the data connection between physical asset and virtual counterpart, the main components of a DT. In addition, the data quality is a critical aspect to ensure the quality of the results of the analyses, simulations, and predictions performed on the virtual model.
The case study section highlighted that the preliminary analyses, i.e., Indicative Post-Occupancy Evaluations (POE) supported by the use of the BIM model, were important to plan the IoT system, in particular as regards number, locations, and orientation of the sensors. The analyses allowed the identification of offices and bathrooms as main spaces to be monitored. In addition, the observed configuration of building spaces allowed planning the sensors installation only in corridors, from which it is possible to detect entries and exits from the different rooms. The BIM model allowed for simulations of sensors location and fields-of-view.
As regards the two test campaigns results, some system faults and related causes were identified and solved. The issues generated by user behavior were the least predictable, trivial, and at the same time the most difficult and expensive to solve, requiring the installation of new cameras. The variability of human behavior inside a building is very high; the calibration of the system must cover a sufficient period of time to bring out all problems related to human behaviors. Considering the complexity of the monitoring system and the high dynamicity of the variables involved (e.g., fast-changing spatial conditions and user behavior), a multi-stage test and calibration campaign was fundamental for the correct setting of a camera-based sensor system.
Another interesting aspect resulting from the test campaigns was the influence that the period of the year had on the test itself, due to changing lighting conditions.
Other relevant aspects are the geometric features of the to-be-monitored spaces. For example, the limited width and height of the corridors led to some difficulties in detecting more users moving together. However, those issues did not have critical effects on the collected data. The boundary conditions of the system should be carefully checked, as they could have negative consequences on collected data and on data analyses.
The use of an online platform was useful to real-time check and evaluate data during the test campaigns, as well as to remote controlling the monitoring system.
Once the system is tested and assessed, further developments of the research will regard the proper monitoring of the building. As of now, qualitative analyses have been performed on collected dataset to identify rough errors, and by means of the two test campaigns, the causes of the faults have been identified and solved. During the next phases of the research project, quantitative analyses will be conducted on collected datasets, which will be the basis for the definition of the occupancy-oriented DT. DT analyses and simulations, and resulting optimization scenarios, will be proposed and analyzed to identify real advantages and limitations of the proposed methodology. The proposed method, once completely tested and refined on the case study building, could be extended to large building stock, supporting the decision-making process of building owners and building managers.
Potential applications of the system would entail the integration of other kind of sensors to monitor Indoor Air Quality (IAQ), carbon dioxide, temperature, humidity, and Volatile Organic Compounds (VOC) levels, resulting in a more complete evaluation of the building conditions and Indoor Environmental Quality (IEQ). Sensors could play an important role for safety management purposes. The combined use of the system with Smart Contract and Blockchain technology could ensure increased network security, reliable data storage, traceability of data, and the possible automation of payments for cleaning activities. Cleaning contracts could in fact be customized based on the actual use of spaces, detected by the proposed system.