The authors’ proposed BL-detection end node device consists of a 4-core ARM CPU of at least 2 GB of RAM and 16 GB SRAM or eMMC flash for OS system storage. It also includes two Bluetooth class-1 dongles, and one BLE dongle. The device is placed above the motorway emergency exits. The two class-1 Bluetooth devices are placed catercorner to the detection controller, using 10 m USB shielded cables (each Bluetooth dongle 10 m apart from the detector). This way, a MIMO antenna is formed that utilizes two synchronous Bluetooth receivers 20 m apart, with a coverage range of 100 m each and a BLE receiver in the middle (coverage range of 15 m), capable of receiving short distance signals close to the tunnel exits. BL-Detector end-node prototype functionality and description of the end-node detection process follows.
3.1. End-Node Prototype Implementation and Functionality
Each of the three Bluetooth and BLE devices scans for advertisement packets continuously and receives the proximity values of the received signal strength indicator (RSSI) from users’ smartphones or vehicles’ Bluetooth devices. Once the scanning process is in progress, the RSSI values are remotely stored in the MongoDB clustered database using the JSON format. Detection results are illustrated in real time by the application service Grafana dashboards. Each Bluetooth detector (dongle) can scan one Bluetooth advertisement channel each time. All the Bluetooth transponders are simultaneously instantiated using three different threads as parts of a single service instance.
Figure 3 depicts the end node BL-detector device implementation [
8] and parts, described below:
- 1.
The USB 4G dongle, which is responsible for the detector’s network connectivity (also an Ethernet port is available for either connectivity or debugging purposes).
- 2.
The class-1 long range Bluetooth dongles support Bluetooth 3, 4.2 and 5.X protocols and are used to scan active Bluetooth devices. The dongles have high temperature resistance up to 70 C and for low temperatures, down to −10 C.
- 3.
BLE dongle adapter that includes a 2 dBi dipole antenna. It is a class-2 adapter embedded in the microcontroller covering the area near the smart exit, with a second USB dongle BLE adapter covering periodically the same area around the tunnel exit.
- 4.
The Ethernet port, which is used for Ethernet communication and for power over Ethernet (PoE) supply (if applicable).
- 5.
The USB cable adapter or extender to adjust the USB dongle in a position with better cellular signal reception.
- 6.
The ABS 3D printed enclosure with the initials of the project printed on the cover.
- 7.
The main power input via a USB type C cable, if PoE is not available (via the Ethernet cable).
- 8.
A small speaker, used for issuing sound alerts in case of an emergency and for navigation purposes toward the tunnel exit in cases of limited visibility (fire, or smoke inside the tunnel). It also includes two solid-state relay outputs connecting to the tunnel exit led stripes.
- 9.
A 16 × 2 Character LCD display, which is used for onsite BL-detector device status information.
The previously presented end-node BL-detector prototype is a technology readiness level 9 (TRL 9) end node device that was successfully tested and validated in its appliance environment. The BL-detector equipment ensures conformity with the EU-wide requirements for operational types of equipment inside tunnels and the local government laws and regulations for wireless transmissions, making it an industry-ready real-time detection implementation.
For the Bluetooth detection process to be quick and accurate, three threaded processes are instantiated, assigned to each of the Bluetooth dongles and one for the two BLE dongles accordingly. Each Bluetooth dongle is assigned to a different advertisement channel per scan interval. Moreover, another threaded dispatched instance per thread is used from the asynchronous threaded pool to send the JSON data to the load balancer and the MongoDB service.
Table 1 presents the results of total Bluetooth scan time, data insertion time, and periodic total cycle time. Using this threaded service approach, the authors managed to reduce the overall scanning process to 180–250 ms. Similarly, the data storing process achieved a maximum of 250–350 ms for all dongle data insertions (maximum entire scanning-recording cycle total time at 660 ms), without the use of the ALBL load balancer, and maximum values of 580–600 ms with the use of the load balancer. The scanning interval for each Bluetooth dongle is 60 ms, which for the class-1 dongles means that they can scan a car driving at a high speed of 200 km/h at least 4–5 times and 7–8 times for a vehicle driving at the speed limit of 130 km/h.
Based on this BL-detector scanning capability, the Friis formula can be used to estimate vehicle distances from the BL-detector dongles and therefore calculate a speed estimation value. Furthermore, since most cars or drivers include in their car an active Bluetooth device, the system can infer speed estimations, or, in the case of tunnel emergencies, if the involved people have their mobile phones, the Bluetooth device set on the system can detect them as instances inside the tunnel or in close proximity to the tunnel’s exit and offer helpful feedback for their release. The following subsection presents the authors’ proposition toward a speed estimator using their BL-detector device that provides better accuracy for the speed of the moving vehicles than using the Friis formula.
3.2. End-Node Speed Estimation and Validation Process
The authors propose a new methodology for estimating speed of moving vehicles in tunnels using a nondeterministic approach. This approach includes a classification engine that uses pre-trained classifiers from RSSI field data and deriving speed category estimations. The authors’ proposition is illustrated in
Figure 4.
According to the authors, the speed estimation process is as follows: Instead of using a formula (such as the Friis equation or the use of Friis equation with a pre-filtering Kalman filter step [
29]), a different approach is followed. For the distance estimation over time using RSSI values, RSSI values are matched to speed classes (training process), using the output of another system for the actual speed validation, the tunnels’ TMS-IL system. Most contemporary tunnels include inductive loops at their entrances and in front of the tunnels’ escape exits.
Different classifiers can be trained using the BL-detector measurements over time as input and the corresponding measurements from the inductive loops as output. That is, the light GBM (LGBM) [
30], the MLP [
31], the random forest (RandomForest) [
32], the decision tree (DecisionTree) [
33], and the extra trees (ExtraTrees) [
34] classifiers. The total number of data is 3927, using 20% for testing purposes and the calculation of the accuracy metric. This is because the F-score metric cannot accurately represent the classification accuracy: the recall part of the score leads to low score values (not all IL output measurements have corresponding BL-detector RSSI values), and the precision is merely an indication of the detector’s accuracy.
Prior to classifiers training, appropriate pre-processing data cleansing as well as data impairments compensation must apply. This data pre-processing methodology includes the following pre-processing steps (filtering process):
Discard data with velocity less than 1 km/h. Explanation: It is only logical that vehicles with a reported speed of less than 1 km/h are due to malfunctions of the TMS-IL system.
Discard data with velocity over than 220 km/h. Explanation: It is only logical that vehicles with a reported speed of more than 220 km/h are due to malfunctions of the TMS-IL system.
Discard data with velocity over the 99.6% range from the Gaussian probability distribution. Explanation: The data provided by the TMS-ILs follow the Gaussian probability distribution. As a result, the outliers lie beyond the 99.6% range.
Discard MAC IDs scanned only from one BLE-detector. Explanation: If a MAC ID that the detectors have scanned is a vehicle, there will be at least one scan from each BL-detector. On the other hand, MAC IDs that are scanned only from one detector are no vehicles passing through the tunnel and are not part of the train dataset.
Discard MAC IDs for which the total time inside the tunnel is more than the minimum speed times the Bl-detector effective coverage length (21 s). Explanation: The slowest vehicle from the TMS-IL data has a speed of 20 km/h, which converts to 5.555 m/s. The BL-detector’s effective coverage length is 500 m, but the coverage radius range of the Bluetooth class-1 transponders is 50 m. There are two class-1 Bluetooth transponders with 20 m distance between them, so the total range that the BL-detector can scan in an open environment is 120 m. As a result, a vehicle with the slowest speed recorded needs 21.621 s to pass through the active scanning area of the BL-detector.
The post-processing optimization step of the classifiers’ train parameters is achieved through a grid search of their hyperparameters. Using F1 score metric, for the classifiers’ testing process on the 20% of the data of the collected dataset, the most accurate parameters per classifier are detected.
Table 2 shows the parameters per classifier put to the test during the grid test, as well as the optimal test parameter outputs per classifier.
For measuring per class accuracy, the authors introduced a new measure called accuracy per class (APC), as an augmented exponential precision calculation function per class, defined as
where
i = 1…
n are the number of speed classes,
is the speed class as calculated by the trained classifier and
is the speed class as calculated by the TMS-IL system, for each vehicle
l = 1…
m detected by the classifier in the class
i. The value
m is the total number of vehicles detected for that class, and
is the total number of vehicles detected by the TMS-IL system for that specific class.
, is a coefficient that exponentially reduces accuracy in cases of
. This is, of course, due to the concentration of most of the accurate classified values as well inaccurate ones belonging to a different class of erroneous values. In the authors’ experimentation, the value
k is the minimum value, so at least one class has
, usually
.
The accuracy per class (APC) is a weighted metric using an exponential formula to deliver balanced weights to vehicles that are misclassified. The purpose of the metric is to add an in-between-classes distance, so the vehicles that are wrongfully distributed can add a weighted bit of precision. Speed classes that are close to each other can provide information regarding the accuracy of the model. It is calculated by the mean for each class for the vehicles detected from the BL-detector and categorized to the specific class. The mean calculates the APC of the system separately for all classes and vehicles detected by the BL-detector. There are cases where the total value is greater than 1. This means that most of the vehicles detected as well as a significant number of vehicles should not belong to this class. In those cases, the value can be set equal to zero, or , where is the total number of classes used. If still, then for that class.
Regarding
Figure 4, an automated pipeline is constructed specifically for the pre- and post-processing steps. Receiving as input the RSSI measurements and the TMS-IL data, which are collected in real time (almost every 500 ms), in the pre-processing step, meaning the data-filtering process, each RSSI datum is assigned to its proper speed class according to the corresponding TMS-IL categorization. Subsequently, concerning the post-processing step, which is mentioned as the training process in
Figure 4, once the input data are filtered, the training of each classifier is performed periodically at the time when a dataset will contain data of one month, resulting in a process that is completed in a few milliseconds (for each monthly dataset, per classifier). This automated two-step processing pipeline is compulsory to be repeated every month only until we gather a certain and representative data collection per speed class. A criterion for halting data filtration and classifiers’ retraining, for example, could be the stabilization of the APC accuracy.
Moreover, the automated pipeline process is as follows: RSSI data are collected in real time when Bluetooth transponders are detected. Regarding
Figure 4, the real-time data acquired pass through a fully automated pipeline consisting of a pre-processing filtering step and a post-processing training step to achieve speed predictions, similar to [
35]. Each Bluetooth detector can acquire more than one RSSI value of each detected Bluetooth MAC. The number of RSSI values/Bluetooth/MAC depends on the users’/vehicles’ moving speed. The BLE devices, which detect vehicles only close to the tunnel exits, require no post-processing or estimation, apart from the appliance of the Friis equation and a pre-processing data cleansing step including impairments compensation. This pre-processing step interval is 500 ms up to 1 min. It is close to the interval for the application service to reload and renew its dashboards. During this time, each detector node retrieves RSSI data as well as TMS-IL output speed data from the MongoDB service, whereas each RSSI datum is assigned to its proper speed class, according to the corresponding TMS-IL categorization. The same pre-processing step applies for the Bluetooth class-1 device, followed by a classifier speed prediction. Subsequently, the post-processing training interval for the estimators training is periodically instantiated in each node every month, resulting in a process which is completed in a few milliseconds (for each monthly dataset, per classifier). During the testing phase, the
values per class are calculated. The newly trained classifier is used if a
is achieved. If not, it is discarded, and a new training process is scheduled that uses the aggregated data of the two intervals for its next post-processing step. This automated two-step processing pipeline is compulsory to be repeated every month only until we gather a certain and representative data collection per speed class. A criterion for halting data filtration and classifiers’ retraining could be the stabilization of the APC accuracy. In the next section, the authors’ experimentation that includes BL-detector system validation and evaluation of their speed estimation process proposition is presented.