Embodiment
Below in conjunction with accompanying drawing, the present invention is described further:
Technical problem
Detection accuracy that is that cause is too low and the uncontrollable problem of boundary node set thickness that detects by malfunctioning node affects too serious to the present invention is directed to existing boundary nodal test method, propose a kind of boundary node detection method based on curve, node to be detected is by collecting neighbor node perception data, pick out part of nodes as fitting nodes, these nodes are carried out curve fitting the boundary curve equation obtaining being similar to, then according to node to be determined to curvilinear equation range estimation its whether be boundary node.
Technical scheme
Implementation of the present invention is as follows:
In the application of wireless sensor network event monitoring, the attribute of overwhelming majority event has the character of " field ", namely event property value along with the increase of distance event center distance be the feature that gradually changeable changes, such as event of fire, the temperature property value of fire is along with distance hot spot is apart from more and more far and gradually reducing, humidity attribute more and more far and gradually increases along with apart from hot spot, and the property value of node perceived is more close to the threshold value that event occurs, then it geographically also should more close to event boundaries.
The present invention utilizes the character of this " field ", find out the node at event attribute Near Threshold, then matching is carried out to the coordinate of these nodes, can obtain being approximately boundary curve equation, carry out the judgement of boundary node finally by calculation level to the distance of boundary curve.
Specific implementation process of the present invention comprises following step:
Step one: calculate the number of fitting nodes according to the densitometer of neighbor node in neighbor domain of node to be determined.
Step 2: all neighbor node perception properties readings collecting node to be determined, builds fitting nodes set according to event generation threshold value and fitting nodes number.
Step 3: the geographical distribution situation according to fitting nodes selects suitable fitting function.
Step 4: the node coordinate in fitting nodes set is carried out curve fitting as match point, obtains boundary curve equation.
Step 5: calculate the beeline of node to be determined to curve, row bound node of going forward side by side judges.
The concrete principle of the computational methods of the fitting nodes number described in step one is as described below, and the present invention determines the quantity of fitting nodes by the method for pattern analysis, fitting nodes quantity when namely computing node neighborhood inner boundary is the shortest and the longest respectively.
Defining 1 network node density is ρ, represents the number of node in every square unit.
Define 2 node nearest-neighbors spacing d, represent that the nearest neighbor node distance of nodal distance oneself is d.
In above two data volumes, network node density ρ can obtain when network design, and node nearest-neighbors spacing d can be obtained by simple computation in node positioning method, and these two data volumes are known quantity in the method.
Fig. 1 is neighbor domain of node inner boundary schematic diagram the most in short-term.As shown in Figure 1, in the neighborhood of node A, boundary line PQ is straight line, and the distance of node A distance border PQ is bound thickness D just
tbe now border PQ the shortest in node A neighborhood time, only need get minimum fitting nodes just can simulate this edge boundary line PQ, in our restrictions of required fitting nodes rectangle frame in the drawings, wherein L is the length of rectangle frame, is also the length of curve PQ, and H is a special length of definition, it collects oneself each neighbor node " nearest-neighbors spacing " by node A, and tries to achieve that mean value obtains.Therefore, at this moment fitting nodes quantity can be passed through formula (1) and obtains:
In this case the fitting nodes minimum number chosen, therefore can utilize this quantity as threshold value.If but again cannot attribute thresholds V in sequence of attributes when choosing node
thleft and right respectively obtains
individual node, then this node is judged to non-boundary node; And the minimum needs of quadratic polynomial approximating method three fitting nodes used, therefore need to correct further formula (1) to obtain:
Formula (2) is the computing formula of the fitting nodes quantity should chosen the most in short-term at neighbor domain of node inner boundary.
Fig. 2 be neighbor domain of node inner boundary the longest time schematic diagram.In the neighborhood of node A, boundary line PQ is curve, and the distance of node A to border PQ is 0, and now border PQ is the longest in node A neighborhood.Because the fitting nodes quantity N chosen does not need accurately strict, so easy in order to calculate, done approximate processing here, assumed curve PQ is circular arc, and at this moment fitting nodes quantity is:
Comprehensive above two kinds of situations, get the mean value of the maximum and minimum situation of fitting nodes number as final fitting nodes value number:
In above-mentioned steps two, the concrete grammar that fitting nodes set is chosen and principle as follows.
When a node will judge oneself whether as boundary node, first can ask survey measurements and coordinate information, then analyze the reading information obtained.Here first to determine the number of attribute, and divide situation discussion according to the difference of attribute number.
Single attribute event (utilizing an attribute to carry out the event weighed or represent) is detected, if m
nfor transducer is for the expectation of attribute reading when not having that event occurs, m
ffor the expectation of attribute reading when transducer occurs for event, then judge that optimum threshold value that event occurs is as [1]:
V
th=0.5(m
n+m
f) (5)
Event attribute can be divided into two classes: ascending-type event attribute and down type event attribute.Wherein ascending-type event attribute value is larger than property value when event occurs when event occurs, and down type event attribute value is less than property value when event occurs when event occurs.
If ascending-type event attribute, binary decision formula is:
If be down type event attribute, binary decision formula is:
Wherein B is the binary result of event judgement, and V is the reading of sensor node.
In fact, the theoretical boundary of event is exactly the isopleth of this threshold value, sensor node its attribute reading sensed and threshold value V that distance isopleth is nearer
thmore close, therefore the attribute sensor reading of neighbor node is done unstable sequence according to size, if ascending-type event attribute, then according to descending, if down type event attribute, then arrange according to ascending order.Then, find the position that threshold value is residing in the sequence, the nearest N number of point of distance threshold is respectively got in left and right.Finally, using this N number of point as fitting nodes S set.
Multiattribute event (event needs multiple attribute to weigh) is detected, if m
i nfor transducer is for the expectation of attribute reading when not having that event occurs, m
i ffor the expectation of attribute reading when transducer occurs for event, for each attribute judge optimum gate limit value that event occurs as:
V
i th=0.5(m
i n+m
i f) (8)
Suppose that event has m attribute, V
ibe the reading of a node for attribute i, then for multiattribute event, whether decision event occurs first to carry out binary decision for single attribute respectively, if ascending-type event attribute, binary decision formula is:
If be down type event attribute, binary decision formula is:
The binary system of final multiattribute event differentiates that result is:
The figure that the teachings of this event is formed for the common factor meeting each attribute and equal m the enclosed region that isopleth that threshold value forms surrounds, in other words, the theoretical boundary of this event allly to meet for connecting:
V
1=V
1 th, V
2=V
2 th, V
3=V
3 th..., V
m=V
m ththe closed curve that formed of node.
Therefore, the perception reading of m the different attribute that neighbor node is perceived carries out instability sequence respectively, if ascending-type event attribute, then according to descending, if down type event attribute, then arrange according to ascending order, obtain the property value sequence that m group is orderly, then the position of the property value sequence that each attribute threshold value is arranged in is found out, left justify is carried out to each sequence, a size order is discharged, such as, for following situation apart from the distance of respective sequence high order end again according to each attribute thresholds:
Attribute 1
Attribute 2
Attribute m
The sequence obtained should be:
< attribute 2 < ... < attribute m < ... < attribute 1 <
In this sequence, attribute the closer to left end proves that the event generation threshold value isopleth of its correspondence is the closer to the center of circle, then actual event boundaries should be the event generation threshold value isopleth the closer to this attribute, therefore using the sequence of attributes near left end as getting point sequence.Next, N/2 the node that selected distance threshold value is nearest from this property value sequence, then using this N number of node as fitting nodes S set.
Choose the concrete grammar of quadratic fit function according to the geographical distribution situation of fitting nodes set in above-mentioned steps three and principle as follows.
After obtaining fitting nodes S set, next set forth how Selection of Function carries out matching to the node coordinate in fitting nodes S set, thus obtain the matched curve of an approximate boundaries curve.According to the relevant knowledge of curve, matched curve needs to determine in advance, the conventional linear once fitting function of fitting function, polynomial fit function, exponential fitting function and power function fitting function etc., and its complexity calculated increases successively.
First discuss and use once fitting function, both used straight line to carry out matching.As shown in Figure 3:
In Fig. 3 a, dash area is a part for event area, compare the radius of neighbourhood of node I, event range is very large, therefore the local event border DFE in the neighborhood of node I is similar to straight line, now use linear function matching just can obtain comparatively close to the curve of real border, if but the radius of neighbourhood that event area compares node I is little, local event border DEF then in the neighborhood of node I is the curve that a radian is larger, and the result now utilizing linear function matching to obtain will be larger with the error of actual boundary.
Dash area in Fig. 3 b is event area, this event area is the irregular area of a class ellipse, in the neighborhood of node A, local event border is curve M LN, this curve approximation straight line, and in the neighborhood of Node B, local event border is curve PRQ, the radian of this curve is larger.If in this example, carry out edge fitting with linear function, in A neighbor domain of node, result comparatively accurately can be obtained, but it is larger to save at B the resultant error obtained in neighborhood of a point.
Consider above two kinds of situations, the present invention adopts quadratic polynomial function to carry out matching, and quadratic polynomial function is slightly larger than linear function on computation complexity, but accuracy rate is higher, can meet the local boundary of any type in above two kinds of situations.Need when selecting quadratic polynomial Function Fitting to consider following situation:
Dash area in Fig. 4 is event area.In the neighborhood of node A, local event boundary curve is MLN, and this curve can use y=ax
2the quadratic polynomial function of+bx+c carries out that matching is approximate to be obtained.In the neighborhood of Node B, local event boundary curve is PRQ, this curve cannot carry out matching with any curvilinear function and obtain, because corresponding two the y values of x value in curve PRQ rectangular coordinate system in the drawings, curve PRQ can not find a function and represents in other words, under the circumstances, intend doing following work when selecting quadratic fit function:
The node finding X-coordinate maximum in fitting nodes S set, is designated as N
xmax, its coordinate is (X
max, Y); Find the node that X-coordinate is minimum, be designated as N
xmin, its coordinate is designated as (X
min, Y); Find the node that Y-coordinate is maximum, be designated as N
ymax, its coordinate is (X, Y
max), find the node that Y-coordinate is minimum, be designated as N
ymin, its coordinate is (X, Y
min).We carry out choosing of fitting function by following formula:
If X
max-X
min>=Y
max-Y
min, then as Fig. 5 A, use shape as the quadratic function y=ax of curve PQ
2+ bx+c carries out matching, if X
max-X
min< Y
max-Y
min, then as Fig. 5 B, use shape as the quadratic function x=ay of curve PQ
2+ by+c carries out matching.
Curve-fitting method concrete in above-mentioned steps four is as follows.
In known plane, some represent the point of experimental datas, look for a curve (such as logarithmic curve) meeting certain character, and make it put closest with these, this method of looking for curve, is called curve, and calculated curve is called matched curve.The method of curve has a lot, considers wireless sensor node resource-constrained, the present invention adopt a kind of comparatively accurately and calculate easy method---least square method.
The general principle of least square method is for given data (x
i, y
i) (i=0,1 ..., m), getting in fixed function class Φ, asking p (x) ∈ Φ, make error r
i=p (x
i)-y
i(i=0,1 ..., quadratic sum m) is minimum, namely
From geometric meaning, seek exactly and set point (x
i, y
i) (i=0,1 ..., square distance m) and be minimum curve y=p (x).Function p (x) is fitting function or least square solution, asks the method for fitting function p (x) to be the least square method of curve.
When fitting function is multinomial, then
For (a
0, a
1..., a
n) the function of many variables, therefore the topic that fits to of polynomial function is changed into and asks I=I (a
0, a
1..., a
n) mechanism problem, have the function of many variables ask mechanism necessary condition,
J=0,1 ..., n, namely
j=0,1,…,n (15)
Above formula is about a
0, a
1..., a
nsystem of linear equations, be expressed in matrix as
Then a is solved
0, a
1..., a
n, and bring former fit equation into, just obtain the equation after matching.
In method, fitting function is y=ax
2+ bx+c(chooses y=ax here
2+ bx+c fitting function is that example is described, and fitting function is x=ay
2during+by+c, principle is identical), match point set is S={ (x
i, y
i) | i=0,1 ... m}, then the matrix of the system of linear equations about a, b, c obtained is:
This is a ternary linear function group, easily solves a, the root of b, c, just can obtain fit equation after trying to achieve undetermined coefficient.
Node to be determined in above-mentioned steps five to the concrete grammar of the beeline of curve and decision process as follows.
Can be obtained the local boundary curve in a neighbor domain of node by curve, need below to calculate the distance of this node to curve, mentioned here some A is expressed as follows to the formalization of the distance of curve PQ:
Point A be curve PQ extenal fixation a bit, on curve PQ, there is 1 B minimum to the distance of some A, this distance is the beeline of an A to curve PQ, and this distance is designated as D.
If D is greater than threshold value D
t, namely sensor node is greater than bound thickness to the distance on border, then this sensor node is not boundary node, if instead D is less than or equal to threshold value D
t, namely sensor node is less than or equal to bound thickness to the distance on border, then this sensor node is boundary node, is formulated as:
Discuss below and how to try to achieve a little to the beeline of curve.The coordinate of postulated point A is (M, N), and the equation of curve PQ is y=ax
2+ by+c, then the range equation putting A to curve PQ is
f=H
2=(x-M)
2+(y-N)
2
=(x-M)
2+(ax
2+bx+c-N)
2(19)
=a
2x
4+2abx
3+(1+b
2+2ac-2aN)x
2
+(2bc-2M-2bN)x+(M
2+c
2-2cN+N
2)
Need the minimum point of trying to achieve function f below, this point is exactly the beeline of an A to curve PQ to the distance of known point A, therefore to function f differentiate, obtains:
Make f '=0, separate this equation, the coordinate that solves of trying to achieve is the extreme point of an A to curve PQ distance, and wherein minimum point is required point.
F '=0 is a simple cubic equation, separates this equation, intends using famous Sheng gold radical formula.
Suppose that the simple cubic equation solved is ax
3+ bx
2+ cx+d=0, (a, b, c, d ∈ R, and a ≠ 0), and define repeated root discriminant A=b
2-3ac; B=bc-9ad; C=c
2-3bd, total discriminant is Δ=B
2-4AC.X
1, x
2, x
3three roots required by us, then:
1) as A=B=0:
2) as Δ=B
2during-4AC > 0:
Wherein
i
2=-1。
3) as Δ=B
2during-4AC=0:
Wherein
4) as Δ=B
2during-4AC < 0:
Wherein
θ=arccosT,
(A>0,-1<T<1)
As Δ=B
2during-4AC > 0, equation has a real root and a pair conjugation imaginary root, fixing point in plane any beeline to curve due to what calculate, so the point on this curve must be necessary being, and imaginary root does not have practical significance in rectangular coordinate system, therefore, as Δ=B
2during-4AC > 0, equation only gets a real root.Bring this real root into fitting function equation, coordinate points (the x tried to achieve, y), this point be exactly on curve to extra curvature 1 A (M, N) nearest point, then try to achieve the distance D of point-to-point transmission according to distance between two points formula, namely put the beeline of A (M, N) to matched curve:
In other situations, use and contain three root x that golden formula tries to achieve equation
1, x
2, x
3, then substitute into fitting function respectively, try to achieve three point (x
1, y
1), (x
2, y
2), (x
3, y
3) these three points are an A (M, N) three extreme points to matched curve distance.Formula (21) is used to obtain the distance D of three point-to-point A respectively
1, D
2, D
3, and finding wherein minimum value, this value is just for some A is to the beeline D of matched curve.
Obtaining a little after curve distance D, using formula (18) to carry out boundary node judgement.
Describe the present invention below by Matlab emulation.
Detection example
Specific embodiment of the invention process comprises following step:
The present invention choose in boundary node detection method representative based on fault-tolerant boundary node detection method (DFTEBD) as a comparison.
Enforcement scene of the present invention is as follows:
Arranging a node scale amounts is the wireless sensor network of 1600, by its random placement in the region that area size is 100*100, supposes that all node communication scopes are for circular in experiment.Suppose that event to be detected is fire, hot spot is positioned at topology area center (50,50), fire scope radius is 30, and judge that the temperature threshold threshold value whether fire occurs is 100, hot spot temperature is 200, along with distance hot spot distance is far away, the temperature at sensor node place reduces gradually.
False readings due to sensor node directly can affect the accuracy of boundary node recognition methods, therefore the error node of 5%, 10%, 15%, 20%, 25%, 30%, 35% ratio is set in topological network, these error node are random selecting in all nodes, arranging event boundaries thickness is 5, contrast the present invention and the performance of DFTEBD method under the network of various error node ratio.
Because the present invention supports manually to set bound thickness, therefore arrange respectively in topological network event boundaries thickness be 3,3.25,3.5,3.75,4,6,6.25, the border thickness value such as 6.75, contrast the performance of the present invention and DFTEBD method when there is no malfunctioning node.
Experiment and analysis
The quality of the boundary node detection method in wireless sensor network event monitoring field is normally using accuracy and energy ezpenditure as evaluation criterion.In this experiment, choose following evaluating and comprehensively detailed evaluation is carried out to the present invention and control methods.
1) discrimination: the percentage of real border node number shared by the boundary node identified by recognition methods.Discrimination embodies the most important index identifying boundary node ability, and this index value is larger, and illustration method performance is better.
2) rate is sentenced in mistake: the boundary node number utilizing boundary node recognition methods not identify accounts for the percentage of real border node number.This Parametric Representation boundary node recognition methods is judged as boundary node the probability of non-boundary node mistakenly, and this parameter value is larger, and illustration method performance is poorer.
3) False Rate: utilize boundary node recognition methods that non-boundary node is judged as the percentage of real border node number shared by the node number of boundary node.This Parametric Representation Boundary Recognition method fault ground is judged as non-boundary node the probability of boundary node, and this parameter value is larger, and illustration method performance is poorer.
Below interpretation:
Fig. 6 is the increase along with malfunctioning node ratio in random network, the curve chart of two kinds of method detection boundaries node recognition rates, and as can be seen from the figure, when in network, malfunctioning node ratio is 5%, discrimination of the present invention is a little more than DFTEBD; Along with malfunctioning node ratio increases, the boundary node discrimination of two kinds of methods reduces all gradually, but the present invention is compared with DFTEBD, and discrimination is obviously higher; After malfunctioning node in network is higher than 25%, discrimination of the present invention still remains on more than 90%, and DFTEBD has dropped to about 80%, although this is because DFTEBD contains malfunctioning node testing mechanism, but False Rate is too high, thus result in follow-up boundary node discrimination degradation.In general, the present invention shows and is better than DFTEBD in discrimination.
Fig. 7 is the increase along with malfunctioning node ratio in random network, and two kinds of methods lose the curve chart sentencing rate about boundary node.When malfunctioning node ratio is identical, Same Way lose sentence rate and accuracy rate and be 1.From this figure, can find out intuitively, along with the increase of malfunctioning node ratio, the mistake of two kinds of methods is sentenced rate and is increased gradually, DFTEBD is when malfunctioning node ratio is 15%, mistake is sentenced rate and is reached more than 15%, the present invention can when malfunctioning node ratio lower than 25% remain on less than 10% always.It is in general, of the present invention that to sentence in rate performance in mistake better.
Fig. 8 is the increase along with malfunctioning node ratio in random network, the curve chart of the boundary node False Rate of two kinds of methods.As can be seen from the figure, False Rate of the present invention increases along with the increase of malfunctioning node ratio, but amplification is less, this error being the erroneous judgement node produced due to the present invention mainly produces to curve distance due to self matched curve and calculation level causes, and the impact by network failure node is less; The False Rate of DFTEBD is very high, and along with the increase of malfunctioning node ratio is also increasing, this is because DFTEBD method is lower in the accuracy rate of malfunctioning node detection-phase, and what meeting was wrong is judged as malfunctioning node many normal node, thus create error, in network, malfunctioning node is more, then misjudgment phenomenon is more serious.
Fig. 9 is the increase along with bound thickness in random network, the boundary node discrimination curve chart of two kinds of methods.When there is no malfunctioning node, the discrimination of DFTEBD can reach 100%, and discrimination of the present invention cannot reach 100%, this is because the event boundaries curve that the inventive method simulates exists certain error with actual boundary curve, thus a small amount of node is caused to be failed to judge.Although this error is less, cannot eliminate.In figure, curve of the present invention is that in the interval of 3 to 4, discrimination increases gradually in bound thickness, this is because when bound thickness is less, general boundaries number of nodes is little, and discrimination is lower; Along with bound thickness increases, boundary node increasing number, discrimination can rise gradually, finally reaches the level close to 100%.All in all, at fault-free node ideally, with the change of bound thickness, discrimination of the present invention is a little less than DFTEBD.
Figure 10 is the increase along with bound thickness in random network, the curve chart of the boundary node False Rate of two kinds of methods.In figure, the False Rate of the inventive method remains on 50% once along with the change of bound thickness always, compares DFTEBD more steady.Main cause is the present invention when judging a node whether as boundary node, judge according to the distance of node to boundary curve, therefore producing erroneous judgement is that the impact of bound thickness on False Rate is little because the error of calculation produced during boundary curve matching causes; And DFTEBD method False Rate is totally all in very high level.In general, contrast DFTEBD method, the present invention can keep lower False Rate in the scope that bound thickness value is larger, and performance is better.
As can be seen from above contrast, the present invention has good performance in the wireless sensor network of random distribution.When in network, malfunctioning node ratio is higher, this method still can ensure higher discrimination and lower False Rate.In addition, the present invention is with the obvious advantage in bound thickness control, can Manual definition's bound thickness change, and discrimination and False Rate can have stable and show preferably.See on the whole, the present invention detection perform and and energy consumption in all very stable, be not that cost pursues high detection perform with energy consumption, but detection perform is still good.In sum, the inventive method can keep balance in energy consumption and detection perform, and combination property is better.