Priority Schemes for Life Extension and Data Delivery in Body Area Wireless Sensor Networks with Cognitive Radio Capabilities

Wireless sensor networks have recently been used to monitor bioelectric signals generated by the human body. However, since the dimensions and capabilities of the network nodes are small and limited, a problem is generated inherently by the energy consumption and radioelectric interference. In view of this


Introduction
The evolution of technologies in recent years has caused the dimensions of the devices to tend to decrease while their processing capacity tends to increase.The advances in electronics and solid-state technologies have also allowed working with wireless devices that provide the facility to use them remotely without the need for connections or wires.In practical terms, technology has also been used in medical applications, from the assistance of surgical procedures to taking vital signs to prosthetics and remotely monitoring different biosignals.Such recent applications have given rise to the e-health research area.It should be noted that wireless and ambulatory applications have relevant importance as they allow the patient to move without the need to be restricted to a specific area or to take extreme caution due to devices disconnection [1].Within e-health, the area of body monitoring is contemplated where the sensing of the signals that are constantly created by the organs is required for diseases detection, recovery assessment, and effort support, among others.Therefore, tools are required to efficiently capture, transmit, store, and analyze electrical signals generated by the human organs (these studies are known as bioelectric or biopotential) [2].
There are different solutions that have been proposed in the literature for monitoring biosignals, including wired and wireless approaches.The cabled option approach has no interference among nodes but patients are not comfortable with wires around their body for long periods of time and the nodes disconnection is highly probable.For the second approach, wireless sensor networks (WSN) constitute a functional and practical alternative [3], where each sensor is composed of electrodes, battery, and a processing module to allow the transmission of the information to a sink node.Therefore, the wireless option is advisable in order to allow patients to have full mobility with the recording equipment in ambulatory monitoring.However, WSNs face an inherent conflict with energy consumption since, despite technological advances, several authors have reported that the lifetime battery of nodes in this type of systems is compromised by the network dimensions (number of nodes) and data rate transmission.Consequently, the system lifetime is usually lower than that in wired networks or when nonambulatory nodes with higher dimensions are used [4,5], even in hospital environments as analyzed by Sodagary in [6].In this context, energy efficiency is one of the main research topics that have been recently studied.
Based on the above, we propose and develop a mathematical analysis that models the main dynamics of the system in order to calculate energy consumption and packet loss probabilities.Numerical results obtained through the mathematical model show that the system lifetime is greatly extended when data transmission is limited.On the other hand, when most data is required at the sink node, the energy consumed to achieve it tends to be higher, reducing the operation time of the network.In view of this inherent compromise among data transmission and energy consumption, we propose two priority schemes to enhance either system duration or data gathering, described as follows: (i) In the energy-efficient approach, nodes limit data transmission in order to extend the system lifetime.Furthermore, nodes with lower residual energy perform fewer transmissions to the sink node while nodes with their full batteries can make more transmissions without affecting the operation of the network.In this scheme, less information is transmitted (many data packets are dropped to reduce energy consumption), since the main objective of this scheme is to gather just enough information from the patient to have insight into his health, but not critic illness that requires prompt medical attention.
(ii) In the data gathering efficient approach, we assume different packets types, effectively assigning priority levels to packet data.Building on this, the priority scheme enables the expediting transmission of high priority data over low priority data, reducing packet dropping probability and reducing packet delay.However, in this approach, energy consumption is higher, reducing the operation time of the network.
These schemes are intended to work under different conditions in ambulatory systems.For instance, consider a patient in stable conditions, where his medical team has the need to monitor him for long periods of time but no emergency events are expected (e.g., an elderly person in vacations or a business trip for a highly stressed corporate worker), where different biopotential signals are of interest but there are no ongoing urgent medical procedures.In these cases, the system is required to gather as much information regarding the patient as possible, but the main interest is that the monitoring network lasts as long as the trip (or interval between medical visits) lasts.On the other hand, there are people with specific affections that require immediate medical attention.As an example, in the case of cardiac disease patients, medical staff can monitor the electrical activity in the patient's heart while allowing such patients to have as much normal life as possible, with no need to spend countless hours in the hospital.However, in case of a tachycardia, the patient can be taken to the hospital and the attending medic can retrieve all information regarding such episode.In both schemes, it is difficult to establish the adequate parameter values to guarantee the performance required for each case.Therefore, the derived mathematical analysis is of great relevance to learning about the performance of the BANET for different system parameters.Based on this model, the system can be finely tuned to achieve a specific use.
With the aim of reducing energy consumption and interference into the system, we propose the use of Cognitive Ratio (CR) capabilities.There are several examples of the potential benefits from this technology in computer networks [7][8][9][10].In CR, two systems are considered: the primary system (PS) consists of users that have the right and license to use the radio-frequency resources, and in the secondary system (SS) nodes transmit in available channels only if they are not being used by primary users (PUs), i.e., users of the PS.Secondary users (SUs) have to be constantly monitoring the availability of the channel to identify empty slots (radiofrequency resources not being used by any PU) in order to avoid any negative impact on the service provided to PUs.
As such, PUs are not affected by the operation of the SS and their service is not degraded.Building on this, we make use of such CR capabilities by allowing continuous monitoring data to be transmitted as the primary system while event-related reports are transmitted as a secondary system, making use of empty spaces in the PS.
Furthermore, we propose an ON/OFF scheme for primary nodes in order to generate empty spaces to be used by secondary nodes.In the OFF mode, primary nodes do not report data and energy consumption is reduced, allowing event-related data to be transmitted in the system.Accurateness of the data is not affected by nodes in the OFF mode since we use an oversampling procedure to allow multiple biopotential signals to be transmitted in a single time frame [11].This issue is explained in detail in Section 2.
The main contributions of this work can be described as follows: (i) A body area network (BANET) for both continuous monitoring and event reporting with CR capabilities is proposed, analyzed, and studied using Markov Chains in order to provide clear guidelines for the design and parameter selection in practical e-health monitoring ambulatory systems.
(ii) Two priority schemes (energy-focused and datafocused) are developed and mathematically analyzed in order to study the capabilities, limits, and performance of each scheme.
(iii) We propose, design, and study the ON/OFF mechanism for primary nodes in order to have empty spaces and reduce energy consumption.
(iv) Numerical results for different system conditions are obtained in order to provide relevant insights into the operation of the system.
(v) The mathematical model is validated through the use of discrete event algorithmic simulations.
The rest of the paper is organized as follows: In Section 2, a brief discussion on related works previously published in the literature is presented.Then in Sections 3 and 4, we describe in detail the proposed communication protocol and main assumptions of this work.We present the mathematical analysis in Section 5, battery and hardware specifications in Section 6, and finally relevant numerical results and discussion on the performance of the system in Section 7. We conclude with important remarks and future works in the area.

