To simulate the Optimized Link State Routing (OLSR) in MATLAB has needs to follow a numerous steps and it is a proactive routing protocol modelled for Mobile Ad-Hoc Networks (MANETs). It sustains a complete routing table at every node that is occasionally updated according to the link-state information. OLSR utilizes multipoint relays (MPRs) to enhance the flooding of control messages, minimizing the overall routing overhead.
Here’s a complete procedures on how to simulate OLSR protocol projects using MATLAB.
Steps to Simulate OLSR Protocol in MATLAB
- Define the Network Topology
The initial step is to describe a network of nodes denotes the devices and their connections (links). The network topology is commonly designed by the way of a graph, that nodes denotes mobile devices and edges signify wireless links among them.
Example: Create a simple network topology
% Define the nodes in the network
nodes = {‘Node1’, ‘Node2’, ‘Node3’, ‘Node4’, ‘Node5’};
% Define the connections between nodes (adjacency matrix)
connections = [0 1 1 0 1; % Node1 is connected to Node2, Node3, and Node5
1 0 1 1 0; % Node2 is connected to Node1, Node3, and Node4
1 1 0 1 0; % Node3 is connected to Node1, Node2, and Node4
0 1 1 0 1; % Node4 is connected to Node2, Node3, and Node5
1 0 0 1 0]; % Node5 is connected to Node1 and Node4
% Generate a graph representative the network topology
G = graph(connections, nodes);
% Plot the network topology
figure;
plot(G, ‘Layout’, ‘force’);
title(‘OLSR Network Topology’);
This signify a simple network of 5 nodes and their particular connections.
- Identify Multipoint Relays (MPRs)
One of the key optimizations of OLSR is the utilization of Multipoint Relays (MPRs). Each and every other node prioritizes a subset of its neighbours by the way of MPRs to minimize the amount of nodes transmitting the broadcast messages. The MPRs make sure that broadcast messages extent the every nodes in the network.
Example: Identify MPRs for Node1
% Function to find MPRs for a given node
function mprs = find_mprs(node, G)
neighbors = neighbors(G, findnode(G, node)); % Get direct neighbors
mprs = [];
% Find neighbors that cover 2-hop neighbors
for i = 1:length(neighbors)
neighbor = neighbors(i);
two_hop_neighbors = neighbors(G, neighbor); % 2-hop neighbors
if length(two_hop_neighbors) > 1
mprs = [mprs, neighbor]; % Add to MPR list if it covers 2-hop neighbors
end
end
end
% Find MPRs for Node1
mprs_node1 = find_mprs(‘Node1’, G);
disp(‘Multipoint Relays (MPRs) for Node1:’);
disp(G.Nodes.Name(mprs_node1));
In this replication, Node1 choses a subset of its neighbours by way of MPRs. MPRs are liable for transferring the broadcast messages in the OLSR protocol.
- Broadcast of Topology Control (TC) Messages
After MPRs are chosen, they are accountable for broadcasting Topology Control (TC) messages to modernize the network about link-state information. The TC message encompasses the list of neighbours of the broadcasting node and is utilized to update routing tables.
Example: Broadcast TC messages from MPRs
% Function to simulate TC message broadcast
function broadcast_tc(node, G)
neighbors = neighbors(G, findnode(G, node));
fprintf(‘%s broadcasts TC message to: ‘, node);
disp(G.Nodes.Name(neighbors)’);
end
% Simulate TC message broadcast from MPRs of Node1
fprintf(‘Node1 MPRs broadcasting TC messages:\n’);
for i = 1:length(mprs_node1)
broadcast_tc(G.Nodes.Name{mprs_node1(i)}, G);
end
The MPRs chosen by Node1 broadcast TC messages to their neighbours, keep informed them concerning their link-state data.
- Route Calculation
After getting TC messages, every node estimate the optimal routes to every other node in the network. The shortest path algorithm such as Dijkstra’s can be utilized to estimate the routes according to the topology information.
Example: Calculate routes using shortest path
% Function to calculate shortest path from a node to all other nodes
function routes = calculate_routes(node, G)
num_nodes = numnodes(G);
routes = cell(num_nodes, 1);
for i = 1:num_nodes
if i ~= findnode(G, node)
[path, ~] = shortestpath(G, findnode(G, node), i);
routes{i} = G.Nodes.Name(path)’;
end
end
end
% Calculate routes for Node1
routes_node1 = calculate_routes(‘Node1’, G);
% Display calculated routes
disp(‘Routes from Node1 to all other nodes:’);
for i = 1:length(routes_node1)
if ~isempty(routes_node1{i})
fprintf(‘Route to Node %d: %s\n’, i, strjoin(routes_node1{i}, ‘ -> ‘));
end
end
This function estimates the shortest paths (routes) from Node1 to every other nodes in the network according to the updated topology.
- Simulate Link Failures
In a dynamic network such as MANET, links among nodes can disruption because of node mobility. When a link miscarries, nodes identify the failure and update their routing tables. We can replicate link failures by eliminating connections from the graph.
Example: Simulate a link failure between Node2 and Node3
% simulate link failure between Node2 and Node3
fprintf(‘Link between Node2 and Node3 fails\n’);
G = rmedge(G, findnode(G, ‘Node2’), findnode(G, ‘Node3’));
% Recalculate routes after the link failure
routes_node1 = calculate_routes(‘Node1’, G);
% Display updated routes after the failure
disp(‘Updated routes from Node1 after link failure:’);
for i = 1:length(routes_node1)
if ~isempty(routes_node1{i})
fprintf(‘Route to Node %d: %s\n’, i, strjoin(routes_node1{i}, ‘ -> ‘));
end
end
In this instance, the link among Node2 and Node3 fails, and Node1 recalculates the routes to other nodes.
- Performance Evaluation
After replicating the OLSR protocol, we can measure its performance based on:
- Routing overhead: Amount of control messages (TC, Hello) interchanged.
- Packet delivery ratio: Ratio of successfully delivered packets.
- Convergence time: Time taken to estimate routes after topology varies like link failures.
Example: Measure routing overhead (control message count)
% Initialize counters for control messages
control_message_count = struct(‘TC’, 0, ‘Hello’, 0);
% Function to count control messages
function control_message_count = count_message(type, control_message_count)
control_message_count.(type) = control_message_count.(type) + 1;
end
% Simulate broadcasting and counting TC messages
fprintf(‘Counting TC messages:\n’);
for i = 1:length(mprs_node1)
control_message_count = count_message(‘TC’, control_message_count);
broadcast_tc(G.Nodes.Name{mprs_node1(i)}, G);
end
% Display control message counts
disp(‘Control Message Counts:’);
disp(control_message_count);
This enables you to amount the number of TC and Hello messages interchanged in the course of the simulation.
Example Project Ideas for OLSR Simulation in MATLAB
- Performance of OLSR in Highly Mobile Networks: Mimic OLSR in a highly mobile network in which the nodes usually alters the positions. Evaluate the protocol’s performance according to packet delivery ratio, routing overhead, and convergence time.
- Energy-Aware OLSR Routing: Adjust the OLSR protocol to contain energy parameter in the selection of MPRs and route estimation. Mimic on how energy-aware routing affects the network lifetime and performance.
- OLSR vs AODV Protocol Comparison: Replicate both OLSR (proactive) and AODV (reactive) in same network environment and relate them according to routing overhead, latency, and packet delivery ratio.
- Security-Enhanced OLSR: Execute security improvements in OLSR, like authentication or encryption of control messages, and measure on how these enhancement impact the performance and security of the protocol.
- OLSR in Large-Scale MANETs: Mimic OLSR in a large-scale network (50+ nodes) and measure its scalability
By utilizing the MATLAB, you can simulate and measure the performance for Optimized Link State Routing projects that were simulated and visualized the results in the above following steps. We will be offer more information related this project in another manual.
Contact us, and we will provide you with excellent services. We offer project ideas and conduct performance analysis based on your interests. At phdprime.com, we simulate OLSR Protocol projects using MATLAB, improving the flooding of control messages and reducing routing overhead by offering the best research topics and ideas.