1 Introduction

Among common public safety accidents, fire disasters always lead to catastrophic consequences, especially when fire accidents happen in closed spaces such as rail vehicle carriages. Recently, IoT (Internet of things) technologies have been widely adopted for indoor surveillances, such as monitoring home, office buildings, warehouses and so on. These IoT systems are generally based on intrusion detection or video surveillance [1]. For fire prevention in closed public places such as rail vehicle carriages, traditional means detect fire through discovering flame or combustion products in the environment. Since it takes time for firefighters arriving at the places where fire broke out, fast spreading fire may already become disastrous.

In order to meet requirements of preventing fire in closed public places like rail vehicle carriages, this paper proposes detection mechanism for flammable and explosive liquids detection. At present, in various industries, there are many monitoring systems and sensing technologies for such detection requirements. Such as liquid component detection based on infrared or ultrasonic absorption, measurement of gas production based on high-precision combustible gas meters. However, these methods generally require specialized environments, and often rely on expensive equipment, which causes high system construction costs. However, for fire preventing in common small public areas, it is impossible to customize surveillance environment for each scene. This paper proposes the fire detection mechanism in small space based on sensor network, which has low implementation cost as well as high scalability.

We make following contributions in this paper: (1) Extensive experiments have been carried out to verify the feasibility of detecting gasoline volatiles using commercial combustible gas sensor probes; (2) We proposed a judgment logic of anomalous gasoline gas diffusion based on temporal and spatial correlation analysis; (3) This paper presents a framework for the detection of gasoline volatile and data processing based on sensor networks; (4) Extensive experiments have been carried out to verify the effectiveness of the detection system.

This rest of this paper is organized as follows: Sect. 2 puts forward the design motivations of this paper. Section 3 introduces the basic principle of the proposed detection mechanism. Section 4 introduces the framework and detail mechanisms of gas detection. Section 5 verifies the detection performance of the system through real experiments. Section 6 concludes the whole paper.

2 Related Work and Motivations

At present, much work has been done in automatic fire alarm systems [2], of which the most common applications include residential area fire prevention [3], forest fire prevention [4], and coal mine fire prevention [5] and so on. This paper targets at fire detection for small public places, which has the similar design goals as residential fire prevention.

The work on automatic fire prevention for residential areas started very early. Since the 1990s, a series of research results have been published, such as selecting specific sensor sets to form a sensor array, designing a self-learning electronic nose to realize fire signs [6]. With the rapid development of wireless sensor network (WSN) technology in recent years, a considerable part of the work began to design networked automatic fire detection systems. As described in [7], an early fire detection system was developed, which was suitable for fire prevention in open spaces such as rural areas and urban areas. They incorporated temperature sensors and maximum likelihood algorithm to fuse sensory information. In [8], a WSN system for preventing fire accident on the running train was proposed. They monitored the temperature of the coaches to determine the fire. When the ambient temperature exceeds the critical temperature, all the drivers and passengers will be alarmed, the drivers can then manually stop the train and open water sprinkles all over the coaches. In [9], a fire-alarming system for indoor environment was proposed, which is capable of assisting firefighting activities including fire alarming, fire rescuing and firefighter orientation. Since fire usually spread quickly in small indoor environment, fire alarm based on detecting combustion products in the air will largely shorten the emergency response time. Focusing on detecting the flammable and explosive liquid in small public places, this paper tries to trigger fire alarm through detecting fire conditions and is an early warning system.

Since flammable liquids are generally volatile, we propose to detect flammable liquids in small spaces through monitoring the concentrations of target liquid vapors. Combustible gas monitoring is common in petrochemical’s production and transportation [10]. In these applications, usually high-precision gas sensors are needed to accurately measure the concentration of certain type gas in the air. Such sensors usually cost high and only have limited detection ranges [11]. And further, to make these sensors work, usually calibration routines is required, such as calibrating the sensor’s measurement data by venting a volume of standard sample gas (such as hydrogen, isobutene, etc.) in a standard closed space [12]. If we carried out the above calibration operation in a public place, the maintenance cost is unbearable.

