Energy and Memory Efﬁcient Data Loss Prevention in Wireless Sensor Networks

: Load balancing, energy efﬁciency and fault tolerance are among the most important data dissemination issues in Wireless Sensor Networks (WSNs). In order to successfully cope with the mentioned issues, two main approaches (namely, Data-centric Storage and Distributed Data Storage) have been proposed in the literature. Both approaches suffer from data loss due to memory and/or energy depletion in the storage nodes. Even though several techniques have been proposed so far to overcome the mentioned problems, the proposed solutions typically focus on one issue at a time. In this paper, we integrate the Data-centric Storage (DCS) features into Distributed Data Storage (DDS) mechanisms and present a novel approach, denoted as Collaborative Memory and Energy Management (CoMEM), to overcome both problems and bring memory and energy efﬁciency to the data loss mechanism of WSNs. We also propose analytical and simulation frameworks for performance evaluation. Our results show that the proposed method outperforms existing approaches in various WSN scenarios.


Introduction
A WSN is a collection of small sensing devices with limited bandwidth, power, and computational capabilities.The main goal of a WSN is to gather information from specific environment, for applications such as remote monitoring and target tracking.The design of a WSN depends significantly on the application and must consider factors such as the deployment environment, the application's design objectives, the maximum cost, the available hardware, and system constraints [1].Energy efficiency, fault tolerance, and load balancing are among the most challenging issues of a WSN.Therefore, many approaches have been proposed in the literature trying to handle the mentioned issues in order to make a WSN reliable and scalable.In particular, data storage plays a key role in making a WSN effective.Data storage approaches can be categorized into two groups: Distributed Data Storage (DDS) and Data-centric Storage (DCS).
To cope with energy efficiency, DDS approaches concentrate on local data storage in sensing nodes.This makes the data storage process very energy efficient.However, in order to collect the specific information stored in the network, all sensors have to be queried by means of a flooding mechanism: this makes the data retrieval process incurs a high amount of traffic and decreases the network lifetime.On the other hand, DCS approaches focus on data-centric mechanisms for storage and retrieval by means of Geographic Hash Tables (GHTs) [2] and geometric routing algorithms such as Greedy Perimeter Stateless Routing (GPSR) [3].Although DCS is more energy consuming than DDS in the storage process, its query process is based on directed dissemination of queries to a specific ii of xviii node, denoted as storage node, so that it reduces the query traffic and increases the efficiency of the retrieval process.
Data replication over multiple storage nodes is the mechanism which both groups of data storage techniques use to handle fault tolerance and load-balancing.Fault tolerance in the WSN is obtained by preventing data loss caused by energy or memory depletion in the storage node.The approaches in [4][5][6][7][8][9][10] focus on data loss prevention due to energy shortages, whereas the approaches in [11][12][13] concentrate on efficient memory usage of nodes in the WSN.The mechanism with which a replica is elected in DDS is based on local broadcasts between the neighbors of the storage node.This fully distributed mechanism generates a high amount of traffic and decreases the network lifetime.
In this paper, we integrate DCS replication features into DDS to cover both memory and energy efficiency in data loss prevention mechanisms for WSNs.We present a novel mechanism denoted as Collaborative Memory and Energy Management (CoMEM).We divide the WSN into multiple zones: in each zone we include a monitor node, proposed in [8], to act as a gateway for both storage and retrieval processes.Therefore, if an event is sensed throughout the zone, the collected information will be forwarded toward the monitor, which stores the summary of the received data locally and chooses the appropriate node for storing the details.On the other hand, in the retrieval process, all queries are routed toward the monitor, which decides whether to answer the query directly (summarized retrieval) or to redirect the query to a specific storage node.
In order to bring self-organization, load balancing, and fault tolerance, two relevant parameters are considered in each zone.The first parameter is related to the percentage of memory and energy availability at the storage nodes.If this parameter falls below a properly set threshold, the monitor will replicate the data over the most memory and energy available node within the zone and will balance the storage traffic load between the previous storage node and its new replica.The second parameter is related to the percentage of energy availability in the monitor.As it acts as a gateway for both storage and retrieval processes, it will deplete its energy quickly.Whenever the percentage of the energy availability of the monitor falls below the properly determined threshold, the most energy-available node is chosen by the current storage node to be the new monitor.As a result, the mechanism collaboratively chooses new replicas and monitors and brings self-organization, fault tolerance, and load balancing to the WSN.
The rest of the paper is organized as follows.Section 2 is devoted to related works on memory shortage problems leading to CoMEM in WSNs.Section 3 proposes our appoarch to integrate DCS features into DDS mechanisms, Section 4 describes the simulation framework used for performance evaluation, Section 5 is dedicated to simulation results.Finally, Section 6 concludes the paper.

