zigbee定位的概念

来源:互联网 发布:常熟淘宝招聘信息 编辑:程序博客网 时间:2024/06/02 13:12


这篇笔记主要是基于CC2431 Location Engine 这篇文档。这篇文档主要提供一些定位的基本概念,同时给出了一种在开发定位系统过程中的小技巧。

(支持原创,如需转载,请注明地址:http://blog.sina.com.cn/litianping0709 作者:叶雨荫城(阿雨))http://blog.sina.com.cn/s/blog_61500ed60100mwgd.html


定位引擎

The  location  algorithm used in the CC2431  Location Engine is based on Received Signal
Strength Indicator (RSSI) values. The RSSI value will decrease when the distance increases.

在cc2431定位引擎里使用的定位算法主要是基于接收信号强度值(RSSI)。这个值随着距离的增加而递减。

image

Figure 1 shows a simplified system for location detection. “Reference node” is a static node
placed at a known position. For simplicity this node knows its own position and can tell other
nodes where it is on request. A reference  node does not need to implement the hardware
needed for location detection, it will not perform any calculation at all. A “Blind node” is a node built with CC2431.  This  node will  collect signals from all reference nodes responding to a request, read out the respective RSSI values, feed the collected values into the  hardware
engine, and afterwards it reads out the calculated position and sends the position information
to a control application.
参考节点知道自身位置,并且硬件本身不带定位引擎。盲节点收集参考节点的信号,读出相应的RSSI值,并将这些值送入硬件定位引擎,然后读出计算出的具体位置信息。
The minimum data contained in a packet sent from a reference node to a blind node shall be
the reference nodes’ X and Y parameters. The RSSI value is calculated by the receiver, i.e.
the blind node.
从参考节点发送到盲节点的数据包应该包括参考节点的“x”和“y”坐标信息。RSSI值由盲节点自身计算得到。
The main feature of the location engine is that the location calculation can be performed at
each blind node, hence the algorithm is decentralised. This property reduces the amount of
data transferred in the network, since only the calculated position is transferred, not the data
used to perform the calculation.
定位引擎的主要特征就是位置计算是分布在各个盲节点中的,因此这种算法是分布式的。这就减少了网络中的数据传输量。
To map each location to a distinct place in the natural environment, a two dimensional grid is
used. The directions will, in the following, be denoted X and Y. In all the figures X is defined to be the horizontal direction and Y the vertical. The CC2431 Location Engine can only handle
two dimensions, but it’s possible to handle a third dimension in software (i.e. to  represent
floors in a building). The point named (X, Y) = (0, 0) is located in the upper left corner of the
grid.

cc2431只能进行二维定位的计算,实现三维定位需要软件的辅助。

3.1 Node types
3.1.1 Reference node
A node which has a static location is called a reference node. This node must be configured
with X and Y value that correspond to the physical location. 
 
The main task for a reference node is to provide a “reference” packet that contains X and Y
coordinates to the blind node, also referred to as an anchor node.  (锚节点)
 
Since  this node  is not using the hardware location engine at all, it is not necessary to use a
CC2431 for the purpose. This means that a reference node can be run on either a CC2430 or
a CC2431. Since CC2430/31 is based on the same transceiver as CC2420, even a CC2420
together with a suitable microcontroller can be used as reference node.

参考节点不需要定位引擎,cc2430或者cc2431,甚至带有cc2420芯片的模块都可以作为参考节点。 
3.1.2 Blind Node
A blind node will communicate with the closest reference nodes, collecting X, Y and RSSI for
each  of these nodes, and calculate its position based on the parameter input using the
location engine hardware. Afterwards the calculated position should be sent to a  control
station. This control station could be a PC or another node in the system.
盲节点将与最近的参考节点通信,收集对应参考节点的x,y和RSSI值,定位引擎利用这些值计算出盲节点的坐标。
A blind node must be using CC2431.

盲节点必须配置cc2431.

 

3.2  The location hardware
The location engine utilizes an extremely simple interface seen from the software layer; write
parameters in, wait for the calculation to performed, and read out the calculated position out.
This chapter will discuss the different parameters and how the shall be interpreted.

定位引擎提供了一个在软件层上非常简单的接口。用户只要写入相关的参数,等待计算结束,读出计算值。

接下来将讨论不同的参数及其代表的意义。

image

 

3.2.1 Input
Table 1 shows all necessary input to the location hardware. All the values will be described in
details later in this document. The following is a brief introduction.

image 

3.2.2 Output

image

 

RECEIVED SIGNAL STRENGTH INDICATOR (RSSI)

When CC2430/31 receives a packet it will automatically add an RSSI value  to  the  received
packet. The RSSI value is always averaged  over  the 8 first symbol periods (128 µs). This
RSSI value is represented as a one byte value, as a signed 2’s complement value. When a
packet is read from the FIFO on the CC2431 the second last byte will contain the RSSI value
that was measured after receiving 8 symbols of the actual packet. Even if the RSSI value  is
captured  at  the  same time as the data packet  is received, the RSSI value will reflect the
intensity of received signal strength at that time, not necessarily the signal power belonging to
the received data. This gives the opportunity for the RSSI value to be erroneous when a large
number of nodes are talking on the same channel  at  the same time as the RSSI value is
captured.

当cc2431/cc2430收到一个数据包的时候他将会自动在数据包中加上相应的RSSI值。RSSI的值是收到开始八个符号周期(128us)的平均值。虽然这个RSSI的值是在接收到数据包的同时捕获的,但是RSSI值只反映当时接收到的信号强度,而不一定是接收到的数据包的信号强度。当一个信道中有多个节点在通信时,捕获的RSSI值就有可能存在误差。
image 

CC2430/31 contains a register termed RSSI. This  register  holds the same values as
described above, but it is not locked when a packet  is  received, hence the register value
should not be used for further calculations. Only  the  locked RSSI value attached to the
received  data  can  be  interpreted as the RSSI value measured exactly when the data is
received.

 

4.1 Offset
The RSSI value described above is represented as signed 2’s complement. The value can
not be read and interpreted as the received signal strength as it is. To convert the actual read
out value to the received signal strength an offset must be added. This offset, which is given
by the data sheet is approximately -45,  furthermore this offset will depend on the actual
antenna configuration.

4.2 Linearity
Measurements performed in TI’s laboratory shows that the RSSI values measured by  the
chips fit nicely with the signal input power. The linearity curve can be found in the CC2430
data sheet plotted as input power versus RSSI value.

image

4.3  Theoretical signal propagation
The received signal strength is a function of the transmitted power and the distance betw
the sender and the receiver.  
The received signal strength will  decrease with increased distance as the equation b
shows.
image

•  n:  signal propagation constant, also named propagation exponent.
•  d:  distance from sender.
•  A:  received signal strength at a distance of one meter.
 
A wider discussion of A and n can be found in chapter 5.

image
 

4.4  RSSI – Practical considerations
Section 4.3 described the theoretical RSSI value as a function of the distance. This section
will discuss how the RSSI value can be expected to be measured in the  real world. When
using the ideal formula for signal strength it’s pretty straightforward to do the calculation, but when using real values uncertainty must be taken into account.Most of this uncertainty is
handled by the hardware, but some software handling should be added to increase  the
accuracy.
The methods presented in this section have one main goal: obtain an RSSI value
that correlate to the distance in the best possible way.

4.4.1  Simple ways to filter the RSSI values
Various filters can be used to smooth the RSSI  value. Two common filters are simple
averaging and feedback filters. Averaging  is  the most basic filter type, but it requires more
data packets to be sent. Feedback filters uses only a small part of the most recent RSSI value
for each calculation. This requires less data, but increases the latency when calculating a new
position.
有两种常用的滤波方法用来平滑RSSI值:均值滤波和反馈滤波。

 

The average RSSI value is simply calculated by requiring a few packets from each reference
node each time the RSSI value are measured and calculated according to the  equation
below.

image

If a filter approximation shall be used, this can be done as shown below. In this equation the
variable a is typically 0.75 or above. This approach ensures that a large difference  in RSSI
values will be smoothed. Therefore it is not advisable if the assets that should be tracked can
move long distance between each calculation. (这种方法不知道可行度如何)

image

5.1  A – RSSI value measured one meter from the sender
A, which is an empirical parameter can be  determined  by measuring the RSSI value one
meter from the transmitting unit.

image

 

Figure 9 shows typical RSSI values measured one meter from sender. The figure shows
values measured at position P0, P1, P2 and P3 from Figure 8. The conclusion from this figure
is that the antenna is not isotropic, so an averaged value should be used as the parameter A.
For the devices used in this test, the  averaged value is approximately  -46.  These
measurements were done with RSSI_OFFSET equal to -45.

image


 

5.1.2  A versus calculated position (A对位置计算的影响)
The figure below shows how an erroneous value for the parameter A will affect the calculation
of a blind node’s position. The figure is not showing which A value that is most correct to use.
The  blue  dot  shows that the blind node calculates its own position differently by using
different values for A, relatively big differences in X and Y can be obtained. Generally an A
value between 45 and 49 gives most accurate answer for an indoor office environment.

室内环境下选择45到49的值一般都比较精确。

In this example the calculated positions with A  between 45 and 49 were  approximately  (22,  28), while the real position was (22, 26).
 image

 

5.2  N – Signal propagation coefficient (信号传播系数)
The parameter named N is a parameter that  describe how the signal strength decreases
when the distance from the transmitter increases. N is highly dependent of the environment.(N和环境有很大的关系) N描述了当距离增加的时候信号的衰减的程度。
E.g. the thickness of walls will influent a lot. This value can only be determined empirically. 
N值只能通过经验获取。
The location engine implemented in CC2431 is not using N directly, instead it is using a value
termed n_index. The relation between N and n_index can be seen in the table below. This
conversion table is used to reduce the complexity for the actual hardware implementation. 
 

image

image

Figure 11 shows how the choice of N affects the theoretical RSSI value at a given distance,
where  the  distance  is given in meters. N should be fitted to the actual environment as
accurate as possible.
 
5.2.1 Measuring n
It is challenging, if not impossible, to find  a default value that is optimum n_index for all
environments. The easiest way will probably be  to install all reference nodes in the
environment where the system should be  used  and  thereafter test with different values of
n_index to find the value that fit the best with the actual environment.

根据实际需要得到n值。

Experiments have shown that an n_index value between 15 and 25 gives good results.

实验表明取15到25结果良好。
5.3  Number of reference nodes
As a rule of thumb; as many  reference nodes as possible should be used. At least three is
necessary to give a reliable result. If too few nodes are used, then the influence from each of
the nodes is higher, and one erroneous RSSI value can change the calculated position in a
significant way. Erroneous RSSI values in this context means an RSSI value that does not fit
well with the theoretical value,  e.g.  due  to multipath or if the signal is blocked by walls or
similar.
 
If  the blind node is located outside the grid of reference nodes, it is highly probable that the
result will differ too much from the real position to be usable. It’s not advisable to track objects that are located outside the grid.

6 SOFTWARE ALGORITHMS
Some general algorithms can be implemented in software, they are described on a high level
in the following. Please notice that this application note not describes any thing specific to the network topology in use.
6.1  Selection of “best” reference nodes
The nearest nodes should be used for calculation. This means that the eight reference nodes
with highest RSSI value should be used, all other nodes should be discarded. If eight nodes
not can be reached, as many nodes as possible should be used.
6.2  Extension of the covered area
The hardware location engine can handle X and Y values up to 64 meters, or more precisely
up to 63,75 meters  in  both  directions.  This is too small an area for many practical
applications. Therefore it will be necessary to extend the area. This can easily be archived by
a simple software pre-processor algorithm.
 
Each node represents X and Y with 2 bytes. With an accuracy of 0.25 meters, this gives a
maximum range of 16 384 m.
image 

Figure 12 shows an example of how the algorithm works. The figure shows reference nodes
placed at each 30th meters in both the X and Y directions.  On the figure the light green node
is the blind node, all other nodes are reference nodes.  
算法工作流程: 
•  Step one is to locate the one node with the highest RSSI value and  calculate  an
offset that “move” this node to the centre of a 64x64 meters square. Because of the
known RSSI value for the signal from this node, the distance to that node can easily
be estimated. In Figure 12 the position must be in the white circle.

第一步:确定具有最高RSSI值的节点,并计算将这个节点移到一个 64x64m的正方形的中央需要的补偿值。
•  The  next  step  is to locate the other reference nodes to be used in addition to the
“strongest” one. In the figure the nodes coloured in dark blue are used. All nodes are
offset with the value found in step 1.

第二步:确定其他用于定位的参考节点。所有节点都由第一步计算的值经过补偿。
•  All values found are fed into the location engine hardware and the resulting position is
read out. 

第三步:计算出位置值。
•  The last step is to add the same offset to the position calculated. After  these
calculations are done, the location of the blind node is known in the global grid. 

第四步:在计算出来的坐标值上加上补偿值。
 image

6.3  Level/ floor indication
The hardware location engine is designed for calculating of positions in two dimensions. This
chapter gives some hint and ideas on how this can be extended in software to handle a third
direction, e.g. floors in building.
 
To indicate levels one coordinate must be added in addition to X and Y. In the following this
coordinate is denoted Z. For most purposes it will be enough to represent Z with a one byte
value, this gives 256 different levels.
 
It is assumed that the received signal strength from a node placed on another floor than the
blind node is lower than the signal strength from a node  in the same floor. This implies that
the density of reference nodes will be pretty high.  It  is not assumed that all reference nodes
on the same floor as the blind node are stronger than all reference nodes at all other floors.
image 

Figure  13  shows  a simplified network used for  position tracking between levels. The three
nodes marked with an ‘A’ all have the same X and Y values, but different Z. All nodes colored
with the same color have the same Z, but different X and Y coordinates.

An algorithm that can be used is to first  locate the nearest reference node and read out the
level indication reported from this node. This level is assumed to be the level the blind node is
located. The blind node then needs to make sure  that only nodes  in the same level are fed
into the location engine. Anyway, an algorithm most be used to select which reference nodes
that should be used, level indication will only add one criteria to this algorithm. The main key
in this algorithm is to decide which level the blind node is on. This can be achieved in different
ways. If the mentioned assumption is not valid, some other algorithm most be implemented.
 
In this example it is assumed that the closest reference node will provide the blind node with
the strongest signal. Figure 13 shows a network distributed over three floors. The red node on
floor 2 is assumed to be a blind node. The algorithm described above would in this case do
the following: 
(1)  Find the closest node, this node is labeled B in this case
(2)  Node B will tell the blind node that it is located on floor 2 
(3)  The blind node will then assume (know) that it also is located at floor 2
(4)  All other reference nodes used for the  calculation must also be located at floor 2
(colored in green in the figure), this most be sorted out by the blind node
(5)  The  blind node calculates its position  in the normal way, only by using X and Y
directions
(6) The calculated X and Y coordinates, together with the decided  Z-coordinate,  is
reported as the three dimensional position


0 0
原创粉丝点击