Considering above characteristics, we propose the design objectives of this paper as: (1) High abnormal event reporting rate and very low abnormal event false alarm rate; (2) The ability to tolerate a variety of external disturbances such as airflow, temperature and humidity fluctuation, crowd movements in the monitoring spaces; (3) Do not need frequent calibration and maintenance, easy to deploy, and has a relative long working life time.

3 Gas Vapor Diffusion Model

We have tested several combustible gas sensors for their detection capabilities of unknown type of combustible vapor gas, and we choose to use TGS2602 for system implementation.

Gas detection mechanism aims to discover the abnormal gasoline vapor diffusion in the surveilling space as soon as possible. Gas sensors measure nearby gas concentrations, and gas diffusion law determines spacial distribution of gas concentration.

When gasoline is stored in a closed gasoline barrel, or when petrol barrel is open without shaking, gas diffusion process is dominated by smoke plume diffusion. As contrast, when gasoline is suddenly exposed to the air, much gas vapor will spread in short time, and lead to a hybrid diffusion process of mass diffusion and smoke plume diffusion. Figure 1 illustrates smoke plume diffusion process as well as mass diffusion process respectively. Under the smoke plume diffusion model, gas concentration has a relatively stable spatial distribution. Therefore, gas diffusion behavior can be conjectured by analyzing correlations between measurements of the sensors located at different positions. Under mass diffusion model, gas concentration at specific location is time varying.

Fig. 1.
figure 1

Smoke plume diffusion and mass diffusion model

To further explore sensor network’s ability of detecting gasoline diffusion process, we deployed a layered sensor array at the height of 50 cm, and on the ground. As shown in Fig. 2, three groups of six sensor nodes were deployed. The distances between two adjacent groups is 100 cm. In this experiment, air flows from right to left as shown in the figure.

Fig. 2.
figure 2

Detection of gas diffusion process

We collected measurements of the sensor groups after opening the petrol barrel, in an enclosed space and an open space respectively. The measurements are plotted in Figs. 3 and 4.

Fig. 3.
figure 3

Measurement curves of sensors in an enclosed space

Fig. 4.
figure 4

Measurement curves of sensors in an open space

From Fig. 3 we can see that, when air circulation is poor, due to continuous evaporation of gasoline gas in the air, the concentration of gasoline gas appears an upward trend. At the same time, due to air circulation, the gas concentration appears fluctuations. Whereas when the air circulation is good, in the early diffusion stage, the relative gas concentration will significantly increase due to mass diffusion, and then continued to decrease over time. At last, the smoke plume diffusion dominates the diffusion process, and each sensor node presents a stable relative concentration distribution according to its position.

Based on above observations, we conclude typical characteristics of sensor measurements in a gas vapor diffusion process as following: (1) Periodicity: Due to air turbulence, the measurement time series show fluctuations according to time. (2) Correlation: Under the smoke plume diffusion model, the sensors near to each other show certain correlation in the measurements, especially for those deployed between upper and lower layers. (3) Localness: Fluctuations in sensor measurements due to gasoline vapor diffusions are generally limited to a small range without a consistent change in global sensor nodes.

4 Data Acquisition and Alarming Mechanism

From above observations, we define system flows as two parts: (1) The sensor nodes detect local gas concentrations and send them to the sink node after filtering noises. (2) The sink node maintains multiple threads for every sensor node, performs online outlier detection for time series of each sensor node, and then jointly analyzes measurements from multi sensor nodes to judge outlier events.

This section will introduce specific techniques adopted at each stage.

4.1 Data Filtering on Sensor Nodes

In order to remove environmental interferences, we use moving average filter to sampling raw data, and let sensors only send filtered data to the sink node for further processing.

The moving average algorithm work as follows:

  1. (a)

    Maintaining a time window of length N on each sensor node;

  2. (b)

    When new measurement arrives, it replaces the measurement on the tail of the time window, and then the arithmetic average of the N measurements in the time window is took as the sampled value after filtering;

  3. (c)

    The value of N depends on the specific sampling interval.

