Intelligent Power Aware Algorithms for Traffic Sensors

3 downloads 0 Views 2MB Size Report
List of Figures ...... ephemeris data stored in the internal flash of the module. ... MX25R64 [31] is an ultra-low power CMOS flash memory with a minimum of 100,000 ...... repeated over 5000 episodes, and each episode commences in a random ...
UNIVERSITY OF OKLAHOMA GRADUATE COLLEGE

INTELLIGENT POWER AWARE ALGORITHMS FOR TRAFFIC SENSORS

A THESIS SUBMITTED TO THE GRADUATE FACULTY in partial fulfillment of the requirements for the Degree of MASTER OF SCIENCE in Electrical and Computer Engineering

By SIRAJ MUHAMMAD Norman, Oklahoma 2018

INTELLIGENT POWER AWARE ALGORITHMS FOR TRAFFIC SENSORS

A THESIS APPROVED FOR THE SCHOOL OF ELECTRICAL AND COMPUTER ENGINEERING

BY

______________________________ Dr. Hazem Refai, Chair

______________________________ Dr. Thordur Runolfsson

______________________________ Dr. Kam Wai C. Chan

© Copyright by SIRAJ MUHAMMAD 2018 All Rights Reserved.

To the soft-hearted and the sapient, my parents, Thanaa and Muhammad. To the great and trustworthy, my dear brother, Obada. To the beautiful little roses that adorn my life, my sisters, Einas and Israa.

To you all I dedicate this work,

Acknowledgements

I would like to offer my genuine appreciation and heartfelt gratitude to my dear advisor, Dr. Hazem Refai for his unparalleled support, mentorship, and constant encouragement to grow and succeed. I extend my sincere appreciation to my committee members, Dr. Thordur Runolfsson and Dr. Kam Wai Chan for their time and insightful suggestions to improve this work. I would also like to acknowledge Dr. Walid Balid for his assistance in the development of this research. Special thanks as well to Michelle Farabough for editing this thesis. To my extended family at OU, professors, students, and staff, I am thankful to you all for everything you have provided me during my time here!

iv

Table of Contents Acknowledgements ......................................................................................................... iv Table of Contents ............................................................................................................. v List of Tables ................................................................................................................. viii List of Figures.................................................................................................................. ix Abstract........................................................................................................................... xii Chapter 1 Introduction ...................................................................................................... 1 Chapter 2 Background and Related Work ........................................................................ 5 2.1

Magnetometer Theory of Operation ............................................................... 5

2.2

Related Research Work .................................................................................. 6

Chapter 3 System Platform Overview ............................................................................ 10 3.1

Microcontroller ............................................................................................. 11

3.2

Magnetometer ............................................................................................... 12

3.3

ZigBee Module ............................................................................................. 12

3.4

GPS ............................................................................................................... 13

3.5

Real-Time Clock .......................................................................................... 13

3.6

Data Storage ................................................................................................. 14

3.7

Battery Gauge ............................................................................................... 14

3.8

Energy Harvester and Management Unit ..................................................... 15

Chapter 4 Porting Algorithms from 1stG to 2ndG ........................................................... 17 4.1

Detection and Counting Algorithm .............................................................. 17

4.2

Adaptive Compensation of Baseline Drift ................................................... 19

4.3

Adaptive Compensation of the RTC Frequency Drift .................................. 21

v

4.4

Optimized ARM DSP Functions .................................................................. 24

4.5

Text Formatting Function ............................................................................. 24

Chapter 5 System Algorithms and Power Analysis ....................................................... 25 5.1

Data Buffering Technique ............................................................................ 25

5.2

Triggered Vehicle Detection ........................................................................ 27

5.3

Communication Scheme ............................................................................... 29

5.4

microSD Card Power Analysis ..................................................................... 30

5.5

5.6

5.4.1

Continuous Data Transfer....................................................................... 30

5.4.2

Triggered Data Transfer ......................................................................... 32

ZigBee Power Analysis ................................................................................ 33 5.5.1

