To develop the Temporally Ordered Routing Algorithm (TORA) Projects includes the NS3. The Temporally Ordered Routing Algorithm (TORA) is an adaptive, distributed routing protocol pattern for highly changed the mobile ad-hoc networks (MANETs). It is term on link reversal model and assures the loop-free on multi-path routing.
Steps to Develop Temporary Ordered Routing Projects Using NS3
- Install NS3
We have enabled the tool NS3 is installed before proceeding:
sudo apt update
sudo apt install git g++ python3 cmake make
git clone
cd ns-3-dev
./ns3 configure –enable-examples –enable-tests
./ns3 build
- Define Network Topology for TORA
We employ the TORA; we generate the mobile ad-hoc network (MANET) and support the TORA routing.
Example: Implementing TORA in NS3
#include “ns3/core-module.h”
#include “ns3/network-module.h”
#include “ns3/internet-module.h”
#include “ns3/mobility-module.h”
#include “ns3/yans-wifi-helper.h”
#include “ns3/tora-helper.h”
#include “ns3/applications-module.h”
using namespace ns3;
NS_LOG_COMPONENT_DEFINE(“TORARoutingExample”);
int main(int argc, char *argv[])
{
uint32_t numNodes = 10;
double simulationTime = 10.0;
CommandLine cmd;
cmd.AddValue(“numNodes”, “Number of nodes in the network”, numNodes);
cmd.Parse(argc, argv);
NodeContainer nodes;
nodes.Create(numNodes);
// Set up mobility model (Random Waypoint)
MobilityHelper mobility;
mobility.SetPositionAllocator(“ns3::RandomRectanglePositionAllocator”,
“X”, StringValue(“ns3::UniformRandomVariable[Min=0.0|Max=100.0]”),
“Y”, StringValue(“ns3::UniformRandomVariable[Min=0.0|Max=100.0]”));
mobility.SetMobilityModel(“ns3::RandomWaypointMobilityModel”,
“Speed”, StringValue(“ns3::UniformRandomVariable[Min=5.0|Max=10.0]”),
“Pause”, StringValue(“ns3::ConstantRandomVariable[Constant=2.0]”));
mobility.Install(nodes);
// Set up WiFi communication
WifiHelper wifi;
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default();
wifiPhy.SetChannel(wifiChannel.Create());
WifiMacHelper wifiMac;
wifiMac.SetType(“ns3::AdhocWifiMac”);
NetDeviceContainer devices = wifi.Install(wifiPhy, wifiMac, nodes);
// Install Internet stack and enable TORA routing
InternetStackHelper internet;
ToraHelper tora;
internet.SetRoutingHelper(tora);
internet.Install(nodes);
// Assign IP Addresses
Ipv4AddressHelper address;
address.SetBase(“10.1.1.0”, “255.255.255.0”);
address.Assign(devices);
// Set up UDP traffic
uint16_t port = 8080;
UdpServerHelper server(port);
ApplicationContainer serverApp = server.Install(nodes.Get(numNodes – 1)); // Last node as destination
serverApp.Start(Seconds(1.0));
serverApp.Stop(Seconds(simulationTime));
UdpClientHelper client(Ipv4Address(“10.1.1.10”), port);
client.SetAttribute(“MaxPackets”, UintegerValue(1000));
client.SetAttribute(“Interval”, TimeValue(Seconds(0.1)));
client.SetAttribute(“PacketSize”, UintegerValue(1024));
ApplicationContainer clientApp = client.Install(nodes.Get(0)); // First node as source
clientApp.Start(Seconds(2.0));
clientApp.Stop(Seconds(simulationTime));
Simulator::Stop(Seconds(simulationTime));
Simulator::Run();
Simulator::Destroy();
return 0;
}
- Explanation of the Code
- Network Setting the TORA
- 10 mobile nodes by Random Waypoint Mobility Model.
- WiFi Ad-Hoc network to allow the wireless communication.
- TORA Routing
- Exploits the connection reversal method for adaptive routing.
- For encourage the multi-path routing in highly dynamic surroundings.
- Traffic Generation
- UDP congestion is forwarding from Node 0 to Node 9.
- Run the Simulation
Compile and implement the process for TORA:
./ns3 run tora-routing
- Performance Analysis
We study the performance of parameter metrices such as Throughput, Packet Delivery Ratio (PDR), and Delay, use FlowMonitor.
Enable FlowMonitor for Traffic Analysis
#include “ns3/flow-monitor-module.h”
FlowMonitorHelper flowmon;
Ptr<FlowMonitor> monitor = flowmon.InstallAll();
Simulator::Stop(Seconds(10.0));
Simulator::Run();
monitor->SerializeToXmlFile(“tora_results.xml”, true, true);
Simulator::Destroy();
- Extend with VANET Simulation
Aimed at VANET applications modify the mobility model to use the SUMO or NS3’s Vehicle Mobility Model.
Example: Implementing TORA in VANET
mobility.SetMobilityModel(“ns3::SteadyStateRandomWaypointMobilityModel”,
“MinSpeed”, DoubleValue(5.0),
“MaxSpeed”, DoubleValue(30.0),
“Bounds”, RectangleValue(Rectangle(-500, 500, -500, 500)));
mobility.Install(nodes);
- Advantages of TORA Routing
✅ Highly Adaptive: Appropriate for modify the network topologies such as MANETs and VANETs.
✅ Loop-Free Routing: Utilized the DAG (Directed Acyclic Graph) method.
✅ Multi-Path Routing: Increases for fault tolerance and load balancing.
In the end, we had explored the basic implementation process on how to execute the Temporally-Ordered Routing Algorithm that was mostly used in MANET environment. If you need additional information regarding the TORA we will provide the additional document.