Related Works
In [14], fault tolerance WSN applications are categorized into five groups: (i)node placement, (ii)topology control, (iii)target and event detection, (iv)data gathering and aggregation, and (v)sensor monitoring and surveillance.In this section, we will briefly take a look at works previously proposed in the area of memory efficient data gathering in WSNs.Basic DCS and DDS methods are not designed either for sensornets with highly mobile or unreliable nodes.Thus, enhanced techniques must be designed so that data dissemination mechanisms are robust against data losses due to both energy and memory depletion occurrences in nodes.As several researches are dedicated to energy efficiency in WSN; our effort mainly concentrates on memory efficient data dissemination mechanisms.
In [11], a Low Complexity Distributed Data Replication (LCDDR) mechanism is proposed to prevent data loss due to memory shortages by means of replicating the data over the most memory available node denoted as "donor node."This brings fault tolerance and reliability to the data storage mechanism.However, the mentioned method has some challenging issues.First, according to the results in [11], the query process is of no concern in the proposed mechanism.Second, the local broadcast mechanism for donor node election is not energy efficient for high scale data dissemination in WSNs.Third, due to the fully distributed donor node election mechanism of LCDDR, a hijacking node can declare itself as the most memory available node and become the donor node in the election process, thus easily sniffing data.Finally, if no donor node can be chosen, the data loss will happen due to the lack of a widespread election mechanism.
In [12], a hybrid routing algorithm, denoted as Bloom Filter based Routing Protocol (BFRP), is proposed: it relies on hierarchical (cluster-based) routing and bloom filter data aggregation.This method decreases the amount of memory usage for the routing table at each node by means of bloom filtering and cluster head data aggregation.However, cluster head election is handled by local broadcasts between the neighbors of the current cluster head.Each node broadcasts a parameter, denoted as "coverage-aware cost" and calculated according to its remaining energy, to its neighbors.After the first broadcast, the node waits for the specific amount of time determined by the coverage-aware cost and, if there is no announcement with a lower cost, it will declare itself as a cluster head to the neighbors by means of another broadcast.This generates a high amount of traffic for cluster head election.Moreover, the elected node is the most energy available one and memory usage is of no concern.
Another method, which relies on data compression and, thus, brings memory efficiency, is presented in [13].In this case, the memory usage of nodes and the wireless bandwidth consumption is affected by a co-design memory mechanism for low-latency in-place lightweight compression.However, as the compression happens on relevant memory pages, the information can only be accessed by multiple packet payload decompression.Therefore, data aggregation on cluster head will bring a high amount of energy consumption.This tends to deplete the energy of the cluster head.Moreover, no election mechanism for a depleted cluster head is proposed.
Memory-based Message Efficient Clustering (MMEC) is presented in [15] to enhance energy efficiency of nodes by reducing the propagation of duplicated messages.Moreover, a heuristic protocol is proposed to predefine the distribution of the sensors over the specific sensed area.This protocol increases the energy saving efficiency in the given network.However, no data loss prevention mechanism is proposed and practical issues, such as random distribution of the sensors, are not considered.
A new transport layer protocol, denoted as Reliable Transport with Memory Consideration (RTMC), is presented in [16]: hop-by-hop retransmission guarantees reception of specific data by the sink.It also prevents the change of transmission rate for congestion control to safeguard the control packets.Furthermore, information on the memory status of each sensor is included in the packet header for memory overflow prevention.However, inserting sensor memory information in each packet continuously causes unnecessary redundant data transmissions.Therefore, this protocol is not energy efficient.
Tiny Distributed Shared Memory (TinyDSM) [17] is a reliable DDS mechanism which tries to replicate the data in some nodes along the path between the sink and the source.According to this method, each node along the query propagation path, which contains the replicated data, will answer the query directly.Therefore, the amount of query propagation traffic is load-balanced over multiple replicas of the storage node.However, as replicas are periodically updated by the source, the latter becomes the bottleneck and depletes its energy fast.Also, TinyDSM does not consider energy and memory constraints in its replica selection mechanism.
A fault recovery mechanism in single-hop small WSNs is proposed in [18], as a mechanism for data loss prevention.In this method, the sensed data is shared between all nodes when a storage node is unavailable.Then, by the time the storage node becomes accessible or some sort of election mechanism chooses a new one, the nodes empty their memories, transferring the sensed data to the storage node.Therefore, whenever the frequency of sensed data is high or the WSN has a high node spatial density, the new storage node has to cope with a high amount of storage-related data traffic and depletes its memory and energy fast.Therefore, this method is not memory and energy efficient in highly dense WSNs.
In Table 1, a summary of the proposed mechanisms is shwon, considering key performance indicators in WSN scenarios.

