Abstract
Keywords
Introduction
Wireless sensor networks (WSNs) are gaining more and more attentions because of the boom of application fields as well as the development of sensor and wireless communication techniques. The WSNs have been used in a variety of everyday life activities and specific applications. An important application is environment monitoring. In the area of environment monitoring, the sensor nodes equipped with all kinds of sensors provide services including temperature monitoring, humidity monitoring, and even audio and video monitoring. However, in most WSNs, it is cost-prohibitive or impossible to replace the exhausted batteries. As a result, the energy, network capacity, and network lifetime are extremely limited, which greatly limits the application of WSNs. Energy problem is always one of the most important problems that remain unsolved.
Recently, a lot of energy-efficient algorithms have been presented to improve the energy efficiency of WSNs. Generally, the energy-efficient algorithms are mainly divided into five categories: radio optimization, data reduction, sleep/wakeup schemes, charging solution, and energy-efficient routing. 1 Each category covers a variety of newly proposed algorithms, which have greatly promoted the research on energy efficiency in WSNs. In radio optimization, energy-efficient power control or topology control 2 is one of the most common solutions. In order to reduce the duplicated data, network coding is applied in WSNs. 3 Sleep/wakeup scheme is one of the most direct ways to save energy in WSNs. Two sleep schemes, duty cycle learning algorithm, 4 and software-defined networking (SDN)-based sleep algorithm 5 are proposed, respectively. Some researchers focus on the charging problem and propose energy-efficient algorithms from the perspective of increasing battery power.6,7
Recent studies 8 show that the data processing and data collecting units consume much less energy than the wireless communication unit. As a result, most energy-efficient-related studies focus on routing and data transmission schemes.9–14 Actually, the availability of WSNs depends on the success of routing discovery and data transmission. The energy-efficient routing protocols are divided into four main categories: network structure, communication model, topology-based, and reliable routing schemes. 15 On the basis of this classification, Liu et al. 9 proposed a data transmission scheme called MIMO and Multi-hop for energy-constrained WSNs. The scheme combined cluster-based virtual multiple-input multiple-output (MIMO) and multi-hop technologies. Farooq and Jung 10 took energy, traffic load, and link quality into consideration and proposed a multi-metric ad hoc routing protocol called Energy, Traffic load, and Link quality aware AODV for WSNs. In the proposed routing protocol, smart meters are used to enhance the network reliability. Low-energy adaptive clustering hierarchy (LEACH) 11 protocol is one of the most famous and suitable routing protocols in energy-efficient WSNs. I Sohn et al. 12 proposed a LEACH-based routing protocol called LEACH-AP using affinity propagation. Some other LEACH-based protocols such as LEACH-C (low-energy adaptive clustering hierarchy centralized) 13 also achieve good energy efficiency in WSNs. L Tang et al. 14 turned the selection of next hop in routing procedure into a multiple criteria decision-making procedure and proposed an energy-efficient routing protocol based on chaos generic optimization.
All the energy-efficient routing protocols above are based on distributed routing schemes which may fail in routing discovery. The implementation of energy-efficient schemes such as power control and sleep/wakeup schemes is mostly based on distributed routing algorithms. Once the sensor nodes have packets to send to the sink node, they start up a routing discovery procedure. On one hand, with the expanding of network size, the edge nodes have large probability of routing failure during routing discovery procedure which makes the energy-efficient schemes invalid. On the other hand, by applying distributed routing algorithms, more routing overhead is necessary to guarantee the success of finding a suitable path to the sink node. However, in WSNs, the transmission of redundant packets consumes much more energy than the operation of processing unit. 8 Routing overhead is a non-ignorable factor that affects energy efficiency in WSNs. Finally, the hop count is also an important impact factor of energy saving. 16 The non-shortest-path-based distributed schemes cannot guarantee the optimization of hop count which brings the uncertainty into energy efficiency in WSNs.
In order to further reduce energy consumption in WSNs, one feasible research direction is to abandon distributed algorithms and adopt centralized control algorithms. By avoiding distributed routing discovery, both routing overhead and probability of routing failure reduce. The central controller has all the information of sensor nodes which makes it easy to optimize the hop count. Energy-efficient algorithms such as load balance and sleep/wakeup are also easier to implement in a centralized control network. 5 Moreover, centralized control algorithms have greatly released the calculation pressure of sensor nodes with simple equipment. In fact, in most of WSNs, sensor nodes are stationary. In other words, the connected relations between sensor nodes seldom change. Routing discovery in distributed routing algorithms becomes less necessary. The sink node in WSNs is usually better equipped than ordinary sensor nodes. These characteristics make it possible to apply centralized control routing scheme, which is the main idea of SDN in WSNs.
Some SDN-based WSN architectures have been proposed.17–20 There are two major architectures, two-layer architecture17–19 and three-layer architecture. 20 The feasibility together with the advantages and challenges of software-defined wireless sensor networks (SDWSNs) has been analyzed in detail.
Although there may still be a lot of problems in applying SDN in WSNs, with the increasing application of SDN over wired networks, SDN architecture has been applied in different kinds of wireless network21–23 such as 5G network 21 and wireless mesh networks 23 to overcome specific problems. In WSNs, a lot of SDN-based energy-efficient algorithms have been proposed.5,24,25 Zeng et al. 24 focused on the energy minimization in multi-task SDWSNs. They investigated three issues (sensor activation, task mapping, and sensing scheduling) by the centralized control algorithms. Sleep scheduling 5 and load balance 25 algorithms were also proposed to achieve energy efficiency in SDWSNs. The energy-efficient algorithms are easier to implement in SDWSNs than in traditional WSNs. However, the SDN-based energy-efficient algorithms mentioned above ignore some common problems in recent proposed SDWSNs. Their implementations are based on the ideal SDWSNs and the authors do not care about the design of SDWSNs. Despite the good performance of the energy-efficient algorithms, the basis of implementation of these algorithms is still an unsolved problem. Therefore, we first analyze the feasibility of SDN over WSNs and design a new architecture of SDWSNs. Then, we propose an energy-efficient algorithm based on multi-energy-space for SDWSNs to achieve energy efficiency.
The main contributions of this article are as follows:
We do a comprehensive analysis of the feasibility of SDN over WSNs and point out the problems in recent proposed architecture of SDWSNs.
We design a new architecture of SDWSNs which is a novel and feasible solution.
We present a multi-energy-space-based algorithm for the first time and apply the inter-space communication mechanism in energy balance in WSNs.
The rest of this article is organized as follow: In section “Analysis of SDWSNs: feasibility and particularity,” we analyze the feasibility of applying SDN in WSNs and the particularity of WSNs. In section “A novel SDN architecture over WSNs: design and implementation,” the details of a new architecture of SDWSNs are introduced. In section “Design of multi-energy-space-based energy-efficient algorithm,” we propose a multi-energy-space-based energy-efficient algorithm for SDWSNs. Simulation scenarios and results are analyzed in section “Simulation results and analysis.” Finally, we conclude this article in section “Conclusion.”
Analysis of SDWSNs: feasibility and particularity
In this article, our study focuses on the WSNs which are specific-application-oriented communication networks. Most of them are designed to satisfy specific applications such as environment monitoring. After the deployment of sensor nodes, the network topologies seldom change except that new sensor nodes join the network and the sensor nodes run out of their power. Because of the limited types of sensors equipped in a sensor node, the types of services are also limited. In consideration of these features, we analyze the feasibility of applying SDN in WSNs.
SDN is first designed to improve the management of wired networks such as data centers. 26 The network is divided into two planes, control plane and data plane, making the programmable network switches in data plane simple forwarding devices. The controller in control plane runs centralized control software to manage the entire networks. 27 By simplifying the function of network switches, the network is easier to manage and the efficiency of network switches is improved. The reason why SDN is feasible to apply in WSNs is that there are some similar attributes in both SDN and WSNs. Such attributes are shown in three aspects:

