Vanet Simulation NS3 – Vehicular Ad Hoc Networks (VANETs) are emerging new technology to integrate the capabilities of new generation wireless networks to vehicles
Applications of VANET:
- Real-time detour routes computation
- Co-operative traffic monitoring
- Blind crossing
- Control of traffic flows
- Prevention of collisions
- Nearby information services
- Providing internet connectivity to vehicular nodes etc.
Characteristics of VANET:
- It has various communication environments
- Sufficient energy and storage
- Hardware delay constraint
- High dynamic topology
- Geographical type of communication
- Interaction with on-board sensors
- Mobility modeling and predication
- Frequently disconnected network etc.
Researches on VANET:
- Defining security mechanisms in VANET
- To improve road and vehicle safety
- Design adaptive and efficient channel estimation algorithm
- Broadcasting schemes in VANET
- Enhancing privacy in VANET Projects etc.
VANET architecture:
Sample code for vanet:
bool Controller::ControlVehicle(Ptr<Highway> highway, Ptr<Vehicle> vehicle, double dt) { if(Plot==true) { bool newStep=false; double now=Simulator::Now().GetHighPrecision().GetDouble(); if(now > T) { T = now; newStep=true; } if(newStep==true) { if(T!=0.0) { cout << "e" << endl; //cout << "pause " << dt << endl; } float xrange = highway->GetHighwayLength(); float yrange = highway->GetLaneWidth()*highway->GetNumberOfLanes(); if(highway->GetTwoDirectional()) yrange=2*yrange + highway->GetMedianGap(); cout << "set xrange [0:"<< xrange <<"]" << endl; cout << "set yrange [0:"<< yrange <<"]" << endl; cout << "plot '-' w points" << endl; newStep=false; } if(newStep==false) { cout << vehicle->GetPosition().x << " " << vehicle->GetPosition().y << endl; } } if(vehicle->GetVehicleId()==2 && vehicle->GetPosition().x >=400) { vehicle->SetAcceleration(-2.0); return true; } return false; } void Controller::BroadcastWarning(Ptr<Vehicle> veh) { stringstream msg; msg << veh->GetVehicleId() << " " << veh->GetPosition().x << " has blocked the road at x=" << veh->GetPosition().x << " direction=" << veh->GetDirection() << " lane=" << veh->GetLane(); Ptr<Packet> packet = Create<Packet>((uint8_t*) msg.str().c_str(), msg.str().length()); veh->SendTo(veh->GetBroadcastAddress(), packet); Simulator::Schedule(Seconds(5.0),&Controller::BroadcastWarning, this, veh);  }