You are on page 1of 7

A Hidden Markov Model for Body Area Networks

Caio Souza Oliveira, Marcel Souza Oliveira


caio.s.o@me.com, marcel.s.o@me.com
Alunos do Programa de P os-Gradua cao em Engenharia Eletrica - PPGEE UFMG
I. INTRODUCTION
Body Area Network or BAN is a wireless network that
allows electronic devices on and near the human body
to exchange digital information through specic network
protocols that was rst dened by Guang-Zhong Yang
in 2006. This peculiar computer network is commonly
used in medical devices to provide human health care
and physiological signals monitoring such as pacemakers,
continuous glucose monitoring, inter alias.
Usually, BANs are low-power networks and conceive
communication with a transfer rate of 250 Kbit/seconds
to networks nodes that are located in distances up to
10 meters using dierent network topologies that can be
either peer-to-peer or star. Both topologies, requires at
least one node to coordinate the data transfer between
the other ones, the sync node.
In this project all the Body Area Networks setups fol-
lows the star topology. Star networks are the most com-
mon network topology that consists of a central node that
works exclusively to conduit and transmit messages, con-
necting indirectly all nodes to each other. The usage of
star topology in BANs have several advantages as mak-
ing it easy to connect new sensors to the network, once is
necessary, for example, monitor more physiological sig-
nals as patient clinical changes.
As a computer network, BANs also works with packet
transmission from any node in the network to de sync
node. Eventually, some of these packets sent from a pe-
ripheral node are not received by the sync node. This is
called Packed loss and can be caused by several factors
as signal degeneration caused by noise, faulty network
hardware, corrupted packets (detection made by parity
bit), channel congestion, inter alia.
The channel RSSI can infer the probability of packet
loss. RSSI is the Received Signal Strength Indicator. It
is a measurement of the power present in received electro-
magnetic waves, in other words, the RSSI is the strength
that one device is hearing another device. The RSSI is
usually measured in decibels from 0 dBm to -120 dBm.
The closer the value to 0, the stronger the signal.
To BANs, the better RSSI required is -70dBm or lower.
In normal situations, the RSSI range in a network would
be -55dBm to -90 dBm, depending on the devices on
the network. The RSSI is specially aected by the noise
present in communication channels and by barriers on
the node-to-sync path. Both interfere in the signal and
change the SNR (Signal-to-Noise Ratio) corrupting the
wave and consequently interfering on the RSSI.
A hidden Markov Model is a common tool to model
situations where the observed signal generator is hidden
to the observer. This tool can be used either to study the
nature of the signal source or to estimate future behavior.
In this project the Hidden Markov Model is used to model
a Body Area Network, in terms of the packet loss on it.
The data used to create this model is a RSSI time series
(RSSI from packets sent from nodes to the sink) and a
packet loss time series.
II. NETWORK MODEL
The network to be modeled in this project consists of
six dierent nodes, ve of which do communicate with
a special node denoted sink, which can synchronize the
other nodes, send and receive messages to them. The
ve node other than the sink are called sensor nodes and
each of them have the function of measure some human
body physiological signal. They periodically send the
measures to the sink, which sends back a special ACK
(acknowledge) packet conrming that the sent packet was
successfully received.
Each sensor node is attached to some dierent part of
human body. It means that a real patient may be wearing
sensor all over its body and they constitute a Body Area
Network, exchanging information from sensor nodes to
the sink node.
In the proposed network, the sink node is placed in the
waist of the patient, a node (namely node 1) is placed in
the right st, another (node 2) is placed in the left st, a
third node is places at the patients right ankle and the
fourth is placed in the left ankle. The fth node is in the
patient head.
One of the main problems experienced in this kind of
network is the packet loss. Information sent from a sensor
node to the sink node commonly is lost during the path
between the nodes to the sink. Once the sensor nodes are
battery driven devices and some of the information are
crucial for the patients welfare (some of which may even
inform if the patient is injured or sick), it must be found
a way to determine exactly when it is more propitious to
send a packet. Based on that, it is intended to build a
Hidden Markov Model that describes the network packet
loss behavior that can potentially aid the nodes to better
decide when to send messages to the sink node.
Prior to the model construction, it may be determined
which are the main elements that describe losses in the
network and how they relate to each other. The next
section will present this analysis and how the model was
built.
2
III. MODEL CONSTRUCTION
As described in the last section, this project intent to
build a model of a Body Area Network with 5 nodes
(one for each bodys edge) and a sink node, in a star
topology, doing so by applying a Hidden Markov Model
technique. A rst step to build a consistent model is to
determine how the network behaves, depending on some
variables. These variables are the transmission rate, the
environment noise (environment noise stands here to
the noise on the transmission channel) and the channel
interference. The amount of nodes would also be a good
parameter to be varied, however the proposed network
setup requires exactly six nodes (a sink and ve sensor
nodes) and so this cant be changed and wont be tested.
Moreover, there wasnt included any node movement.
The only way to verify how that variables are related
with the network behavior is by analyzing some tempo-
ral data of the running network. This information can
be gathered by performing a set of simulations on the
proposed network setup. The simulation was a prefer-
ential way to acquire data once it is much faster than
real data acquisitions, it is much cheaper (no founding
was granted to this project) and it cans accurately repre-
sent real network behaviors. Furthermore, There wasnt
available any network test environment to perform real
tests with the given network setup.
The chosen simulator to this project was Castalia.
Castalia is a widely used simulator for BANs and WSNs
(Wireless Sensor Networks) for low-power embedded de-
vices. Researchers commonly use Castalia during tests
of new network protocols and analysis of network behav-
ior given certain constraints. Castalia is developed and
maintained by Australias Information and Communica-
tions Technology since 2006. The version used to execute
the simulations for this project was 3.2.
The simulations can be divided into three major dis-
tinct groups, classied according to the channel Interfer-
ence. It is because the only way to simulate packet losses
on Castalia is by setting the channel interference level.
The simulator provides three interference levels: in the
rst one (0) there arent any collisions happening. The
second (1) the collisions happen with low probability and
in the third (2) they tend to happen very often. Notice
that the amount of nodes in the network and their phys-
ical position can aect the interference model. In order
to make the interference model more realistic, it was in-
cluded some variability in the channel noise levels with
two dierent noise models, changing the signal-to-noise
ratio.
The simulation groups can be divided as follows: the
rst one implements a high level channel interference, the
second implements a medium channel interference and
the third implements a low channel interference. Each of
the three subgroups can be subdivided into two smaller
groups in which the packet generation rates are variable.
The rst subgroups represents a high packet generation
rate, with 2 packets sent to the sink node per second, and
the second represents a low packet generation rate, with
1 packet sent in two seconds. In each of those subgroups
the nodes can send a packet to the sink in a random time,
within the time frame specied. It means that a node
can send a packet to the sink in any moment between 0
to 0.5 second (in the rst packet generation rate) and in
any moment between 0 to 2 seconds.
The packet generation rates described are suitable to
the network to be modeled once it is a BAN. In this kind
of network, it is not usual to delivery high amounts of
data from a source node to the sink. It is because sensor
nodes, must try to save energy and they usually archive
it by sending information the least times as possible. In
practice, it means that it is not likely (but not impossi-
ble) to exist data bursts from nodes to the sink, once they
avoid making long transmissions and repeated sequential
transmissions, in order to save power. Moreover, the net-
work mostly includes sensor nodes that measure slowly
changing variables, that dont plot signicant changes
during short time period.
There were performed ve simulation rounds during
about 24 hours, for each test groups. In every simula-
tion the channel noise oor was set to describe the ab-
sence, a low and a high noise value, the data transmission
rate was 250 Kbps and the packet had size of 100 bytes.
There wasnt considered any multi-hop stage during the
packet transmissions once the network was designed with
star topology. The simulation outputs two important
information about the transmissions: every transmitted
packet RSSI value and the moment when packets were
lost. Figure 1 depicts the RSSI value for the rst 80
packets sent from node 1 to sink with a high interfer-
ence level on channel and no noise, in the subgroup of 2
packets per second.
FIG. 1. 80 packets transmission RSSI value.
The main goal of the model is to determine whether
a loss is likely to occur or not. So rstly it is necessary
to study the packet losses in the network. To determine
how the packet loss tends behave on the proposed BAN
topology, it is necessary to investigate which elements
can aect the average loss rate. This can be done by
3
analyzing the results of the losses over the simulations.
The next sections will present these results.
A. Packet Loss Behaviour
When it comes to network models, one of the most
important attributes is the average packet loss rate. It
was rstly estimated an average loss rate over each round
of each subgroup of simulations in an ideal environment
(with no channel noise). For this, it was performed a set
of extra simulations as described in the last section, with
no noise in the channel. This information can demon-
strate how much packets are lost on the average, during
the transmissions and how they are expected to behave in
the very best scenario. The average loss can be computed
by dividing the total losses by the overall transmissions.
Once there was more than one realization for each group,
the average packet loss was the average of the losses rate
on each realization. The results of the ideal scenario can
be seen on Table I:
TABLE I. Average packet loss rates for an ideal channel
PGR
a
Hight (%) Medium (%) Low (%)
2/second 3.52 3.60 2.57
0.5/second 2.74 2.65 2.34
a
Packet Generation Rate
Table 1 shows an interesting behavior of the mean
packet losses over the ideal channel network. According
to the results computed on Castalias simulation outputs,
the average packet loss tends to be unchanged, regard-
less the transmission rate and the channel interference
level. The term unchanged was used here to describe a
very low variation on the average loss rate among each
interference level.
There is a possible explanation to the occurred. The
most likely reason comes from the packet generation
rates. It is given that each packet sent in the network has
a length of 100 bytes. It is also known that the transmis-
sion rate is xed in 250 Kbps. By crossing this informa-
tion, one can easily see that a packet takes about 0.3 mil-
liseconds to be sent from a source node to the sink. Once
in rst subgroup of simulations, nodes can start sending
packets to the sink at any moment between 0 and 0.5
seconds, there is about 0.0006% of probability of a sent
packet collide with another. In the second subgroup this
probability becomes even smaller being around 0.00015%
(once a node can send a packet at any moment between
0 and 2 seconds). So that it can be said that the packet
generation rates dened to this network does not
impose much severe restrictions over the packet
transmission events, once the noise wasnt interfering
in the transmissions and the losses only occurred because
of eventual collisions.
This is a very reasonable explanation to the occurred
because Castalias interference model is primarily based
on packet collisions due to transmissions emanated from
other nodes. Once the probability of one node be trans-
mitting a packet in the same moment that other is trans-
mitting is very low, and there arent losses because of
noisy channels (in this case), it is expected a very low
packet loss rate, even though the nodes are in the each
others range. Furthermore it can be seen that the rst
row of Table I has higher average rates than the second,
which was expected due to the packet generation rate
associated with each of them.
By analyzing the results from each average loss rate, it
can also be noticed that the position of the node doesnt
aect the loss rate in a severe way, despite of include
a more dynamic variability in the values. For the rst
subgroup of simulations e.g., the second node plotted a
very low loss rate (around 1.47%) and the third node had
about 5% of its packet lost.
Once it is known that the generation rates dont play
an important role in the losses on the network, neither
do the positions of the nodes, the main reason to packet
losses in the proposed network may come from channel
noise. In this case, it was analyzed the average loss rates
of packets transmissions on a noisy channel (as described
in the last section). The Table II shows the results:
TABLE II. Average packet loss rates for an noisy channel
High noise level
PGR Hight (%) Medium (%) Low (%)
2/second 43.79 42.86 42.34
0.5/second 43.02 42.11 42.1
Low noise level
PGR Hight (%) Medium (%) Low (%)
2/second 15.16 14.98 15.01
0.5/second 14.96 14.59 14.22
As expected, the average loss rate is slightly dierent
on each packet generation rate and it is widely dierent
than the results for the ideal channel. This is because
the noise is imposing severe restrictions to the packet de-
livering from a node to the sink. This means that by
comparing these results with the ideal ones, the main
source of packet losses in the noise is the channel.
It is important to notice that the collisions can still hap-
pening in this scenario but their contributions are lower
than the noises. By this assertion it can be seen that
the channel must be the central element in the networks
model, once the losses are much likely to occur due to its
eects.
In order conrm the assertions made, it can also be
observed the length of the loss bursts in the channel. The
loss bursts describes what is the length of the sequence of
losses over the network. Figure 2 depicts the loss bursts
for one of each noise models, in the high interference
channel for packets sent from the fth node:
4
FIG. 2. Packet loss bursts for dierent noise interference in
the channel for the rst 1712 packets. The time interval was
arbitrarily chosen. (a) Sequential losses for high noise level
channel. (b) Sequential losses for low noise level channel. (c)
Sequential losses for ideal channel.
As it can be seen in the gure, the packets are most
likely to be lost (also in sequence) when the channel is
noisy. In the chart shown in Figure 2.a it can be seen
that several packets were lost, one after another during
the transmissions from the node 5 to the sink. It can be
seen that it is most likely to one packet be lost alone,
but two sequential losses as well as three have a high
probability to occur.
This conrms the information presented in Table II
where losses happen with high probability when the chan-
nel is noisy. By analyzing Figure 2.b the same behavior
can be seen. Once more, the isolated losses are most
likely to occur, but this time, two or three sequential
losses are not so provable to come. This is also con-
rmed by the information in II where, given a low noise
channel, there exists a probability of loss, but it is not so
frequent that could cause chain losses as seen in 2.a.
Finally in absence of noise, the losses occur with low
probability and it is most likely due to collisions during
packet transmissions. Note that there isnt any sequen-
tial loss once the probability of packet loss is too low.
The same behavior was observed along the three possi-
ble interference levels for each node, on each packet gen-
eration rate. This means that the position of the node,
the packet generation rate and the and the probability of
collisions dont interfere considerably in the losses bursts
but only the noise in the channel.
Once the loss analysis were performed, it is possible
to determine the very basic elements that the model will
try to represent. According to the analysis presented in
this section, the most signicant agent on the packet loss
dynamics is the channel noise. It was seen that expres-
sive losses were observed in the channel when the noise
was introduced (or partially introduced). When the noise
was not inuencing the channel, the losses eventually oc-
curred with low probability due to collisions. So the Hid-
den Markov Model must be capable to describe the noise
dynamics.
Given that one of the goals of this project is to archive
a simple model, the minor loss sources (referring colli-
sion, node positions and packet generation rates) were
left apart and only the channel noise was considered to
be the reason of packet losses through the network.
The only concerns from now on are to determine which
are the parameters of the model, which are its states
and how the initial probabilities of each state will be
assigned. The next section describes the model and its
implementation process.
B. Channel Model
As a Hidden Markov Model, the Channel is now char-
acterised by some elements and sets. The rst is a set of
N hidden states, which are states that have some signif-
icance attached to it. Generally the states are intercon-
nected in some way that any state may reach other state.
These states are denoted by S = {S
1
,S
2
,...,S
N
} and the
state at time t is q
t
. The second elements set is com-
posed of M distinct observation symbols e.g. a discrete
observation alphabet. The set of symbols is denoted by
V = {V
1
,V
2
,...,V
M
}. Another element is the transition
probability distribution A = { a
i,j
} such that:
a
i,j
= P[q
t+1
= S
j
|q
t
= S
i
] 1 i, j N (1)
where a
i,j
i, j. The observation symbols probability
distribution in state j is given by B = {b
j
(k)} where:
b
j
(k) = P[V
k
, t|q
t
= S
j
] 1 j N 1 j M (2)
The last element is the initial state distribution = {
i
}
where:

i
= P[q
1
= S
i
]1 i N (3)
Once given the appropriate values for N, M, A, B,
the Hidden Markov Model can be used to generate an
observation sequence
O = O
1
, O
2
, O
3
, ..., O
T
(4)
where the observation O
t
is one of the symbols from V
and T is the number of observations in the sequence.
In the network model, the output sequence is repre-
sented by a series of binary information that describes if
a packet was successfully sent (1) or if it was lost dur-
ing the transmission (0). The emissions sequence was so
5
chosen because it is intended to model the loss through
the network transmissions.
The rst parameters to be set are the number of hidden
states N and the number of observation symbols M. The
number of hidden states is of crucial importance to the
network model once it happens to be the parameter that
describes the hidden dynamics on it. It means that
every behavior that is related to the noise (the primary
agent that causes losses in the network) is modeled by
the N states in the transition probability matrix A. If
N is too large, it usually results in very complex models,
that could be over tted to the observation sequence. If
it is too small the model could not reproduce the system
accurately.
So that, it is necessary to be aware of the right value
for N which is appropriate to describe the model. The
number of observation symbols M is directly extracted
from the observation sequence and must be equal to the
total of distinct outputs observed in the system.
To the Body Area Network Hidden Markov Model, the
values of Mand Nwere chosen in order to better describe
the packet loss behavior. The observation sequence O is
the discrete series that describe if a packet was lost with
a single binary digit (0, 1). From this, it can be seen that
M = 2.
The number of hidden states N was set to 3. It means
that the network will be modeled according to three
states that describe the state of the channel at each given
time. The hidden states can be labeled as good, bad
and regular. This is a very common way de describe
a network and it also reects the three noise levels de-
termined during the simulation stage (good would mean
very low levels of noise, bad would mean high noise level
and regular would mean a moderate noise rate).
Once the parameters N and M were set, it can be de-
termined the probability of the transitions matrix A and
the probabilities of the observation symbol matrix B. The
transition probabilities (between the hidden states) can
be set in a way that transitions can happen only be-
tween neighboring states. This is a special feature
dened to this network model once it is not likely to the
channel to change it state drastically in short time peri-
ods (its not likely for example, to have a good channel
and then suddenly a bad channel, once this transition
usually happens by passing through the regular state,
even for a short time). The probabilities of the obser-
vation symbols are dened for each hidden states (this
means that each hidden state have a positive probabil-
ity of emitting some of the observation states). Once
at each channel noise level (good, regular and bad)
its possible to one observes successful and unsuccessful
packet transmissions, each hidden state is connected to
each observation state. Figure 3 depicts the described
chain:
FIG. 3. Hidden Markov Model for the Body Area Network.
(a) Hidden states that model the channel noise. (b) Output
states representing the packet transmission result.
Based on the graph seen on the gure, it is possible to
describe an initial probability set to ll up the matrices
A and B. Matrix A will be a 3 x 3 matrix and matrix
B will be a 3 x 2 matrix. It was performed a simulation
in which one can experience dierent noise levels. These
noise were those used during the simulations presented
in the last section (the channel noise can be very low,
low or high). This simulation is also necessary during
the matrix entries estimations, used on Baum-Welch al-
gorithm. The initial transitions and observation symbol
probabilities were chosen in order to minimally describe
the network behavior observed of the simulation. The
initial state distribution was also dened after the sim-
ulation results.
Once the model parameters are dened, it is possible
to estimate its probability matrices (A B) based on the
packet sequence simulation. The simulation results were
treated in order to transform it into a sequence of 0 and
1, where 0 represent a packet loss and 1 represents a
successfully sent packet. This simulation resulted in ve
data series, one for each sensor node. The estimation was
made using Baum-Welch Algorithm.
To estimate the model of a Hidden Markov Model, is
necessary to nd a way that maximize the probability of
an observation sequence, in other words, its necessary to
determine the better model that represents a given obser-
vation sequence. The main problem is that these models
cant be found analytically, so, the better way is to use
an iterative algorithm that estimate these parameters to
a model that give the maximum probability of a sequence
of observations.
The Baum-Welch algorithm is one of the most ecient
methods for automatically estimates the parameters of
Hidden Markov Models. This is a learning algorithm in
which, given an observation sequence and a set of states
of the Hidden Markov Model, it learns the parameters
of this model that are given by the A and B matrices.
Specically, this algorithm learns the transition proba-
bilities A=[a
ij
] and the observation symbol probabilities
B=[b
i
(o
t
)]. To do so, the Baum-Welch algorithm esti-
mate the states iteratively starting with arbitrarily cho-
sen estimates for a
ij
and b
ij
, improving the estimates.
The algorithm outputs the transition probability ma-
trix A and the observation symbol probability matrix B.
6
Both matrices represented the initial guess given accord-
ing to the observed behavior of the simulations. The al-
gorithm was executed over 1000 steps, using as input the
two guessed matrices A and B and a set of ve packet
transmission series (one for each node). The resultant
matrix can be seen next:
It can be seen that once the channel reaches the state
good, it is more likely to transit to other states rather
than continue in this state. Once the channel is good,
the probability of a packet be successfully sent from a
source node to the sink node is much higher (more than
99%) than it be lost through the path. If the channel
is on the regular state, it tends to stay in that (and
eventually go to bad or the good state). In the regular
state, it is a higher probability of delivering a packet to
the sink, than loosing it along the channel. If the network
is in the bad state, the packets are more likely to be lost
and the channel doesnt last longer in this state. Note
that the resultant matrices is also dependent on the rst
guess, so the results could be slightly dierent if other
guesses were made.
The results of Baum-Welch were considered satisfac-
tory once it mostly describes the expected behavior of
the network. Moreover, when it comes to A, it can be
see that it maintained the dened structure as stated in
this section. B was also as expected once it reects the
losses over the network according to the noise levels in
the channel.
In order to determine if the model describes the net-
work, it can be used Viterbis algorithm to generate the
most likely hidden state sequence, given A, B and an
simulation sequence. This is a useful tool to be used in
comparisons between the model and the real network.
By performing this comparison, one can build a con-
vergence percentage that measures how much the two
output sequences are equal. If the series are alike, then
the model can describe the network dynamics.
Once the network data is obtained via simulation, it is
possible to determine in exactly which noise level is the
channel, for every time t. By using this information it is
possible to compare Viterbis algorithm output with the
models output.
After executing Viterbis algorithm and comparing it
with the network noise level series, it was obtained an av-
erage convergence percentage of about 69%. This means
that the model can only describe part of the network dy-
namics, once the most likely sequence of states is only
69% equal to the simulation output. Even though, it is
considered a good model once more than a half of the
states in the sequence were equal. There is a good expla-
nation for this. It is possible that the number of states
in the proposed Hidden Markov Chain is not enough to
describe the full behavior of the network.
Furthermore, by analyzing Viterbis algorithm output,
it can be seen that the model tends to stay in the regular
state and that it usually stays shorter periods in state
good and bad, which was expected, according to the
analysis of the simulation outputs and the matrix A.
Another important factor that could contribute to the
dierence between the two series (from Viterbis algo-
rithm and the simulations output) is the model struc-
ture. Once it only describes the eect of the noise over
the packet loss, the model may (and certainly is) be miss-
ing the eects of the other elements of packet loss (like
nodes position, collisions during transmissions and other
minor eects like bit corruption etc.). This means that at
little fraction of the losses in the input of Viterbis algo-
rithm may happened due to those elements rather than
the channel noise itself. So by this factor, it can be said
that the prediction capability of the model is constrained.
IV. CONCLUSIONS
Based on the procedures executed for this project, and
on the results obtained, it is possible to argue about the
conclusions. The model built to describe the network was
somewhat inaccurate to describe the full network behav-
ior, however it was able to replicate the overall model
characteristics. It can be said that its results are enough
to aid nodes to determine when to send a packet given
the network situation.
The initial analysis was determinant to archive this
model, once it allowed some important assumptions that
are important to keep the simplicity of the model. More
complexes versions of the proposed model can be done by
including states in the Hidden Markov Chain that better
describes the collisions and nodes positions (and possibly
considering nodes movements). Furthermore, despite of
the network model was built based on simulation outputs,
the procedures described here can easily be applied to
real network data in order to make even more accurate
models.
From this, it concludes that the model can be useful
to predict Body Area Network packet losses (with a
moderate success rate) and that Hidden Markov Models
are indeed powerful to describe complex real world
dynamics.
7
V. REFERENCES
[1] A Tutorial on Hidden Markov Models and Selected
Applications on Speech Recognition; Rabenier R. L.
Proceedings of the IEEE. 1989. 77 (1); 257, 278;
[2] Body Sensor Networks, First Edition. Yang G.Z.;
Springer-Verlag London Limited, London, UK, 2006;
[3] Body Area Sensor Networks: Hanson. A.M., Powell.
C.H.. Challenges And Opportunities;Published by the
IEEE Computer Society; 2009; 58, 65;
[4] Introduction to Stochastic Processes, Second Edition.
Lawer F. G. Chapman & Hall CRC, 2006;
[5] Overview of the IEEE 802.15.4/4a standards for low
data rate Wireless Personal Data Networks; Nardis. L.,
Benedetto. M.. Workshop on Positioning, Navigating
and Communication. 2007. 4 (1); 285, 289;
[6] Wireless Body Area Network (WBAN) for Med-
ical Applications; Khan. Y.J., Yuce. R.M.. New
Development in Biomedical Engineering, University of
Newcastle; 591, 627;

You might also like