Related Work
Biosignals (also called bioelectric studies) are measurements of electrical voltages between two points in living cells, tissues, and organisms.The study of such signals allows monitoring the status and health of organs, muscles, or body parts.Bioelectric studies can be evaluated in the area of e-health, in charge of the use of technological resources to improve the quality of life of the patients and general population [12].
Most of the time, these studies are made through specialized wired instrumentation; however, at present (LTE systems) and future (considering the full potential of the Internet of Things {IoT} in 5G systems), wireless options are an accessible and fully functional resource [13].For this reason, there are a wide variety of tools that can assist in the measurement of biopotential signals wirelessly [14].For instance, we can consider the implementation of biopotential signal monitoring with ZigBee (a set of protocols that make up a wireless technology for signal acquisition) prepared by [15][16][17] (all three cases measure the heart status) or embedded ECG (electrocardiogram) systems adaptable to commercial devices [18] or WiFi-based ECG systems like [19].However, in these investigations, the authors themselves indicate that they are limited by the particular specifications that the protocols describe, energy consumption levels are already established, and there is not a clear proposal for life extension in data delivery for WSNs.
An alternative to these standardized applications is custom-design wireless sensor networks whose use has increased due to their versatility and functionality in multiple implementation areas [20].Specifically, e-health networks have a broad applications spectrum.The literature presents several protocols that can be implemented in Wireless Body Area Sensor Network (WBASN) where efficiency and energy consumption are evaluated, and in most cases to extend the average node duration it is required to include additional hardware or to include software for analysis and network topological balancing [21].To illustrate this, we can see the work by Sivakumara [22].His proposal consists of the study and evaluation of energy consumption for wireless sensor networks applying conventional protocol models with their respective programming; we can also go to the work of Kan et.al. in [23]; he makes an efficient study of a WSN (without including cognitive radio and neglecting the possible interferences that can be generated with highly specialized medical equipment) for ECG nodes.Likewise, Saleh [24] also proposes an architecture for each sensor of a WSN where the maximum energy efficiency in the system is contemplated without including the cognitive radio concept.
There are also works like that by Chávez [25] which makes a proposal of the bases of implementation of cognitive radio in weareble networks but does not develop an energy consumption analysis, but rather focuses its development on compatibility with the devices and reduction of interferences.Mamoon in [26] also defines the implementation of Cognitive Radio Network (CRN) in hospitals but without specifying the energy consumption over WSN.
As it can be seen, there are several works focused on the network implementation for the monitoring of biosignals in patients with noninvasive nodes [27].Their proposed systems are analyzed in a theoretical and practical way using various protocols and tools, proposed to contemplate the network energetic performance.However, it is very important to note that most of the reported works for life extension of the nodes and analysis of energy consumption do not usually include the conceptualization of cognitive radio in their development (or, specifically, cognitive radio is used for the decrease of radioelectric interference and bandwidth but ignoring the analysis of the energy performance of the network).In contrast, our work presents a general, flexible mathematical framework to evaluate the performance of the body area network (BANET).
To further expand the cognitive radio capabilities, we develop the analysis for each scheme, that is, network configurations that allow a greater efficiency to be generated with respect to what the users may require.Two general schemes are contemplated: a configuration to extend the network lifetime (such as the one used by Al in [28] which describes in detail the energy behavior of the network, but only focusing on one scheme and a single study) and another to provide a better resolution in the medical studies (like the one proposed by Jenq in [29] which performs a development of an efficient, high-resolution scheme, but, just like the previous example, does not mention any other scheme for the same network).It should be noted that there are researches, such as those by Pramanick [30] or Tamanna [31], that contemplate multiple schemes but focus on the nodes routing without the respective mathematical analysis.Therefore, two priority schemes are proposed to enhance the system performance.In addition to this, the mathematical model allows parameters to be adjusted in order to configure the network and have an approximate performance to what is specifically required.

Wireless Communications and Mobile Computing
This is not considered in many commercial products such as Mobita [32].As such, if the user requires a 2-hour study, it is possible to estimate the performance of the system in terms of energy consumption and the final resolution of the study (since it is associated with the packet loss probability).

