How to Start Temporary Ordered Routing Projects Using MATLAB

To start Temporal Ordered Routing (TOR) in MATLAB which is a routing protocol that normally utilised within delay-tolerant networks (DTNs) or networks including intermittent connectivity. It addresses the timing of packet forwarding according to the temporal restrictions that defines according the time window packets are sent where they are sent and inherited instead of depending on the constant and real-time connection.

To execute the Temporal Ordered Routing (TOR) for replicating the network topology, routing protocol, and temporal constraints in which packets are sent using MATLAB. Below is a detailed process to start Temporal Ordered Routing (TOR) project in MATLAB:

Steps to Start Temporal Ordered Routing (TOR) Project in MATLAB

Step 1: Understand the Key Concepts of Temporal Ordered Routing

Following is Temporal Ordered Routing’s core concepts to know before executing it:

  1. Nodes and Time Windows: Every single node (or router) contains a time window in the course of which it is available for interaction.
  2. Packet Buffering: Packets are temporarily saved and sent depends on time limitations, when the destination turns out to be attainable.
  3. Routing Decisions Based on Temporal Order: Routers will be chosen when transmitting the packets depends on when they are obtainable for interaction with its neighbors such as periodic connections, mobility, or time-limited availability.

Key Features of TOR:

  • Buffering: Packets are stored in buffer waiting the correct time for sending.
  • Delivery Based on Temporal Windows: Packets are sent based on the particular duration or conditions.
  • Mobility of Nodes: In TOR differences, the nodes mobility like in vehicular networks or mobile ad-hoc networks impacts as packets are sent.

Step 2: Define the Network Topology

Initially, we create a network topology. Nodes are normally in movable and its connectivity modifies over time within TOR. We can be designed the nodes including arbitrary positions within a 2D or 3D space and we need to replicate its movement using MATLAB.

Below is how we can make a simple network topology:

% Define network parameters

numNodes = 10;  % Number of nodes

areaSize = 100;  % Size of the area (100×100 units)

nodePositions = rand(numNodes, 2) * areaSize;  % Random positions for nodes

% Visualize the network topology

figure;

scatter(nodePositions(:,1), nodePositions(:,2), ‘filled’);

title(‘Network Topology’);

xlabel(‘X Coordinate’);

ylabel(‘Y Coordinate’);

In this case:

  • numNodes is the volume of nodes within the network.
  • areaSize is the size of the area that is 100×100 units where the nodes are located.
  • nodePositions specifies random (x, y) coordinates for every node.

Step 3: Define the Temporal Availability of Nodes

Every single node is obtainable for interacting only during certain time windows in Temporal Ordered Routing. We need to replicate it by means of describing an arbitrary availability schedule for every node, and it will be found when the nodes can be sent or inherited packets.

% Define temporal availability for each node (random availability windows)

numWindows = 5;  % Number of availability windows per node

availability = zeros(numNodes, numWindows, 2);  % Store availability windows (start, end times)

for i = 1:numNodes

for j = 1:numWindows

% Random availability window (start and end times)

startTime = rand * 100;  % Random start time (0 to 100)

endTime = startTime + rand * 10;  % Random end time (10 units long)

