Design of a New Method for Detection of Occupancy in the Smart Home Using an FBG Sensor

This article introduces a new way of using a fibre Bragg grating (FBG) sensor for detecting the presence and number of occupants in the monitored space in a smart home (SH). CO2 sensors are used to determine the CO2 concentration of the monitored rooms in an SH. CO2 sensors can also be used for occupancy recognition of the monitored spaces in SH. To determine the presence of occupants in the monitored rooms of the SH, the newly devised method of CO2 prediction, by means of an artificial neural network (ANN) with a scaled conjugate gradient (SCG) algorithm using measurements of typical operational technical quantities (indoor temperature, relative humidity indoor and CO2 concentration in the SH) is used. The goal of the experiments is to verify the possibility of using the FBG sensor in order to unambiguously detect the number of occupants in the selected room (R104) and, at the same time, to harness the newly proposed method of CO2 prediction with ANN SCG for recognition of the SH occupancy status and the SH spatial location (rooms R104, R203, and R204) of an occupant. The designed experiments will verify the possibility of using a minimum number of sensors for measuring the non-electric quantities of indoor temperature and indoor relative humidity and the possibility of monitoring the presence of occupants in the SH using CO2 prediction by means of the ANN SCG method with ANN learning for the data obtained from only one room (R203). The prediction accuracy exceeded 90% in certain experiments. The uniqueness and innovativeness of the described solution lie in the integrated multidisciplinary application of technological procedures (the BACnet technology control SH, FBG sensors) and mathematical methods (ANN prediction with SCG algorithm, the adaptive filtration with an LMS algorithm) employed for the recognition of number persons and occupancy recognition of selected monitored rooms of SH.


Introduction
Recognizing the occupancy, number of individuals, location-and-movement recognition and activity recognition of an individual in an indoor space is one the key functionalities of a smart home (SH), as a prerequisite to providing services to support independent living of elderly SH occupants and has a great influence on internal loads and HVAC (heating, ventilation and air conditioning) requirement, thus increasing the energy consumption optimization. Azghandi et al. focused on the particular case of an SH with multiple occupants, they developed a location-and-movement recognition method using many inexpensive passive infrared (PIR) motion sensors and a small number of more

Fiber Bragg Grating (FBG) Sensor Using for Recognition of Number Occupants in Smart Home (SH) Room R104
Bragg gratings (FBG) are special structures created by an ultraviolet (UV) laser inside the core of a photosensitive optical fibre. This structure consists of a periodic structure of changes in the refractive index, where the layers of the refractive index of the core alternate with the layers of the increased refractive index (1): where is the refractive index induced by UV radiation [16]. When a broad-spectrum light is introduced into the optical fibre, the Bragg grating reflects a narrow spectral portion and all the other wavelengths pass through the structure without damping ( Figure 2).

Fiber Bragg Grating (FBG) Sensor Using for Recognition of Number Occupants in Smart Home (SH) Room R104
Bragg gratings (FBG) are special structures created by an ultraviolet (UV) laser inside the core of a photosensitive optical fibre. This structure consists of a periodic structure of changes in the refractive index, where the layers of the refractive index of the core n 1 alternate with the layers of the increased refractive index n 3 (1): where δn is the refractive index induced by UV radiation [16]. When a broad-spectrum light is introduced into the optical fibre, the Bragg grating reflects a narrow spectral portion and all the other wavelengths pass through the structure without damping ( Figure 2). Sensors 2020, 20, x FOR PEER REVIEW 3 of 29 3. Experimental verification of the method with ANN SCG that was devised for CO2 concentration prediction (more one-day measurements in the period from 25 June 2018, to 28 June 2018) to locate an occupant (in rooms R104, R203, and R204) in an SH with the highest possible accuracy. 4. Experimental verification of the possibility of ANN learning for one room only (R203) in order to predict CO2 concentrations in other rooms (R104, R204).
The experimental measurements of objective parameters of the internal environment and thermal comfort evaluation were conducted in selected SH rooms R204, R203, and R104 in a wooden building of the passive standard located in the Faculty of Civil Engineering, VSB-TU Ostrava. (Figure 1) [14].

