Dose Milicar support ad hoc routing protocols such as AODV or OLSR?
SplayXu opened this issue · 3 comments
I'm currently working on a project about ad hoc UAV network based on 5G, so I chose NS-3 and Milicar in order to achieve it. But when I tried to use routing portocols like OLSR and AODV, the building progress got terminated due to the fooling errors:
Error: assert failed. cond="m_bid2lcid.find(bearerId) != m_bid2lcid.end()", msg="BearerId to LCID mapping not found ", file=../src/millicar/model/mmwave-vehicular-net-device.cc, line=408
I saw someone raised this issue earlier and I cannot find a solution anywhere. I'm sure all the nodes are in the same group, I used helper->PairDevices(adhocDevs);
to put all the netdevices in the same group.
Would you be so kind to tell me what other setting I should do? Or which part of the milicar module should I modify to make it work?
Thank you so much for your time.
Here are the code of my script for your reference:
#include "ns3/mmwave-sidelink-spectrum-phy.h"
#include "ns3/mmwave-vehicular-net-device.h"
#include "ns3/mmwave-vehicular-helper.h"
#include "ns3/constant-position-mobility-model.h"
#include "ns3/mobility-module.h"
#include "ns3/config.h"
#include "ns3/isotropic-antenna-model.h"
#include "ns3/spectrum-helper.h"
#include "ns3/mmwave-spectrum-value-helper.h"
#include "ns3/applications-module.h"
#include "ns3/internet-module.h"
#include "ns3/core-module.h"
#include "ns3/netanim-module.h"
#include "ns3/olsr-helper.h"
NS_LOG_COMPONENT_DEFINE ("VehicularSimpleOne");
using namespace ns3;
using namespace millicar;
uint32_t g_rxPackets; // total number of received packets
uint32_t g_txPackets; // total number of transmitted packets
Time g_firstReceived; // timestamp of the first time a packet is received
Time g_lastReceived; // timestamp of the last received packet
static void Rx (Ptr<OutputStreamWrapper> stream, Ptr<const Packet> p)
{
g_rxPackets++;
SeqTsHeader header;
p->PeekHeader(header);
*stream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << p->GetSize() << "\t" << header.GetSeq() << "\t" << header.GetTs().GetSeconds() << std::endl;
if (g_rxPackets > 1)
{
g_lastReceived = Simulator::Now();
}
else
{
g_firstReceived = Simulator::Now();
}
}
int main (int argc, char *argv[])
{
// system parameters
double bandwidth = 1e8; // bandwidth in Hz
double frequency = 28e9; // the carrier frequency
uint32_t numerology = 3; // the numerology
// applications
uint32_t packetSize = 1024; // UDP packet size in bytes
uint32_t startTime = 30050; // application start time in milliseconds
uint32_t endTime = 32000; // application end time in milliseconds
uint32_t interPacketInterval = 3000; // interpacket interval in microseconds
// mobility
double intraGroupDistance = 10; // distance between two vehicles belonging to the same group
CommandLine cmd;
//
cmd.AddValue ("bandwidth", "used bandwidth", bandwidth);
cmd.AddValue ("iip", "inter packet interval, in microseconds", interPacketInterval);
cmd.AddValue ("intraGroupDistance", "distance between two vehicles belonging to the same group, y-coord", intraGroupDistance);
cmd.AddValue ("numerology", "set the numerology to use at the physical layer", numerology);
cmd.AddValue ("frequency", "set the carrier frequency", frequency);
cmd.Parse (argc, argv);
Config::SetDefault ("ns3::MmWaveSidelinkMac::UseAmc", BooleanValue (true));
Config::SetDefault ("ns3::MmWavePhyMacCommon::CenterFreq", DoubleValue (frequency));
Config::SetDefault ("ns3::MmWaveVehicularHelper::Bandwidth", DoubleValue (bandwidth));
Config::SetDefault ("ns3::MmWaveVehicularHelper::Numerology", UintegerValue (numerology));
Config::SetDefault ("ns3::MmWaveVehicularPropagationLossModel::ChannelCondition", StringValue ("a"));
Config::SetDefault ("ns3::MmWaveVehicularPropagationLossModel::Shadowing", BooleanValue (true));
Config::SetDefault ("ns3::MmWaveVehicularSpectrumPropagationLossModel::UpdatePeriod", TimeValue (MilliSeconds (1)));
Config::SetDefault ("ns3::MmWaveVehicularAntennaArrayModel::AntennaElements", UintegerValue (16));
Config::SetDefault ("ns3::MmWaveVehicularAntennaArrayModel::AntennaElementPattern", StringValue ("3GPP-V2V"));
Config::SetDefault ("ns3::MmWaveVehicularAntennaArrayModel::IsotropicAntennaElements", BooleanValue (true));
Config::SetDefault ("ns3::MmWaveVehicularAntennaArrayModel::NumSectors", UintegerValue (2));
Config::SetDefault ("ns3::MmWaveVehicularNetDevice::RlcType", StringValue("LteRlcUm"));
Config::SetDefault ("ns3::MmWaveVehicularHelper::SchedulingPatternOption", EnumValue(2)); // use 2 for SchedulingPatternOption=OPTIMIZED, 1 or SchedulingPatternOption=DEFAULT
Config::SetDefault ("ns3::LteRlcUm::MaxTxBufferSize", UintegerValue (500*1024));
// create the nodes
NodeContainer n;
n.Create (3);
// create the mobility models
MobilityHelper mobility;
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (n);
n.Get (0)->GetObject<MobilityModel> ()->SetPosition (Vector (0,0,0));
n.Get (1)->GetObject<MobilityModel> ()->SetPosition (Vector (0, intraGroupDistance, 0));
n.Get (2)->GetObject<MobilityModel> ()->SetPosition (Vector (intraGroupDistance, intraGroupDistance, 0));
// create and configure the helper
Ptr<MmWaveVehicularHelper> helper = CreateObject<MmWaveVehicularHelper> ();
helper->SetNumerology (3);
helper->SetPropagationLossModelType ("ns3::MmWaveVehicularPropagationLossModel");
helper->SetSpectrumPropagationLossModelType ("ns3::MmWaveVehicularSpectrumPropagationLossModel");
NetDeviceContainer adhocDevs = helper->InstallMmWaveVehicularNetDevices (n);
// Enable OLSR
NS_LOG_INFO("Enabling OLSR routing on all adHoc nodes");
OlsrHelper olsr;
Ipv4StaticRoutingHelper staticRouting;
Ipv4ListRoutingHelper list;
list.Add (staticRouting, 0);
list.Add (olsr, 10);
InternetStackHelper internet;
internet.SetRoutingHelper (list);
internet.Install (n);
Ipv4AddressHelper ipv4;
NS_LOG_INFO ("Assign IP Addresses.");
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer i = ipv4.Assign (adhocDevs);
// Need to pair the devices in order to create a correspondence between transmitter and receiver
// and to populate the < IP addr, RNTI > map.
helper->PairDevices(adhocDevs);
std::cout << "IPv4 Address node 0: " << n.Get (0)->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal () << std::endl;
std::cout << "IPv4 Address node 1: " << n.Get (1)->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal () << std::endl;
std::cout << "IPv4 Address node 2: " << n.Get (2)->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal () << std::endl;
Ptr<mmwave::MmWaveAmc> m_amc = CreateObject <mmwave::MmWaveAmc> (helper->GetConfigurationParameters());
// setup the applications
Config::SetDefault ("ns3::UdpClient::MaxPackets", UintegerValue (0xFFFFFFFF));
Config::SetDefault ("ns3::UdpClient::Interval", TimeValue (MicroSeconds (interPacketInterval)));
Config::SetDefault ("ns3::UdpClient::PacketSize", UintegerValue (packetSize));
// create the applications
uint32_t port = 4000;
UdpEchoServerHelper server (port);
ApplicationContainer echoApps = server.Install (n.Get (1));
echoApps.Start (Seconds (0.0));
UdpClientHelper client (n.Get (1)->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal (), port);
ApplicationContainer apps = client.Install (n.Get (0));
UdpClientHelper client1 (n.Get (1)->GetObject<Ipv4> ()->GetAddress (1, 0).GetLocal (), port);
ApplicationContainer apps1 = client1.Install (n.Get (2));
// set the application start/end time
apps.Start (MilliSeconds (startTime));
apps.Stop (MilliSeconds (endTime));
apps1.Start (MilliSeconds (startTime));
apps1.Stop (MilliSeconds (endTime));
AsciiTraceHelper asciiTraceHelper;
Ptr<OutputStreamWrapper> stream = asciiTraceHelper.CreateFileStream ("simple-one-stats.txt");
echoApps.Get(0)->TraceConnectWithoutContext ("Rx", MakeBoundCallback (&Rx, stream));
AnimationInterface anim ("milicar-animation.xml"); // Mandatory
for (uint32_t i = 0; i < n.GetN (); ++i)
{
anim.UpdateNodeDescription (n.Get (i), "car"); // Optional
anim.UpdateNodeColor (n.Get (i), 255, 0, 0); // Optional
}
anim.EnablePacketMetadata ();
Simulator::Stop (MilliSeconds (endTime + 1000));
Simulator::Run ();
Simulator::Destroy ();
std::cout << "----------- Statistics -----------" << std::endl;
std::cout << "Packets size:\t\t" << packetSize << " Bytes" << std::endl;
std::cout << "Packets received:\t" << g_rxPackets << std::endl;
std::cout << "Average Throughput:\t" << (double(g_rxPackets)*(double(packetSize)*8)/double( g_lastReceived.GetSeconds() - g_firstReceived.GetSeconds()))/1e6 << " Mbps" << std::endl;
return 0;
}
Hi , I am facing the exact problem now, please let me know if you have any new update on this issue, thanks in advance.