Network structure of wired SDN and traditional WSN.
In consideration of the similar attributes above, it is reasonable and feasible to apply SDN mechanism in WSNs. The SDWSNs should be able to inherit the advantages of the wired SDN. However, SDN is designed for wired networks originally. It is still not yet known whether SDN framework in its current specification suits WSNs or not. In spite of the similar attributes, WSNs have their own natures and constraints which are quite different from those of wired SDN. The particularities of WSNs are as follows:
The particularities of WSNs bring some common problems which are ignored in the current designed SDWSNs.17–20
Problem 1: control problem
Sensor nodes are randomly distributed in the monitoring area. At the initial phase of the network, the sink node or the controller has no idea where the sensor nodes are. The sensor nodes also do not know their neighbor relations as well as the path to the sink node or the controller. Under these circumstances, the control messages cannot easily reach the sensor nodes because of unable to establish of TCP/IP (Transmission Control Protocol/Internet Protocol) connection. This problem is addressed by Luo et al. 17 but no appropriate solution is provided.
Problem 2: secure channel problem
Most proposed SDWSN architectures ignore the establishment of secure channel.17,19,20 The secure channel can be established by traditional routing algorithms. 18 However, the process of finding the secure channel is not inevitably successful. The secure channel consists of multiple wireless links which are not stable and has to be hosted in band. 17 Control messages have to share the same multi-hop path as well as the packet loss rate with the sensor data packets. As a result, the secure channel may not be secure enough.
Problem 3: topology problem
In WSNs, the network topologies change dynamically. The change in topology means the redefine of flow rules and the rebuilt of secure channel which brings a lot of additional traffic overhead. De Gante et al. 18 apply traditional routing protocols to deal with the node mobility problem. However, this approach is against the principle of centralized control mechanism. The additional routing overhead and the probability of routing failure make it inefficient or unacceptable in WSNs. In fact, whether it is feasible to apply centralized control mechanism in WSNs with too-frequently-changing topologies is still not clear.
Problem 4: flow problem
WSNs are designed for specific applications, and the types of services are limited and known. Ignoring the particularity of WSNs and directly applying the flow mechanism in OpenFlow for wired networks in WSNs17,19,20 are not reasonable. There is no need for the sensor nodes to request the flow table frequently, and in consideration of the limited resources of sensor nodes, the flow table should be as simple as possible.
These problems urgently need to be solved in the newly designed SDWSNs. However, it is not necessary for the SDN mechanism in wired networks to deal with these problems. Therefore, it is not suitable to directly apply wired SDN mechanism in WSNs. In full consideration of the particularity of WSNs, some appropriate modifications in current specification of wired SDN are indispensable.
A novel SDN architecture over WSNs: design and implementation
In consideration of the particularity of WSNs, our designed WSNs-fit-in SDWSN architecture focuses on solving or avoiding the problems mentioned above. In order to achieve the goal, some basic principles need to be obeyed when designing the new architecture.
The network framework of our proposed SDWSNs is depicted in Figure 2. The main idea is to make the network programmable and make the complexity of sensor nodes as simple as possible. The sink node in control plane acts as a controller and has the whole control of the entire network by applying the SDN paradigm. The sensor nodes in data plane act as switches. Wireless multi-hop secure channels are used to transmit control messages from controller to sensor nodes.