Theoretical Analysis ............................................................................... 33

5.5.2

Empirical Data Collection ...................................................................... 37

System Level Power Consumption Analysis ............................................... 38

Chapter 6 Reinforcement Learning for Power Management ......................................... 41 6.1

Introduction to Reinforcement Learning ...................................................... 41

6.2

RL for iVCCS ............................................................................................... 44

6.3

Problem Formulation .................................................................................... 45

6.4

Bellman Equation vs. Temporal Differences Equation ................................ 47

6.5

Reducing Number of Actions ....................................................................... 50

6.6

Power Consumption Analysis ...................................................................... 52

6.7

Simulation using Real-World Data .............................................................. 53

Chapter 7 Experiments and Results ................................................................................ 55 7.1

Detection Algorithm Validation ................................................................... 55

vi

7.2

Power Optimization Validation .................................................................... 57 7.2.1

Lab Test .................................................................................................. 57

7.2.2

On-Campus Test ..................................................................................... 59

Chapter 8 Conclusion and Future Work ......................................................................... 62 8.1

Conclusion .................................................................................................... 62

8.2

Future Work.................................................................................................. 63

References ...................................................................................................................... 65 Appendix A: Ported Algorithms ..................................................................................... 71 Appendix B: Optimized Algorithms .............................................................................. 78

vii

List of Tables Table 1. ZigBee Phases, Timings, and Currents ............................................................ 36 Table 2. Comparison of energy sources ......................................................................... 63

viii

List of Figures Figure 1. Magnetic field of the earth [11]. ....................................................................... 5 Figure 2. Disturbance in magnetic flux lines caused by a vehicle. .................................. 6 Figure 3. Changing system sleep mode according to load [21]. ...................................... 8 Figure 4. Overview of the system components [7]......................................................... 10 Figure 5. iVCCS PCB components. ............................................................................... 11 Figure 6. Simplified schematic of the battery gauge unit [32]. ...................................... 15 Figure 7. ADP5091 detailed functional block diagram [33]. ......................................... 16 Figure 8. Detection algorithm parameters applied on a vehicle flux magnitude [7]. ..... 18 Figure 9. Detection algorithm state machine [7]. 𝑭𝑭𝑭𝑭(𝒌𝒌) is the field magnitude. ......... 19 Figure 10. Baseline magnitude drift with (blue) and without (yellow) adaptive

compensation [8]. ........................................................................................................... 20 Figure 11. High-level description of adaptive compensation algorithm. x, y, and z are the measured field’s components. xacm, yacm, and zacm are the accumulated values. ...... 20 Figure 12. GPS-based RTC time drift correction system block diagram [8]. ................ 21 Figure 13. A flow chart depicting the algorithm for RTC drift calibration. ................... 22 Figure 14. PPS-RTC difference calculation sub process................................................ 23 Figure 15. Measuring process flow chart inside RTC 1 Hz signal interrupt function.... 23 Figure 16. Block diagram illustrating data buffering technique..................................... 26 Figure 17. High level description of data buffering technique, ...................................... 27 Figure 18. MMI and BFI operation in KMX62 magnetometer. ..................................... 28 Figure 19. High level description of triggered vehicle detection algorithm................... 29 Figure 20. Data format for each sample. ........................................................................ 30

ix