Fiber Bragg Grating (FBG) Sensor Using for Recognition of Number Occupants in Smart Home (SH) Room R104
Bragg gratings (FBG) are special structures created by an ultraviolet (UV) laser inside the core of a photosensitive optical fibre. This structure consists of a periodic structure of changes in the refractive index, where the layers of the refractive index of the core alternate with the layers of the increased refractive index (1): where is the refractive index induced by UV radiation [16]. When a broad-spectrum light is introduced into the optical fibre, the Bragg grating reflects a narrow spectral portion and all the other wavelengths pass through the structure without damping ( Figure 2).  The central wavelength of the reflected spectral portion is called the Bragg wavelength λ B and is defined by the optical and geometric properties of the structure according to (2): where n e f f is the effective refractive index of the periodic structure and Λ is the distance between the periodic changes in the refractive index. The external effects of the temperature and the deformation influence the optical and geometric properties and thus, the spectral position of the Bragg wavelength. Thanks to this feature, Bragg gratings are used in sensory applications. The dependence of the Bragg wavelength on the deformation and the temperature is expressed by (3): where k is the deformation coefficient, ε is the optical fibre deformation caused by measurement, α Λ is the coefficient of thermal expansion, α n is the thermo-optic coefficient and ∆T is the change in the operating temperature [17]. Bragg gratings in a standard optical fibre with a central wavelength of 1550 nm show a deformation sensitivity of 1.1 pm/µstrain and a temperature sensitivity of 10.3 pm/ • C. By using a suitable encapsulation, it is possible to implement a sensor of almost any physical quantity. FBG sensors are used in automobile [18] and railway transport [19], the construction industry [20], power engineering, biomedical [21] or perimetric applications [22], etc.
Bragg gratings are single-point sensors. By using a wavelength or time multiplex, it is possible to connect tens or hundreds of these sensors in a single optical fibre in order to achieve a quasi-distributed sensory system [23].

Fiberglass Bragg Sensors
One of the most widespread applications of Bragg gratings includes deformation and compression measurements. Depending on the type of application, Bragg gratings can be encapsulated in many ways. The principle of the encapsulation is to protect the fragile glass fibre, to enhance the sensitivity to the desired quantity and to suppress the surrounding interference. Bragg gratings can be encapsulated in polymers [24] of fibreglass or composite materials [25,26], and special steel jigs [27], which are mechanically attached to the structure that is to be measured, etc. Based on the advantages of using Bragg gratings-such as their reliable and very accurate measurement-these types of sensors were used for the reference measurement of the occupancy recognition of room R104 in the SH.
Because the grating sensors were installed on a wooden staircase, the encapsulation of Bragg gratings in fibreglass strips was used. This method enables the implementation of a very thin sensor that transmits deformations from the step (passage of persons) to the optical fibre itself.
Two Bragg gratings in a single-mode optical fibre with primary acrylate protection were used for implementing the sensors. Bragg gratings A and B had the following parameters: The Bragg wavelengths were 1547.510 nm and 1552.369 nm, respectively; the reflection spectrum width was 256 pm and 227 pm, respectively; the reflectivity was 91.2% and 91.3%, respectively. Each Bragg grating was placed between the glass fabrics (2 layers below and 2 layers above the optical fibre). The glass fabric was then coated with a polymer resin. The actual curing caused a Bragg wavelength shift of 23 µm for Sensor A and of 19 µm for Sensor B to lower wavelengths ( Figure 3). The Bragg grating is located in the middle of the fibreglass strip, marked in red.
Sensors 2020, 20, 398 5 of 31 for implementing the sensors. Bragg gratings A and B had the following parameters: The Bragg wavelengths were 1547.510 nm and 1552.369 nm, respectively; the reflection spectrum width was 256 pm and 227 pm, respectively; the reflectivity was 91.2% and 91.3%, respectively. Each Bragg grating was placed between the glass fabrics (2 layers below and 2 layers above the optical fibre). The glass fabric was then coated with a polymer resin. The actual curing caused a Bragg wavelength shift of 23 µm for Sensor A and of 19 µm for Sensor B to lower wavelengths ( Figure 3). The Bragg grating is located in the middle of the fibreglass strip, marked in red.
(a) (b) Figure 3. Implementation of the sensor by encapsulating the Bragg grating in fibreglass (a); the resulting fibre Bragg grating (FBG) fibreglass sensor (b).

