To simulate Fisheye State Routing (FSR) using MATLAB that is a proactive, link-state routing protocol modeled for wireless ad-hoc networks and MANETs (Mobile Ad-hoc Networks). The significant aspect of FSR is which it minimizes the control overhead by transmitting in-depth routing data to close nodes and gradually less detailed data to nodes that are farther away. The protocol’s “fisheye” nature intends that nodes needs to have a clearer view of its instant vicinity, however a less exact view of distant portions of the network.
To replicate the Fisheye Protocol using MATLAB that encompasses to make a network, to execute the fisheye routing algorithm, and to estimate the performance of the protocol.
Steps to Simulate Fisheye Protocol in MATLAB
- Define the Network Topology
- Describe the network of mobile nodes, its locations, and their communication range. Nodes will swap routing data periodically with its neighbors, however with diverse levels of detail based on its distance.
Example of defining a network with nodes:
numNodes = 10; % Number of nodes in the network
networkArea = 100; % Area size (100×100 meters)
nodePositions = rand(numNodes, 2) * networkArea; % Random node positions
communicationRange = 30; % Communication range (in meters)
% Adjacency matrix to store distances between nodes (inf if out of range)
adjacencyMatrix = inf(numNodes);
for i = 1:numNodes
for j = i+1:numNodes
distance = norm(nodePositions(i,:) – nodePositions(j,:));
if distance <= communicationRange
adjacencyMatrix(i,j) = distance;
adjacencyMatrix(j,i) = distance;
end
end
end
- Define Routing Tables
- Every single node sustains a routing table along with entries for every other node. Firstly, nodes only understand the distance to its direct neighbors.
Example of initializing the routing tables:
function routingTable = initializeRoutingTable(numNodes, adjacencyMatrix)
routingTable = inf(numNodes); % Initialize with infinity (unknown distances)
for i = 1:numNodes
routingTable(i,i) = 0; % Distance to itself is 0
neighbors = find(adjacencyMatrix(i,:) < inf); % Neighbors within communication range
for neighbor = neighbors
routingTable(i, neighbor) = adjacencyMatrix(i, neighbor); % Distance to neighbors
end
end
end
routingTable = initializeRoutingTable(numNodes, adjacencyMatrix);
- Implement Fisheye Scope
- In FSR, the network is split into diverse scopes according to the distance. Nodes swap complete routing data with nodes in its inner scope (close neighbors), however minimize the frequency of updates to nodes within the outer scope (distant nodes).
Example of defining fisheye scopes:
function [innerScope, outerScope] = fisheyeScopes(adjacencyMatrix, node, innerRadius, outerRadius)
numNodes = size(adjacencyMatrix, 1);
innerScope = []; outerScope = [];
for i = 1:numNodes
distance = adjacencyMatrix(node, i);
if distance <= innerRadius && distance > 0
innerScope = [innerScope, i];
elseif distance > innerRadius && distance <= outerRadius
outerScope = [outerScope, i];
end
end
end
innerRadius = 30; % Inner scope (full routing info)
outerRadius = 60; % Outer scope (reduced routing info)
- Update Routing Tables
- Nodes periodically transmit its routing tables to other nodes in their scope. Nodes modernize their routing tables with the support of the Bellman-Ford algorithm or other shortest-path algorithms to reduce the distance for each destination.
Example of updating routing tables:
function routingTable = updateRoutingTable(adjacencyMatrix, routingTable, node, innerScope, outerScope)
% Update routing table using the Bellman-Ford algorithm
numNodes = size(adjacencyMatrix, 1);
% Update for nodes in inner scope (full routing information)
for i = innerScope
for j = 1:numNodes
if routingTable(node,j) > routingTable(node,i) + adjacencyMatrix(i,j)
routingTable(node,j) = routingTable(node,i) + adjacencyMatrix(i,j);
end
end
end
% Update for nodes in outer scope (less frequent updates)
for i = outerScope
for j = 1:numNodes
if routingTable(node,j) > routingTable(node,i) + adjacencyMatrix(i,j)
routingTable(node,j) = routingTable(node,i) + adjacencyMatrix(i,j);
end
end
end
end
- Simulate Periodic Updates
- Periodically, nodes exchange its routing data according to their scope. Inner scope nodes obtain more frequent updates, even though outer scope nodes receive less frequent updates.
Example of simulating periodic updates:
numIterations = 10; % Number of update iterations
for iteration = 1:numIterations
for node = 1:numNodes
% Determine inner and outer scopes
[innerScope, outerScope] = fisheyeScopes(adjacencyMatrix, node, innerRadius, outerRadius);
% Update routing tables
routingTable = updateRoutingTable(adjacencyMatrix, routingTable, node, innerScope, outerScope);
end
% Display the routing table after each iteration
disp([‘Routing table after iteration ‘, num2str(iteration)]);
disp(routingTable);
end
- Simulate Data Transmission Using FSR
- Replicate data transmission among the nodes, after the routing tables have converged. We can utilize the shortest paths from the routing table to find out how data is sent among nodes.
Example of simulating data transmission:
function transmitData(routingTable, src, dst)
if routingTable(src,dst) < inf
disp([‘Data transmitted from node ‘, num2str(src), ‘ to node ‘, num2str(dst), ‘ via hop count: ‘, num2str(routingTable(src,dst))]);
else
disp(‘No valid route found.’);
end
end
% Simulate data transmission from node 1 to node 7
srcNode = 1;
dstNode = 7;
transmitData(routingTable, srcNode, dstNode);
- Evaluate Fisheye Protocol Performance
- Evaluate parameters like convergence time, average hop count, routing overhead, and packet delivery ratio to estimate the FSR protocol’s performance.
Example of calculating the average hop count:
totalHopCount = 0;
pathCount = 0;
for i = 1:numNodes
for j = i+1:numNodes
if routingTable(i,j) < inf
totalHopCount = totalHopCount + routingTable(i,j);
pathCount = pathCount + 1;
end
end
end
avgHopCount = totalHopCount / pathCount;
disp([‘Average hop count: ‘, num2str(avgHopCount)]);
- Visualize the Network Topology and Routes
- Envision the network topology, nodes, and routing paths using MATLAB’s plotting functions.
Example of visualizing the network:
figure;
hold on;
plot(nodePositions(:,1), nodePositions(:,2), ‘bo’); % Plot node positions
% Plot communication links
for i = 1:numNodes
for j = i+1:numNodes
if adjacencyMatrix(i,j) < inf
plot([nodePositions(i,1), nodePositions(j,1)], [nodePositions(i,2), nodePositions(j,2)], ‘k-‘);
end
end
end
title(‘Fisheye Protocol Network Topology’);
hold off;
Conclusion
To replicate the Fisheye State Routing (FSR) protocol using MATLAB:
- Describe the network topology that including nodes and communication links.
- Introduce the routing tables in which each node only understands the distances to their neighbors firstly.
- Execute the fisheye scope, where nodes swap full routing data with nearby neighbors and minimized data with distant nodes.
- Replicate periodic updates to bring up-to-date routing tables according to the fisheye scope.
- Mimic data transmission utilizing the shortest paths is acquired from the routing tables.
- Estimate performance by calculating parameters such as average hop count and routing overhead.
- Envision the network topology also routing paths utilizing MATLAB’s plotting capabilities.
We established a set of simulation steps to execute and simulate the Fisheye Protocol projects through MATLAB platform. If needed, we can explore this subject further and provide complete information.
Fisheye Protocol Projects using MATLAB tools are simulated by phdprime.com, which will help you achieve great results. We provide customized project ideas and conduct network comparison analysis based on what interests you. Our team works on modeling link-state routing protocols for wireless ad-hoc networks and MANETs (Mobile Ad-hoc Networks).