Architecture of our proposed SDWSNs.
It is worth noting that there are two major differences between traditional SDN26,27 and our designed SDWSNs. (1) In the control plane, the controller has a flow table which is used to process the data from the sensor nodes. The forwarding rules of the flow table are modified by the controller itself according to the predefined policies. (2) In the data plane, the sensor nodes are equipped with sensors to collect sensor data and create flows themselves. Actually, by separating the data processing unit and the data collecting units from the controller and the sensor nodes, respectively, our designed architecture is the same as the traditional SDN architecture.
To further understand the principles of our designed SDWSN architecture, we propose the protocol structures of both the controller and the sensor nodes. These two new structures are shown in Figure 3.

Protocol structures of sensor nodes and controller.
The sensor nodes do not run the distributed routing algorithms. They just receive the forwarding rules and fill the flow table which has greatly reduced their calculation pressure. The controller creates forwarding rules according to the topology information and delivers them to the sensor nodes. The details of how our designed SDWSNs work are addressed below. We mainly introduce the topology management, controller, secure channel, and flow table modules.
Topology management: discovery and maintenance
As mention in principle 1, before the start of SDN mode, the controller has to learn the information such as node distribution and link quality of the entire network. Otherwise, the controller has no idea where the sensor nodes are. As a result, the forwarding rules cannot be generated and delivered to the sensor nodes. Topology management module has two main duties: topology discovery and topology maintenance.
Topology discovery
After the start of the network, the controller and the sensor nodes immediately start a topology discovery procedure to collect the network topology and other information (link quality, residual energy, etc.). The topology discovery algorithm is a distributed algorithm which is against but necessary for the paradigm of SDWSNs. The algorithm processes are different in the controller and the sensor nodes.
In the sensor nodes, the main purpose of topology discovery is to find the neighbors and fill the neighbor table. The sensor nodes broadcast HELLO_RQ (hello request) packets periodically and wait for HELLO_RP (hello response) packets from their neighbors. They fill their neighbor tables with the information obtained from the HELLO_RP packets. Once the sensor nodes have received TOPOLOGY_RQ (topology request) packets from the controller, they packet the neighbor information together with the node information (residual energy) into TOPOLOGY_RP (topology response) packets and send them to the controller. The process is shown in Algorithm 1.
In the controller, the main purpose of topology discovery is to get network interconnection map (shown in adjacency matrix) and other information (link quality, residual energy, etc.). A short time after the start of the network (ensure that the sensor nodes have found their neighbors), the controller broadcasts a TOPOLOGY_RQ packet and waits to receive the TOPOLOGY_RP packet for a period of time. During the topology discovery period, the controller sends the information in the TOPOLOGY_RP packet to the topology information module as long as it receives a TOPOLOGY_RP from a sensor node. The process is shown in Algorithm 2. After that, the topology maintenance procedure begins.
Topology maintenance
In the sensor nodes, the main purpose of topology maintenance is to detect the change in neighbor relations. After sending the TOPOLOGY_RP to the controller or receiving the forwarding rules from the controller (for new arrival sensor nodes), the sensor nodes start the topology maintenance procedure. The sensor nodes also broadcast HELLO_RQ packets periodically to collect their neighbor information. Before the next broadcast of HELLO_RQ, the sensor nodes compare the neighbor information collected during the last two HELLO_RQ periods. If any differences are detected, the sensor nodes packet the change information into TOPOLOGY_REPAIR packets and send them to the controller. The process is shown in Algorithm 1.
In the controller, the topology maintenance procedure is relatively simple. After the topology discovery, the controller keeps waiting until it has received a TOPOLOGY_REPAIR packet. Then, the controller modifies the topology information module according to the TOPOLOGY_REPAIR packet. The process is shown in Algorithm 2.
Topology management module is one of the most important modules in our designed SDWSN architecture. It has to apply distributed algorithms to guarantee the reliable control of the entire network. Two important cases of topology change (the arrival of new sensor nodes and the death of sensor nodes) are solved by the topology management module. When a sensor node joins the network, the sensor nodes that have already connected to the controller would detect the change in their neighbors and inform the controller. Once a sensor node has run out of its power, its neighbors would also detect the change and inform the controller.
Controller: the kernel module
The controller module is only implemented in the controller. After the topology discovery procedure, the controller module requests the information (mostly shown in an adjacent matrix) in topology information module through a certain interface. First, the secure channels must be established. By applying optional principles, such as shortest-path-first and optimal-path-first, the secure channels to all sensor nodes are decided.
After that, the controller module generates forwarding rules according to predefined types of flows (to satisfy the principle 4). Then, the controller fills its flow table and delivers the forwarding rules to the sensor nodes along the secure channels to accomplish the entire network configuration. This is the most basic operation in our designed SDWSNs. Details will be discussed in the subsequent section.
The controller module also provides interface for some other mechanisms such as network virtualization, multi-task scheduling, and sleep/wakeup algorithm. Network virtualization, for example, is easy to implement in SDWSNs. Since the controller has the entire network information, the sensor nodes can be easily divided into different sub-networks by modifying the forwarding rules or changing the attributes of sensor nodes.
Secure channel: dynamic establishment
In our designed architecture, both the topology management module and the controller module have interfaces to the secure channel module. Secure channels can be modified by these two modules in different phases dynamically.
In routing discovery procedure, the topology management module establishes one-way secure channels from the sensor nodes to the controller according to the spread of TOPOLOGY_RQ. Before the start of SDN mode, the controller does not need secure channels to the sensor nodes since there is no forwarding rule to be sent. The sensor nodes establish temporary one-way secure channels when they receive the TOPOLOGY_RQ from the controller or other sensor nodes. Then, the TOPOLOGY_RP packets can be sent to the controller along the one-way secure channels.
The secure channels may not be the optimal ones in the routing discovery procedure. Once the controller has finished the routing discovery procedure, the topology information module is filled with the network topology and other information (link quality, residual energy, etc.). Then, through the interface between topology information module and the controller module, the controller module establishes optimal two-way secure channels according to the predefined principles. The configurations of the secure channels are delivered to the sensor nodes hop by hop from the controller. Therefore, all the secure channels from the controller to the sensor nodes are established as well as TCP connections.
The control messages such as TOPOLOGY_RP, TOPOLOGY_REPAIR, and forwarding rules all travel along the secure channels. To avoid the dynamic change and the accumulated packet loss rate of secure channels, we use predefined types of services to simplify the flow table so that the sensor nodes know all flows’ forwarding rules. As a result, the control messages are reduced to a large degree, which also satisfies principle 3.
Flow table: generation and simplification
In consideration of the particularity of services in WSNs, we take all types of services into account and all flows’ forwarding rules are decided in the controller right after the finish of topology discovery procedure. The controller module gets the necessary information from the topology information module and generates forwarding rules according to energy efficiency or load balance principles. Actually, in our designed SDWSNs, the energy efficiency and load balance algorithms are shown in a weighted adjacent matrix. The weight of an edge in the adjacent matrix indicates the residual energy of sensor nodes or the remaining bandwidth. Algorithms such as D-algorithm and F-algorithm are applied in finding optimal forwarding rules. When the controller has finished generating forwarding rules for all sensor nodes, the forwarding rules are sent to the sensor nodes along the secure channels to finish the configuration of flow tables of sensor nodes. So far, the entire network enters the SDN mode completely.
The flow table is shown in Figure 4. For example, if a sensor node receives a Type1 packet from IP1 and the destination of this packet is IP2, then the sensor node adds its sensor data into the packet and retransmits it. For simplicity, after filling the flow tables with forwarding rules, it is not necessary for the sensor nodes to request the forwarding rules again. In principle, the sensor nodes will not create packets that are not defined in the flow table and there is only one destination (the controller) for the sensor data packets. As shown in Figure 4, the sensor nodes or the controller will drop the packets with unknown type. That is also one of the reasons why the OpenFlow in wired SDN is not suitable in WSNs. If the topology change is detected, the controller rebuilds the secure channels and regenerates the forwarding rules. The sensor nodes even do not need to know when and how to receive the configuration packets. They just report the change in their neighbors to the controller and transmit packets according to their flow tables. In this way, the calculation pressure of sensor nodes is released. The frequency of usage of the secure channels is relatively low which greatly improves the reliability of the entire network.