Implementation of FBG Sensors
FBG sensors were implemented on the staircase leading from the ground floor to the first floor ( Figure 4). The sensors were glued with cyanoacrylate adhesive to the bottom of the second step (FBG A) and the third step (FBG B).
Sensors 2020, 20, x FOR PEER REVIEW 5 of 29 Figure 3. Implementation of the sensor by encapsulating the Bragg grating in fibreglass (a); the resulting fibre Bragg grating (FBG) fibreglass sensor (b).

Implementation of FBG Sensors
FBG sensors were implemented on the staircase leading from the ground floor to the first floor ( Figure 4). The sensors were glued with cyanoacrylate adhesive to the bottom of the second step (FBG A) and the third step (FBG B).

Use of a CO2 Sensor Network for Monitoring SH Space Occupancy
Common CO2 sensors can be used to detect the occupancy of individual SH spaces. In room R104, the BT 12.09 sensor ( Figure 5), in room R203 the BT 12.10 sensor and in room R204 the BT 12.10 sensor ( Figure 6) were used for measuring the CO2 concentration in the framework of forced Air Condition (AC) control ( Figure 7). The BACnet technology is used in the SH to control HVAC ( Figure  8). The presence of occupants in the SH can be detected by measuring the CO2 concentration. Figure  5 shows the ground plan of the ground floor of the SH with the location of the individual sensors for CO2 measurement.

Use of a CO 2 Sensor Network for Monitoring SH Space Occupancy
Common CO 2 sensors can be used to detect the occupancy of individual SH spaces. In room R104, the BT 12.09 sensor ( Figure 5), in room R203 the BT 12.10 sensor and in room R204 the BT 12.10 sensor ( Figure 6) were used for measuring the CO 2 concentration in the framework of forced Air Condition (AC) control ( Figure 7). The BACnet technology is used in the SH to control HVAC ( Figure 8). The presence of occupants in the SH can be detected by measuring the CO 2 concentration. Figure 5 shows the ground plan of the ground floor of the SH with the location of the individual sensors for CO 2 measurement.
Sensors 2020, 20, 398 6 of 31 R104, the BT 12.09 sensor ( Figure 5), in room R203 the BT 12.10 sensor and in room R204 the BT 12.10 sensor ( Figure 6) were used for measuring the CO2 concentration in the framework of forced Air Condition (AC) control ( Figure 7). The BACnet technology is used in the SH to control HVAC ( Figure  8). The presence of occupants in the SH can be detected by measuring the CO2 concentration. Figure  5 shows the ground plan of the ground floor of the SH with the location of the individual sensors for CO2 measurement. The individual rooms on the ground floor of the SH are marked as follows ( Figure 5):    The individual rooms on the SH first floor are marked as follows ( Figure 6): R205-toilet and bathroom.     A block diagram containing a description of the individual components and function blocks within the BACnet technology in the SH for HVAC control is shown in Figure 8.   A block diagram containing a description of the individual components and function blocks within the BACnet technology in the SH for HVAC control is shown in Figure 8.

The Design of the New Method for CO2 Prediction
The newly devised method for CO2 prediction from the temperature indoor and relative humidity indoor values measured by means of ANN SCG (multiple one-day measurements) was used for the location of an occupant (in rooms R104, R203 a R204) in SH with the highest possible accuracy. Block diagram of processing the quantities measured in SH for multiple one-day The individual rooms on the ground floor of the SH are marked as follows ( Figure 5): R104-entrance room; FBG sensor is placed on the staircase, • R105-utility room, there are heating sources, • R106-classroom. Figure 6 shows the ground plan of the first floor of the SH with the location of the individual sensors for CO 2 measurement.
The individual rooms on the SH first floor are marked as follows ( Figure 6): R205-toilet and bathroom.  A block diagram containing a description of the individual components and function blocks within the BACnet technology in the SH for HVAC control is shown in Figure 8.