Collaborative Memory and Energy Management (CoMEM)
Data storage and retrieval processes are interesting design aspects, as they are directly related to a WSN lifetime and to its topological structure.As anticipated in Section 1, DDS and DCS are the main approaches proposed in literature for data storage and retrieval with energy efficiency and scalability.
• In DDS, the source node, upon sensing a specific data, stores it locally without any communication requirement.Therefore, this approach is the most energy efficient one in the storage process.Moreover, in order to collect the sensed data in the retrieval phase, all nodes within the network have to be queried and this typically involves the use of flooding mechanisms.Therefore, the retrieval process involves a high amount of traffic and decreases the network lifetime.Figure 1 shows the retrieval process in DDS-based methods.As illustrated in the figure, the Personal Digital Assistant (PDA) node sends the query for specific data to all nodes.The nodes, which contain the specific data of interest, will answer the PDA.For example, this data could refer to specific targets.The target node specified in the figure can also be mobile and detected by multiple sensors simultaneously.• In DCS-based methods, the sensed data is stored in a specific location determined by a GHT mechanism [2], which maps the specific event-type to a specific location.In order to route the sensed data, geometric routing algorithms, such as Greedy Perimeter Stateless Routing (GPSR) [3], are used to deliver the data to the nearest node to the mapped location.This node is denoted as storage node.Although this approach relatively increases the storage process traffic, the retrieval process is very efficient as all queries are forwarded to the single storage node using the GHT mapped location.This avoids flooding mechanisms and brings energy efficiency and scalability to the network.Figure 2 shows the storage and retrieval processes in DCS-based methods.As shown in the figure, sensors will forward their sensed data to the storage node.Therefore, the PDA only sends queries to this specific node instead of flooding all nodes with queries.
Both basic versions of DDS and DCS suffer from data loss due to node mobility and node failure.To overcome these limitations, several approaches have been proposed in the literature.All of them are based on replicating the data, i.e., creating replicas over multiple storage nodes.In DDS-based approaches, due to a fully distributed storage mechanism, the most memory or energy available node is elected as a replica based on the local broadcasts between the neighbors of the storage node [11], [12].This mechanism has the following challenging issues.First, a local broadcast mechanism for replica election is not energy-efficient for high densed data dissemination in WSNs.Second, a hijacking node can declare itself as the most suitable node to store the data so that the data can easily be sniffed.Finally, if no storage node for a replica can be chosen, data loss will be unavoidable.This is due to the lack of a widespread election mechanism.
On the other hand, in DCS-based approaches, the replica is selected by the centralized GHT mechanism: the nearest node to the mapped location, determined by a hash function, will become the replica.Therefore, the energy or memory availability of the new elected replica is of no concern.
According to the method proposed in [8], the entire network is divided into partitions called "zones."In each zone, in addition to the storage node for each event-type, a new node called "monitor" is introduced to act as a gateway for both storage and retrieval processes.Whenever a data is sensed by a source node in the zone, it is forwarded to the monitor by means of a GHT hash function.The monitor then stores the summary of received data locally and forwards its details to the replica specified for the event-type of the received data.In the retrieval process, all queries are forwarded to the monitor node.If the queries are related to locally stored data, the monitor will answer directly; otherwise, it will forward the query to the appropriate replica.However, due to the role of the monitor, all storage and retrieval traffic passes through the monitor and its neighbors.Therefore, they have to support a high amount of traffic, especially when the occurrence frequency of sensed events and the sensor spatial density are high.This depletes the energies of the monitor's neighbors and soon the monitor is left with no neighbor.The neighborless monitor is not accessible and the storage and query traffic will be interrupted.Figure 3 shows the storage and retrieval processes in R-DCS.
We integrate the DCS data storage mechanism into the DDS one and propose a novel scheme, denoted as CoMEM, which relies on the ideas presented in [11], [8] and [9].According to CoMEM approach, we divide the network into zones with similar dimensions.The number of zones is assumed to be a power of 2 and depends on the network size.In some approaches, e.g., in [9], the number of zone changes on the basis of the occurrence frequency of sensed events.Here, we assume that the number of zones is constant.First, the monitor and storage nodes are determined by GHT within each zone.After this centralized election, a self-organized mechanism for the election of the monitor and replicas is considered.Each node within a zone informs the monitor of its remaining memory and energy.This can be carried out during the propagation of sensed data to the monitor or through a dedicated packet forward.We denote ζ e ∈ [0, 1] as the fraction of the remaining energy of the node and ζ m ∈ [0, 1] as the fraction of the remaining free memory; These coefficients can thus be expressed as follows: where: i e is the initial energy (dimension: [J]) and r e is the remaining energy (dimension: [J]) of each node; i m is the initial available memory (dimension: [Bytes]) and r m is the remaining memory (dimension: [Bytes]) of each node.The mentioned coefficients are calculated by each node and sent to the monitor.The monitor stores the received data in its local coefficient table and calculates the "election coefficient" (ζ replica ) which is the following heuristic coefficient simultaneousely taking into account energy and memory resources: where c 1 and c 2 are the relative weights for the energy and memory coefficients.The monitor also computes the following variation coefficient: where ζ replica is the election coefficient of the storage node and (max)ζ replica is the maximum value of all election coefficients reported by the nodes.If ζ var(replica) overcomes a pre-defined threshold, i.e., the average value of all election coefficients, the following election mechanism starts: If a node has lower energy and/or memory than at least another node in the zone, then the former will be covered by latter and its coverage number (defined in the election algorithm) will be set to zero.As a result, nodes with larger than zero coverage numbers are more likely to become replicas.With this algorithm, local broadcasts between the neighbors of the storage nodes are avoided and also the new replicas are not limited to the neighbors of the storage nodes, which also tolerate a high amount of traffic.
This mechanism has one drawback, normally related to the single point of failure due to the presence of the monitor.Since all the interactions for storage, query and election processes are handled by the monitor, the monitor manages a high amount of traffic and, thus, depletes its energy fast.We then propose an efficient election mechanism for the monitor.This election is performed by the storage nodes.The collected ı e of all nodes are periodically sent to the storage node by the monitor.The storage node then calculates the variation of ζ e as follows: where ζ e is energy coefficient of the monitor and (max)ζ e is the maximum value of energy coefficients reported by nodes within a zone.If ζ var(monitor) overcomes a threshold, i.e., the average value of ζ e of all nodes, the (max)ζ e node becomes the new monitor by the storage node announcement throughout the zone.Then, the old monitor transfers its data to the new one.Although this mechanism performs a single broadcast for monitor election in the zone, it can be ignored as it happens whenever the monitor needs to be changed.Therefore, this is more energy efficient than the one presented in DDS approaches.Moreover, as the monitor contains all the information related to nodes' identification and placement, a hijacking node can be easily detected and then, the mentioned node can be easily banned.