Figure 21. Timing diagram for writing to microSD card. .............................................. 31 Figure 22. ZigBee transmit period (TTX) and receive period (TIdle). .............................. 35 Figure 23. Power consumption of ZigBee TX and RX compared to baseline test. ....... 37 Figure 24. Example for battery status log line (a) and Vehicle timestamp (b). VOLT, CAP, and SOC are battery voltage, capacity, and state-of-charge, respectively. ........... 38 Figure 25. Current consumption at various states. ......................................................... 39 Figure 26. State transition diagram. ............................................................................... 46 Figure 27. Q-Matrix convergence: Bellman vs. TD equation. ....................................... 48 Figure 28. Normalized Q-Matrix for Bellman equation. ................................................ 49 Figure 29. Normalized Q-Matrix for TD equation. ........................................................ 50 Figure 30. Bellman equation convergence: 2 actions vs 4 actions. ................................ 51 Figure 31. Q-Matrix using two actions........................................................................... 51 Figure 32. Current consumed when MCU wakes from sleep mode............................... 52 Figure 33. Traffic trend and power policy on campus. .................................................. 54 Figure 34. Traffic trend and power policy on Britton Highway..................................... 54 Figure 35. iVCCS setup on Britton Highway. ................................................................ 55 Figure 36. Battery capacity of regular and triggered detection sensors over a 180-minute time period. ..................................................................................................................... 56 Figure 37. Lab test using a train and two sensors placed under the track. ..................... 58 Figure 38. Lab test: Speed estimates of the train for a time period over 24 hours. ........ 58 Figure 39. Lab test: Battery capacity of the sensor for a time period over 24 hours...... 59 Figure 40. Campus field test setup. ................................................................................ 60 Figure 41. Campus field test: Number of vehicles detected and speed estimates. ......... 61

x

Figure 42. Battery capacity of sensor with and without DPM for a time period over 24 hours. .............................................................................................................................. 61

xi

Abstract The Internet of Things (IoT) is reshaping our world. Soon our world will be based on smart technologies. According to IHS Markit forecasts, the number of connected devices will grow from 15.4 billion in 2015 to 30.7 billion in 2020. Forrester Research predicts that fleet management and the transportation sectors lead others in IoT growth. This may come as no surprise, since the infrastructure (roadways, bridges, airports, etc.) is a prime candidate for sensor integration, providing real-time measurements to support intelligent decisions. The energy cost required to support the anticipated enormous number of predicted deployed devices is unknown. Currently, experts estimate that 2 to 4% of worldwide carbon emissions can be attributed to power consumption in the information and communication industry [1]. This thesis presents several algorithms to optimize power consumption of an intelligent vehicle counter and classifier sensor (iVCCS) based on an event-driven methodology wherein a control block orchestrates the work of various components and subsystems. Data buffering and triggered vehicle detection techniques were developed to reduce duty cycle of corresponding components (e.g., microSD card, magnetometer, and processor execution). A sleep mode is also incorporated and activated by an artificial intelligence-enabled, reinforcement learning algorithm that utilizes the field environment to select proper processor mode (e.g., run or sleep) relative to traffic flow conditions. Sensor life was extended from 48 hours to more than 200 days when leveraging 2300 mAh battery along with algorithms and techniques introduced in this thesis.

xii

Chapter 1 Introduction Transportation systems are at the heart of our socio-economic environment and played a major role in shaping the trajectory of economic strength and quality of life in a given community. The opposite effect is also true. For a strong and continually prosperous economy, it is a necessity for underlying infrastructure to be equipped and up-to-date with technological advancements characteristic of other industry sectors. Transportation systems must integrate and interoperate with others. Intelligent Transportation System (ITS) technology has been accelerated since the turn of the century due to a variety of technological forces that have caused an everincreasing need to efficiently utilize the transportation infrastructure. In spite of the fact that other industries (e.g., information technology, communications) have evolved at a faster pace, the 2010-2011 ITS America Annual Report informs [2]: •

77% of fixed bus route agencies have real-time arrival data.



94% of toll roads have electronic collection.



70% of the population is covered by 511 systems in 38 states.



Thousands of miles of highway and arterial roads are managed under Traffic Management Centers surveillance. ITS is one of the most promising sectors for Internet of Things (IoT) hype,

primarily due to the impact transportation system elements will have on domains connected to the Internet cloud. Smart traffic signals and surveillance systems enable more convenient traffic planning by communicating traffic conditions and flow to connected vehicle on-board systems, which, in turn, will aid in saving an enormous amount of time due to traffic congestion delays. ITS America reports that each year the

1