availability(i, j, 🙂 = [startTime, endTime];

end

end

% Visualize the availability windows of each node

figure;

hold on;

for i = 1:numNodes

for j = 1:numWindows

plot([availability(i,j,1), availability(i,j,2)], [i, i], ‘r-‘, ‘LineWidth’, 2);

end

end

title(‘Node Temporal Availability Windows’);

xlabel(‘Time’);

ylabel(‘Node’);

In this case:

  • Every single node contains numerous availability windows, which is described by using arbitrary start and end times.
  • For every node, the availability matrix saves the availability windows. We contain several time windows like numWindows = 5, and every single time window includes a start time and an end time for every node.

Step 4: Simulate Packet Generation and Forwarding

Packets are created at particular times and sent according to the availability windows of the nodes in Temporal Ordered Routing. Every single packet contains creation time and it have to send once it converges the correct conditions (when the destination is attainable, and the nodes are obtainable).

Here’s how we can replicate the packet generation:

% Define parameters for packets

numPackets = 5;  % Number of packets to generate

packetCreationTimes = rand(1, numPackets) * 100;  % Random creation times

% Store packet information

packets = struct(‘id’, num2cell(1:numPackets), …

‘creationTime’, num2cell(packetCreationTimes), …

‘destination’, randi([1, numNodes], 1, numPackets));

% Display generated packets

disp(‘Generated Packets:’);

disp(packets);

In this instance:

  • numPackets is the volume of packets for creating.
  • Every single packet contains a random creation time (packetCreationTimes), and a destination node.

Step 5: Implement the Temporal Ordered Routing Algorithm

Here, we need to execute the TOR algorithm that transmits packets according to the temporal availability and the present network state (connectivity among the nodes). We can execute logic to confirm if the packet can be send depends on the availability windows.

% Implementing Temporal Ordered Routing (TOR)

function simulateTOR(nodePositions, availability, packets, numNodes)

% Iterate over all packets and simulate forwarding

for p = 1:length(packets)

packet = packets(p);

disp([‘Simulating packet ‘ num2str(packet.id)]);

currentNode = 1;  % Start from source node

destination = packet.destination;

creationTime = packet.creationTime;

% Forward packet based on availability windows

for t = creationTime:0.1:100  % Simulate time (from creation time to max time)

if currentNode == destination

disp([‘Packet ‘ num2str(packet.id) ‘ reached destination node ‘ num2str(destination)]);

break;

end

% Check if current node is available to forward the packet at time t

available = false;

for w = 1:size(availability, 2)

if t >= availability(currentNode, w, 1) && t <= availability(currentNode, w, 2)

available = true;

break;

end

end

if available

% Forward the packet to the closest node or next-hop

nextHop = findClosestNode(nodePositions, currentNode);

currentNode = nextHop;  % Update current node to next hop

disp([‘Packet ‘ num2str(packet.id) ‘ forwarded to node ‘ num2str(nextHop)]);

end

end

end

end

% Function to find the closest node to the current node

function nextHop = findClosestNode(nodePositions, currentNode)

distances = sqrt(sum((nodePositions – nodePositions(currentNode, :)).^2, 2));

[~, nextHop] = min(distances);  % Find the closest node

end

Explanation:

  • According to the temporal availability, simulateTOR function replicates the packets sending from source to destination nodes.
  • The time is replicated from the packet’s creation time waiting a maximum time (100 in this case).
  • Function confirms if it is obtainable at specific time (t) for each node. If the node is obtainable then the packet is sent to the next hop.
  • The packet is transmitted to the closest node (or next-hop) that is computed to utilise the findClosestNode function.

Step 6: Test the Simulation

Request the simulateTOR function including node positions, availability schedule, and generated packets for executing the simulation:

% Run Temporal Ordered Routing Simulation

simulateTOR(nodePositions, availability, packets, numNodes);

Step 7: Enhance and Extend the Project

When the Temporal Ordered Routing (TOR) basic execution is configured then we can be prolonged the project in numerous manners:

  1. Add Mobility: Replicate the node movement to utilise random or predefined mobility models for impacting the network topology over time.
  2. Multi-Path Routing: Permit packets to track several routes or backup routes lest of failures or delays.
  3. Real-Time Visualization: Envision the sending process of packet within real-time to show which node is transmitted a packet at any provided time.
  4. Evaluate Performance: Asses the performance parameters like packet delivery ratio, latency, and buffer occupancy in diverse network conditions.

In this manual, you can learn about the detailed process with coding snippets for simulating and analysing the Temporary Ordered Routing Projects in MATLAB environment. We will also be presented more specifies on this topic in another guide.