In order to reduce implementation cost of the system, we try to avoid frequent sensor calibration. But on the other hand, external temperature and humidity fluctuations, as well as instable power supplies will disturb measurement readings. So after data filtering on the sensor nodes, the sink node need to further process the received data flow from distributed sensors. By distinguishing the cause of abnormal data changes, it can determine whether there is abnormal gas diffusion in the current monitoring region.

We use periodicity, correlation and localness characteristics to determine whether there is an exception event by analyzing the temporal and spatial correlation between measurements of different sensors deployed in the monitoring region. We analyze the correlation of different measurements by quantifying time series similarity. For more accurate quantization calculation, it is first needed to extract time series sub-segment from the original time series for matching. In this paper, we use time-series segmentation through extracting important points.

Considering the periodic characteristics of volatile gas concentration variation, we want to choose complete measurement fluctuation period series for analysis. Therefore, we use local extreme points of time series as the key point.

Suppose the measurement time-series of sensor X is represented as \( X = \{ x(t_{i} )\}_{i = 1}^{n} \), wherein \( [x_{i} , \ldots ,x_{(i + a)} ] \) is a subset of the time series. If there is a minimum value \( x_{min} \) or a maximum value \( x_{max} \) in the subset, then these two elements are referred as local minimum and maximum points. The local maximum/minimum point extraction algorithm is as follows:

figure a

Through Algorithm 1, the maximum and minimum points can be extracted to form a new time series \( {\text{y}}(t_{i} )\;i \in \{ 1, \ldots ,n\} ,\;t_{i} \in \{ 1, \ldots ,{\text{m}}\} \), wherein n is the number of the original sequence elements, m is the number of important points, and a is a configurable parameter to control the number of output extreme points.

4.2 Quantifying Similarities Between Time Series

Although the sensor nodes with different distances from the diffusion source have different fluctuation amplitudes in the measured gas concentration curves, they have similar varying patterns. For this feature, we choose to use dynamic time warping distance (DTW) to quantify the morphological similarity between different measurement sequences.

Suppose there are two time series of length m, n respectively:

$$ q[1:m] = \{ q_{1} ,q_{2} , \ldots ,q_{m} \} $$
(1)
$$ {\text{c}}[1:n] = \{ c_{1} ,c_{2} , \ldots ,c_{n} \} $$
(2)

DTW distance for q, c can be calculated by constructing a distance matrix of size m × n, called bending matrix, as shown in Fig. 5.

Fig. 5.
figure 5

Bending matrix to calculate DTW

From bending matrix, the matching between q and c points is transformed into a curved path in the bending matrix from the square(1, 1) to the square(m, n):

$$ {\text{W}} = w_{1} ,w_{2} , \ldots ,w_{l} (\hbox{max} (m,n) \le l \le m + n) $$
(3)

We define a mapping function \( {\text{f}}_{\text{w}} :\left( {q,c} \right) \to W \) that maps the \( \left( {q,c} \right) \) point pairs in the curved path to a square in the curved path:

$$ {\text{w}}_{\text{k}} = f_{w} (q_{i} ,c_{j} ),\;1 \le i \le m,1 \le j \le n,\;1 \le k \le l $$
(4)

Then the problem of calculating DTW distance between q and c is transformed into figuring out a curved path which has the smallest distance in the bending matrix \( W \):

$$ {\text{DTW}}(q,\;c) = \mathop {\arg \hbox{min} }\limits_{w} (\sum\nolimits_{i = 1}^{c} {w_{i} } ) $$
(5)

4.3 Gas Vapor Source Detection

Figure 6 shows outlier detection flow chart of our system. When two time series are normalized, they are considered related if their DTW distance is less than a specified value. If a sensor node reports abnormal time series which are related to other sensor’s reported time series, a potential gas vapor source will be considered in the surveillant carriage by the sink node. If there is no correlation between different sensors’ reports, the sink node will continue observing whether the reporting sensor node will continuous send other abnormal time series pieces. If so, a gas vapor source is also considered near the reporting sensor node is. If a sensor node and the nearby sensor nodes simultaneously appear abnormal fluctuation of the measured value, it is deemed that there is a gas vapor source nearby.

