34 #include "ns3/animation-interface.h"
35 #include "ns3/channel.h"
36 #include "ns3/config.h"
38 #include "ns3/mobility-model.h"
39 #include "ns3/packet.h"
40 #include "ns3/simulator.h"
41 #include "ns3/wifi-mac-header.h"
42 #include "ns3/wimax-mac-header.h"
43 #include "ns3/wifi-net-device.h"
44 #include "ns3/wifi-mac.h"
45 #include "ns3/constant-position-mobility-model.h"
46 #include "ns3/lte-ue-phy.h"
47 #include "ns3/lte-enb-phy.h"
48 #include "ns3/uan-net-device.h"
49 #include "ns3/uan-mac.h"
51 #include "ns3/ipv4-routing-protocol.h"
52 #include "ns3/energy-source-container.h"
68 m_mobilityPollInterval (
Seconds (0.25)),
69 m_outputFileName (fn),
73 m_enablePacketMetadata (false),
75 m_stopTime (
Seconds (3600 * 1000)),
77 m_originalFileName (fn),
78 m_routingStopTime (
Seconds (0)),
79 m_routingFileName (
""),
80 m_routingPollInterval (
Seconds (5)),
293 loc = CreateObject<ConstantPositionMobilityModel> ();
296 Vector hubVec (x, y, z);
297 loc->SetPosition (hubVec);
298 NS_LOG_INFO (
"Node:" << n->
GetId () <<
" Position set to:(" << x <<
"," << y <<
"," << z <<
")");
305 NS_LOG_INFO (
"Setting node image for Node Id:" << nodeId);
308 NS_FATAL_ERROR (
"Resource Id:" << resourceId <<
" not found. Did you use AddResource?");
318 NS_FATAL_ERROR (
"NodeCounter Id:" << nodeCounterId <<
" not found. Did you use AddNodeCounter?");
326 if ((opacity < 0) || (opacity > 1))
351 NS_LOG_INFO (
"Setting node color for Node Id:" << nodeId);
359 std::string linkDescription)
366 std::string linkDescription)
393 const EnergyFractionMap::const_iterator fractionIter =
m_nodeEnergyFraction.find (node->GetId ());
395 return fractionIter->second;
412 v = mobility->GetPosition ();
422 if ((ceil (oldLocation.x) == ceil (newLocation.x)) &&
423 (ceil (oldLocation.y) == ceil (newLocation.y)))
439 for (uint32_t i = 0; i < MovedNodes.size (); i++)
456 std::vector <Ptr <Node> >
459 std::vector < Ptr <Node> > movedNodes;
481 movedNodes.push_back (n);
496 return WriteN (st.c_str (), st.length (), f);
505 uint32_t nLeft = count;
506 const char* p =
data;
507 uint32_t written = 0;
510 int n = std::fwrite (p, 1, nLeft, f);
525 NS_LOG_INFO (
"Writing Route Path From :" << nodeId <<
" To: " << destination.c_str ());
545 const std::vector<std::string>
548 std::vector <std::string> elements;
550 while (pos1 != context.npos)
552 pos1 = context.find (
"/",pos1);
553 pos2 = context.find (
"/",pos1+1);
554 elements.push_back (context.substr (pos1+1,pos2-(pos1+1)));
584 return n->
GetDevice (atoi (elements.at (3).c_str ()));
628 const uint32_t nodeId = node->GetId ();
630 NS_LOG_INFO (
"Remaining energy on one of sources on node " << nodeId <<
": " << currentEnergy);
636 const double energyFraction = currentEnergy / energySource->GetInitialEnergy ();
638 NS_LOG_INFO (
"Total energy fraction on node " << nodeId <<
": " << energyFraction);
750 double lbTx = (now + txTime).GetSeconds ();
751 double fbRx = (now + rxTime - txTime).GetSeconds ();
752 double lbRx = (now + rxTime).GetSeconds ();
755 tx->GetNode ()->GetId (),
758 rx->GetNode ()->GetId (),
792 NS_LOG_INFO (
"UanPhyGenRxTrace for packet:" << animUid);
795 NS_LOG_WARN (
"UanPhyGenRxBeginTrace: unknown Uid");
821 Mac48Address nodeAddr = netDevice->GetMac ()->GetAddress ();
822 std::ostringstream oss;
841 NS_LOG_INFO (
"Wifi RxBeginTrace for packet:" << animUid);
846 std::ostringstream oss;
856 NS_LOG_WARN (
"Transmitter Mac address " << oss.str () <<
" never seen before. Skipping");
863 NS_LOG_WARN (
"WifiPhyRxBegin: unknown Uid, but we are adding a wifi packet");
900 NS_LOG_INFO (
"WimaxRxTrace for packet:" << animUid);
959 context =
"/" + context;
965 std::list <Ptr <Packet> > pbList = pb->GetPackets ();
991 context =
"/" + context;
997 std::list <Ptr <Packet> > pbList = pb->GetPackets ();
1007 NS_LOG_WARN (
"LteSpectrumPhyRxTrace: unknown Uid");
1045 NS_LOG_INFO (
"CsmaPhyTxEndTrace for packet:" << animUid);
1053 NS_LOG_WARN (
"Unknown Uid, but adding Csma Packet anyway");
1079 NS_LOG_INFO (
"CsmaPhyRxEndTrace for packet:" << animUid);
1080 NS_LOG_INFO (
"CsmaPhyRxEndTrace for packet:" << animUid <<
" complete");
1103 NS_LOG_INFO (
"MacRxTrace for packet:" << animUid <<
" complete");
1111 uint32_t nodeId = 0;
1113 nodeId = pktInfo.
m_txnd->GetNode ()->GetId ();
1124 uint32_t rxId = pktInfo.
m_rxnd->GetNode ()->GetId ();
1133 uint32_t nodeId = pktInfo.
m_txnd->GetNode ()->GetId ();
1134 uint32_t rxId = pktInfo.
m_rxnd->GetNode ()->GetId ();
1151 pendingPackets->insert (AnimUidPacketInfoMap::value_type (animUid, pktInfo));
1159 return (pendingPackets->find (animUid) != pendingPackets->end ());
1167 if (pendingPackets->empty ())
1169 std::vector <uint64_t> purgeList;
1170 for (AnimUidPacketInfoMap::iterator i = pendingPackets->begin ();
1171 i != pendingPackets->end ();
1179 purgeList.push_back (i->first);
1182 for (std::vector <uint64_t>::iterator i = purgeList.begin ();
1183 i != purgeList.end ();
1186 pendingPackets->erase (*i);
1194 switch (protocolType)
1222 return pendingPackets;
1231 std::string typeString =
"unknown";
1232 switch (counterType)
1236 typeString =
"UINT32";
1241 typeString =
"DOUBLE";
1253 std::ostringstream oss;
1323 std::ostringstream oss;
1325 oss <<
"NodeList/" << n->
GetId () <<
"/DeviceList/" << devIndex <<
"/";
1347 std::ostringstream oss;
1349 oss <<
"NodeList/" << n->
GetId () <<
"/DeviceList/" << devIndex <<
"/";
1371 for (uint32_t devIndex = 0; devIndex < nDevices; ++devIndex)
1383 if (lteEnbNetDevice)
1396 Config::Connect (
"NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxBegin",
1398 Config::Connect (
"NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxBegin",
1410 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyTxBegin",
1412 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyTxEnd",
1414 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyRxEnd",
1416 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/MacRx",
1418 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyTxBegin",
1420 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyRxBegin",
1422 Config::Connect (
"/NodeList/*/$ns3::BasicEnergySource/RemainingEnergy",
1436 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Enqueue",
1438 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/TxQueue/Enqueue",
1440 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Enqueue",
1445 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Dequeue",
1447 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/TxQueue/Dequeue",
1449 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Dequeue",
1454 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::AlohaNoackNetDevice/Queue/Drop",
1456 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/TxQueue/Drop",
1458 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::PointToPointNetDevice/TxQueue/Drop",
1463 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTx",
1465 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacTxDrop",
1467 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRx",
1469 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MacRxDrop",
1473 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxDrop",
1475 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxDrop",
1489 NS_LOG_UNCOND (
"AnimationInterface WARNING:Node:" << n->
GetId () <<
" Does not have a mobility model. Use SetConstantPosition if it is stationary");
1516 Address nodeAddr = nd->GetAddress ();
1517 std::ostringstream oss;
1519 return oss.str ().substr (6);
1528 NS_LOG_WARN (
"Node: " << nd->GetNode ()->GetId () <<
" No ipv4 object found");
1531 int32_t ifIndex = ipv4->GetInterfaceForDevice (nd);
1534 NS_LOG_WARN (
"Node :" << nd->GetNode ()->GetId () <<
" Could not find index of NetDevice");
1538 std::ostringstream oss;
1550 uint32_t n1Id = n->
GetId ();
1552 for (uint32_t i = 0; i < nDev; ++i)
1561 if ((dev->GetInstanceTypeId ().GetName () ==
"ns3::LteUeNetDevice") ||
1562 (dev->GetInstanceTypeId ().GetName () ==
"ns3::LteEnbNetDevice")||
1563 (dev->GetInstanceTypeId ().GetName () ==
"ns3::VirtualNetDevice"))
1570 std::string channelType = ch->GetInstanceTypeId ().GetName ();
1572 if (channelType == std::string (
"ns3::PointToPointChannel"))
1575 uint32_t nChDev = ch->GetNDevices ();
1576 for (uint32_t j = 0; j < nChDev; ++j)
1579 uint32_t n2Id = chDev->GetNode ()->GetId ();
1673 if (!routing &&
m_f)
1683 NS_LOG_INFO (
"Creating new trace file:" << fn.c_str ());
1685 f = std::fopen (fn.c_str (),
"w");
1753 NS_LOG_WARN (
"Routing protocol object not found");
1767 rpElements.push_back (elem);
1771 std::ostringstream oss;
1777 rpElements.push_back (elem);
1781 rpElements.push_back (elem2);
1787 rpElements.push_back (elem);
1792 rpElements.push_back (elem);
1859 NS_LOG_INFO (
"TrackIpv4L3ProtocolCounters Completed");
1911 std::stringstream stream;
1914 return stream.str ();
1921 NS_LOG_INFO (
"RecursiveIpv4RoutePathSearch from:" << from.c_str () <<
" to:" << to.c_str ());
1922 if ((from ==
"0.0.0.0") || (from ==
"127.0.0.1"))
1924 NS_LOG_INFO (
"Got " << from.c_str () <<
" End recursion");
1932 rpElements.push_back (elem);
1954 NS_LOG_WARN (
"Routing protocol object not found");
1967 std::ostringstream oss;
1973 rpElements.push_back (elem);
1977 rpElements.push_back (elem2);
1983 rpElements.push_back (elem);
1992 m_tagName (tagName),
1993 m_emptyElement (emptyElement)
1998 template <
typename T>
2002 std::ostringstream oss;
2003 oss << std::setprecision (10);
2005 m_elementString += attribute.c_str ();
2008 m_elementString +=
"=\"";
2009 std::string valueStr = oss.str ();
2010 for (std::string::iterator it = valueStr.begin (); it != valueStr.end (); ++it)
2015 m_elementString +=
"&";
2018 m_elementString +=
""";
2021 m_elementString +=
"'";
2024 m_elementString +=
"<";
2027 m_elementString +=
">";
2030 m_elementString += *it;
2034 m_elementString +=
"\" ";
2038 m_elementString +=
"=\"" + oss.str () +
"\" ";
2045 m_elementString +=
">\n";
2053 m_elementString +=
"/>\n";
2057 m_elementString +=
"</" + m_tagName +
">\n";
2064 m_elementString +=
">";
2070 m_elementString +=
"\n";
2082 return m_elementString;
2108 std::string closeString =
"</" + name +
">\n";
2179 element.
AddAttribute (
"info", routingInfo.c_str (),
true);
2187 std::string tagName =
"rp";
2195 for (Ipv4RoutePathElements::const_iterator i = rpElements.begin ();
2196 i != rpElements.end ();
2204 element.
Add (rpeElement);
2218 if (!metaInfo.empty ())
2220 element.
AddAttribute (
"meta-info", metaInfo.c_str (),
true);
2240 uint32_t tId,
double fbRx,
double lbRx, std::string metaInfo)
2246 if (!metaInfo.empty ())
2248 element.
AddAttribute (
"meta-info", metaInfo.c_str (),
true);
2388 .SetGroupName (
"NetAnim")
2397 return GetTypeId ();
2403 return sizeof (uint64_t);
2421 os <<
"AnimUid=" << m_AnimUid;
2427 m_AnimUid = AnimUid;
2459 m_fbTx (fbTx.GetSeconds ()),
uint64_t GetAnimUidFromPacket(Ptr< const Packet >)
void Set(uint64_t AnimUid)
Set global Uid in tag.
uint64_t GetTracePktCount()
Get trace file packet count (This used only for testing)
void AddToIpv4AddressNodeIdTable(std::string, uint32_t)
void UpdateNodeImage(uint32_t nodeId, uint32_t resourceId)
Helper function to update the image of a node.
void WriteXmlRp(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
void AddPendingPacket(ProtocolType protocolType, uint64_t animUid, AnimPacketInfo pktInfo)
void CsmaMacRxTrace(std::string context, Ptr< const Packet > p)
void WriteXmlNonP2pLinkProperties(uint32_t id, std::string ipv4Address, std::string channelType)
Simulation virtual time values and global simulation resolution.
CounterType
Counter Types.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
SocketErrno
Enumeration of the possible errors returned by a socket.
NodeCounterMap64 m_nodeQueueDequeue
void WifiMacRxTrace(std::string context, Ptr< const Packet >)
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Ipv4Address GetLocal(void) const
Get the local address.
std::string GetIpv4Address(Ptr< NetDevice > nd)
std::string CounterTypeToString(CounterType counterType)
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void WriteU64(uint64_t v)
AnimationInterface(const std::string filename)
Constructor.
static Ptr< Node > GetNode(uint32_t n)
AnimationInterface & AddSourceDestination(uint32_t fromNodeId, std::string destinationIpv4Address)
Helper function to print the routing path from a source node to destination IP.
void WriteXmlUpdateNodeImage(uint32_t nodeId, uint32_t resourceId)
static TypeId GetTypeId(void)
Get Type Id.
void TrackIpv4L3ProtocolCounters()
Introspection did not find any typical Config paths.
void CsmaPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Ptr< LteEnbPhy > GetPhy(void) const
Mobility model for which the current position does not change once it has been set and until it is se...
AnimUidPacketInfoMap m_pendingWifiPackets
void WriteXmlUpdateNodePosition(uint32_t nodeId, double x, double y)
NodeDescriptionsMap m_nodeDescriptions
static bool IsInitialized(void)
Check if AnimationInterface is initialized.
uint32_t m_ipv4L3ProtocolTxCounterId
void PurgePendingPackets(ProtocolType protocolType)
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
uint32_t m_queueEnqueueCounterId
uint64_t m_maxPktsPerFile
void QueueDropTrace(std::string context, Ptr< const Packet >)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
std::map< std::string, uint32_t > m_macToNodeIdMap
Time m_ipv4L3ProtocolCountersPollInterval
void LteSpectrumPhyRxStart(std::string context, Ptr< const PacketBurst > pb)
void TrackQueueCounters()
void TrackWifiPhyCounters()
Ptr< NetDevice > GetNetDeviceFromContext(std::string context)
Vector GetPosition(void) const
void WifiPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
void EnableWifiPhyCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Wifi Phy Counters such as TxDrop, RxDrop.
void TrackIpv4RoutePaths()
NodeContainer m_routingNc
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
Time m_ipv4L3ProtocolCountersStopTime
void WriteXmlAnim(bool routing=false)
uint64_t m_currentPktCount
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
NodeCounterMap64 m_nodeWifiPhyTxDrop
void LteTxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &)
void WimaxRxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &)
std::map< std::string, uint32_t > m_ipv4ToNodeIdMap
void RecursiveIpv4RoutePathSearch(std::string fromIpv4, std::string toIpv4, Ipv4RoutePathElements &)
void UpdateNodeSize(uint32_t nodeId, double width, double height)
Helper function to update the size of a node.
virtual void Deserialize(TagBuffer i)
Deserialize function.
void WriteXmlAddNodeCounter(uint32_t counterId, std::string counterName, CounterType counterType)
void ProcessRxBegin(Ptr< const NetDevice > nd, const double fbRx)
void ConnectLteEnb(Ptr< Node > n, Ptr< LteEnbNetDevice > nd, uint32_t devIndex)
std::string GetIpv4RoutingTable(Ptr< Node > n)
void WriteXmlUpdateNodeSize(uint32_t nodeId, double width, double height)
void Print(std::ostream &os) const
Print the packet contents.
void WriteXmlUpdateNodeColor(uint32_t nodeId, uint8_t r, uint8_t g, uint8_t b)
void SetStartTime(Time t)
Specify the time at which capture should start.
void SetStopTime(Time t)
Specify the time at which capture should stop.
virtual Ptr< Ipv4RoutingProtocol > GetRoutingProtocol(void) const =0
Get the routing protocol to be used by this Ipv4 stack.
std::vector< Ptr< Node > > GetMovedNodes()
LinkPropertiesMap m_linkProperties
uint32_t GetSystemId(void) const
Time m_queueCountersPollInterval
void WifiPhyRxBeginTrace(std::string context, Ptr< const Packet > p)
void Ipv4TxTrace(std::string context, Ptr< const Packet >, Ptr< Ipv4 >, uint32_t)
void UpdateNodeColor(Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
Helper function to update the node color.
void WriteXmlAddResource(uint32_t resourceId, std::string resourcePath)
void ResetAnimWriteCallback()
Reset the write callback function.
NodeCounterMap64 m_nodeWifiMacTx
AnimWriteCallback m_writeCallback
a polymophic address class
void UanPhyGenTxTrace(std::string context, Ptr< const Packet >)
static void SetConstantPosition(Ptr< Node > n, double x, double y, double z=0)
Helper function to set Constant Position for a given node.
void WriteXmlUpdateLink(uint32_t fromId, uint32_t toId, std::string)
void CheckMaxPktsPerTraceFile()
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
DropReason
Reason why a packet has been dropped.
void ConnectLteUe(Ptr< Node > n, Ptr< LteUeNetDevice > nd, uint32_t devIndex)
std::map< uint32_t, Vector > m_nodeLocation
virtual void Print(std::ostream &os) const
Print tag info.
Keep track of the current position and velocity of an object.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void SetBackgroundImage(std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)
Helper function to set the background image.
uint32_t m_ipv4L3ProtocolRxCounterId
void Add(AnimXmlElement e)
void CsmaPhyRxEndTrace(std::string context, Ptr< const Packet > p)
Identifies a byte tag and a set of bytes within a packet to which the tag applies.
void RemainingEnergyTrace(std::string context, double previousEnergy, double currentEnergy)
uint32_t m_wifiPhyTxDropCounterId
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
void WifiMacRxDropTrace(std::string context, Ptr< const Packet >)
void WriteXmlClose(std::string name, bool routing=false)
void OutputWirelessPacketTxInfo(Ptr< const Packet > p, AnimPacketInfo &pktInfo, uint64_t animUid)
void EnableWifiMacCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Wifi Mac Counters such as Tx, TxDrop, Rx, RxDrop.
static void EnablePrinting(void)
Enable printing packets metadata.
void UpdateNodeCounter(uint32_t nodeCounterId, uint32_t nodeId, double counter)
Helper function to update a node's counter referenced by the nodeCounterId.
uint32_t m_queueDropCounterId
uint32_t AddNodeCounter(std::string counterName, CounterType counterType)
Setup a node counter.
std::string GetElementString()
~AnimationInterface()
Destructor for the animator interface.
AnimUidPacketInfoMap m_pendingWimaxPackets
EnergyFractionMap m_nodeEnergyFraction
void SkipPacketTracing()
Do not trace packets.
static Iterator End(void)
std::string GetNetAnimVersion()
double GetNodeEnergyFraction(Ptr< const Node > node) const
Get node's energy fraction (This used only for testing)
Ptr< Node > GetNodeFromContext(const std::string &context) const
std::string m_outputFileName
void DequeueTrace(std::string context, Ptr< const Packet >)
NodeCounterMap64 m_nodeIpv4Drop
void UanPhyGenRxTrace(std::string context, Ptr< const Packet >)
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
ByteTagIterator GetByteTagIterator(void) const
Retiurns an iterator over the set of byte tags included in this packet.
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
void WriteXmlP(std::string pktType, uint32_t fId, double fbTx, double lbTx, uint32_t tId, double fbRx, double lbRx, std::string metaInfo="")
void WifiMacTxTrace(std::string context, Ptr< const Packet >)
void StartAnimation(bool restart=false)
void WriteXmlNode(uint32_t id, uint32_t sysId, double locX, double locY)
std::vector< Ipv4RoutePathElement > Ipv4RoutePathElements
AnimationInterface & EnableIpv4RouteTracking(std::string fileName, Time startTime, Time stopTime, Time pollInterval=Seconds(5))
Enable tracking of the Ipv4 routing table for all Nodes.
AnimXmlElement(std::string tagName, bool emptyElement=true)
std::map< uint32_t, NodeSize > m_nodeSizes
void Connect(std::string path, const CallbackBase &cb)
Ipv4Address GetGateway(void) const
void CsmaPhyTxEndTrace(std::string context, Ptr< const Packet > p)
std::string GetPacketMetadata(Ptr< const Packet > p)
Time m_wifiMacCountersPollInterval
std::vector< std::string > m_resources
int WriteN(const char *, uint32_t, FILE *f)
Access to the Ipv4 forwarding table, interfaces, and configuration.
void DevTxTrace(std::string context, Ptr< const Packet > p, Ptr< NetDevice > tx, Ptr< NetDevice > rx, Time txTime, Time rxTime)
uint32_t GetNDevices(void) const
Time m_wifiPhyCountersPollInterval
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
tag a set of bytes in a packet
NodeColorsMap m_nodeColors
void WriteXmlRouting(uint32_t id, std::string routingInfo)
void Ipv4RxTrace(std::string context, Ptr< const Packet >, Ptr< Ipv4 >, uint32_t)
void WriteXmlPRef(uint64_t animUid, uint32_t fId, double fbTx, std::string metaInfo="")
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t m_wifiMacRxDropCounterId
keep track of a set of node pointers.
void UpdateLinkDescription(uint32_t fromNode, uint32_t toNode, std::string linkDescription)
Helper function to update the description for a link.
uint32_t AddResource(std::string resourcePath)
Add a resource such as the path to an image file.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
std::string fromNodeDescription
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
void SetMaxPktsPerTraceFile(uint64_t maxPktsPerFile)
Set Max packets per trace file.
bool NodeHasMoved(Ptr< Node > n, Vector newLocation)
Iterator over the set of byte tags in a packet.
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionaly.
Time m_routingPollInterval
NodeCounterMap64 m_nodeQueueDrop
uint32_t m_wifiMacRxCounterId
AnimUidPacketInfoMap m_pendingLtePackets
void TrackWifiMacCounters()
void EnablePacketMetadata(bool enable=true)
Enable Packet metadata.
std::map< uint64_t, AnimPacketInfo > AnimUidPacketInfoMap
TypeId GetTypeId(void) const
virtual void Serialize(TagBuffer i) const
Serialize function.
static Time Now(void)
Return the current simulation virtual time.
const std::vector< std::string > GetElementsFromContext(const std::string &context) const
void WriteXmlUpdateNodeDescription(uint32_t nodeId)
void EnqueueTrace(std::string context, Ptr< const Packet >)
Byte tag using by Anim to uniquely identify packets.
uint32_t m_wifiMacTxCounterId
virtual TypeId GetInstanceTypeId(void) const
Get Instance Type Id.
void StopAnimation(bool onlyAnimation=false)
void GetTag(Tag &tag) const
Read the requested tag and store it in the user-provided tag instance.
void WriteXmlUpdateNodeCounter(uint32_t counterId, uint32_t nodeId, double value)
Vector UpdatePosition(Ptr< Node > n)
Ptr< const NetDevice > m_rxnd
std::string m_elementString
uint64_t Get(void) const
Get Uid in tag.
std::string toNodeDescription
NodeCounterMap64 m_nodeIpv4Rx
Ipv4 addresses are stored in host order in this class.
std::vector< Ipv4RouteTrackElement > m_ipv4RouteTrackElements
NodeCounterMap64 m_nodeWifiMacRxDrop
void WifiMacTxDropTrace(std::string context, Ptr< const Packet >)
void MobilityCourseChangeTrace(Ptr< const MobilityModel > mob)
NodeCounterMap64 m_nodeWifiPhyRxDrop
std::string m_routingFileName
bool IsPacketPending(uint64_t animUid, ProtocolType protocolType)
uint32_t GetId(void) const
a class to store IPv4 address information on an interface
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
uint32_t m_queueDequeueCounterId
std::string GetMacAddress(Ptr< NetDevice > nd)
static Iterator Begin(void)
NodeCounterMap64 m_nodeIpv4Tx
NodeCounterMap64 m_nodeWifiMacRx
AnimUidPacketInfoMap m_pendingUanPackets
#define MAX_PKTS_PER_TRACE_FILE
void AddByteTag(uint64_t animUid, Ptr< const Packet > p)
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
void WriteXmlUpdateBackground(std::string fileName, double x, double y, double scaleX, double scaleY, double opacity)
virtual uint32_t GetSerializedSize(void) const
Get Serialized Size.
Interface to network animator.
void WriteNonP2pLinkProperties(uint32_t id, std::string ipv4Address, std::string channelType)
bool m_enablePacketMetadata
Ptr< const NetDevice > m_txnd
uint32_t m_wifiMacTxDropCounterId
Time m_wifiPhyCountersStopTime
void OutputWirelessPacketRxInfo(Ptr< const Packet > p, AnimPacketInfo &pktInfo, uint64_t animUid)
static bool IsFinished(void)
Check if the simulation should finish.
void SetAnimWriteCallback(AnimWriteCallback cb)
Set a callback function to listen to AnimationInterface write events.
void SetMobilityPollInterval(Time t)
Set mobility poll interval:WARNING: setting a low interval can cause slowness.
void Ipv4DropTrace(std::string context, const Ipv4Header &, Ptr< const Packet >, Ipv4L3Protocol::DropReason, Ptr< Ipv4 >, uint32_t)
NodeCounterMap64 m_nodeQueueEnqueue
uint32_t m_wifiPhyRxDropCounterId
Time m_wifiMacCountersStopTime
void WriteRoutePath(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
void WriteLinkProperties()
Time m_mobilityPollInterval
bool IsStarted(void)
Is AnimationInterface started.
void EnableIpv4L3ProtocolCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Ipv4 L3 Protocol Counters such as Tx, Rx, Drop.
AnimUidPacketInfoMap * ProtocolTypeToPendingPackets(ProtocolType protocolType)
void EnableQueueCounters(Time startTime, Time stopTime, Time pollInterval=Seconds(1))
Enable tracking of Queue Counters such as Enqueue, Dequeue, Queue Drops.
void AddAttribute(std::string attribute, T value, bool xmlEscape=false)
uint32_t m_remainingEnergyCounterId
void WifiPhyRxDropTrace(std::string context, Ptr< const Packet >)
std::string linkDescription
Vector GetPosition(Ptr< Node > n)
a unique identifier for an interface.
NodeCounterMap64 m_nodeWifiMacTxDrop
TypeId SetParent(TypeId tid)
Set the parent TypeId.
std::vector< std::string > m_nodeCounters
void WifiPhyTxDropTrace(std::string context, Ptr< const Packet >)
void LteRxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &)
void UpdateNodeDescription(Ptr< Node > n, std::string descr)
Helper function to update the description for a given node.
void OutputCsmaPacket(Ptr< const Packet > p, AnimPacketInfo &pktInfo)
uint32_t m_ipv4L3ProtocolDropCounterId
Time m_queueCountersStopTime
void SetOutputFile(const std::string &fn, bool routing=false)
void LteSpectrumPhyTxStart(std::string context, Ptr< const PacketBurst > pb)
AnimUidPacketInfoMap m_pendingCsmaPackets
void WriteXmlLink(uint32_t fromId, uint32_t toLp, uint32_t toId)
void WimaxTxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &)
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.