Simulation Framework
In order to evaluate the performance (according to various metrics) of the proposed distributed storage system for WSNs, various simulation approaches have been proposed with use of Discrete Event-based Simulators (DES) such as ns2 [19], ns3 [20], TOSSIM [21], and EmStar [22].
We have developed a DES which is based on the event-scheduling algorithm explained in [23] .In this simulator, we concentrate on events and their effects on the status of the WSN during a predetermined simulation time.Figure 4 illustrates the proposed DES structure, with the three engines described below: 1.The Simulation Engine is the heart of our DES and implements event scheduling algorithm for non-deterministic, discrete and dynamic WSNs.This engine has the following main components.
• Snapshot, which contains: CLOCK as a base of timing system; State Variables to describe the system in different points of time; Future Event List (FEL), which contains an ordered list of future events for event scheduling algorithm execution; and Output Parameters for ix of xviii evaluation and analysis.It has some functionalities in list processing for inserting events into FEL and removing events from it.• The event Scheduling Algorithm for event processing and updating the snapshot of the system in different points of time.The snapshot is the container of system state variables, FEL, system queues, and output counters [23].• Simulation Initializer, which is used to build the first snapshot of the system at the CLOCK=0.
2. The Network Engine handles all the interactions of the nodes within the WSN on the basis of the DCS data dissemination mechanisms.This engine includes the following elements.
• GHTs for mapping an event type to a specific location.These hash functions are expedient to avoid traditional point-to-point routing approaches, which are used in today's Internet and, indeed, use data-centric approaches.• GPSR is routing algorithm of choice: it can route a packet toward the destination on the basis of the location of the storage node.GPSR can operate in two modes.The first mode, denoted as Greedy, is used whenever there is a node, between the current node and the destination, which is nearer to the destination than the current one.The second mode, denoted as Perimeter, is used when there is no node closer than the current one to the destination.According to the latter mode, a packet is forwarded to the neighbors of the current node based on the "right hand rule" [3] until a closer node is found.We also enhanced GPSR to route the packets more efficiently and avoid loops during the transmission of the packets by adding the list of traversed node's identification to the header of Protocol Data Units (PDUs) in Perimeter mode.• "Node" is the template for sensor node implementation in terms of energy and memory management.
• "Target" is used to define target coordinations and target movements within WSN.
• "Packet" is a container of raw information which is routed toward the storage, monitor or PDA nodes.We implement services like path tracing and loop avoidance in the structure of the packets to enhance GPSR for efficient routing and loop avoidance.• "Zones" are the partitions of the WSN network and are used in all considered mechanisms, i.e., R-DCS, AR-DCS, and CoMEM.Zones are associated with their boundaries and their members.
3. The two dimensional graphical engine allows to explicitly visualize events within the WSN whenever a specific algorithm is going to be used.It shows target movement, node placement, information sensing, dissemination of information toward the monitor or storage node, and the data retrieval process of PDA.It contains the following packages.
• Board Wrapper: used to draw the boundary of the network and nodes placement.
• Node Wrapper: used to determine wireless transmission range of the nodes and characterize transmission and reception activities.• Target Wrapper: indicates the target position and its movement throughout the network.
• PDA Wrapper: chooses the position of the PDA to handle data retrieval process.
• Packet wrapper: needs to show the ensemble of the packets within the WSN.
The DES simulator proposed in this paper does not owe to the methods we used for evaluation and analysis of energy and memory efficiency.According to its layered structure, it can easily be extended to host more applications of WSN with simple modifications.The main advantage of the mentioned simulator is related to the in dependency between network functionality and simulation graphical engines.Therefore, any modification in data dissemination protocols has no effect on the mentioned engines.