Fig. 6.
figure 6

The flow chart of abnormal gas diffusion judgment

5 Evaluation

We set up an experimental environment as shown in Fig. 7 to test gas vapor diffusion detecting capability. In the experiment, 12 sensor nodes were deployed in two layers in a closed room. Sensors A0, B0, C0, D0, E0 and F0 are deployed on the ground, while sensors A1, B1, C1, D1, E1 and F1 are deployed at the height of 50 cm. The distance between sensors was 2 m in x-axis direction and 2 m in y-axis direction. In the figure, two positions are marked. At position 1, vapor diffusion source (gasoline drum) is 1 m from both the x-axis and the y-axis. At position 2, vapor diffusion source is 1 m from the node C0 and the node D0. The diffusion source is a 5L petrol barrel with a 10 cm diameter lid and 35 cm height.

Fig. 7.
figure 7

Experimental environment

Firstly, we test the system’s capability of detecting gas vapor diffusion, and then, we examine its anti-false alarming performance towards typical external turbulences. We tested closed oil drum in open space and closed space, open oil drum in open space and closed space respectively, the four experimental results are as shown respectively in Figs. 8, 9, 10 and 11. Then we circulate air, change the ambient temperature, and shake sensor nodes to see how the system responds to external interferences.

Fig. 8.
figure 8

Closed gasoline barrel in the open space

Fig. 9.
figure 9

Closed gasoline barrel in the enclosed space

Fig. 10.
figure 10

Open gasoline barrel in the open space

Fig. 11.
figure 11

Open gasoline barrel in the enclosed space

For the first four experiments, we placed the petrol barrel at positions 1 and 2, and opened the barrel lid immediately in the latter two experiments, recorded the alarm time of the system to above operations. The process of each experiment lasted 2 min, and repeated 20 times. Figures 8, 9, 10, and 11 shows the cumulative distribution of the alarm delay of the first four groups of experiments. In these graphs, we treat the time out reports as failure detections.

From the above experimental results, it can be seen that, when the gasoline barrel is at position 1, the system has a higher detection delay than that at position 2. This is because the diffusion source is farther away from sensor nodes, hence the fluctuations in the sensor measurements become subtle. Think node requires more data to determine if there are abnormal gas vapor diffusions. In the experiments with sealed petrol barrels, slight amount of gas leakage can lead significant reduction in event detection rates. Especially in the first group of experiments, when we place the closed petrol barrel in the open space, the detection ratio always lies under 40%. We can also see that, the detection rate will significantly increase when the distance between diffusion source and monitoring sensors decreases. As in the first experiment, the system had a 25% improvement in detection rate when we move the gasoline barrel from position 2 to position 1, and also about 10% improvement in the second experiment.

At last, we test the sensor network system’s tolerance towards external interferences. We force air circulation, then change the room temperature, and sway sensor nodes to disturb measurements. Each action is repeated 20 times, and then we record the alarm times of the system as shown in Table 1.

Table 1. System alarm performance

In the case of forced air circulation, the system has one false judgement in 20 attempts, the false alarm rate is 5%. In the case of forced ambient temperature changes, all the judgements are made correctly. In the case of artificially shaking sensor nodes, the system has 3 false judgements in 20 attempts, the false alarm rate is 15%. In this experiment, since we are using very tense external interference, especially the air flow intensity and the amplitude of artificial sensors are higher than the general situations, the overall false alarm rate is controlled under 7%, indicating good anti-jamming capability.

6 Conclusion

In this paper, a gas vapor detection framework is proposed to detect fire hazard in small public places like rail vehicle carriages. Based on the gas diffusion model and experimental results under typical small space scenario, we proposed sensor deployment scheme, as well as detection logic for abnormal gasoline vapor diffusion. We also implemented data sampling and filtering mechanisms, as well as outlier decision schemes based on DTW distance quantization.

The experimental results show that, our system can detect the gasoline barrel in the room (small space) in short time in most cases, while maintaining very low false alarm rates to typical external interferences.