System Design
In this section, we present the main assumptions made throughout the paper and explain the overall operation of the system.
A WSN is composed by a set of autonomous devices that allow sensing, processing, and communication between other nodes of the network [33].On the other hand, a biopotential study refers to the representation of ionic flux through the cell membrane that can be measured invasively or noninvasively (invasive indicates that it is placed inside the body while noninvasive means it is placed superficially on the person) [34].The studies considered for the network design are presented in Table 1; however, other studies can be included in future applications.
The proposed BANET consists of a set of noninvasive sensors, organized as a low-range transmission WSN, that obtain a bioelectric measurement of signals assuming that they are placed on a standalone person.(We assume that the probability of finding multiple patients with the same monitoring system in such ambulatory network is relatively low.)The intercommunication distance between the nodes is less than or equal to forty inches, so sensors operate on body area networks [35] with e-health applications.The system functionality considers the actual medical applications described below, but different studies may use different parameters to measure the specific aura or symptoms for each individual patient and medical team.It is important to indicate that heart rate variability (HRV) is a study associated with electrocardiogram (ECG) but this is not limited to the HRV.That is why the frequency of 250 Hz is considered for the ECG.In this work, we consider a Time Division Multiple Access (TDMA) protocol where each sensor node from the PS transmits in a previously assigned time slot, and nodes belonging to the secondary network transmit, in case of an event detection, in an empty slot (time slot not being used by a PU).
In Figure 1, we can observe that the primary nodes are continuously transmitting their information, and each sensor (with its electrode) has a predesignated slot avoiding collisions.As nodes become active/inactive, certain slots are left unused, allowing secondary nodes to send event-related information.
In order to maintain control of the electrodes that are sending information, we add redundancy sending control bits between the sensors and the sink.The packet headers are included at the beginning of each of the frames composed by  bits.Initial bits are equal to the number of primary system sensors and indicate whether a sensor transmits (1) or does not transmit (0).The remaining bits are equal to the number of SS or secondary system nodes, and they indicate whether they transmit or not.This can be visualized in Figure 2.
To exemplify this process, let us suppose that we have 10 sensors in PS and 4 in SS.In addition to the frame that contains the information of the signals, 14 bits are included; 10 of them to indicate which electrodes of the PS are active and 4 indicate how many and which electrodes of the SS will transmit in the frame.It is important to indicate that when all the nodes of the secondary network have the same transmission probability and there are limited slots, the event nodes that gain access to the channel are the first ones that detected the event.As such, a FIFO (First In First Out) event queue is assumed.
In order to obtain the frame and slot duration for the biosignals indicated in Table 1, the following sampling process has to be considered: The biopotential study which requires the highest sample rate is electrocardiogram.Specifically, the sampling frequency of ECG can be calculated as 1/(2)(250) = 2 ms.Hence, the frame duration is set at   = 2 ms; i.e., the time between each data point for the ECG and the rest of the biopotential signals is also set at 2 ms.Note that by assuring a high sampling rate, the rest of the signals are oversampled, which allows the correct reconstruction of all signals in the sink node according to the Nyquist theorem [36].
This oversampling (which is required in order to have multiple biopotential signals in the same frame) also entails having much more information than needed.For instance, consider the case of the EEG (electroencephalogram) signals, which require a sampling frequency of 1/(2)(150) = 3.3 ms which generates 300 samples per second, i.e., 300 data packets per second for the EEG study.However, since the data frame is set at 2 ms, the number of data packets for all biosignals is around 500 per second.As such, there are 200 additional data packets per second for the EEG study.
We take advantage of this fact in order to design the BANET protocol as follows: We consider the nodes monitoring the EEG signals as the primary users, i.e., nodes reporting the biopotential signals from the electric activity of the brain as the primary system transmitting in a continuous monitoring fashion.Due to the oversampling of this signal, we propose to turn ON and OFF such nodes in order to generate empty spaces that can be used by the rest of the nodes which transmit in an event-driven basis.As such, nodes in the secondary network (nodes monitoring the ECG, HRV, EGG, EOG, and ERG signals) only transmit data in case of an abnormal activity is detected from these signals, and such transmissions occur by searching empty spaces left by nodes in the OFF mode of primary nodes (EEG nodes).
Conversely, primary nodes in the ON state transmit a data packet each frame.In this work, we model this ON/OFF process by considering that nodes have probability   to become active in a given frame.Hence, nodes go to the OFF mode with probability 1 −   .As such, nodes can become active (inactive) at each frame independently of the state in the previous frame.Based on the mathematical analysis presented below, we are able to establish the adequate value of   to attain an adequate performance of the proposed network.From this, the slot duration can be computed by   = 2/  +   , as depicted in [40], where   is the number of nodes that report continuous monitoring Building on this, specific values are proposed to exemplify the system design development.There are pathologies, diseases, and preventive analyses that require multiple biosignals operating at the same time.An example is polysomnography, a particular sleep study to diagnose disorders such as sleep apnea, syndromes of periodic leg movements, and narcolepsy, among others, that needs the diagnosis of the signals [41].One way to monitor polysomnography is a 20-channel EEG and 4-channel EOG study [42].Since the EEG requires constant monitoring, it is selected as the primary system network.On the other hand, the retina movement occurs in particular dream phases (for example, rapid eye movement or REM) [43]; therefore, it is necessary to monitor EOG only under certain circumstances assigning it as the SS.
It must be taken into account that the polysomnography is a possible application case, but the user can set the network according to the specific need, as long as the sensor sampling rate is not higher than the studies presented in Table 1.As mentioned before, we consider the case where the PS is dedicated to the data gathering of an electroencephalogram composed of 20 electrodes (primary nodes).The secondary network is assumed to be a 4-channel EOG.From this, we set  =   = 20 nodes,   = 4 event detection monitoring electrodes (secondary network nodes), and  = 24 control bits.
Energy consumption in the nodes forming the BANET is as follows: (i) In the ON mode: The PS electrodes in the ON state consume   energy units per packet transmission.
(ii) In the OFF mode: The PS can be switched OFF and consequently do not transmit their respective EEG information and consume   energy units, where   = 0.1  .This relationship can be adjusted according to specific commercial node used in the study.
The use of energy units allows a general mathematical model that can be used for any commercial or noncommercial nodes.Indeed, each electronic device that can be selected to be used as a node has its own specific parameters of energy consumption that depend on the electronic characteristics of the node.As such.these values can be directly substituted on the analytical expressions derived later in this work to obtain performance metrics for such particular nodes.
Additionally, in the system model, we consider the case where sensor nodes do not detect the ongoing event.This occurs with a nonnegligible probability in BANETs due to the movement of the patient and the displacement of nodes in direct contact with the skin.As such, we consider that an event-driven node successfully detects an event with probability .(Nodes do not detect an event with probability 1 − .) Finally, it is important to mention that data packets can be dropped or lost for different reasons.
(i) Not enough empty channels are available.This occurs when the number of nodes that detect an event is higher than the number of empty channels (unused channels from the primary users).In the case of polysomnography, suppose that the 4 EOG channels need to transmit, but there are only three unused channels in the PS.Based on this we would have one lost packet.
(ii) False Negative.This occurs when an event occurs in the system but nodes fail to detect it.
(iii) Nontransmission.This occurs due to the use of the priority schemes; as some nodes have priority over other nodes to convey their information, some eventdriven nodes that correctly detect an event and find enough empty channels to transmit may choose not to transmit in order to prioritize some data over other, as explained in detail in the following section.