average American spends 40 hours sitting in traffic [3]. Moreover, public safety vehicles, buses, and commercial vehicle fleets will benefit from a smart, connected infrastructure able to communicate valuable information about traffic and road conditions. Cisco Systems has already introduced a high-level system overview, namely Cisco Connected Roadways [4]. An essential ITS system component is vehicle detection and classification. However, the integral real-time traffic monitoring and analysis functionality proves problematic. Commuters, traffic administrators and agencies must rely on such systems for improving traffic control and management, as well as for trip planning and routing decisions. Technologies used for vehicle detection and surveillance can be categorized into two types: -

In-roadway sensors, including Inductive Loop Detectors (ILD), magnetic sensors, piezoelectric sensors, and Weigh-In-Motion (WIM) sensors.

-

Off-roadway sensors, including video image processors, microwave radars, infrared sensors, ultrasonic sensors, and passive acoustic arrays sensors.

Interested readers can find additional details about these technologies in [5]. Existing technologies, like Bluetooth, have also been used to detect vehicles and estimate highway travel time [6]. Regardless of the technology, the era of IoT is redefining the objectives and standards of all systems. IoT device are expected to be smart, reliable, and low-cost, without significant maintenance. For ITS systems to fit into the IoT paradigm, they must adhere to the inherent need for constrained resources for processing, memory,

2

power, and security functionality. These could impose further difficulties and challenges on ITS, especially given the nature of the applications they target. For instance, some Automatic Vehicle Classification (AVC) systems cannot save collected data for more than several days. WIM systems, on the other hand, can store data for up to a year. Problems with power consumption persist, whether at the processing or communication stage at the point when data is transmitted to an access point for further processing. The work detailed in this thesis is an extension to a project focused on designing a low-cost, reliable, and low-power intelligent vehicle counter and classification sensor (iVCCS) system [7] in which the sensor exploits the physical phenomenon of magnetic field disturbance caused by ferrite materials in the body of a vehicle. The sensor relies on a triaxial magnetometer to measure magnetic field before measurements are transmitted to processing platform. Previous work (i.e., first generation iVCCS [iVCCS 1stG]), proved the design concept with high accuracy and reliability [7]–[9]. A second generation iVCCS (iVCCS 2ndG) was designed around a more powerful, 32-bit microcontroller equipped with an on-die digital signal processing (DSP) core. Special attention to power consumption was lead to the development of the new iVCCS 2ndG platform. This research focuses on minimizing sensor power consumption while maintaining accurate vehicle detection, count, and speed estimation. Several algorithms were ported and modified from iVCCS 1stG to accommodate the new platform and reduce overall circuit current consumption of the system. A number of new techniques were also introduced to enable interrupt-based microcontroller operations and reduce

3

duty cycle. In addition, a dynamic power management was proposed, leveraging the merits of artificial intelligence. The balance of this thesis is organized, as follows: •

Chapter 2 includes the theoretical concept of magnetometers and their application in vehicle detection and counting; a literature review of work related to low-power embedded systems and dynamic power management is also provided.



Chapter 3 focuses on an overview of the system platform, describing hardware and specifications.



Chapter 4 describes algorithm modifications ported from the iVCCS 1stG to iVCCS 2ndG.



Chapter 5 introduces new techniques developed to further optimize sensor operations relative to interrupts in favor of a polling methodology for reducing duty cycle; a power analysis of components is also presented.



Chapter 6 highlights the dynamic power management problem and proposes a reinforcement algorithm to predict activities to reduce power consumption.



Chapter 7 reports results collected from tests and deployments obtained in both lab and real-world scenarios.



Chapter 8 concludes the thesis and offers direction for further research.

4

Chapter 2 Background and Related Work 2.1 Magnetometer Theory of Operation Geomagnetic field is a force field that surrounds the earth’s surface and flows from the earth’s interior into the space. It is similar to a field generated by a simple bar magnet tilted, currently estimated at an 11.5° angle. Although the force field’s intensity is in constant flux and has experienced large-amplitude variations over the past 800 thousand years [10], it is considered rather uniform at any region on the earth’s surface, ranging between 25 and 65 µT (0.25 to 0.65 gauss).

