Data Processing with Predictions in LoRaWAN
<p>Transmission waveform for a Class A node (own source).</p> "> Figure 2
<p>Transmission waveform for Class B node (own source).</p> "> Figure 3
<p>Transmission waveform for a Class C node (own source).</p> "> Figure 4
<p>View of LoRa gateway: LORANK-8 (own source).</p> "> Figure 5
<p>The architecture of the communication system and measuring equipment (own source).</p> "> Figure 6
<p>Linear equation for prediction (own source).</p> "> Figure 7
<p>Laboratory set with measuring instruments (own source).</p> "> Figure 8
<p>Graph of electricity consumption of the end device without the use of optimization methods.</p> "> Figure 9
<p>Graph of electricity consumption of the end device using temperature prediction.</p> "> Figure 10
<p>Graph of electricity consumption of the end device using antenna gain optimization.</p> "> Figure 11
<p>Graph of electricity consumption of the end device using antenna gain optimization and temperature prediction.</p> "> Figure 12
<p>Comparison of the average power consumption of the terminal device for each measurement.</p> "> Figure 13
<p>Graph showing the percentage decrease in power consumption of the end device as a result of the applied optimization algorithms.</p> "> Figure 14
<p>End device position (1), LoRa gateway positions (2, 3, 4) and distances between end device and LoRa gateway (A, B, C) in Lecture and Conference Centre of the Poznan University of Technology—first floor.</p> "> Figure 15
<p>Graph of electric current consumption of the end device for four cases and devices—locations (A).</p> "> Figure 16
<p>Graph of electric current consumption of the end device for four cases and devices—locations (B).</p> "> Figure 17
<p>Graph of electric current consumption of the end device for four cases and devices—locations (C).</p> ">
Abstract
:1. Introduction
2. Related Works
3. LoRa Wireless Communication Technology and LoRaWAN Wireless Communication Protocol for IoT Applications
- End-points (end-node);
- Gateway;
- Network server;
- Application server.
- Class A;
- Class B;
- Class C.
- If the power of the radio signal (called the link budget) is high, the transmission rate can be increased;
- If the link budget is small, the transmission rate can be decreased.
4. Proposal of a Test Set for Measuring the Energy Consumption of End Devices Operating in a LoRaWAN and Optimization Algorithms
4.1. The Proposal of Temperature Value Prediction Algorithm
Listing 1. Implementation of the condition required to create a model. |
if ( |
temp_measurements.size() > SIZE_OF_MEASUREMENTS_BUFFER && |
abs(temp.temperature - previous_predicted_temp) > |
(temp.temperature * MEASUREMENT_CORRECTNESS) |
){ |
update_params_for_prediction(temp_measurements, params); |
iter_for_prediction = 0; |
} |
Listing 2. Value update function of the parameters a and b in the linear equation. |
static void update_params_for_prediction( |
std::vector<double>& buffer, |
std::pair<double, double>& params |
){ |
/*Intialization Phase*/ |
double err; |
double alpha = 0.01; |
params.first = 0.00; |
params.second = 0.00; |
|
/*Training Phase*/ |
for (int epoch = 0; epoch<2000; epoch++) |
{ |
int idx = epoch % SIZE_OF_MEASUREMENTS_BUFEER; |
double p = params.first + params.second * idx; |
err = p – buffer[idx]; |
params.first = params.first – alpha * err; |
params.second = params.second – alpha * err * idx; |
} |
|
iter_for_prediction = 0; |
} |
Listing 3. Predictive function of temperature values. |
double predict_temp_value(float& actual_temp, std::pair<double, |
double>& params) |
{ |
double predicted_value = params.first + |
(params.second * (SIZE_OF_MEASUREMENTS_BUFFER + |
iter_for_prediction)); |
return predicted_value; |
} |
Algorithm 1 Temperature prediction algorithm |
# statement of constants size_of_measurements_buffer ← 10 measure_correctness = 0.02 temp_measurements ← [ ] predicted_temp ← −150 previous_predicted_temp ← −150 alpha ← 0.01 a ← 0.00 b ← 0.00 iter ← 0 # main loop declarationwhile is_main_loop() temp ← get_from_sensor() # checking the condition (exceeding the error threshold) if length(temp_measurements) > size_of_measurements_buffer &&absolute(temp-previous_predicted_temp) > (temp × measure_correctness) then iter ← 0 a ← 0.00 b ← 0.00 # determination of the number of epochs for epoch ← 0 to amount_of_epoch idx ← epoch % size_of_measurements_buffer # determination of prediction error error ← a + b × idx a ← a – alpha × error b ← b – alpha × error × idx if a ≠ 0 && b ≠ 0 then previous_predicted_temp = predicted_temp predicted_temp ← a + b × (size_of_measurements_buffer × iter) temp_measurements.erase(temp.measurement.begin()) iter ← iter + 1 temp_measurements[length(temp_measurement)] ← temp |
4.2. The Proposal of Optimization of Antenna Gain Values Algorithm
Listing 4. Functions defining the value of antenna gain depending on RSSI. |
int set_antenna_power(int rssi) |
{ |
if (rssi <= -100) return TX_POWER_0; |
else if (rssi <= -85 && rssi > -100) return TX_POWER_1; |
else if (rssi <= -70 && rssi > -85) return TX_POWER_2; |
else if (rssi <= -55 && rssi > -70) return TX_POWER_3; |
else if (rssi <= -40 && rssi > -55) return TX_POWER_4; |
else if (rssi <= -20 && rssi > -40) return TX_POWER_5; |
else if (rssi > -20) return TX_POWER_6; |
|
} |
int increase_tx_power(int tx_power) |
{ |
if(tx_power > TX_POWER_0) return tx_power--; |
return tx_power; |
} |
int decrease_tx_power(int tx_power) |
{ |
if(tx_power > TX_POWER_6) return tx_power++; |
return tx_power; |
} |
int adjust_antenna_power(int rssi, int tx_power) |
{ |
if (rssi < -130) return increase_tx_power(tx_power); |
else if (rssi > - 100) return decrease_tx_power(tx_power); |
|
return tx_power; |
} |
Listing 5. Conditions found in the main loop of the program. |
if (lorawan_send_uncorfirmed(message.GetString(), |
strlen(message.GetString()), 2, antenna_gain |
) < 0) |
{ |
printf(“failed!!!\n”); |
} |
else |
{ |
if(iter_for_antenna_gain == ANTENNA_ITER_THRESHOLD) |
{ |
antenna_gain = TX_POWER_0; |
iter_for_antenna_gain = 0; |
} else { |
iter_for_antenna_gain++; |
} |
gpio_put(PICO_DEFAULT_LED_PIN, true); |
printf(“success!\n”); |
} |
|
if (lorawan_process_timeout_ms(RECEIVE_DELAY) == 0) |
{ |
//check if a downlink message was received |
receive_lenght = lorawan_receive( |
receive_buffer, sizeof(receive_buffer), &receive_port |
); |
if (receive_length > -1 && lorawan_rx_rssi() != NULL) |
{ |
iter_for_antenna_gain = 0; |
|
if (!antenna_gain_setted) { |
antenna_gain = set_antenna_power(lorawan_rx_rssi()); |
antenna_gain_setted = true; |
} else { |
antenna_gain = adjust_antenna_power(lorawan_rx_rssi(), |
antenna_gain); |
} |
} |
} |
Algorithm 2 Antenna gain optimization algorithm |
# statement of constants antenna_iter_threshold ← 20 iter_for_antenna_gain ← 0 # main loop declaration while is_main_loop() iter_for_antenna_gain ← iter_for_antenna_gain + 1 if iter_for_antenna_gain == antenna_iter_threshold then antenna_gain ← 0 # procedure for determining optimal antenna gain if is_response_from_gateway() then rssi ← get_rssi_from_gateway_response() if antenna_gain_setted then if rssi ≤ −100 then antenna_gain ← 0 else if rssi ≤ -85 && rssi > −100 then antenna_gain ← 1 else if rssi ≤ −70 && rssi > −85 then antenna_gain ← 2 else if rssi ≤ −55 && rssi > −70 then antenna_gain ← 3 else if rssi ≤ −40 && rssi > −55 then antenna_gain ← 4 else if rssi ≤ −20 && rssi > −40 then antenna_gain ← 5 else then antenna_gain ← 6 else then if rssi < −130 then if antenna_gain > 0 then antenna_gain ← antenna_gain-1 else if rssi > −100 then if antenna_gain < 6 then antenna_gain ← antenna_gain + 1 |
5. Testing of the Developed Algorithms to Optimize Antenna Gain and Predict Temperature Value
- (A): Distance between points 1 and 2 = 8 m, two walls;
- (B): Distance between points 1 and 3 = 20 m, three walls;
- (C): Distance between points 1 and 4 = 24 m, four walls;
- (I): Measuring electric current consumption and energy consumption for the case without optimization methods applied;
- (II): Measuring electric current consumption and energy consumption for the case with temperature measurement prediction applied;
- (III): Measuring electric current consumption and energy consumption for the case with antenna gain optimization applied;
- (IV): Measuring electric current consumption and energy consumption for the case with temperature measurement prediction and antenna gain optimization applied;
- Measurement recording time in the Matlab platform—100 s, 50 Hz sampling.
Limitations of the Proposed Method
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
Abbreviations
IoT | Internet of Things |
LoRaWAN | Long Range Wide Area Network |
LoRa | Long Range |
LPWAN | Low Power Wide Area Network |
SF | Spreading Factor |
CF | Carrier Frequency |
BW | Bandwidth |
CR | Coding Rate |
TP | Transmission Power |
SNR | Signal to Noise Ratio |
GSM | Global System for Mobile Communications |
WiFi | Wireless Fidelity |
FEC | Forward Error Correction |
MAC | Medium Access Control |
ADR | Adaptive Data Rate |
ADTR | Adaptive Transmission Data Rate |
SARA | Self-Adaptive Routing Algorithm |
HAPS | High-Altitude Platform Stations |
ISM | Industrial Scientific Medical |
CSS | Chirp Spread Spectrum |
ECB | Electronic Codebook |
ITU | International Telecommunication Union |
RSSI | Received Signal Strength Indication |
References
- Adelantado, F.; Vilajosana, X.; Tuset-Peiro, P.; Martinez, B.; Melià-Seguí, J.; Watteyne, T. Understanding the Limits of LoRaWAN. IEEE Commun. Mag. 2017, 55, 34–40. [Google Scholar] [CrossRef] [Green Version]
- Butun, I.; Pereira, N.; Gidlund, M. Security Risk Analysis of LoRaWAN and Future Directions. Future Internet 2019, 11, 3. [Google Scholar] [CrossRef] [Green Version]
- AL-Hthlool, A.; Frikha, M. Analysis of Security Aspects in LoRaWAN. J. Cyber Secur. 2022, 4, 109–118. [Google Scholar] [CrossRef]
- Khalifeh, A.; Aldahdouh, K.; Alouneh, S. LoRaWAN Energy Optimization with Security Consideration. Int. Arab. J. Inf. Technol. 2021, 18, 476–483. [Google Scholar] [CrossRef]
- Antonowicz, A.; Derbis, P.; Nowak, M.; Urbaniak, A. Smart Meter in Voltage Control System of Power Network. In Proceedings of the 21th International Carpathian Control Conference (ICCC), High Tatras, Slovakia, 27–29 October 2020; pp. 1–6. [Google Scholar] [CrossRef]
- Bouguera, T.; Diouris, J.-F.; Chaillout, J.-J.; Jaouadi, R.; Andieux, G. Energy Consumption Model for Sensor Nodes Based on LoRa and LoRaWAN. Sensors 2018, 18, 2104. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Nurgaliyev, M.; Saymbetov, A.; Yashchyshyn, Y.; Kuttybay, N.; Tukymbekov, D. Prediction of energy consumption for LoRa based wireless sensors network. Wirel. Netw. 2020, 26, 3507–3520. [Google Scholar] [CrossRef]
- Sinha, S.R.; Wei, Y.; Hwang, S. A survey on LPWAN technology: LoRa and NB-IoT. ICT Express 2017, 3, 14–21. [Google Scholar] [CrossRef]
- LoRa Alliance Website, LoRa Technology. Available online: https://lora-alliance.org/about-lorawan (accessed on 15 October 2022).
- Cano-Ortega, A.; Sanchez-Sutil, F. Performance Optimization LoRa Network by Artificial Bee Colony Algorithm to Determination of the Load Profiles in Dwellings. Energies 2020, 13, 517. [Google Scholar] [CrossRef] [Green Version]
- Baumker, E.; Miguel Garcia, A.; Woias, P. Minimizing power consumption of LoRa and LoRaWAN for low-power wireless sensor nodes. J. Phys. Conf. Ser. 2019, 1407, 012092. [Google Scholar] [CrossRef]
- Conte, R.; Mahmud, S. LoRa-STAR: Optimizing Energy Consumption in LoRa Nodes for Precision Farming. In Proceedings of the 2021 IEEE 7th World Forum on Internet of Things (WF-IoT), New Orleans, LA, USA, 14 June–31 July 2021; pp. 183–188. [Google Scholar] [CrossRef]
- Augustin, A.; Yi, J.; Clausen, T. A study of LoRa: Long range low power networks for the Internet of Things. Sensors 2016, 16, 1466. [Google Scholar] [CrossRef] [PubMed]
- Devalal, S.; Karthikeyan, A. LoRa technology-an overview. In Proceedings of the 2018 Second International Conference on Electronics, Communication and Aerospace Technology (ICECA), Coimbatore, India, 29–31 March 2018; pp. 284–290. [Google Scholar] [CrossRef]
- Zourmand, A.; Kun Hing, A.L.; Wai Hung, C.; AbdulRehman, M. Internet of Things (IoT) using LoRa technology. In Proceedings of the 2019 IEEE International Conference on Automatic Control and Intelligent Systems (I2CACIS), Selangor, Malaysia, 29–29 June 2019; pp. 324–330. [Google Scholar] [CrossRef]
- Hamdi, R.; Baccour, E.; Erbad, A.; Qaraqe, M.; Hamdi, M. LoRa-RL: Deep Reinforcement Learning for Resource Management in Hybrid Energy LoRa Wireless Networks. IEEE Internet Things J. 2022, 9, 6458–6476. [Google Scholar] [CrossRef]
- Noreen, U.; Bounceur, A.; Clavier, L. A study of LoRa low power and wide area network technology. In Proceedings of the 2017 International Conference on Advanced Technologies for Signal and Image Processing (ATSIP), Fez, Morocco, 22–24 May 2017; pp. 1–6. [Google Scholar] [CrossRef]
- Hou, Y.; Liu, Z.; Sun, D. A novel MAC protocol exploiting concurrent transmissions for massive LoRa connectivity. J. Commun. Netw. 2020, 22, 108–117. [Google Scholar] [CrossRef]
- Harada, H.; Mizutani, K.; Fujiwara, J.; Mochizuki, K.; Obata, K.; Okumura, R. IEEE 802.15.4g Based Wi-SUN Communication Systems. IEICE Trans. Commun. 2017, E100.B, 1032–1043. [Google Scholar] [CrossRef] [Green Version]
- Kaven, S.; Bornholdt, L.; Skwarek, V. Authentication by RSSI-Position Based Localization in a LoRa LPWAN. In Proceedings of the 2020 6th IEEE Congress on Information Science and Technology (CiSt), Agadir-Essaouira, Morocco, 5–12 June 2021; pp. 448–454. [Google Scholar] [CrossRef]
- Nolan, K.E.; Guibene, W.; Kelly, M.Y. An evaluation of low power wide area network technologies for the Internet of Things. In Proceedings of the IEEE International of Wireless Communications and Mobile Computing Conference (IWCMC), Paphos, Cyprus, 5–9 September 2016; pp. 440–444. [Google Scholar] [CrossRef]
- Kufakunesu, R.; Hancke, G.; Abu-Mahfouz, A. A Fuzzy-Logic Based Adaptive Data Rate Scheme for Energy-Efficient LoRaWAN Communication. J. Sens. Actuator Netw. 2022, 11, 65. [Google Scholar] [CrossRef]
- Mendes, B.; Correia, N.; Passos, D. On the Optimization of LoRaWAN Gateway Placement in Wide Area Monitoring Systems. In Internet of Things; IoT through a Multi-Disciplinary Perspective. IFIPIoT 2022. IFIP Advances in Information and Communication Technology; Camarinha-Matos, L.M., Ribeiro, L., Strous, L., Eds.; Springer: Cham, Switzerland, 2022; Volume 665. [Google Scholar] [CrossRef]
- Dandachi, G.; Hadjadj-Aoul, Y. A Frequency-Based Intelligent Slicing in LoRaWAN with Admission Control Aspects. In Proceedings of the International Conference on Modeling Analysis and Simulation of Wireless and Mobile Systems, Montreal, Canada, 24–28 October 2022; pp. 189–196. Available online: https://dl.acm.org/doi/abs/10.1145/3551659.3559055 (accessed on 7 November 2022).
- Zahid, N.; Sodhro, A.H.; Kamboh, U.R.; Alkhayyat, A.; Wang, L. AI-driven adaptive reliable and sustainable approach for internet of things enabled healthcare system. Math. Biosci. Eng. 2022, 19, 3953–3971. [Google Scholar] [CrossRef] [PubMed]
- Maudet, S.; Andrieux, G.; Chevillon, R.; Diouris, J.F. Refined node energy consumption modeling in a LoRaWAN network. Sensors 2021, 21, 6398. [Google Scholar] [CrossRef] [PubMed]
- Nowak, M.; Derbis, P.; Kurowski, K.; Różycki, R.; Waligóra, G. LPWAN Networks for Energy Meters Reading and Monitoring Power Supply Network in Intelligent Buildings. Energies 2021, 14, 7924. [Google Scholar] [CrossRef]
- Semtech White Paper, Real-world LoRaWAN™ Network Capacity for Electrical Metering Aplications, Semtech Corporation. Available online: https://info.semtech.com/network_capacity_white_paper_download (accessed on 15 October 2022).
- Giambene, G.; Korre, K. LoRa-based System for IoT Applications via HAPS in Remote Areas. In Proceedings of the 2022 International Conference on Software, Telecommunications and Computer Networks (SoftCOM), Split, Croatia, 22–24 September 2022; pp. 1–6. [Google Scholar]
- Pasolini, G. On the LoRa Chirp Spread Spectrum Modulation: Signal Properties and Their Impact on Transmitter and Receiver Architectures. IEEE Trans. Wirel. Commun. 2022, 21, pp. 357–369. [Google Scholar] [CrossRef]
- IC880A-SPI Technical Documentation. Available online: https://wireless-solutions.de/downloadfile/ic880a-spi-documents/ (accessed on 15 October 2022).
- BeagleBone Black Technical Documentation. Available online: https://cdn-shop.adafruit.com/datasheets/BBB_SRM.pdf (accessed on 15 October 2022).
- LoRa Alliance Technical Committee, LoRaWAN™ 1.1 Specification, Version 1.1, LoRa Alliance. Available online: https://lora-alliance.org/wp-content/uploads/2020/11/lorawantm_specification_-v1.1.pdf (accessed on 15 October 2022).
- Raspberry Pi Pico Technical Documentation. Available online: https://datasheets.raspberrypi.com/pico/pico-datasheet.pdf (accessed on 15 October 2022).
- Hoperf RFM95W Technical Documentation. Available online: https://www.hoperf.com/data/upload/portal/20190801/RFM95W-V2.0.pdf (accessed on 15 October 2022).
- Adafruit SHT40 Technical Documentation. Available online: https://www.mouser.com/pdfDocs/4885SensirionSHT40Sensor.pdf (accessed on 15 October 2022).
- RapidJSON Library Technical Documentation. Available online: https://rapidjson.org/ (accessed on 15 October 2022).
- RIGOL DM3051 Technical Documentation. Available online: https://www.rigolna.com/products/digital-multimeters/dm3000/ (accessed on 15 October 2022).
- Ywrobot MB-V2 Technical Documentation. Available online: https://static.rapidonline.com/pdf/73-4538_v1.pdf (accessed on 15 October 2022).
- Rigol instruments and MATLAB. Available online: https://ch.mathworks.com/products/instrument/supported/rigol-technologies.html (accessed on 10 December 2022).
- Driver Registry. IVI Fundation. Available online: https://www.ivifoundation.org/registered_drivers/driver_registry.aspx (accessed on 10 December 2022).
- TTN—The Things Network, TTS—The Things Stack—Open Source Infrastructure Aiming at Providing a Free LoRaWAN Network Cover. Available online: https://www.thethingsnetwork.org (accessed on 10 December 2022).
- Number Connected IoT Devices. Available online: https://iot-analytics.com/number-connected-iot-devices (accessed on 10 December 2022).
Configuration in Building | RSSIMIN [dBm] | RSSIMAX [dBm] | Median [dBm] | Received Packets [%] | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
I | II | III | IV | I | II | III | IV | I | II | III | IV | I | II | III | IV | |
1–2 (A) | −55 | −56 | −56 | −55 | −47 | −47 | −48 | −47 | −51 | −51 | −52 | −51 | 99 | 98 | 99 | 99 |
1–3 (B) | −69 | −69 | −69 | −69 | −58 | −58 | −58 | −59 | −64 | −64 | −64 | −64 | 100 | 100 | 100 | 100 |
1–4 (C) | −77 | −78 | −77 | −77 | −66 | −66 | −66 | −67 | −71 | −71 | −71 | −71 | 99 | 98 | 99 | 99 |
Mean Value of Electric Current [A]- Distance A | Mean Value of Electric Current [A]- Distance B | Mean Value of Electric Current [A]- Distance C | ||
---|---|---|---|---|
Cases | I | 0.032 | 0.034 | 0.035 |
II | 0.031 | 0.033 | 0.033 | |
III | 0.031 | 0.033 | 0.034 | |
IV | 0.030 | 0.032 | 0.033 |
Energy Consumption [W]-Distance A | Energy Consumption [W]-Distance B | Energy Consumption [W]-Distance C | ||
---|---|---|---|---|
Cases | I | 0.160 | 0.170 | 0.175 |
II | 0.155 | 0.165 | 0.169 | |
III | 0.156 | 0.166 | 0.171 | |
IV | 0.151 | 0.161 | 0.166 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Nowak, M.; Różycki, R.; Waligóra, G.; Szewczyk, J.; Sobiesierski, A.; Sot, G. Data Processing with Predictions in LoRaWAN. Energies 2023, 16, 411. https://doi.org/10.3390/en16010411
Nowak M, Różycki R, Waligóra G, Szewczyk J, Sobiesierski A, Sot G. Data Processing with Predictions in LoRaWAN. Energies. 2023; 16(1):411. https://doi.org/10.3390/en16010411
Chicago/Turabian StyleNowak, Mariusz, Rafał Różycki, Grzegorz Waligóra, Joanna Szewczyk, Adrian Sobiesierski, and Grzegorz Sot. 2023. "Data Processing with Predictions in LoRaWAN" Energies 16, no. 1: 411. https://doi.org/10.3390/en16010411
APA StyleNowak, M., Różycki, R., Waligóra, G., Szewczyk, J., Sobiesierski, A., & Sot, G. (2023). Data Processing with Predictions in LoRaWAN. Energies, 16(1), 411. https://doi.org/10.3390/en16010411