Analytic Results
Energy and memory efficiency are the most important evaluation factors of WSNs as they are directly related to data loss and network lifetime.In [2], [8]   "Total Number of Query Packets" (Q), and "Total Number of Response Packets" (Dq) are proposed as the main metrics for energy efficiency evaluation.On the other hand, in [12], [11], the "Number of Data Losses" (Total dataloss ) due to memory shortages is the main performance evaluation parameter for memory efficiency.Since the election mechanism is part of the storage process, we account for it in the traffic considered as TotalQ.
In order to evaluate our proposed method with the metrics outlined in the previous paragraph, we assume that sensor nodes are static -the assumption to face with the mobile nodes is under investigation.Since neighboring nodes should not be deployed too close to each other, the locations of nodes are determined randomly by considering a minimum distance.We assume that nodes are equipped with General Positioning System (GPS), so that they know their coordinates.We also assume that the quality of radio channel does not change dramatically in a short period of time, so that the transmission range is considered to be constant.Moreover, nodes are robust during storage and retrieval processes and do not crash in the presence of traffic bursts.Finally, as our research mainly focuses on the application layer, three different wireless communication technologies at physical and data-link layers: 802.11b and 802.11g, with large transmission range and relatively low node spatial density; and 802.15.4 6lowPAN, with short transmission range and relatively high node spatial density.In this paper, we concentrate on 802.15.4 6lowPAN: the extension to 802.11b and 802.11g protocols (and comparative performance analysis) will be the subject of our future work.Table 2 summarizes the input parameters for 802.15.4 6lowPAN [24].We can categorize the metrics in Table 2 into three groups: • Parameters depending on the application: Network Size, Number of Nodes, Minimum Distance between neighboring nodes, Number of Targets, and Sensor Range.• Parameters based on the node specification: Node Initial Energy, which is evaluated on the basis of the initial energy of an Alkaline Battery [25]; E transmit , computed as the product between the node voltage, the current in transmission mode, and the transmission time, i.e., 3 V × 13.8 mA × 4 ms = 165 µJ for 802.15.4 6lowPAN [24]; E receive computed as the product between the node voltage, the current in receiving mode, and the receiving time, i.e., 3 V × 11.8 mA × 4 ms = 141 µJ; transmission Range calculated according to Friis Law [26]   In order to run our simulations, there are some parameters, related to simulation framework, that have to be evaluated as well.These parameters, shown in table 3, depend on the type of application and the simulation scenario.
In order to evaluate the performance of the storage and retrieval processes, we focus on the energy consumption of a single packet transmission and the total amount of packets which are sent in each process.On the basis of the data provided by [24], the energy consumption per packet can be calculated according to the following equation: Beside TotalQ, Q, and Dq, to evaluate memory efficiency, we define a metric denoted as Total Dataloss , which corresponds to the total number of packets which can not be stored in replicas due to memory shortages.According to the 802.15.4 standard, the minimum payload size is 81 Bytes: Since 40 Bytes are used for IPv6 header and 7 Bytes belongs to UDP header, 33 Bytes lay for data.The use of JSON data structure consumes 7 more Bytes, so that the space left for key/value pair (the "data") is 26 Bytes.Therefore, the amount of data loss can be computed as follows:

Short-term Simulations
In short term simulations, we evaluate each data storage algorithm by inserting different number of targets in the simulated WSN.The number of targets is between 1 and 120 in order to force different levels of storage and retrieval traffic in a short period of time (600 s).For long-term simulations, we set the number of targets in the range between 1 and 50-the reason for this change is related to the amount of packets generated by the simulator and will be discussed later in Section 5.2.

TotalQ
Obviously, TotalQ is minimized when using LCDDR, as data is stored locally without any transmission.Therefore, the traffic due to storage is only limited to the election mechanism.The basic DCS ranks second in terms of storage traffic, as it only relies on storage nodes and no fault tolerance mechanism is implemented: therefore, it does not contain any election mechanism for storage and this also decreases the traffic due to storage.R-DCS ranks third.With this algorithm, monitors are also used in the storage process: this creates more traffic and makes R-DCS vulnerable to monitor failure.Finally, CoMEM is the method with monitor and storage nodes collaborating in the storage process and uses two election mechanisms for monitor and storage node election.Therefore, the traffic amount for storage is relatively higher with respect to other methods.In Figure 5, the performance results, in terms of TotalQ, as a function of the number of the targets, are shown.As the results in Figure 5 show, there is no election traffic with LCDDR, so that the election mechanism is not relevant in short-term simulations.The metrics Q and Dq are expedient in understanding the efficiency of the retrieval process.Figure 6 and Figure 7 show the performance results, respectively, in terms of Q and Dq as functions of the number of targets.The most efficient retrieval process belongs to the basic DCS, because only storage nodes are involved in queries and responses.However, this mechanism suffers from data loss due to node failure.The second position belongs to R-DCS and CoMEM due to the role of the monitor as a gateway in retrieval process.R-DCS also suffers from the single point of failure risk related to the energy depletion of the monitor.Finally, the LCDDR mechanism faces the highest amount of traffic due to its inefficient retrieval process: this brings traffic bursts in the retrieval process and decreases the network lifetime.

Total Number of Packets
As shown in Figure 8, CoMEM traffic is relatively increased, with respect to DCS and RDCS, because of the election mechanism.On the other hand, LCDDR mechanism incurs a high amount of traffic and, consequently, a relevant energy consumption (approximately 75 J over 600 s).It can thus be concluded that CoMEM brings fault tolerance and load-balancing to data storage and retrieval processes, keeping the traffic close to that of the basic distributed storage methods.In Figure 9, Total dataloss is shown as a function of the number of targets.As expected, the amount of data loss in basic data dissemination methods is high, whereas LCDDR and CoMEM suffer no data loss in short-term simulations.

Long-term Simulations
In order to enhance our results, we developed a low-level (taking into account hardware constraints) DES simulator based on the framework presented in Section 4 over 32 bit MinGW engine [27].In this simulator, we use C++ compiler and omit 2 dimension animation to enhance the simulation speed.With this simulator, we can expand the simulation time from 600 s to 3600 s to collect more accurate performance results.However, the main problem with 32 bit MinGW engine is related to the amount of RAM which can be accessed during the simulation.This value corresponds to 4 GB with the used computer.Therefore, applications which generate a large amount of packets, such as LCDDR, can not be simulated with our simulator.Moreover, we can not consider a large number of targets as in short-term simulations.More precisely, the number of targets is set in a range between 1 and 50.By using a large memory server and a 64 bit compiler engine, these limitations disappear.This extension is the topic of our future research.