Figure 1. Magnetic field of the earth [11].

Ferrous materials in traveling vehicles cause small, local disruptions in the geomagnetic field. Due to high magnetic permeability of these ferrous materials, the flux lines of the field are absorbed and distorted in a non-linear form as a vehicle passes 5

through the field, as shown in Figure 2. Several factors play a role in the resulting intensity magnitude and direction of field changes (e.g., speed, density, and size mechanical form).

Figure 2. Disturbance in magnetic flux lines caused by a vehicle.

Measured disturbance is known as the vehicle magnetic signature, which is unique and differs from one vehicle to another. The disturbance can be modeled as a number of magnetic dipoles [12]. Signatures can be measured by magnetometers, which report three geomagnetic components of the field: north 𝐵𝐵𝑥𝑥 , east 𝐵𝐵𝑦𝑦 , and vertical 𝐵𝐵𝑧𝑧 . 2.2 Related Research Work

Power consumption is a primary concern for wireless sensor node design, as each element of the design (e.g., processing unit, power management unit (PMU), processing algorithm, and, most importantly, system components) is affected. As such, it is critically important to carefully select each device and peripheral as a first step to sensor design [13]–[15]. iVCCS 2ndG was purposefully designed to optimize low power consumption. While technological advancements have reached a point at which application performance is ensured, energy efficiency remains challenging, especially given IoT 6

integration. Modeling power consumption at the early stages of development and predeployment becomes decisive. Authors in [16] propose a general methodology to simulate wireless sensor node power consumption by profiling three essential aspects of WSNs: networking, sampling, and processing. Although electrical component characteristics and wireless interfaces play a major role in determining power consumption, a particular standard, component, and technology becomes crucial when developing an algorithm. A model for performance evaluation is necessary for optimization. Literature has suggested building a predictor for estimating remaining power in the main energy storage and predicting the amount of power harvested during future time slots [17], [18]. Such mechanisms aid in determining which functionalities to disable and for how long based on a corresponding peripheral power profile. This stage of development can benefit from the power consumption model proposed in previous references. In [17], authors optimized RF transmission time — the most power-hungry system element — to determine an optimal transmission interval. Software development is dependent upon energy consumption. Given that a nonoptimal algorithm is executed for energy consumption, selecting low-power components is inconsequential. In fact, several techniques must then be orchestrated to achieve a satisfactory performance. Most energy management implementations involve smart and intelligent use of peripherals and system sensors [17]–[20]. Indeed, the heart of the power management process should be an algorithm that determines when to enable and disable each module on the board, in addition to flexibly controlling and switching between power schemes. This is preferred over a fixed profile that runs the

7

system in its many situations. Such an algorithm is commonly referred to as Dynamic Power Management (DPM). Researchers have defined and tried to resolve the DPM problem. Authors in [21] modeled system behavior as a time series of busy and idle periods, suggesting that various idle intervals require different sleep modes (see Figure 3), primarily because switching takes time and more energy than nominal consumption. They employed adaptive tree learning as a method for solving policy selection wherein a predictor is used to indicate when and for how long idle states occur.

Figure 3. Changing system sleep mode according to load [21].

In [22], authors used Reinforcement Learning (RL) to adaptively choose the optimal power management policy in a given idle state wherein an action is taken and objectives are evaluated. Based on outcomes, subject-to-constraints (e.g. performance) state-action pairs are rewarded/punished, assigning a 𝑄𝑄-value. A variation of the 𝑄𝑄-

Learning algorithm, namely SARSA (State-Action-Reward-State-Action), is used to monitor values in a 𝑄𝑄-table. Idle time is known and can be calculated according to assumptions.

8

A more recent paper [23] used the 𝑄𝑄-learning algorithm to optimize power

consumption in a video encoder System-on-Chip (SoC).

Authors in [24] proposed a machine learning algorithm to select the optimal policy online. The algorithm considers a variant of RL with weights placed on policies and a loss function to update weights. Assumed idle times are known; the way in which loss function affects weight is not clear.

9

