Clear Filters
Clear Filters

how to share node table with neighbours node

5 views (last 30 days)
singh
singh on 28 May 2015
Commented: Walter Roberson on 30 May 2015
hello friends i have multiple nodes on 2d graph and my question is how the nodes are share the table with neighbor node like AODV routing protocol.

Answers (1)

Walter Roberson
Walter Roberson on 28 May 2015
If node J has array to send to node K, then you can simulate sending the table by using something like
Default_max_tables = 3; %Example. Keep tables from 3 neighbors by default
if length(TableBuffer) >= K & ~isempty(TableBuffer(K).max_tables);
max_K_tables = TableBuffer(K).max_tables;
K_table_senders = TableBuffer(K).table_senders;
K_neighbor_tables = TableBuffer(K).neighbor_tables;
else
max_K_tables = Default_max_tables; %this node never talked to before
K_table_senders = [];
K_neighbor_tables = {};
end
[JinK, Jidx_in_K] = ismember(J, K_table_senders);
if JinK %K already has one from J?
K_neighbor_tables(Jidx_in_K) = []; %remove old one
K_table_senders(Jidx_in_K) = [];
elseif length(K_table_senders) >= max_K_tables %is their storage full?
K_neighbor_tables(1) = []; %remove oldest
K_table_senders(1) = [];
else %it was not there but we have room for more so no problem
end
K_neighbor_tables(end+1) = {J_route_table;} %add J's table at end
K_table_senders(end+1) = J;
TableBuffer(K).max_tables = K_max_tables;
TableBuffer(K).table_senders = K_table_senders; %update master copy
TableBuffer(K).neighbor_tables = K_neighbor_tables;
At the beginning, initialize
TableBuffer = [];
This code simulates a limited buffer space for tables. In this code, when a node receives a table, it checks to see if it already has a table from that neighbour. If it does, then it discards the existing table; if it did not already have a table from that neighbour then it checks to see if it is full, and if it is then it discards the oldest table. Then it adds the incoming table to the end of the per-node buffers.
This code does not assume that the buffer space is the same for each node. If you want to set a particular node N to a non-default maximum number of tables, set TableBuffer(N).max_tables to the maximum number; with this code you do not need to initialize the maximum for the nodes you want to default in size.
The code does assume that number of table entries available does not shrink. It would not be difficult at all to alter it to allow shrinking, but if you are simulating a process by which the nodes get full then you probably want to do the shrinking at the time the simulated necessity was simulated detected.
The simulation could be improved. For example if the tables might be different sizes then the simulated limitation could be placed not upon the number of tables but rather upon their simulated total size. When a large table came in that might require deleting multiple tables to make room.
The code also does not simulate MRU (Most Recently Used) behaviour, which would call for releasing tables not according to "oldest received" but rather according to "oldest used", under some measure of "used". The distinction is an important one for some purposes, and adjusting the retention strategy should be part of your research.
  2 Comments
singh
singh on 29 May 2015
Walter Roberson,thanks for response but how it will be start
Walter Roberson
Walter Roberson on 30 May 2015
As I indicated, you start it with
TableBuffer = [];
You need to simulate "booting" each node, putting it into an active state where it has not heard from any neighbours. You need to simulate some kind of discovery process so that devices advertise their presence, and you need to simulate that some devices might not "hear" the announcement the first time around. You need to simulate that not all devices will be turned on when the simulation starts. Later in the simulation you will need to simulate that some of the devices may get switched off. And you will need to simulate that some or all transmissions get blocked (node gets moved under a concrete building for a few minutes, and so on.) All those matters of how to announce initial presence and how to decide who is nearby and how far they are (signal strength or quality) and how to decide what to put in the routing tables: all of those are outside the scope of the above code. You asked how to simulate sending a routing table between two nodes, and that's all the above code does, simulate a successful reception of a routing table. The only initialization it needs is setting the TableBuffer variable to [] before you start.

Sign in to comment.

Categories

Find more on Test and Measurement in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!