Priority Schemes
In this section, we explain in detail the proposed priority schemes to improve the system performance.In the first scheme (energy-centered scheme), nodes with low energy make fewer transmissions than high energy nodes, effectively extending the system lifetime.In the second scheme (datacentered scheme), nodes with important event packets have priority over nodes with data from less important events.

Energy-Centered Priority Scheme.
The main objective of this scheme is to extend the system lifetime.This is done by reducing the number of transmissions.Hence, in this scheme, data resolution is reduced which also reduces energy consumption.As we show in the Numerical Results, data transmissions cannot be reduced arbitrarily since this would lead to poor system performance.Instead, we propose a finetuning of the system by selecting the appropriate values.
Building on this, it is clear that this scheme is not intended for applications where the main objective is to gather as much information as possible.Rather, it is aimed at situations where the patient may be far from the hospital or medical staff for long periods of time and only general information regarding his particular health is required, for instance, for elderly people or patients with chronic disease, or to evaluate a brain behavior between different impulses throughout a day, or even for sportsmen or women interested in monitoring their health status.Returning to the case of polysomnography, this scheme can be useful when the medical staff requires the monitoring of a patient while he is at home and needs to analyze long sleep periods.
Considering this, we propose the following transmission probability for all nodes in the network.Specifically, event reporting nodes with information to be relayed, i.e., nodes that detected an event in the previous frame (with probability ), transmit with probability  described as where   is the transmission probability for node ,  is the control parameter,  0 is the initial battery energy,   is the residual battery energy.
It can be seen that, by using this transmission probability, nodes with higher residual energy transmit with higher probability, while nodes with low residual energy levels transmit sporadically.

Data-Centered Priority
Scheme.Contrary to the previous scheme, where system lifetime is extended by reducing the number of transmissions of low energy nodes, in this priority scheme, we intend to expedite highly important packets over less important packets, regardless of energy consumption.This is due to the fact that, in e-health applications, there are situations where the information of one sensor is more important than others.For instance, in an EGG study, some patients who have diabetes present arrhythmias in specific stomach areas.Therefore, a scheme where gastric information is delivered more efficiently than other event data is of major interest in certain patients.In the case of sleep problems, this priority scheme would work best when the user is at the hospital and the medical team needs to analyze mainly a brain hemisphere that is more active than another through eye movements.In this way, the sensors of one eye have greater importance than the other nodes.To differentiate low priority nodes from high priority nodes, we preassign the priority level at the system setup.
From this, transmission probabilities are set as follows: (i) High priority nodes transmit with probability   .
(ii) Low priority nodes transmit with probability   .
In Table 2 we present the main system design parameters and probabilities in order to simplify the further sections.

