## 5 Fuzzy Logic-Based WSN Power Management and Optimization
[51] applied a fuzzy logic algorithm by optimizing the sleep/wakeup process in the most common industrial communication protocols for WSNs, namely, wireless highway addressable remote transducer(HART) and IEEE 802.15.4 protocols. The authors proposed an innovative management algorithm of energy resources in order to minimize the average power consumption of each slave node, by activating the nodes only in case of critical events, thus prolonging the network lifetime. This algorithm consists of a fuzzy logic algorithm that can manage sleep/wakeup messages sent by the network controller to their slaves dynamically on the basis of the dynamic power management algorithm (DPMA). The DPMA algorithm wakes up the nodes only when they are needed, and the input variables are the sampled data and the sampling time to the fuzzification block of its fuzzy controller when the fuzzy logic controller is activated. The controller operates two input variables: the current sampling time and the data of interest (the detected temperature value, for example), where it utilizes a sampling time membership function and the detected data, and then passing the output to the de-fuzzification block, with the output being a new sampling time that is produced and used in the sampling process and wakeup/sleep cycle. Figure 10 depicts the used fuzzy controller scheme of the proposed system. The algorithm uses the temperature as input data with the range of -40 to 75 \({}^{\circ}\)C, and the current sampling time produces a new sampling time on the basis of a fuzzy controller, as depicted in Figure 10, which uses the FLS described in Figure 1. The fuzzy system evaluates the temperature variations using a specific inference mechanism, and the sampling time is a value varying from 0.1 to 1 seconds. The input variables are set in numerical shape. Every input variable has three Mamdani membership functions (low, medium, and high), then the values are processed by the fuzzy controller using an  
Figure 10: Fuzzy controller scheme. Figure 9: The fuzzy controller in dynamic sampling algorithm approach. E: deadline miss ratio, DE: deadline miss ratio desired, RBC: remaining battery capacity. inference mechanism utilizing a set of IF-THEN statements. The new sampling time, represented by a membership function, will be then fuzzified through the centroid algorithm and converted to a numerical value readable by the sensors. [PERSON]. et al. [52] proposed a power consumption reduction mechanism using fuzzy logic that utilizes the battery level and ratio throughput for identifying the sensor sleep time on the basis of the IEEE 802.15.4 protocol. Figure 11 depicts the proposed fuzzy logic controller. It calculates the sleep time on an IEEE 802.15.4 network using a centralized mechanism. The aim of sleep time calculation is to prolong the WSN lifetime for monitoring purposes. The fuzzy logic controller is used to calculate sleep time on reduced function device (RFD). After that, RFD will notify the first pan coordinator (FPC) when the sleep time is finished. The proposed mechanism uses three membership values, namely, sleeping time is the output variable, whereas the ratio of throughput to workload (TH/WL) and battery level are the input variables. The FLC defines the sleeping time of the RFD on the basis of the battery-level and the ratio of throughput to workload. The throughput is the aggregate for periodic and aperiodic packets sent by each node. The workload is the total number of packets that each node has sent. Each input and output variable has three Mamdani membership functions (low, medium, and high). These functions fuzzify the crisp inputs, and the range of throughput-to-workload percentage is 0 to 100%, with the battery level being 0 to 1024. The output variable has a sleeping time with a range from 0 to 10 s. The sampling time value is a constant determined at the design time for each node. Gaussian fuzzy membership functions are used for input and output variables, where the degree of membership is represented by normalized values between 0 and 1.