Design of flow table.
Design of multi-energy-space-based energy-efficient algorithm
In this section, we design an energy-efficient algorithm based on multi-energy-space for the above designed SDWSNs. The WSN applies the new SDWSN architecture, and during the topology discovery procedure, the controller gets the network adjacent matrix
The sensor nodes remain stationary once they are deployed in the target area.
All sensor data flow to the controller from the sensor nodes.
The sensor nodes are powered by limited power sources which are not able to replace. The controller is not limited in terms of energy and memory.
All sensor nodes are location unaware.
The collisions in media access control (MAC) layer are ignored (network layer strategies are analyzed in this article).
The first four assumptions are reasonable in most applications of WSNs. The fifth assumption is easy to be satisfied by MAC layer mechanisms such as CSMA/CA (carrier-sense multiple access with collision avoidance). Some network properties are as follows:

Important concepts of multi-energy-space-based algorithm.
After the entire network entered the SDN mode, our energy-efficient algorithm begins to work. First, the controller gets the adjacent matrix and the residual energy of all sensor nodes from the topology information module. The energy hierarchies of sensor nodes are assigned according to their residual energy. Then, the sensor nodes are initially assigned proper energy spaces based on their energy hierarchies. One of the most important principles is that the sensor nodes in higher energy space have higher priority than the sensor nodes in lower energy space to forward packets. The sensor nodes in lower energy space will not help the sensor nodes in higher energy spaces to forward packets even though they are closer (in hop count) to the controller. They just create packets and send to the controller through the AISLs. As a result, the packets may travel along a longer path consisted of sensor nodes with higher energy hierarchies. Thus, the traffic load is assigned to the sensor nodes with more residual energy which helps to balance energy consumption in the network.
With the passage of time, the residual energy of sensor nodes drops. Once the residual energy has dropped to a low level, the sensor nodes are assigned new energy hierarchies and may be moved to lower energy spaces. Therefore, the pressure of forwarding packets from other sensor nodes has been released. The sensor nodes may also be forced to move to lower energy spaces because of no routes are found to the controller. When all sensor nodes are in the lowest energy space, the network becomes a traditional WSN.
Our multi-energy-space-based energy-efficient algorithm follows the following steps. Some important symbols and their introductions are shown in Table 1.
Introduction of some important symbols.