Mathematical Analysis
In this section, we develop the Markov Chain that models the main system dynamics.Specifically, this analysis considers ON and OFF transitions of the continuous monitoring nodes, event detection probabilities, event packet transmissions according to two priority schemes, and ON and OFF transitions of event reporting nodes.
We propose a Discrete Time Markov Chain where transitions occur at the beginning of each frame as shown in Figure 3.
The system state is defined as {Ω :    , 1 ,  is the residual energy of the  ℎ event reporting node;  V is the total number of event reporting nodes; and   represents the state of the event reporting node and it is given by the following.
0 if event node  does not detects an event As stated before, event reporting nodes detect an event at each time frame with probability , and such nodes with data to convey to the sink node have to search for empty channels in the primary system.Once an empty channel is detected, event node  transmits with probability   .At each frame, nodes consume a certain amount of energy due to the transmission, reception, or sleep activities.
Hence, when nodes deplete all their energy, the network is considered to be useless.For this reason, system lifetime corresponds to the time from the initial operation of the BANET (when all nodes have their batteries at the maximum energy level,  0 ) until all nodes have depleted their energy.As such, the final state of the system corresponds to state (   , 0, 0 . . .0).Hence, the proposed Discrete Time Markov Energy units in sleep mode node  Chain (DTMC) is a Transitory Markov Chain and state (   , 0, 0 . . .0) is an absorbing state.Figure 3 depicts state transitions from the aforementioned DTMC when there are enough resources for event reporting nodes to convey all their information; i.e., ∑  =1   ≤  − .As such, no event packets are lost due to lack of resources in the primary channel.
At each time frame, the system evolves in the following frame to states where nodes consume energy according to the specific operation of each node.Specifically, continuous monitoring nodes can (i) switch from the ON state to the OFF state.
(ii) switch from the OFF state to the ON state.
And event reporting nodes can (i) transmit: in this case   energy units are consumed by such nodes.
(ii) not transmit: in which case   energy units are consumed by such nodes.
(iii) go from the ON (OFF) state to the OFF (ON) state; this is represented by   , since   is a binary variable.
(iv) remain in sleep mode.
From this, the number of active continuous monitoring nodes is , which represents the final number of active nodes after some of them have become active while some others have become inactive.Similarly, some event reporting nodes become active/inactive in the following frame with the residual energy at the beginning of the frame minus the corresponding energy units used in such frame.Since the state depicted in Figure 3 corresponds to a general state, we represent such energy consumption as Δ  .Note that in case that the event reporting node is in the OFF state (inactive), then the energy consumption is   .Hence, energy consumption of node  is given as follows.
Now, we consider energy consumption in terms of energy units where   >   .Indeed, in most commercial devices, packet transmissions consume more energy than nodes in sleep mode which are considered to be in low energy consumption mode but still consume small amounts of energy.
For generality sake, we consider arbitrary values of such energy units in the mathematical model in order to allow the use of the specific values of any commercial device.As such, practical implementation is straightforward by substituting these values in the model.However, in the Numerical Results, we use practical values from our specific nodes developed in our laboratory.
In Figure 4, we show transition probabilities from the general state (   , 1 , where   is the probability that a continuous monitoring node is active in the current frame.(Evidently, a continuous monitoring node is inactive with probability (1 −   ).)   is defined in (3).  is the probability of transmitting or receiving independently of the state of the node.Since transmission/reception probabilities are multiplied by the state of the node (  ), in case that   = 0, the value of   is irrelevant.In order to maintain the general form presented in (4) we defined it as follows.
Since all nodes can be inactive in a given time frame, i.e.,   = 0 for all values of , we have to add an indicator function,  0 , to avoid having zero transition probabilities when in fact such probabilities are nonzero.
From this,  0 is defined as follows.
Finally,   is the probability that an event reporting nodes detects or not an ongoing event.Specifically, for node  (1 ≤  ≤ ), Using the general expression for the transition probabilities depicted in Figure 3, it is straightforward to find the numerical value of such probability from any state to any other valid state as shown in Figure 4.
It is important to note that not all event-related packets are successfully conveyed to the sink node.Indeed, the previous system description considered that ∑  =1   ≤  − , where  is the total number of time slots and  is the number of channels being used by primary users (continuous monitoring nodes).Now, consider the case when ∑  =1   >  − .In this case, the number of event-related packets is higher than the number of empty spaces in the time frame.Hence, not all event packets can be transmitted.This case is shown in Figure 5.
In this case, the number of event-related packets that can be successfully transmitted is  −  and ∑  =1   − ( −

Wireless Communications and Mobile Computing
C, e  ) event-related packets cannot be transmitted.Building on this, nodes that cannot transmit consume   energy units instead of   or   .For clarity sake, consider the following example.Suppose that the number of event-related packets that cannot transmit is one, and there are four event reporting nodes.Then, there are four possible events leading to the state transition depicted in Figure 5. Specifically, event nodes 1, 2, and 3 transmit and node 4 cannot transmit; or event nodes 1, 2, and 4 transmit and node 3 cannot transmit; or event nodes 1, 3, and 4 transmit and node 2 cannot transmit; or event nodes 2, 3, and 4 transmit and node 1 cannot transmit.These possible transitions occur with the same probability   = 1,   = , and   =   for  = 1, 2, 3, 4. As such, even if one node cannot transmit, it still had a packet ready to send but no available channel was found.However, energy consumption for this node is different from the nodes that actually transmitted.The aforementioned chain is numerically solved in order to find the average number of time frames from initial state (  ,  0 0 ,  0 0 ... 0 0 ) to absorbing state (   , 0, 0...0), denoted as V   , 0 , 0 ... 0 , where V , where the transition probabilities  ,  1 1 ,  2 2 ...

𝑆 𝑛 𝑛
are given by (4).Now, the average packet loss, , is calculated.Based on the lack of available resources in the primary network, the average number of packets lost in state (, which can be expressed as and the average number of packets lost in the system is derived as follows.
Finally, average energy consumption is now derived.In each frame, when the system is in state (, ), the number of packets successfully transmitted is as follows.
Note that if there are enough available resources, the number of nodes that transmit is the number of continuous monitoring nodes in the ON state, , and the number of event reporting nodes that detected the event, that is, those being active and those transmitting with probability .On the other hand, if there are no available resources to transmit all the event reporting nodes, then, all time slots are being used and the number of transmitted packets is .This can also be expressed as follows. , and the for each transmitted packet,   energy units are consumed, active nodes that do not transmit consume   energy units, and inactive nodes consume   energy units.Hence, average energy consumption can be expressed as follows.

Numerical Results
In this section, we present some relevant numerical results for the proposed WSN.First, we compare the performance evaluation obtained through the numerical solution of the Markov Chain described in the previous section to numerical results obtained through a homemade network simulator developed in C language.For this software, linear programming was considered in a MacBook Pro (Processor Intel Core i5 @ 2.4 GHZ, 8GB RAM, Intel graphics Iris 1536 MB, 256 Hard Drive Storage).The general algorithm is described below: Wireless Communications and Mobile Computing (i) Whole system initialization starts from the state where all the nodes are off and nothing is being transmitted.(ii) The simulation of the occurrence of an event is carried out so that it can be transmitted through PS (primary system).(iii) The frame sending is prepared, indicating, based on a time ON, whether each of the nodes will transmit or not in the PS.(iv) Randomly, a study is recreated with a transmission probability , for the SS (secondary system).The order of transmitting-sensors is selected randomly (if it is the energy-focused scheme) or a node is prioritized (if it is the data-oriented scheme).(v) The transmission process is simulated; the control of how many nodes of the PS and SS transmitted, how many packets were lost, and how much energy was consumed in the frame is generated.(vi) This process is repeated for each frame calculating the packets loss, energy consumed, and energy consumed ending until the initial system energy reaches zero.This is described in the diagram presented in Figure 6.This comparison allows us to verify the validity of the mathematical model and identify the system conditions where the assumptions of the model are accurate.For the results presented in this section, we consider a system with four event reporting nodes and 20 continuous monitoring nodes as required for the polysomnography study.
First, we focus on the data-efficient priority scheme.We show the accuracy of the mathematical model for the different performance metrics of the system, comparing the discrete event simulation results to the Markov Chain numerical results as shown in Figures 7-10.
For these results, we set the system with one high priority event reporting node and three low priority event reporting nodes.These figures show a good match between the mathematical model and simulation results mainly for the central part of the figures.The main reason for the discrepancies between these results (analytical and simulation) is that the time unit of the Markov model is the time frame.As such, we consider that ON/OFF transitions and event occurrences only happen at the beginning of the time frame.
However, in the simulation, we consider that these events can occur at any time during the simulation and not only at the beginning of the time frame.As such, in the mathematical model, events in the middle of the frame are not considered.However, we can see that the mathematical model can effectively describe the performance of the system with relatively small errors compared to the simulations.Also, consider that a more accurate mathematical model would require considering a time slot basis system which could further complicate the analysis.
In Figures 7 and 8, we present the average energy consumption for active primary nodes and inactive primary nodes, respectively.
As continuous monitoring nodes remain longer times in the active mode (  → 1), active nodes consume more energy since they transmit/receive more data packets but inactive nodes consume less energy.In these figures, we can clearly see the prime tradeoff between system lifetime and data fathering accuracy.Specifically, if the system administrator (treating medical team) requires strict medical following of the continuous monitoring nodes, a high value of   should be used.However, this entails high energy consumption which reduces the system lifetime.Even if this observation may sound obvious, the merit of this work resides in the fact that we provide hard numerical values for both tradeoff parameters.
As such, using the mathematical model, it is possible to calculate both energy consumption and reporting efficiency in such a way as to carefully select the system parameters to achieve adequate performance for each individual patient.Note that data gathering is directly related to the value of   .If the system requires that continuous monitoring nodes report 70% of their data, then   has to be set at 0.7.Another important observation is that the value of the probability to detect an event, , has no major impact on the results presented in Figures 7 and 8 simply because in these figures the energy consumption of the primary nodes is depicted which is not impacted by the event reporting activities except for high values of .
Indeed, for  → 1, secondary nodes have more probability of occupying the system's resources.As such, if a primary node becomes active in the middle of the frame, it cannot use such channels and no packet transmission occurs.This explains the energy reduction of primary nodes (that could not transmit) for high values of .
Figure 9 shows the average energy consumption of secondary nodes.Here, the value of  has a major impact on the system performance since higher values of this variable imply a higher number of event data transmissions.
Note that this value cannot be modified or selected by the network administrator since it is proper for the system environment.As such,  reflects the dynamics of the patient in the sense that it models how many events occurr for this particular patient and how efficient the nodes are at detecting such events.Building on this, we argue that the medical team may not have strict knowledge of the value of  at the beginning of the system operation.However, as a few days of operation go by, the medical team can have more accurate values for this parameter, which in turn allows a better energy consumption calculation.
Also, from this figure we can see that as   increases, primary nodes make more intensive use of the system resources, which leaves a very low number of empty spaces for the secondary nodes to use, which in turn reduces the energy consumption of secondary nodes.This observation is further validated by the high packet loss probability as shown in Figure 10.
Furthermore, these results bring up another important tradeoff: High continuous monitoring data gathering entails low event monitoring data reports and vice versa.Then, for specific requirements of event-related-data, the value of   has to be finely tuned to achieve a good system performance.Figures 11 and 12 show the average energy consumption of active and inactive continuous monitoring nodes, respectively.As in the data-efficient case, as   increases, the energy consumption of primary nodes increases accordingly as well as continuous monitoring data gathering.However, this leaves almost no empty spaces for the secondary nodes to report event-related packets as depicted in Figure 13 where almost no event packet can be successfully transmitted.
Contrary to the data-efficient priority scheme, in this energy-efficient scheme, energy consumption does not display an almost linear relation to neither   nor .Conversely, in this scheme, nodes with high residual energy levels perform more transmissions than low energy nodes; average energy consumption is depicted in Figure 14.
In this figure, it is shown that for high values of , where nodes consume more energy for data transmissions, energy consumption is lower.The rationale behind this is as follows: In such high event detection environment, nodes consume much more energy in less time.As such, the transmission probability   highly decreases, effectively increasing the system lifetime.From this, it is clear that the proposed priority schemes have different performance since they are designed to operate for different goals.
Again, it is important to note that the mathematical model derived in this paper allows one to know in advance the performance of the system in terms of continuous monitoring packets, event-related packets, and energy consumption of both primary and secondary nodes, mainly finely selecting the value of   , since the rest of the parameters cannot be directly selected.
Now that the mathematical model has been validated, we compare both priority strategies using only analytical results.

Battery and Hardware Specifications
In order to have practical values for the energy consumption, and for the sake of completeness, we consider the following hardware specifications to present results not only in energy units but in ampere/hr.(i) Device specification for noncommercial sensor nodes.We call these nodes noncommercial since the sensor, processor, and transceptor are not built for specific wireless sensor network applications.These are general purpose modules that were interconnected for this specific application.The values shown below are associated with devices used in our laboratory (not involving the network implementation, but only the characteristics of the available devices).
(a) Sensor.In order to collect the measurements generated by the electrode composing the BANET, an integrated circuit that includes both the electrode (transducer device that detects biopotential signals) and the digital signal processing is required.For this, the Texas ADS1299 commercial sensor is used.(b) Processor.We use an ATMEL ATMEGA328P microprocessor that will be able to work with signals retrieved from the ADS1299.(c) Low power transceiver ATmega128RFA1, which allows the wireless biosignals transmission, is used.(d) Batteries.3 Duracell MN2400 size AAA batteries are used, given that they provide the electrical supply necessary to operate the complete WSN.
Each ADS1299 consumes 60 /ℎ in average (considering specifications given in the datasheet) and each one supports 8 electrodes.The system occupies 3 of these generating   = 180 /ℎ.An ATMEGA328P consumes  328 = 150 /ℎ based on the maximum circuit consumption.Additionally, a transceiver is required to send the information of each microcontroller.In this case it is known from the 128RFA1 datasheet that the device consumes 10 , contributing  128 = 30 .Therefore, the demanded energy of the system is   =   +  328 +  128 = 360 /ℎ.
Based on the battery datasheet, it supports a current of 320 mA/h for a duration of 4 hours with the voltage occupied by the devices (4.5 V).Then, the current consumed by each node is as follows.
Hence, each slot consumes 0.2  and the system has initial energy of  0 = 1.28 .All the considered values are an estimation since the temperature and other parameters can affect the hardware operation.In the case of the polysomnography study, 20 electroencephalogram nodes and 4 EOG nodes are required as mentioned in Table 2.These circuits and devices were selected for a wide variety of biomedical studies already available in our research group.As such, they may not be the most suited energy options.However, the mathematical model can be adapted to any device.
(ii) Device specifications for commercial nodes.We called these nodes commercial nodes because these are explicitly built for WBANET applications and their performance is optimized for this usage.Hence, a system that occupies the ARM Cortex-M0 + processor based on SoC is proposed as a second case of nodes that entail different energy consumption values.These devices are of particular interest since they have been tested and showed a very adequate behavior for WSN with ECG studies [44]; they constitute a suitable option for embedded applications of small dimensions, of high energy efficiency.Also, since the rest of the bioelectric signals considered in our study are oversampled with respect to the ECG, these nodes can operate in an effective way for the complete system showing its behavior with commercial values.
In this sense, we take the practical values from the works of James [45,46] that have measured a consumption of 2 mA (for each node) per cycle for the processor with an ECG signal, in such a way that   = 40.If battery specifications are taken again from the noncommercial nodes, it supports a current of 150 mA/h for a duration of 24 hours with the 1.2 V (based on the datasheet curves) used by the system.
Consequently, each slot for this case consumes 22  and system initial energy is  0 = 1.28 .As we can see, the devices energy performance is much lower than the noncommercial nodes.As such, numerical results show an increased system lifetime.However, the important contribution about these results is to show the versatility of the mathematical model, where any device can be used to derive the expected performance of the system.
For the next set of results (considering both cases), we use practical commercial energy consumption in terms of amperes in order to show the flexibility of the derived mathematical analysis by directly converting energy units to amperes.
In Figure 15 we show the average energy consumption for secondary nodes comparing both priority schemes, namely, the energy-efficient and data-efficient schemes for the noncommercial nodes.For these results, we use the values of  = 0.1, 10 as opposed to 1, to see the impact of this adjustment parameter in the performance of the system.For the data-efficient scheme, we show energy consumption of both low and high priority nodes as well as the total energy consumption for the complete scheme.In these figures it can be seen that low priority nodes always consume less energy than high priority nodes in the data-efficient scheme since low priority nodes transmit less information than high priority nodes.Furthermore, low priority nodes consume even lower energy levels than nodes in the energy-efficient scheme at the expense of the number of reported packets.However, when observing the total energy consumption in the secondary network, we can see that the residual energy scheme with  = 0.1 consumes less energy than the dataefficient scheme.The energy-efficient scheme with  = 10 consumes more energy than the other schemes for almost all system conditions.Indeed, low values of  restrict the number of transmissions as observed in (1).Unlike the dataefficient scheme, where all low priority nodes reduce their transmissions, in the energy-efficient scheme, only nodes with low residual energy reduce the number of transmissions while nodes with high residual energy levels transmit almost all their data packets.From these results, it is clear that selecting low values of  entails longer system lifetimes at the cost of reducing the event reporting data when nodes begin to deplete their energy.
Figure 16 shows the system performance when commercial nodes are used.First, we can observe a much lower energy consumption compared to the noncommercial nodes because the devices demand much less current and voltage.However, the behavior of both schemes is maintained in the sense that the energy-efficient scheme entails lower energy consumption compared to the priority scheme.Now, we observe the packet loss probability for both priority schemes in commercial and noncommercial nodes, respectively, as seen in Figures 17 and 18.First, note that packet loss probability is not affected by the type of node being used since the specific node only affects energy consumption but the amount of information conveyed by the network is the same.Also, it can be seen that, in general, packet loss probability is low (lower than 0.01) for   ≤ 0.6.However, when primary nodes are mostly active,   > 0.6, this packet loss probability increases to values lower than 0.1.Hence, less than 10% of the packets are lost due to the implementation of these priority schemes.The data-efficient priority scheme and the energy-efficient scheme with  = 0.1 lose more packets than the rest.However, in the residual energy scheme with  = 10, packet loss probability is lower than that in the data-efficient scheme.It is important to note that high priority nodes lose more packets since they perform more transmissions than low priority nodes.
In Figures 19 and 20, we compare the results of total energy consumption (PS and SS) and average packet loss with the same network setup with and without the priority schemes.From these figures, it is clear that the energyefficient scheme consumes less energy than the priority scheme and the system where no schemes are used.Furthermore, we can also see that the data scheme also entails a lower energy consumption than the system with no schemes.As such, even if the main objective is to increase the data transmission of high priority nodes, i.e., energy consumption reduction is not the main priority, the data-oriented scheme naturally reduces energy consumption in the system compared to the case where no transmission schemes are used.The reason for this is that nonpriority data packets transmit with lower transmission probability, also reducing the number of overall transmissions in the system.
In order to have more insights into the performance of the priority schemes, we now show the packet loss probability due to nonreporting events for both cases, as shown in Figures 21  and 22.
It can be seen that the data-efficient scheme has a higher reporting rate; i.e., there is a lower nonreporting probability compared to the energy-efficient scheme.Since in this scheme the objective is to report as many packets as possible from high priority nodes, we can see that this priority scheme achieves its goal.However, this intensive data transmission entails a higher energy consumption.This can be seen in Figure 23 (for noncommercial nodes) and Figure 24 (for commercial nodes), where the system lifetime is presented.
Conversely, the energy-efficient strategy achieves longer system lifetime since nodes transmit less packets as reflected by the high packet loss probability due to nonreported packets seen in Figure 21.Certainly, the fact of using devices that demand lower energy consumption also influences the final duration, such as the maximum difference of hours that can be observed in Figures 23 and 24.

Conclusion
This article developed a mathematical analysis using Discrete Time Transitory Markov Chains to represent the energetic performance of a hybrid (continuous monitoring and event reporting) wireless sensor network oriented toward the monitoring of biopotential signals in ambulatory BANETs.The TDMA-based communication system allows performing multiple medical studies such as EEG (electroencephalogram), ECG (electrocardiogram), EGG (electrogastrogram), ERG (electroretinogram), EOG (electrooculogram), and EMG (electromyography) interchangeably according to the specific condition of a patient.To this end, we propose the use of cognitive radio capabilities by assigning the use of the channels to primary nodes while secondary nodes make opportunistic use of empty spaces.Nodes in the primary system report their data packets according to a continuous monitoring regime, while secondary nodes transmit in an event-driven fashion.As such, primary nodes become active or inactive in order to release their channel, reducing both energy consumption and data gathering accuracy, and generate opportunities (empty spaces) for secondary nodes.knowledge, this is the first work that presents clear guidelines for the selection of the system parameters to achieve the desired performance of the system for medical studies that require either an extended network lifetime (at the cost of losing a certain amount of data) or enhanced data gathering capabilities (at the cost of increasing energy consumption).Specifically, through the mathematical model, the system administrator can finely tune the system in terms of   and   to different system conditions given by the event detection probability .

Data Availability
All data used in this work was obtained through the numerical solution of the Markov Chains and it can be available on request from the corresponding author.

Figure 1 :
Figure 1: TDMA frame construction for the communication system with ON/OFF process.

Figure 3 :
Figure 3: Transitory Markov Chain for the complete system dynamics.

Figure 4 :Figure 5 :
Figure 4: Description of Markov Chain in the initial state.

Figure 6 :
Figure 6: Flow chart of the system simulation.

Figure 7 : 14 WirelessFigure 8 :Figure 9 :
Figure7: Average energy consumption of the active primary nodes for the data-efficient priority scheme, 1 high priority sensor and 3 low priority sensors.

Figure 10 :Figure 11 :Figure 12 :Figure 13 :Figure 14 :
Figure10: Average packet loss probability of event-related packets due to lack of resources for the data-efficient priority scheme, 1 high priority sensor and 3 low priority sensors.

Figure 18 :Figure 19 :Figure 20 :
Figure 18: Schemes comparison for busy channel packet loss for commercial nodes.

Figure 21 :Figure 22 :Figure 23 :Figure 24 :
Figure 21: Comparison of nonreported packets for both data-efficient and energy-efficient priority schemes for noncommercial nodes.

Table 1 :
[37][38][39]tudies to measure biopotential signals in the WSN[37][38][39]. is the time derived from the  control bits discussed above.It is important to note that by using such ON/OFF scheme and enabling the CR technique, we effectively reduce the frame from   +  time slots to  time slots, where   is the number of nodes reporting in the eventdriven regime and  <   +   , which reduces the data rate required from nodes, allowing lowering the implementation cost of the system and making a more efficient use of the radioelectric frequencies.

Table 2 :
System design parameters and probabilities.