3.3. Establishment of DTM for Indoor Safety
3.3.1. Information Needed to Characterise DTM
In the management system framework, a DTM corresponding to a real physical building must be built in the virtual digital world through modelling by engineers, the IoT, Internet, etc. In order to achieve the scene monitoring of the safety status and danger positioning with the scene, the 3D geometric information of buildings must be depicted. The information on the building materials, material manufacturers, and other aspects does not need to be depicted. Additionally, the DTM must contain information generated during building operation, including the indoor temperature, oxygen concentration, carbon-monoxide concentration, smoke concentration, opening and closing statuses of doors and windows, number of indoor personnel, and time.
3.3.2. Processing of BIM Model
To realise the flexible access of the system using different terminals, including personal computers, tablets, and smartphones, a B/S structure was used for the proposed system. The BIM model must be uploaded so that users can access it on the webpage via the Internet and browse the indoor layouts of buildings. The BIM model of a building contains many types of professional information, such as geometric information, structural information, equipment information, and material information. The objective of this study was to use a BIM model for building layout information. It does not need structural, electrical, or other such information; therefore, this information was excluded, and only the building geometric information was retained in the BIM model. Additionally, the model was exported into an IFC file. Then, the file was read in a JavaScript environment to realise a light-weighted BIM model for improving the loading and running speeds of the BIM model on the webpage. The lightweight BIM model was loaded on the webpage through WebGL technology, which realised the 3D visualisation of the building layout and provided a 3D scene for the safety monitoring and danger positioning. The 3D visual effect of the building layout on the webpage is shown in
Figure 3.
3.3.3. Construction of IoT Structure
For the collection of operating data, this paper proposes an IoT system which comprises a perception layer, a transport layer, a service layer, and an application layer, as shown in
Figure 4. This study uses Low-Power Wide-Area Network (LPWAN) to build an IoT system. LPWAN is a form of IoT with a lower power consumption and wider transmission range than the traditional IoT. In this study, LoRa technology was used in the LPWAN, which is essentially a spread spectrum modulation technology. Spread spectrum modulation technology has been widely used in the military and aviation fields, and LoRa technology is a low-cost wireless communication solution for manufacturing and other civil fields. In China, LoRa works in the 470/510-MHz ISM bands and can achieve long-distance coverage, with bit rates ranging from 0.37 to 46.9 kbps [
30].
The perception layer includes sensors that are used to measure the operating conditions. The network layer is constructed using LoRa wireless communication technology in an LPWAN, which is used for data transmission. The service layer uses Structured Query Language (SQL) to build a database on the web and uses an SVM algorithm for data analysis and processing to realise safety status monitoring and danger alarms, danger categorisation and classification, and other functions, as well as assisting in the intelligent management of safety. With the help of these functions, the safety management staff can take action to handle danger; thus, the intelligent management of indoor safety in the application layer is realised.
(1) Perception layer.
For the perception layer, indoor environment information acquisition terminals based on the LoRa transmission protocol were developed. The terminal consists of various sensor modules, a LoRa module, a microcontroller unit control module, and a power module. Its structure is shown in
Figure 5. According to the needs of indoor information collection, five types of sensing terminals were developed for sensing the oxygen concentration, carbon-monoxide concentration, smoke concentration, temperature, and opening and closing statuses of doors and windows. The sensor terminals can realise the real-time measurement of the indoor operating information of the building and wirelessly transmit this information to the LoRa gateway. The sensor parameters selected in this study are presented in
Table 1. The terminal that senses the opening and closing of the doors and windows employs changes in potential. The structure of the sensing terminal is shown in
Figure 5. Some of the developed sensor terminals are shown in
Figure 6. In addition to using and developing LoRa-based sensing terminals, the perception layer employs cameras to obtain indoor images, along with image-recognition technology to automatically determine the number of people in the images, as shown in
Figure 7. Additionally, to realise the visualisation and information storage of the corresponding position of the sensor terminal in the BIM model, family library models of different sensor terminals were established to realise terminal visualisation in the BIM model.
(2) Transport layer.
A wireless transmission network based on LoRa technology was constructed. The LoRa wireless network had a star network structure. LoRa technology has the advantage of a high capacity, allowing it to realise the connection of a large number of data-collection terminals with the LoRa gateway. The sensing terminal transmits the indoor safety information obtained by the built-in sensor to the LoRa gateway through the LoRa module. The LoRa gateway then uploads the information to the cloud server through the 4G network, and the local server accesses the cloud server through the Internet to obtain the indoor safety information. A schematic of the network deployment based on LoRa technology is shown in
Figure 8.
(3) Application layer.
The application layer mainly includes the following functional modules: (1) safety status monitoring with a scene, (2) danger classification and level assessment, (3) danger alarm and positioning with a scene, and (4) danger handling suggestions. Each module is described below.
(1) Safety status monitoring with a scene.
This module uploads the data collected by the sensing terminal to the webpage and associates it with the sensor. The model is associated with the camera, whereby the actual situation at the corresponding position in the building can be viewed. The perspective of the camera is fixed, while the layout of the building can be viewed from different directions through the roaming function of the BIM model on the web. When the safety management staff view different rooms from a 3D perspective, the rooms can be monitored by the cameras installed inside. Thus, virtual reality, a fixed perspective, and a mobile perspective are combined in a complementary manner. Additionally, when the model is associated with the sensing terminals, not only can the position of the terminals be observed, but also the collected data can be viewed. The data can be updated with the information collected by the sensing terminal to monitor the environmental data of the building. The interface rendering is shown in
Figure 9.
(2) Danger classification and level assessment.
At present, the evaluation of the level and types of dangers mainly depends on the evaluation of safety management staff; thus, it is highly dependent on people and inefficient. This paper proposes a method where an SVM is used to analyse the collected building operating data for realising automatic danger assessment. The assessment includes the classification of danger types and the determination of danger levels. This study focused on three types of dangers—illegal invasion, overcrowding, and fire—which were divided into three levels: safe, potentially dangerous, and dangerous.
(3) Danger alarm and positioning with a scene.
To achieve the warning function for the danger victims and manufacturers, this function module is responsible for sending out alarm signals on the webpage and transmitting the signal to the alarm device in the corresponding room to sound an alarm when the room is in danger. When the BIM model of the terminal corresponding to the real position is established, a unique number is assigned to the terminal. The 3D layout of the room and the corresponding video surveillance screen can be automatically searched according to the terminal number in the room when the room is in danger to identify and locate the danger.
(4) Danger-handling suggestions.
According to the different types and levels of danger, this module provides specific suggestions for danger response, as shown in
Table 2.
The system sends the danger-handling suggestions (together with the 3D scene of the location of the danger) to the safety management staff through the webpage to guide the staff in taking correct measures for dealing with the danger.
3.4. SVM for Intelligent Classification and Level Assessment of Danger
The relationship between danger parameters is complex and cannot be easily characterised with a reliable mathematical expression. For example, in the early stage of fire development, smoke is relatively thick, but the temperature is not high and the danger is relatively small; however, with the development of the fire, the smoke gradually decreases and the temperature increases. Moreover, many factors affect the fire parameters; thus, it is difficult to establish a reliable mathematical relationship between the types of danger, the level of danger, and the parameters.
Machine-learning methods can find complex correlations between independent variables and dependent variables through large amounts of calculations based on a series of samples, leading to reliable classification and regression. Therefore, the use of machine-learning methods to achieve the classification and rating of dangers is one of the methods that can be considered. In this study, to realise the automatic classification and level evaluation of dangers, an SVM was employed to mine the safety data collected by the IoT, and a mature SVM model was trained. Using this model, the automatic classification and level assessment of indoor dangers were realised. For each danger type, an SVM model was used to determine whether it has occurred. The danger level was evaluated using a danger coefficient predicted by an SVM model. A larger danger coefficient corresponded to a higher level of danger.
The specific steps for the intelligent classification and level assessment of dangers are shown in
Figure 10.
(1) Data collection for influencing factors.
The data used in this study for the factors influencing the danger level were from the BIM model and the operating data collected by the IoT. Information regarding the room area, room space relationship, number, and locations of doors and windows was mainly collected from the BIM model. The operating data, including information regarding the opening and closing statuses of doors and windows, temperature, carbon-monoxide concentration, oxygen concentration, smoke concentration, and number of personnel, were mainly collected by the IoT.
(2) Data processing.
The data were divided into numerical data and logical data. The logical data were quantised into numerical data. Numerical data “0” and “1” were used to represent the logical data as “false” and “true”, respectively. The time data were transformed into corresponding numerical data using Equation (1).
Owing to the different dimensions of the influencing parameters, the value ranges of the transformed numerical data differed significantly. The dispersion standardisation method was used to normalise all the transformed numerical data. The transformation equation was as follows:
(3) Selection of training and test sets.
Because the number of samples with danger was significantly smaller than the number of samples without danger, the use of these data for training directly influenced the training effect of the SVM, owing to data skew. Therefore, it was necessary to pre-process the sample. The under-sampling of samples without danger was used to reduce the difference between the numbers of samples with and without danger [
46]. Then, the samples without danger from under-sampling and all the samples with danger were randomly scrambled [
47]. A total of 80% of these samples were randomly selected for model training, and the remaining 20% were used for model testing [
48].
(4) Model training.
The key to model training is to select the proper parameters and kernel functions. In this study, the radial basis function (RBF) was selected as the kernel function because its accuracy and calculation performance are better than those of other kernel functions [
49,
50]. K-fold cross-validation was used to determine the kernel-function parameter and penalty coefficient.
(5) Test and effect evaluation.
Classification of danger types: The test set selected in step 3 was used to test the prediction effect of SVM. Through a comparison between the prediction results and the actual danger of classification, the prediction accuracy was calculated (using Equations (3)–(5)). A higher accuracy corresponded to the better prediction effect of the model.
In the prediction of the danger classification, the calculation of the classification accuracy, precision, and recall rate with the help of a confusion matrix is a common method for evaluating the classification effect. Higher values of these indicators correspond to a better classification effect [
51]. The confusion matrix is shown in
Figure 11, and the accuracy, precision, and recall are calculated using Equations (3)–(5).
Prediction of danger level: In this study, according to the danger level of the experiment, the danger coefficient α was evaluated artificially and recorded. A larger danger factor corresponds to a higher danger level. When there is no danger, α ≤ 1; when there is potential danger, 1 < α ≤ 2; when there is danger, α > 2. The predicted coefficient is classified into the corresponding grade and compared with the actual coefficient. Consistency between the two indicates that the prediction is correct. The prediction accuracy was used to evaluate the prediction effect of the SVM model. A higher accuracy rate corresponded to a better prediction effect. Additionally, in regression prediction, the squared correlation coefficient
R2 is an important indicator for evaluating the prediction effect. An
R2 value closer to 1 corresponds to a better prediction effect.
R2 is calculated using Equation (6).
where
yi represents the true value,
fi represents the predicted value, and
represents the average of all the true values.
When the accuracy of the classification and level division is low, step 4 and step 5 should be repeated. The parameters are adjusted until the accuracy is increased.