Dynamic change in the nodes’ energy space distribution.
There are two important circumstances should be noticed:
The changes in AISLs and energy spaces are reflected in step 2. By analyzing the process of step 2, it is easy to know that in our energy-efficient algorithm, the sensor node has higher priority to forward packets if it is in a higher energy space. For the sensor nodes in the same energy space, the optimal forwarding rules are selected. In this way, our multi-energy-space-based energy-efficient algorithm shows its ability of energy balance.
Simulation results and analysis
In this section, we first built a simulation platform of our proposed SDWSNs in MATLAB to prove the feasibility of SDN over WSNs. The processes such as topology discovery, topology maintenance, and forwarding rules generation are simulated in the simulation platform. Then, we add our multi-energy-space-based energy-efficient algorithm into the simulation platform to evaluate its performance. Our proposed algorithm is compared with some traditional energy-efficient routing algorithms such as WRP (Wireless Routing Protocol), 15 E-TORA (Energy-aware Temporarily Ordered Routing Algorithm), 28 and LEACH-C 13 routing protocols. In WRP, the shortest path first principle is applied. The sensor nodes select a path with the minimum hop count to the controller. In E-TORA, each sensor node is assigned a height based on its distance to the controller as well as the energy consumption level. The controller has the lowest height and the packets are forwarded into the downstream to the controller. LEACH-C is a cluster-based energy-efficient routing algorithm. In LEACH-C, a centralized control mechanism is applied and the controller selects the clusters in a energy-efficient way based on the overall information of the sensor nodes. Some important performance indexes will be analyzed in the following subsection.
We adopt energy consumption model in the work by Heinzelman et al.
29
It is assumed that the radio expends
The energy consumption of receiver is given by
The energy consumption of transmitting a packet of 5000 bits is shown in Figure 7.

