How can I Position N nodes in WSNs which are distributed uniformly at random in a grid of a certain size?
3 次查看(过去 30 天)
显示 更早的评论
N=number of nodes,
observation field of size=(100*sqrt(N)*100*sqrt(N)),
divide the field into sqrt(N)*sqrt(N) grid of square areas,
put a sensor uniformly at random inside these squares.
0 个评论
采纳的回答
Walter Roberson
2017-2-1
编辑:Walter Roberson
2017-2-2
consider:
P = ceil(sqrt(N));
[X, Y] = ndgrid(0:P-1);
RX = 100*(rand(P,P) + X);
RY = 100*(rand(P,P) + Y);
scatter(RX(:), RY(:))
xticks(100*(0:P))
yticks(100*(0:P))
grid on
2 个评论
更多回答(2 个)
sn at
2017-2-2
2 个评论
Walter Roberson
2017-2-2
You need to define that more clearly.
The maximum maximum possible distance between nodes in the above is 100*P*sqrt(2), and the minimum maximum possible distance between two nodes in the above is 100*(P-2)*sqrt(2). Those are calculations from the bottom left to top right corner (or top left to bottom right corner). Do all nodes need to be able to transmit directly to each other?
If all nodes do not need to be able to transmit directly to each other, then if d_max >= 100*sqrt(2) then the "pigeon hole principle" guarantees that every node will be within that distance of at least two other nodes and guarantees that you cannot end up with disconnected partitions of the network.
I am still working out what the conditions are that would guarantee that a chain could not be made.
One of the questions that I have is what the rules are if N is not a perfect square?
For example if N = 54 then the area as a whole has to be 100 * sqrt(54) by 100 * sqrt(54), the sides of which are irrational in length. If we suppose that it has to be done as full units, then that would be either 734 or 735 units per side, depending on whether you are required to round down or round up. Supposing we round down, then we would have a square 734 x 734, and we would be required to divide this into a sqrt(54) x sqrt(54) grid of tiles. What does it mean to have 7.348... squares per side? If we assume rounding down again then that would be 7, so that would require that each cell be (734/7) = 104.857... units on a side. If we round that down too to 104, then 7 of those would only get you to 728 wide when you need 734 wide...
It would seem morally that the point is to put N sensors randomly into a square grid, but when you start getting into the reality that you cannot build in terms of irrational units, if you assume unit intervals, you can only get floor(sqrt(N))^2 or ceil(sqrt(N))^2 sensors; for N = 54 that would correspond to either 49 or 64 sensors.
I think the "100" factor is doing the equivalent of saying that you can build out to two decimal places; if so then floor() in various places are justified.
But much easier for calculation purposes would be if we could get a declaration that N will be a perfect square.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!