TotalQ
In long-term simulations, since the neighbors of the storage nodes begin to deplete their energies, the paths to reach storage nodes become longer.Therefore, the traffic associated with the storage process when using the basic methods reaches the value of the traffic load of CoMEM.In Figure 10, TotalQ is shown as a function of the number of targets, confirming this observation.As a result, the traffic due to the storage process in long-term simulations is relatively the same for CoMEM, DCS, and R-DCS.

Q
The traffic due to the query process depends completely on the storage algorithm in data-centric storage methods.More complicated storage algorithms incure a higher query traffics.As shown in Figure 11 and Figure 12, the lower traffic is guaranteed by DCS, which has the simplest data dissemination mechanism.CoMEM and R-DCS have a similar performance.In Figure 13, the total number of packets is shown as a function of the number of targets.Since the traffic due to the storage process is approximately the same in the three considered methods, the total number of packets is directly affected by the query process traffic.For CoMEM, the total energy consumption is approximately 75 J, which is equal to the amount of energy consumption in LCDDR in short-term simulations .Therefore, it can be concluded that CoMEM is six times more energy efficient than LCDDR.

Total Dataloss
In Figure 14, the amount of data loss is shown as a function of the number of targets.In order to reduce to zero the data loss incured by CoMEM, we change the value of C1 and C2 parameters presented in Section 3. Since the initial energy associated with the nodes is quite high (16 KJ) with respect to the energy consumption associated with the transmission and reception of each packet (300 µJ), we set C1 to 0.1 and C2 to 0.9 in order to give a higher priority to memory efficiency.
According to the results in Figure 14, CoMEM is incurs no data loss in the long term simulation.It also generates load balancing to the traffic due to storage process over multiple replicas.Moreover, the possibility of setting C1 and C2 makes it flexible and able to adapt to various situations.

Conclusions
In both DCS and DDS singular mechanisms, nodes are reliable and the network topology does not change over time, so that node failure has not been considered.However in the presence of node failure, these assumptions no longer hold.In this paper, a novel scheme denoted as CoMEM is proposed which integrates the DCS features into DDS.CoMEM avoids local broadcasts for storage election and brings energy and memory efficiency to the data loss prevention mechanism for data dissemination algorithms in WSNs.CoMEM uses the features of DCS in storage and retrieval processes: therefore, it does not generate a high amount of traffics in the network.However, it collaboratively prevents data loss or traffic failure due to nodes failure.

e l e c t e d = k r e t u r n e l e c t e d Listing 1 :
import E ( n ) # a r r a y o f energy c o e f f i c i e n t s import M( n ) # a r r a y o f memory c o e f f i c i e n t s def cover ( n ) = ones ( n ) # e v a l u a t i n g t h e a r r a y o f c o v e r s f o r i i n range ( 1 , n ) f o r j i n range ( 1 , n ) i f cover ( j ) <>0 and E ( i ) <E ( j ) and M( i ) <M( j ) and i <> j #node j c o v e r s node i cover ( i ) = 0 cover ( j ) = cover ( j ) + 1 # f i n d i n g t h e a p p r o p r i a t e node f o r r e p l i c a t i o n e l e c t e d = 1 ; f o r k i n range ( 2 , n ) i f cover ( k ) > cover ( e l e c t e d ) e l e c t e d = k e l s e i f cover ( k ) =cover ( e l e c t e d ) and E ( k ) >E ( e l e c t e d ) e l e c t e d = k e l s e i f cover ( k ) =cover ( e l e c t e d ) and E ( k ) =E ( e l e c t e d ) and M( k ) >M( e l e c t e d ) Election algorithm.

preprints.org) | NOT PEER-REVIEWED | Posted: 11 July 2018 doi:10.20944/preprints201807.0206.v1
with Path Loss Exponent set to 4; and Number of Memory Slots computed by dividing the available RAM for data storage in the sensor nodes by the PDU dimension.• Parameters based on the network characteristics: Frequency Band, Bit Rate, and Transmission delay.