Energy consumption of transmitting a packet of 5000 bits.
Simulation parameters.
First, the functional verification of our proposed SDWSN architecture is given. To evaluate the energy efficiency of WSNs, we then mainly analyze the performance indicators including energy balance, network lifetime, and energy consumption. Energy balance shows in the distribution of energy, which is defined as the location distribution of residual energy of sensor nodes. It is easy to see the energy balance of the whole network from the energy distribution. The network lifetime is directly reflected by the number of dead sensor nodes. A dead node is defined as the sensor node who runs out its energy. Finally, we analyze the total energy consumption of the entire network and energy consumption per packet.
Simulation platform of SDWSNs
Figure 8 shows the interface of our simulation platform. Details of mechanisms such as topology discovery are implemented in the simulation platform. First, the number of sensor nodes, the efficient communication radius, and the size of monitoring area are required. Then, we click the Init button to finish the network initialization.

An overview of interface of SDWSN simulation platform.
After that, we click the Start button to start the network simulation. The sensor nodes start to send HELLO_RQ to discover their neighbors and the controller starts to broadcast TOPOLOGY_RQ packet to collect topology information. After a period of time, the controller gets the topology information of the entire network which is shown in an adjacent matrix. Then, we click the Topology button to show the connection diagram in the left coordinate system in Figure 9.