The Design of the New Method for CO 2 Prediction
The newly devised method for CO 2 prediction from the temperature indoor and relative humidity indoor values measured by means of ANN SCG (multiple one-day measurements) was used for the location of an occupant (in rooms R104, R203 a R204) in SH with the highest possible accuracy. Block diagram of processing the quantities measured in SH for multiple one-day measurements in the period from 25 June 2018, to 28 June 2018, using the method devised for CO 2 prediction by means of ANN SCG is shown in Figure 9.
Sensors 2020, 20, x FOR PEER REVIEW 8 of 29 measurements in the period from 25 June 2018, to 28 June 2018, using the method devised for CO2 prediction by means of ANN SCG is shown in Figure 9. The measured values that were used in these experiments are the indoor CO2 concentration, indoor relative humidity and indoor temperature. The data were pre-processed to improve the efficiency of neural network training. That means that data were normalized so that all the values are between 0 and 1 ( Figure 10, Step 1). In Matlab, the function nftool (neural fitting) was used with neurons varying from 10 to 100 and the three methods previously mentioned. The data samples were divided into 3 sets: training (used The measured values that were used in these experiments are the indoor CO 2 concentration, indoor relative humidity and indoor temperature. The data were pre-processed to improve the efficiency of neural network training. That means that data were normalized so that all the values are between 0 and 1 ( Figure 10, Step 1). gradient artificial neural network (ANN SCG) within the method devised for CO2 prediction.
The measured values that were used in these experiments are the indoor CO2 concentration, indoor relative humidity and indoor temperature. The data were pre-processed to improve the efficiency of neural network training. That means that data were normalized so that all the values are between 0 and 1 ( Figure 10, Step 1). In Matlab, the function nftool (neural fitting) was used with neurons varying from 10 to 100 and the three methods previously mentioned. The data samples were divided into 3 sets: training (used to teach the network), validation and testing (provides an independent measure of the network training) ( Figure 10, Step 2). After training the networks with data measured on 25 July for room 203, the 90 networks were used to predict data for the rest of the dates from the same room, as well as the two others. Since the learning date was different from the prediction dates, this was called "crossvalidation". In this step, the function used in Matlab was 'nntool' ( Figure 10, Step 3). Once the results were ready, the next step was to calculate some parameters that would allow us to quantify the precision of the results, and, therefore, compare the prediction quality between the different ANN SCG ( Figure 10, Step 4).
The three parameters we relied on for our experiments are as follows. R (correlation coefficient) is a statistical measure that calculates the strength of the relationship between the relative movements of two variables and is calculated with the formula (4). The values range between −1 and 1. A value of exactly 1.0 means there is a perfect positive relationship between the two variables. For a positive increase in one variable, there is also a positive increase in the second variable. A value of −1.0 means there is a perfect negative relationship between the two variables. This shows that the variables move in opposite directions-for a positive increase in one variable, there is a decrease in the second variable. If the correlation is 0, there is no relationship between the two variables [28]. In Matlab, the function nftool (neural fitting) was used with neurons varying from 10 to 100 and the three methods previously mentioned. The data samples were divided into 3 sets: training (used to teach the network), validation and testing (provides an independent measure of the network training) ( Figure 10, Step 2). After training the networks with data measured on 25 July for room 203, the 90 networks were used to predict data for the rest of the dates from the same room, as well as the two others. Since the learning date was different from the prediction dates, this was called "cross-validation". In this step, the function used in Matlab was 'nntool' ( Figure 10, Step 3). Once the results were ready, the next step was to calculate some parameters that would allow us to quantify the precision of the results, and, therefore, compare the prediction quality between the different ANN SCG ( Figure 10, Step 4).
The three parameters we relied on for our experiments are as follows. R (correlation coefficient) is a statistical measure that calculates the strength of the relationship between the relative movements of two variables and is calculated with the formula (4). The values range between −1 and 1. A value of exactly 1.0 means there is a perfect positive relationship between the two variables. For a positive increase in one variable, there is also a positive increase in the second variable. A value of −1.0 means there is a perfect negative relationship between the two variables. This shows that the variables move in opposite directions-for a positive increase in one variable, there is a decrease in the second variable. If the correlation is 0, there is no relationship between the two variables [28].
The MSE (mean squared error) parameter describes how close a regression line is to a set of points and is calculated with formula (5). It does this by taking the distances from the points to the regression line (these distances are the "errors") and squaring them. The squaring is necessary to remove any negative signs. It also gives more weight to larger differences. It is called the mean squared error as you are finding the average of a set of errors [29]: MAPE (average absolute percentage error) is a statistical measurement parameter of how accurate a forecast system is. It measures this accuracy as a percentage, and it can be calculated as the average absolute percent error for each time period minus actual values divided by actual values which are given by (6) [30]: y i : reference value, y * i : predicted value, n: total number of values, x, y: mean of x, y.
After calculating the MAPE, MSE, and R correlation parameters, we plot two figures. The first one has a reference and predicted CO 2 over time ( Figures 18,20 and 22) and the second one is a Bland-Altmann plot (Figures 19, 21 and 23). The Bland-Altman technique allows us to make a comparison between two measurement methods of the same sample. It was established by J. Martin Bland and Douglas G. Altman. Essentially, it quantifies the difference between measurements using a graphical method. It consists of a scatterplot with the average and the difference represented on the X-axis and the Y-axis, respectively. The plot also has horizontal lines drawn at the mean difference and at the limits of agreement, which are defined as the mean difference plus and minus 1.96 times the standard deviation of the differences (Figure 10, Step 5). The final step is to compare the results and the plots, so as to decide which conditions and which methods are optimal for future predictions.
The procedure used to carry out the learning process in the neural networks is called optimization algorithms. In the following experiments, a ANN SCG type of mathematical algorithm was used to train the ANNs.

Scaled Conjugate Gradient Algorithm:
SCG is a supervised learning algorithm for feedforward neural networks and is a member of the class of conjugate gradient methods (CGMs). Let p = exp −∆E T be a vector, N the sum of the number of weights and of the number of biases of the network, and E the error function we want to minimize. SCG differs from other conjugate gradient methods in two ways [31]: Each iteration k of a CGM computes ω i , where R N is a new conjugate direction, and ω k+1 = ω k + α k .p k is the size of the step in this direction. In fact, p k is a function of α k , the Hessian matrix of the error function, namely the matrix of the second derivatives. In contrast to other CGMs that avoid the complex computation of the Hessian and approximate α k with a time-consuming line search procedure, SCG makes the following simple approximation of the term E (ω k ), a key component of the computation of α k : s k [32] as the Hessian is not always positive, which prevents the algorithm from achieving good performance; SCG uses a scalar α k which is supposed to regulate the indefiniteness of the Hessian. This resembles the Levenberg-Marquardt method, and is performed by using the following equation (7) [33]: and adjusting λ k at each iteration. The final step is to compare the results and the plots, so as to decide which conditions and which methods are optimal for future predictions [34].

The Signed-Regressor LMS Adaptive Filter
The signed-regressor LMS adaptive filter was used to filter the predicted course in order to determine the occupancy of the monitored areas more precisely (Figures 19, 21, 23, 26, 28 and 30).

The Conventional LMS Algorithm
The LMS algorithm is a linear adaptive filtering algorithm, which consists of two basic processes: (a) a filtering process, which involves computing the output y(n) of the linear filter in response to an input signal x(n) (8), generating an estimation error e(n) by comparing this output y(n) with the desired response d(n) (9), (b) an adaptive process (10), which involves the automatic adjustment of the parameters w(n+1) of the filter in accordance with the estimation error e(n).

The Signed-Regressor LMS Algorithm
The signed-regressor algorithm is obtained from the conventional recursion (10) by replacing the tap-input vector x(n) with the vector sign(x(n)), where the sign function is applied to the vector x(n) on an element-by-element basis. The signed-regressor recursion is then [35]:

Using Fiber Bragg Grating Sensor for Recognition of Number of Occupants in SH Room R104
The results of the experiments to detect the number of occupants in the monitored space of room R104 are described below. On 25 June 2018, we installed the individual sensors (FBG A and FBG B) on the staircase in room R104 ( Figure 4). The actual measurement to unambiguously detect the number of occupants in the monitored space took place from 25 to 28 June 2018. The record of the continuous measurement conducted in the period from 25 to 28 June 2018, is shown in Figure 11. These are signals from the Bragg sensors where the individual peaks represent persons treading on a particular step. Blue shows the waveform of the FBG A sensor on the second step and red shows the signal from FBG B sensor on the third step. To detect the number of occupants on the first floor, an algorithm was implemented in the MATLAB (Matrix Laboratory) computational software environment. The algorithm is based on the detection of peaks (treading on the step) from both FBG sensors. The time-corresponding peaks were compared over time, while the direction of the passage (up or down) was detected based on earlier treading on the first or second step. The number of occupants on the first floor was detected using a counter. The occupancy waveform of the first floor is shown in Figure 12. To detect the number of occupants on the first floor, an algorithm was implemented in the MATLAB (Matrix Laboratory) computational software environment. The algorithm is based on the detection of peaks (treading on the step) from both FBG sensors. The time-corresponding peaks were compared over time, while the direction of the passage (up or down) was detected based on earlier treading on the first or second step. The number of occupants on the first floor was detected using a counter. The occupancy waveform of the first floor is shown in Figure 12.
To detect the number of occupants on the first floor, an algorithm was implemented in the MATLAB (Matrix Laboratory) computational software environment. The algorithm is based on the detection of peaks (treading on the step) from both FBG sensors. The time-corresponding peaks were compared over time, while the direction of the passage (up or down) was detected based on earlier treading on the first or second step. The number of occupants on the first floor was detected using a counter. The occupancy waveform of the first floor is shown in Figure 12. The number of occupants can be detected from the following Table 1: The number of occupants can be detected from the following Table 1:

Discussion-Experiment 3.1:
On the basis of measuring the movement of occupants on the staircase in room R104 using FBG sensors in the period from 26 to 29 June 2019, it is possible to clearly identify the number of occupants ( Figure 12 Table 1). The drawback of this method of using the FBG sensor to detect the number of occupants in the monitored space is the lack of information on the occupancy of the monitored space of R104 in the SH. This drawback has been eliminated by adding CO 2 sensors to rooms R104, R203 and R204 in experiment 2, which is described below.

Use of CO 2 Sensors for Monitoring SH Space Occupancy
CO 2 sensors (R104 (BT12.09), R203 (BT12.10), R204 (BT12.11)) can be used to detect occupancy of the monitored spaces (rooms R104, R203, R204) in the SH (Figures 5 and 6); these sensors are used to control the quality of the indoor environment in these rooms using BACnet technology in the SH (Figure 7). To control HVAC in SH (Figure 7), other CO 2 sensors which provide "measurement at the fresh outdoor air inlet into QPA 2062 SH (BT 12.01) were used; measurement at the recirculation air inlet from SH spaces into the QPM 2162 heat recovery unit (BT 12.02); measurement at the recirculation air inlet from SH spaces into the QPA 2062 heat recovery unit (BT 12.03); measurement in the QFA 2060 heat recovery unit (BT 12.04); measurement at the recirculation and fresh air outlet from the heat recovery unit into the QFM 2160 SH (BT 12.05); measurement at the exhaust air inlet into the QFM 2160 recuperation unit (BT 12.06); measurement at the exhaust air outlet from the QPA 2062 recuperation unit (BT 12.07); measurement at the recirculation air inlet from SH spaces into the QPM 2162 heat recovery unit (BT 12.08)".

Discussion-Experiment 3.2:
Using the information from the FBG sensor ( Figure 13), it is possible to unambiguously detect the number of occupants present in the monitored space. Based on the measured values (CO 2 concentration), it is possible to detect the occupancy of the monitored SH spaces, the arrival of a person into the monitored room or the exit from the monitored space, or the length of stay in the monitored space (Figures 14-16). The aforementioned procedure enables the unambiguous determination of the occupancy rate of the monitored SH spaces, indirectly by measuring common non-electrical quantities (CO 2 ) within the operational-technical function control in the SH.
Due to the higher costs of acquiring CO2 sensors, we proposed the possibility of lowering the initial investment costs for larger administrative buildings by providing information about the occupancy of the individual rooms within the newly devised method of CO2 prediction. The mathematical method of ANN SCG was used to predict the waveform of CO2 concentration using the values measured from indoor temperature (Tin) and indoor relative humidity (rHin) sensors. The experiments performed within the newly devised method are presented in the following text.

Experimental Verification of the Method with the Devised Artificial Neural Network (ANN) Scaled Conjugate Gradient (SCG)
The conditions of experiments 3.3a and 3.3b were as follows. The experiments were performed for the waveforms of temperature (Tin), relative humidity (rHin) and CO2 concentration measured on 26 June 2018, 27 June 2018, and 28 June 2018, (step 1) for rooms R104, R203 and R204 ( Figure 17). However, if the building is of an administrative type, the acquisition of CO 2 sensors for dozens of rooms is a major investment. In market research, we ascertained that CO 2 sensors are two to three times (in some cases, greater) more expensive than temperature and humidity sensors, which are, moreover, a common part of individual rooms in administrative buildings in the Czech Republic.
Due to the higher costs of acquiring CO 2 sensors, we proposed the possibility of lowering the initial investment costs for larger administrative buildings by providing information about the occupancy of the individual rooms within the newly devised method of CO 2 prediction. The mathematical method of ANN SCG was used to predict the waveform of CO 2 concentration using the values measured from indoor temperature (T in ) and indoor relative humidity (rH in ) sensors. The experiments performed within the newly devised method are presented in the following text.

Experimental Verification of the Method with the Devised Artificial Neural Network (ANN) Scaled Conjugate Gradient (SCG)
The conditions of experiments 3.3a and 3.3b were as follows. The experiments were performed for the waveforms of temperature (T in ), relative humidity (rH in ) and CO 2 concentration measured on 26 June 2018, 27 June 2018, and 28 June 2018, (step 1) for rooms R104, R203 and R204 (Figure 17).

Experimental Verification of the Method with the Devised Artificial Neural Network (ANN) Scaled Conjugate Gradient (SCG)
The conditions of experiments 3.3a and 3.3b were as follows. The experiments were performed for the waveforms of temperature (Tin), relative humidity (rHin) and CO2 concentration measured on 26 June 2018, 27 June 2018, and 28 June 2018, (step 1) for rooms R104, R203 and R204 (Figure 17). Furthermore, the measured data were pre-processed (step 2) ( Figure 17). The design of the prediction system structure (step 3), the implementation (step 4) and ANN SCG training (step 5) for CO2 prediction using two input values of temperature (Tin) and relative humidity (rHin) were carried Furthermore, the measured data were pre-processed (step 2) ( Figure 17). The design of the prediction system structure (step 3), the implementation (step 4) and ANN SCG training (step 5) for CO 2 prediction using two input values of temperature (T in ) and relative humidity (rH in ) were carried out. The ANN SCG structure designed ( Figure 18) for experiment 3.3a was trained (step 5) for the temperature (T in ), relative humidity (rH in ) and CO 2 concentration values measured in room R203. The actual CO 2 prediction (step 6) was implemented for the data measured in rooms R104, R203 and R204. To increase the accuracy of the newly devised method, an additional quantity from the FBG sensor containing the number of occupants in the monitored space of R104 was added to the original two input quantities. The ANN SCG structure designed for experiment 3.3b for CO 2 prediction using three input quantities-temperature (T in ), relative humidity (rH in ) and the number of occupants (FBG sensor). The procedure for performing the experiments was the same as that described in Figure 17. Experiment 3.3a: Input values, Tin and rHin, to ANN SCG for prediction of CO2 in rooms R203, R204, and R104 ( Figure 18). Prediction of CO2 in rooms R203, R204, R104 for the dates 26, 27 and 28 June 2018 with inputs Tin and rHin, using learned ANN SCG (Figure 18) from 25 June 2018. Tables 2-4 show R, MSE and MAPE parameter values, followed by plots of reference and predicted CO2, as well as Bland-Altmann plots in rooms 203 (Figures 19 and 20), 204 (Figures 21 and 22) and 104 (Figures 23 and 24).

Experiment 3.3a:
Input values, T in and rH in , to ANN SCG for prediction of CO 2 in rooms R203, R204, and R104 ( Figure 18). Prediction of CO 2 in rooms R203, R204, R104 for the dates 26, 27 and 28 June 2018 with inputs T in and rH in , using learned ANN SCG ( Figure 18) from 25 June 2018. Tables 2-4 show R, MSE and MAPE parameter values, followed by plots of reference and predicted CO 2 , as well as Bland-Altmann plots in rooms 203 (Figures 19 and 20), 204 (Figures 21 and 22) and 104 (Figures 23 and 24).                                (Figures 19 and 20). This is because ANN SCG learned for the data measured on 25 June 2018, in room R203 was used for CO 2 prediction. By contrast, the worst calculated result was detected for ANN SCG in room R104 (Table 4), where R = 21.88 (%), MSE = 1.21 × 10 −2 and MAPE = 21.47 × 10 −2 for a 10 ANN SCG neurons. This is because room R104 was the furthest away from room R203 for which ANN SCG was learned.
As for the CO 2 prediction, the best result within the designed three-day experiments using the FBG sensor for learned ANN SCG from 25 June 2018, in R203 (with T in , rH in and the FBG sensor for PPM) and prediction with cross-validation for 26 June 2018, in R203, R204, R104 (with T in , rH in and the FBG sensor for PPM), 27 June 2018, in R203, R204, R104 (with T in , rH in and the FBG sensor for PPM), 28 June 2018, in R203, R204, R104 (with T in , rH in and the FBG sensor for PPM) was detected for ANN SCG-number of neurons = 60 in room R203 (Figures 26 and 27), (Table 5), where, on 26 June 2018, R = 92.81 (%), MSE = 0.40 × 10 −2 , and MAPE = 21.55 × 10 −2 . This is because ANN SCG learned for the data measured on 25 June 2018, in room R203 was used for CO 2 prediction. By contrast, the worst calculated result was detected for ANN SCG in room R204 (Table 6), where R = 21.45 (%), MSE = 1.11 × 10 −2 , and MAPE = 20.39 × 10 −2 , for 10 ANN SCG neurons. This is because there was no FBG sensor in room R204 to detect the presence of persons.
Based on the graphs illustrated in Figures 32a-c and 33a-c, it can be stated that one universal learned ANN SCG cannot be used for the most accurate calculation of CO 2 prediction for all SH spaces. In our experiments, ANN SCG was learned for the data measured in room R203 on 25 June 2018. The calculated values of the verification parameters measured (R coefficient, MSE and MAPE) in Tables 2 and 5 (Figures 19, 20, 26 and 27) indicate that, in order to achieve the greatest accuracy of CO 2 prediction, it is necessary that ANN SCG is always learned for a specific room, for a specific monitored space in the SH. The expectations related to the use of the FBG sensor to increase the accuracy of CO 2 prediction by means of ANN SCG were not fulfilled in the above-mentioned experiments (Figures 32 and 33). However, the use of the FBG sensor in the SH is very useful from the point of view of a robust and stable solution for recognizing the number of occupants in the monitored SH spaces or intelligent administrative buildings. The mathematical method with ANN SCG is not the most suitable for the devised CO 2 prediction method. For greater accuracy, it is necessary to implement filter algorithms [28] to remove additive noise from the predicted CO 2 concentration waveform. Based on the results achieved and described above, further experiments on CO 2 prediction will be conducted using more precise mathematical methods [29][30][31][32][33][34][37][38][39] within the IoT platform [40].

Conclusions
In order to detect the occupancy of the individual SH spaces by indirect methods (without using cameras), common operational and technical sensors were used in the experiments conducted to measure the indoor temperature, the indoor relative humidity and the indoor CO 2 concentration within the BACnet technology for HVAC control in the SH.
Based on the experiments conducted in rooms R104, R203 and R204, it is possible to unambiguously detect the suitability of the sensors used for measuring the CO 2 concentration in order to detect the occupancy and the length of stay in the monitored SH space. Moreover, the CO 2 sensors used in the technology that were exclusively for HVAC control in the SH can be used to detect the occupancy and the length of stay in the monitored spaces, which will make the required information more accurate.
From the perspective of cost reduction, a method for predicting the CO 2 concentration waveform by means of ANN SCG from the indoor temperature and indoor relative humidity values measured were devised and verified for the space location of an occupant (in rooms R104, R203, and R204) in the SH with the highest possible accuracy. The ANN SCG mathematical method used does not achieve such accuracy compared to the methods used in [28][29][30] and [34,[37][38][39][40]. For selected experiments, nevertheless, the correlation coefficient in this article was greater than 90%. An increase in the correlation coefficient value can be achieved by using filter methods for suppressing additive noise from the predicted CO 2 concentration waveform [28]. In the experiments conducted, we verified that, for each monitored space in the SH, the ANN SCG should be learned so that the CO 2 prediction was as accurate as possible.
The FBG sensor was used to unambiguously detect the number of occupants in the monitored space of room R104. The experiments confirmed the suitability of using FBG sensors for reasons of robustness, accuracy and high reliability in the detection of the number of occupants moving in the monitored SH or Intelligent Building space without the need to deploy cameras. The experiments did not confirm the assumption that the input value of the presence of occupants added from the FBG sensor to the ANN SCG will make the prediction of the CO 2 concentration using the ANN SCG method more accurate.
The application of FBG sensors in a passive SH is described. These sensors are electrically passive, while allowing the evaluation of multiple quantities at the same time, and with suitable encapsulation of FBG, the sensor is immune to EMI (electromagnetic interference). Due to its small size and weight, implementation in an SH is both straightforward and cost-effective. Using a spectral approach, tens of FBG sensors can be evaluated using a single evaluation unit [21].
In the next work, the authors will focus on verifying the practical implementation of the method devised for CO 2 prediction in an SH for monitoring the occupancy of the SH within the IoT platform [40].