How to Start TORA Projects Using MATLAB

To start Temporally-Ordered Routing Algorithm (TORA) which is a reactive routing protocol created for extremely active mobile ad hoc networks (MANETs). It makes routes only if required and it supports distributed, loop-free, and highly adaptive routing. Following is a detailed guide to get started:

Steps to Start TORA Project in MATLAB

  1. Understand TORA
  • Key Features:
    • It has multi-path routing.
    • Utilises a directed acyclic graph (DAG) rooted at destination.
    • It reduces routing overhead using localizing updates.
  • Phases:
  1. Route Creation: Launch paths to utilise height metric.
  2. Route Maintenance: Modify paths within reply to topology modifications.
  3. Route Erasure: Eliminate the invalid routes.
  4. Set Project Objectives
  • Replicate the route creation, maintenance, and erasure phases of TORA.
  • Manage dynamic topology modifications such as link failures.
  • Measure routing parameters like delay, packet delivery ratio, and routing overhead.
  1. Define Network Topology

Make use of an adjacency matrix or a graph object for denoting the network.

Example: Adjacency Matrix

% Define adjacency matrix for a 5-node network

adjMatrix = [

0 1 0 1 0;

1 0 1 0 0;

0 1 0 1 1;

1 0 1 0 1;

0 0 1 1 0

];

% Visualize the network

G = graph(adjMatrix);

plot(G, ‘EdgeLabel’, G.Edges.Weight);

title(‘Network Topology for TORA’);

  1. Implement the TORA Algorithm

Step 1: Specify the height metric for nodes.

  • The height is a tuple (τ,oid,r,δ,id)(τ, oid, r, δ, id)(τ,oid,r,δ,id) utilised for breaking connections and find the route direction.

MATLAB Implementation:

function heights = initializeTORA(numNodes, destNode)

% Initialize heights for all nodes

heights = inf(numNodes, 5); % [τ, oid, r, δ, id]

heights(destNode, 🙂 = [0, 0, 0, 0, destNode]; % Destination node height is 0

end

  1. Route Creation Phase

We will need to make a directed acyclic graph (DAG) rooted at the destination.

MATLAB Implementation:

function dag = createRoute(adjMatrix, heights, destNode)

numNodes = size(adjMatrix, 1);

dag = zeros(numNodes); % Directed graph representation

for i = 1:numNodes

for j = 1:numNodes

if adjMatrix(i, j) > 0

% Direction based on height comparison

if heights(i, 1) > heights(j, 1)

dag(i, j) = 1; % i -> j

end

end

end

end

end

  1. Route Maintenance Phase

Manage the link failures by means of modifying the structure of DAG.

MATLAB Implementation:

function heights = updateRoute(adjMatrix, heights, failedLink)

% Adjust heights after a link failure

[nodeA, nodeB] = deal(failedLink(1), failedLink(2));

% Mark link as failed

adjMatrix(nodeA, nodeB) = 0;

adjMatrix(nodeB, nodeA) = 0;

% Recompute heights

numNodes = size(adjMatrix, 1);

for i = 1:numNodes

neighbors = find(adjMatrix(i, 🙂 > 0);

if isempty(neighbors)

heights(i, 1) = inf; % Mark as unreachable

else

heights(i, 1) = min(heights(neighbors, 1)) + 1; % Update height

end

end

end

  1. Route Erasure Phase

It helps to eliminate the invalid routes by way of overflowing route erasure messages.

MATLAB Implementation:

function adjMatrix = eraseRoute(adjMatrix, invalidNode)

% Flood erasure messages from the invalid node

adjMatrix(invalidNode, 🙂 = 0;

adjMatrix(:, invalidNode) = 0;

end

  1. Simulate TORA Routing

Integrate the phases for replicating the behaviour of TORA.

Example:

% Initialize the network and TORA

numNodes = 5;

destNode = 5;

heights = initializeTORA(numNodes, destNode);

% Create routes

dag = createRoute(adjMatrix, heights, destNode);

fprintf(‘Initial DAG:\n’);

disp(dag);

% Simulate link failure

failedLink = [3, 5];

heights = updateRoute(adjMatrix, heights, failedLink);

fprintf(‘Updated Heights After Link Failure:\n’);

disp(heights);

% Erase invalid routes

invalidNode = 3;

adjMatrix = eraseRoute(adjMatrix, invalidNode);

fprintf(‘Adjacency Matrix After Route Erasure:\n’);

disp(adjMatrix);

  1. Visualize Routing

Envision the DAG and actively update it to utilise plotting tools of MATLAB for visualization.

Example:

% Visualize the DAG

figure;

plot(graph(dag), ‘EdgeLabel’, dag(dag > 0));

title(‘TORA Directed Acyclic Graph’);

  1. Evaluate Performance

Examine the crucial performance parameters such as:

  • Route Optimality: After link failures, we confirm paths stay valid.
  • Overhead: Estimate the volume of control messages.
  • Convergence Time: Measure the duration of convergent for route updates.
  1. Extend the Project
  • Dynamic Traffic Simulation: Mimic packet flows including source-destination pairs to alter.
  • Fault Tolerance: Assess resilience of TORA to numerous link or node failures.
  • Comparison: We want to equate the TORA including AODV or DSR such as overhead and delay.

Complete MATLAB Code Example

Below is a comprehensive example for TORA:

% Define adjacency matrix

adjMatrix = [

0 1 0 1 0;

1 0 1 0 0;

0 1 0 1 1;

1 0 1 0 1;

0 0 1 1 0

];

% Initialize TORA

numNodes = 5;

destNode = 5;

heights = initializeTORA(numNodes, destNode);

% Create routes

dag = createRoute(adjMatrix, heights, destNode);

disp(‘Initial DAG:’);

disp(dag);

% Simulate a link failure

failedLink = [3, 5];

heights = updateRoute(adjMatrix, heights, failedLink);

disp(‘Updated Heights After Link Failure:’);

disp(heights);

% Erase routes

invalidNode = 3;

adjMatrix = eraseRoute(adjMatrix, invalidNode);

disp(‘Adjacency Matrix After Route Erasure:’);

disp(adjMatrix);

% Visualize the DAG

plot(graph(dag), ‘EdgeLabel’, dag(dag > 0));

title(‘TORA Directed Acyclic Graph’);

Conclusion

This project has solid basics to replicate and examine the Temporally-Ordered Routing Algorithm (TORA) using MATLAB environment. If you want any more guidance to discover extensions such as packet delivery simulation or integration including dynamic traffic models, we will provide it to you.