Display of network connection diagram according to the topology information.
The controller module in the controller generates the forwarding rules of all sensor nodes according to the adjacent matrix. The forwarding rules are shown in the right coordinate system in Figure 10.

Display of forwarding rules of all sensor nodes.
Node 1 is set as the controller. Then, we click the FRi button to view the path from node 20 to the controller which is shown as the red path in the right coordinate system in Figure 11.

Display of forwarding rules of sensor node 20.
In our simulation platform, the basic functions of the proposed SDWSNs are implemented. For simplicity, we consider only one optimal path to the controller for each sensor node. The secure channels are the same as the packet forwarding paths. Our proposed multi-energy-space-based energy-efficient algorithm is also implemented in this platform.
Energy balance
Figure 12 shows the snapshots of energy distributions of different algorithms at the same simulation time. From Figure 12, we can intuitively see the energy balance of different algorithms.

Energy distribution of different energy-efficient algorithms: (a) WRP, (b) ETORA, (c) LEACHC, and (d) MES
As shown in Figure 12(d), our algorithm performs better in balancing energy consumption than WRP and E-TORA. The sensor nodes that have the similar distances to the controller have nearly the same residual energy. They have the same speed of energy consumption and run out of their energy almost at the same time. The reason is that, when the energy hierarchies of sensor nodes are detected changed (energy information of sensor nodes can be insert into the data packets), the controller moves the sensor nodes to a lower energy space. As a result, the flows through these sensor nodes will then change their paths to the controller. The excessive energy consumption of sensor nodes at key positions is avoided. However, in Figure 12(a), by applying the shortest-path-based routing algorithm, the flows will not change the paths to the sink node until relay sensor nodes in the paths run out of their energy. Therefore, the residual energy of sensor nodes at key positions drops quickly which is reflected in Figure 12(a). In Figure 12(b), the sensor node chooses a path to the sink node based on the residual energy of relay nodes and the distance to the sink node. The sensor node is assigned a lower height and has a lower priority to be selected as relay node if its residual energy is low. In this way, with the continuous consumption of energy, the energy consumption speed slows down. Thus, the energy distribution of E-TORA is more balanced than that of WRP.
LEACH-C is a cluster-based algorithm, and its energy consumption is much different from the other three algorithms. The LEACH-based algorithms may have better performance in small-scale sensor networks. As shown in Figure 12(c), we can see that the sensor nodes at the edge of the network run out of their energy faster than the sensor nodes around the sink node. The reason is that by applying the data aggregation technique, the cluster nodes around the sink node have much less packets to forward, which greatly reduces the speed of energy consumption. Meanwhile, the sensor nodes at the edge of the network always have longer distances to the clusters. As a result, they spend much more energy to transmit packets to the clusters which is shown in Figure 7. The sensor node spends more than seven times of energy to transmit a 5000-bit packet through a distance of 150 m than 60 m. The cluster selection strategy of LEACH-C leads to the energy distribution in Figure 12(c). Our simulation results also prove that LEACH-based algorithms adapt small-scale networks well.
Network lifetime
Figures 13 and 14 show the number of dead nodes of different algorithms versus the simulation time. The number of dead nodes, which directly reflects the network lifetime, increases continuously with the passage of time. In this article, we define the network lifetime as the time from the beginning to the time when the first dead node appears. From Figure 13, we can see that our algorithm performs much better in prolonging network lifetime. WRP and LEACH-C have similar performance. However, in WRP, most of dead nodes are sensor nodes around the sink node, while in LEACH-C, most dead nodes are sensor nodes at the edge of the network. The reason is expounded in the previous section. Moreover, E-TORA has similar performance as our algorithm of