Chapter 3 System Platform Overview iVCCS 2ndG is a fully autonomous system designed to achieve self-powered, low-power operation through energy harvesting without sacrificing performance. The new system is carefully crafted in a compact design (45×30×6 mm) that combines highperformance, energy-efficient components and that is equipped with a power management subsystem for minimizing energy consumption while maintaining accurate vehicle count, logging, and speed estimation. Figure 4 shows the interconnections among various components. A gauge monitors and reports battery capacity to the microcontroller unit (MCU). Nano-power load switches are placed at the power lines of certain energy-hungry sensor components, including the RF wireless module, GPS receiver, and SD card, among others. Energy-efficient algorithms were developed to accurately detect, count, estimate speed, and control various system components. Figure 5 shows top and bottom views of the printed circuit board.

Figure 4. Overview of the system components [7].

10

Figure 5. iVCCS PCB components.

3.1 Microcontroller At the heart of the sensor system lies an ultra-low power platform manufactured by STMicroelectronics, equipped with an ARM CORTEX-M0+ 32-bit RISC core –

11

STM32L071 [25]. This microcontroller is characterized by number of features that make it appealing for low-power applications [26]. These include: − 0.29 μA standby mode (3 wakeup pins) − 0.43 μA stop mode (16 wakeup lines) − 0.86 μA stop mode + RTC + 20 KB RAM retention − Down to 93 μA/MHz in run mode − 5 μs wakeup time (from flash memory) − Core from 32 kHz up to 32 MHz max − 1 to 25 MHz crystal oscillator − 32 kHz oscillator for RTC with calibration − Up to 192 KB flash memory with ECC − 20 KB RAM 3.2 Magnetometer Kionix KMX62 is a 6 degrees-of-freedom magnetometer/accelerometer inertial sensor system [27] that senses changes in the magnetic flux of earth’s surface due to vehicles passing in its vicinity. KMX62 is a very reliable and power-efficient sensor, consuming 395 µA at high-resolution mode and 1 µA in standby mode. The magnetometer’s full-scale range is ±1200 µT, and digital bit depth is 16 bits, resulting in a magnetic sensitivity of ±0.0366 µT compared to ±0.1 µT in iVCCS 1stG. 3.3 ZigBee Module The radio frequency (RF) frontend utilizes a ZigBee transceiver from ZLG based on an NXP JN5168 microcontroller [28]. AW516x is a low-power, highperformance ZigBee module that incorporates the IEEE 802.15.4 standard and supports 12

a variety of protocols on top (e.g., FastZigBee, ZNET, ZigBee-PRO, and RF4CE). The AW5161P0CF module used in iVCCS 2ndG has a small footprint (13.5×16.5 mm) and features a ceramic antenna. Receiver sensitivity is -95 dBm, consuming 21 mA, and transmitter power is 2.5 dBm with 18 mA current consumption. The engine features a deep sleep mode with 100 nA typical current. Data transfer rate of the system is 2 Mbps. 3.4 GPS Time synchronization is achieved via a GPS module manufactured by Quectel. L76-L GPS receiver module integrates GLONASS and GPS systems [29] and provides a built-in low-noise amplifier (LNA) for improved performance for 33 tracking channels, 99 acquisition channels, and 210 PRN channels. The module features EASY technology [29] and allows L76-L to automatically calculate and predict orbits using ephemeris data stored in the internal flash of the module. This reduces time-to-fix even in indoor situations with poor signal levels. Current consumption is 25 mA in acquisition mode and 7 µA in backup mode. 3.5 Real-Time Clock STM32L071 also offers an internal Real-Time Clock (RTC) and features low power operation [26]. It has on-the-fly correction capability with a range of 1 to 32767 RTC clock pulses, allowing the system’s 1 Hz clock to synchronize with the Pulse Per Second (PPS) signal of the GPS module subsequent to fix acquisition. The internal RTC is clocked by a 32.768 kHz external ultra-low power oscillator manufactured by SiTime [30], which offers a current consumption of

Suggest Documents