Number of dead sensor nodes of different energy-efficient algorithms.

Number of dead sensor nodes of MES with different
With an increase in
The comparison of the performance improvement and the complexity increase is illustrated in Figure 15. Compared to

Comparison of performance improvement and complexity increase.
Energy consumption
The energy consumption of the whole network and the energy consumption per packet are shown in Figures 16–19, respectively. When all sensor nodes are dead nodes or isolated nodes, the network is considered a dead network whose energy consumption remains the same. We can see from Figure 16 that the energy consumption of WRP is the lowest before the death of the network. E-TORA and our proposed Multi-Energy-Space (MES)-based algorithm consume more energy than WRP because of a longer path may be applied with the decrease in residual energy of relay nodes. With the passage of time, when all nodes around the sink node died, the network died.

Energy consumption of the entire network of different energy-efficient algorithms.

Energy consumption of the entire network of MES with different

Energy consumption per packet considering data aggregation.

Energy consumption per packet without considering data aggregation.
In LEACH-C-based network, however, the network remains active when all other energy-efficient algorithms–based network died. Due to the data aggregation technique, the sensor nodes transmit much less packets than the other energy-efficient algorithms. The energy consumption speed around the sink node is much slower. The small-scale network around the sink node remains active despite the death of the sensor nodes at the edge of the large-scale network.
As shown in Figure 17, comparing the energy consumption of our proposed algorithm with different energy spaces, it is easy to find that with the increase in
From simulation results above, we know that our proposed SDWSN architecture is feasible and can be implemented. The multi-energy-space-based energy-efficient algorithm shows its ability of energy balance and network lifetime extension. From the analysis of the simulation results compared with WRP, E-TORA, and LEACH-C algorithms, the essential reason why our algorithm is more energy-efficient is that the controller has the information of entire network and makes full use of the limited energy of all sensor nodes.
Conclusion
In this article, we first gave a comprehensive analysis of applying centralized control mechanism in traditional WSNs. Then, the details of our novel SDWSN architecture, which fully considered the particularity of traditional WSNs and the superiority of SDN, were introduced. On the basis of SDWSN architecture, a multi-energy-space-based energy-efficient algorithm, which took the residual energy of sensor nodes into consideration, was presented. In the simulation part, we first built a SDWSN platform to functionally prove the feasibility of our proposed architecture. Then, the multi-energy-space-based algorithm was implemented. Simulation results demonstrated that our algorithm performed better in balancing energy consumption and prolonging network lifetime than WRP, E-TORA, and LEACH-C algorithms. Further studies will focus on the design of SDWSN testbed and the implementation of our energy-efficient algorithm in such testbed.
