25 #include "ns3/animation-interface.h"
26 #include "ns3/channel.h"
27 #include "ns3/config.h"
29 #include "ns3/mobility-model.h"
30 #include "ns3/packet.h"
31 #include "ns3/simulator.h"
32 #include "ns3/animation-interface-helper.h"
33 #include "ns3/wifi-mac-header.h"
34 #include "ns3/wimax-mac-header.h"
35 #include "ns3/wifi-net-device.h"
36 #include "ns3/wifi-mac.h"
37 #include "ns3/constant-position-mobility-model.h"
38 #include "ns3/lte-ue-phy.h"
39 #include "ns3/lte-enb-phy.h"
40 #include "ns3/uan-net-device.h"
41 #include "ns3/uan-mac.h"
43 #include "ns3/ipv4-routing-protocol.h"
44 #include "ns3/energy-source-container.h"
58 #define PURGE_INTERVAL 5
68 : m_routingF (0), m_xml (usingXML), m_mobilityPollInterval (Seconds (0.25)),
69 m_outputFileName (fn),
70 m_outputFileSet (false), gAnimUid (0), m_randomPosition (true),
71 m_writeCallback (0), m_started (false),
72 m_enablePacketMetadata (false), m_startTime (Seconds (0)), m_stopTime (Seconds (3600 * 1000)),
73 m_maxPktsPerFile (maxPktsPerFile), m_originalFileName (fn),
74 m_routingStopTime (Seconds (0)), m_routingFileName (
""),
75 m_routingPollInterval (Seconds (5))
118 std::stringstream stream;
121 return stream.str ();
127 NS_LOG_INFO (
"RecursiveIpv4RoutePathSearch from:" << from.c_str () <<
" to:" << to.c_str ());
128 if ((from ==
"0.0.0.0") || (from ==
"127.0.0.1"))
130 NS_LOG_INFO (
"Got " << from.c_str () <<
" End recursion");
138 rpElements.push_back (elem);
173 std::ostringstream oss;
179 rpElements.push_back (elem);
183 rpElements.push_back (elem2);
189 rpElements.push_back (elem);
234 rpElements.push_back (elem);
238 std::ostringstream oss;
244 rpElements.push_back (elem);
248 rpElements.push_back (elem2);
254 rpElements.push_back (elem);
259 rpElements.push_back (elem);
304 std::ostringstream oss;
320 return "netanim-3.104";
339 NS_LOG_INFO (
"Creating new trace file:" << fn.c_str ());
340 m_f = std::fopen (fn.c_str (),
"w");
449 NS_LOG_UNCOND (
"AnimationInterface WARNING:Node:" << n->
GetId () <<
" Does not have a mobility model. Use SetConstantPosition if it is stationary");
450 Vector deterministicVector (100,100,0);
485 std::vector <uint64_t> purgeList;
495 purgeList.push_back (i->first);
499 for (std::vector <uint64_t>::iterator i = purgeList.begin ();
500 i != purgeList.end ();
512 std::vector <uint64_t> purgeList;
522 purgeList.push_back (i->first);
526 for (std::vector <uint64_t>::iterator i = purgeList.begin ();
527 i != purgeList.end ();
540 std::vector <uint64_t> purgeList;
550 purgeList.push_back (i->first);
554 for (std::vector <uint64_t>::iterator i = purgeList.begin ();
555 i != purgeList.end ();
566 std::vector <uint64_t> purgeList;
576 purgeList.push_back (i->first);
580 for (std::vector <uint64_t>::iterator i = purgeList.begin ();
581 i != purgeList.end ();
591 Address nodeAddr = nd->GetAddress ();
592 std::ostringstream oss;
594 return oss.str ().substr (6);
602 NS_LOG_WARN (
"Node: " << nd->GetNode ()->GetId () <<
" No ipv4 object found");
605 int32_t ifIndex = ipv4->GetInterfaceForDevice (nd);
608 NS_LOG_WARN (
"Node :" << nd->GetNode ()->GetId () <<
" Could not find index of NetDevice");
612 std::ostringstream oss;
637 struct Rgb rgb = {255, 0, 0};
645 std::ostringstream oss;
655 std::ostringstream oss;
666 uint32_t n1Id = n->
GetId ();
668 for (uint32_t i = 0; i < nDev; ++i)
677 if ((dev->GetInstanceTypeId ().GetName () ==
"ns3::LteUeNetDevice") ||
678 (dev->GetInstanceTypeId ().GetName () ==
"ns3::LteEnbNetDevice")||
679 (dev->GetInstanceTypeId ().GetName () ==
"ns3::VirtualNetDevice"))
686 std::string channelType = ch->GetInstanceTypeId ().GetName ();
688 if (channelType == std::string (
"ns3::PointToPointChannel"))
691 uint32_t nChDev = ch->GetNDevices ();
692 for (uint32_t j = 0; j < nChDev; ++j)
695 uint32_t n2Id = chDev->GetNode ()->GetId ();
703 std::ostringstream oss;
710 oss <<
"0.0 L " << n1Id <<
" " << n2Id << std::endl;
725 if (
m_xml && !restart)
753 std::ostringstream oss;
755 oss <<
"NodeList/" << n->
GetId () <<
"/DeviceList/" << devIndex <<
"/";
776 std::ostringstream oss;
778 oss <<
"NodeList/" << n->
GetId () <<
"/DeviceList/" << devIndex <<
"/";
799 for (uint32_t devIndex = 0; devIndex < nDevices; ++devIndex)
823 Config::Connect (
"NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxBegin",
825 Config::Connect (
"NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyRxBegin",
837 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyTxBegin",
839 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyTxEnd",
841 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/PhyRxEnd",
845 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyTxBegin",
847 Config::Connect (
"/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyRxBegin",
849 Config::Connect (
"/NodeList/*/$ns3::BasicEnergySource/RemainingEnergy",
888 return WriteN (st.c_str (), st.length (), f);
893 std::vector < Ptr <Node> > MovedNodes;
916 MovedNodes.push_back (n);
934 uint32_t nLeft = count;
935 const char* p =
data;
936 uint32_t written = 0;
939 int n = std::fwrite (p, 1, nLeft, f);
954 std::ostringstream oss;
959 oss <<
GetXMLOpenClose_p (
"p", 0, fbTx, lbTx, 0, fbRx, lbRx,
"",
"DummyPktIgnoreThis");
967 NS_LOG_INFO (
"Writing Route Path From :" << nodeId <<
" To: " << destination.c_str ());
983 std::ostringstream oss;
997 std::ostringstream oss;
999 double lbTx = (now + txTime).GetSeconds ();
1000 double fbRx = (now + rxTime - txTime).GetSeconds ();
1001 double lbRx = (now + rxTime).GetSeconds ();
1004 oss <<
GetXMLOpenClose_p (
"p", tx->GetNode ()->GetId (), fbTx, lbTx, rx->GetNode ()->GetId (),
1011 oss << std::setprecision (10);
1013 << tx->GetNode ()->GetId () <<
" "
1014 << rx->GetNode ()->GetId () <<
" "
1015 << (now + txTime).GetSeconds () <<
" "
1016 << (now + rxTime - txTime).GetSeconds () <<
" "
1017 << (now + rxTime).GetSeconds () << std::endl;
1046 return n->
GetDevice (atoi (elements.at (3).c_str ()));
1131 NS_LOG_INFO (
"UanPhyGenRxTrace for packet:" << AnimUid);
1134 NS_LOG_WARN (
"UanPhyGenRxBeginTrace: unknown Uid");
1149 const uint32_t nodeId = node->GetId ();
1151 NS_LOG_INFO (
"Remaining energy on one of sources on node " << nodeId <<
": " << currentEnergy);
1157 const double energyFraction = currentEnergy / energySource->GetInitialEnergy ();
1159 NS_LOG_INFO (
"Total energy fraction on node " << nodeId <<
": " << energyFraction);
1183 Mac48Address nodeAddr = netDevice->GetMac ()->GetAddress ();
1184 std::ostringstream oss;
1204 NS_LOG_INFO (
"TxDropTrace for packet:" << AnimUid);
1220 NS_LOG_INFO (
"Wifi RxBeginTrace for packet:" << AnimUid);
1224 std::ostringstream oss;
1240 NS_LOG_WARN (
"WifiPhyRxBegin: unknown Uid, but we are adding a wifi packet");
1271 NS_LOG_INFO (
"MacRxTrace for packet:" << AnimUid <<
" complete");
1296 NS_LOG_INFO (
"MacRxTrace for packet:" << AnimUid <<
" complete");
1334 NS_LOG_INFO (
"WimaxRxTrace for packet:" << AnimUid);
1395 context =
"/" + context;
1401 std::list <Ptr <Packet> > pbList = pb->GetPackets ();
1427 context =
"/" + context;
1433 std::list <Ptr <Packet> > pbList = pb->GetPackets ();
1443 NS_LOG_WARN (
"LteSpectrumPhyRxTrace: unknown Uid");
1482 NS_LOG_INFO (
"CsmaPhyTxEndTrace for packet:" << AnimUid);
1488 NS_LOG_WARN (
"Unknown Uid, but adding Csma Packet anyway");
1513 NS_LOG_INFO (
"CsmaPhyRxEndTrace for packet:" << AnimUid);
1517 NS_LOG_INFO (
"CsmaPhyRxEndTrace for packet:" << AnimUid <<
" complete");
1544 NS_LOG_INFO (
"MacRxTrace for packet:" << AnimUid <<
" complete");
1564 v = mobility->GetPosition ();
1568 std::ostringstream oss;
1579 if ((ceil (oldLocation.
x) == ceil (newLocation.
x)) &&
1580 (ceil (oldLocation.
y) == ceil (newLocation.
y)))
1596 std::ostringstream oss;
1598 for (uint32_t i = 0; i < MovedNodes.size (); i++)
1620 std::ostringstream oss;
1632 const EnergyFractionMap::const_iterator fractionIter =
m_nodeEnergyFraction.find (node->GetId ());
1635 return fractionIter->second;
1653 "<information><!-- \n\
1654 Description of attributes:\n\
1655 =========================\n\
1657 * ver = Current version\n\
1659 * minX = minimum X coordinate of the canvas\n\
1660 * minY = minimum Y coordinate of the canvas\n\
1661 * maxX = maximum X coordinate of the canvas\n\
1662 * maxY = maximum Y coordinate of the canvas\n\
1665 * locX = X coordinate\n\
1666 * locY = Y coordinate\n\
1667 * r = Red component\n\
1668 * g = Green component\n\
1669 * b = Blue component\n\
1671 * fromId = From Node Id\n\
1672 * toId = To Node Id\n\
1673 * fd = From Node description (for IP Address)\n\
1674 * td = To Node description (for IP Address)\n\
1675 * ld = Link description (for Bandwidth, delay etc)\n\
1677 * t = Simulation time\n\
1678 * ld = Link description (for Bandwidth, delay etc)\n\
1680 * t = Simulation time\n\
1681 * descr = Node description\n\
1682 * r = Red component\n\
1683 * g = Green component\n\
1684 * b = Blue component\n\
1685 * visible = Node visibility\n\
1686 * rc = Residual energy (between 0 and 1)\n\
1688 * fId = From Node Id\n\
1689 * fbTx = First bit transmit time\n\
1690 * lbTx = Last bit transmit time\n\
1691 * tId = To Node Id\n\
1692 * fbRx = First bit Rx Time\n\
1693 * lbRx = Last bit Rx\n\
1694 * meta-info = Packet meta data\n\
1696 * fId = From Node Id\n\
1697 * fbTx = First bit transmit time\n\
1698 * lbTx = Last bit transmit time\n\
1699 * range = Reception range\n\
1700 * tId = To Node Id\n\
1701 * fbRx = First bit Rx time\n\
1702 * meta-info = Packet meta data\n\
1703 * lbRx = Last bit Rx time-->\n\
1712 std::ostringstream oss;
1713 uint32_t nodeId = 0;
1715 nodeId = pktInfo.
m_txnd->GetNode ()->GetId ();
1720 uint32_t rxId = pktrxInfo.
m_rxnd->GetNode ()->GetId ();
1731 std::ostringstream oss;
1733 uint32_t nodeId = pktInfo.
m_txnd->GetNode ()->GetId ();
1734 uint32_t rxId = pktrxInfo.
m_rxnd->GetNode ()->GetId ();
1747 hubLoc = CreateObject<ConstantPositionMobilityModel> ();
1751 hubLoc->SetPosition (hubVec);
1752 NS_LOG_INFO (
"Node:" << n->
GetId () <<
" Position set to:(" << x <<
"," << y <<
"," << z <<
")");
1759 NS_FATAL_ERROR (
"SetBoundary must be used prior to creating the AnimationInterface object");
1775 NS_FATAL_ERROR (
"SetNodeColor must be used prior to creating the AnimationInterface object");
1778 struct Rgb rgb = {r, g, b};
1785 NS_LOG_INFO (
"Setting node visibility for Node Id:" << nodeId);
1796 std::ostringstream oss;
1809 NS_LOG_INFO (
"Setting node color for Node Id:" << nodeId);
1810 struct Rgb rgb = {r, g, b};
1819 for (uint32_t i = 0; i < nc.
GetN (); ++i)
1829 std::string linkDescription)
1831 std::ostringstream oss;
1837 std::string linkDescription)
1841 std::ostringstream oss;
1847 std::string linkDescription,
1848 std::string fromNodeDescription,
1849 std::string toNodeDescription)
1855 LinkProperties lp = { fromNodeDescription, toNodeDescription, linkDescription };
1871 std::string linkDescription,
1872 std::string fromNodeDescription,
1873 std::string toNodeDescription)
1884 NS_FATAL_ERROR (
"SetNodeDescription must be used prior to creating the AnimationInterface object");
1898 std::ostringstream oss;
1908 NS_FATAL_ERROR (
"SetNodeDescription must be used prior to creating the AnimationInterface object");
1909 for (uint32_t i = 0; i < nc.
GetN (); ++i)
1922 std::ostringstream oss;
1935 std::ostringstream oss;
1936 oss <<
"<topology minX = \"" << minX <<
"\" minY = \"" << minY
1937 <<
"\" maxX = \"" << maxX <<
"\" maxY = \"" << maxY
1938 <<
"\">" << std::endl;
1945 std::ostringstream oss;
1946 oss <<
"<nodeupdate id=\"" <<
id <<
"\"";
1949 oss <<
" visible=\"" << 1 <<
"\"";
1951 oss <<
" visible=\"" << 0 <<
"\"";
1964 std::ostringstream oss;
1965 oss <<
"<node id=\"" <<
id <<
"\"";
1967 oss <<
" locX = \"" << locX <<
"\" " <<
"locY = \"" << locY <<
"\"";
1977 std::ostringstream oss;
1978 oss <<
"<node id = \"" <<
id <<
"\"";
1980 oss <<
" locX=\"" << locX <<
"\" " <<
"locY=\"" << locY <<
"\"";
1991 std::ostringstream oss;
1993 <<
" fromId=\"" << fromId
1994 <<
"\" toId=\"" << toId
1997 oss <<
" ld=\"" << linkDescription <<
"\""
2005 std::ostringstream oss;
2006 oss <<
"<link fromId=\"" << fromId
2007 <<
"\" toId=\"" << toId
2036 std::ostringstream oss;
2037 oss << std::setprecision (10);
2038 oss <<
"<p fId=\"" << fromId
2039 <<
"\" fbTx=\"" << fbTx
2040 <<
"\" lbTx=\"" << lbTx
2041 << (auxInfo.empty ()?
"":
"\" aux=\"") << auxInfo.c_str () <<
"\">";
2047 std::ostringstream oss;
2049 <<
" id=\"" << nodeId <<
"\""
2050 <<
" info=\"" << routingInfo.c_str () <<
"\""
2051 <<
"/>" << std::endl;
2057 std::ostringstream oss;
2059 <<
" id=\"" << nodeId <<
"\"" <<
" d=\"" << destination.c_str () <<
"\""
2060 <<
" c=\"" << rpElements.size () <<
"\"" <<
">" << std::endl;
2061 for (Ipv4RoutePathElements::const_iterator i = rpElements.begin ();
2062 i != rpElements.end ();
2066 oss <<
"<rpe" <<
" n=\"" << rpElement.
nodeId <<
"\"" <<
" nH=\"" << rpElement.
nextHop.c_str () <<
"\"" <<
"/>" << std::endl;
2068 oss <<
"</rp>" << std::endl;
2074 uint32_t tId,
double fbRx,
double lbRx, std::string metaInfo,
2075 std::string auxInfo)
2077 std::ostringstream oss;
2078 oss << std::setprecision (10);
2079 oss <<
"<" << pktType <<
" fId=\"" << fId
2080 <<
"\" fbTx=\"" << fbTx
2081 <<
"\" lbTx=\"" << lbTx <<
"\"";
2082 if (!auxInfo.empty ())
2084 oss <<
" aux=\"" << auxInfo.c_str () <<
"\"";
2086 if (!metaInfo.empty ())
2088 oss <<
" meta-info=\"" << metaInfo.c_str () <<
"\"";
2090 oss <<
" tId=\"" << tId <<
"\" fbRx=\"" << fbRx <<
"\" lbRx=\"" << lbRx <<
"\">" << std::endl;
2098 std::ostringstream oss;
2099 oss << std::setprecision (10);
2100 oss <<
"<wpacket fromId=\"" << fromId
2101 <<
"\" fbTx=\"" << fbTx
2102 <<
"\" lbTx=\"" << lbTx
2103 <<
"\" range=\"" << range <<
"\">" << std::endl;
2110 std::ostringstream oss;
2111 oss << std::setprecision (10);
2112 oss <<
"<rx toId=\"" << toId
2113 <<
"\" fbRx=\"" << fbRx
2114 <<
"\" lbRx=\"" << lbRx
2115 <<
"\"/>" << std::endl;
2121 std::ostringstream oss;
2122 oss <<
"<meta info=\""
2123 << metaInfo <<
"\" />" << std::endl;
2130 std::ostringstream oss;
2131 oss <<
"<nonp2plinkproperties id=\""
2133 <<
" ipv4Address=\"" << ipv4Address <<
"\""
2134 <<
" channelType=\"" << channelType <<
"\""
2135 <<
"/>" << std::endl;
2142 std::vector <std::string> elements;
2143 size_t pos1=0, pos2;
2144 while (pos1 != context.npos)
2146 pos1 = context.find (
"/",pos1);
2147 pos2 = context.find (
"/",pos1+1);
2148 elements.push_back (context.substr (pos1+1,pos2-(pos1+1)));
2150 pos2 = context.npos;
2163 ostream <<
" descr=\"\"";
2169 const uint8_t r = color.
r;
2170 const uint8_t g = color.
g;
2171 const uint8_t b = color.
b;
2173 ostream <<
" r=\"" << (uint32_t)r <<
"\" "
2174 <<
" g=\"" << (uint32_t)g <<
"\" "
2175 <<
" b=\"" << (uint32_t)b <<
"\" ";
2183 ostream <<
"rc = \"" << fractionIter->second <<
"\" ";
2185 ostream <<
"rc = \"1\" ";
2193 .AddConstructor<AnimByteTag> ()
2206 return sizeof (uint64_t);
uint64_t GetAnimUidFromPacket(Ptr< const Packet >)
void Set(uint64_t AnimUid)
Set global Uid in tag.
std::string GetXMLOpenClose_nodeupdate(uint32_t id, bool visible=true)
uint64_t GetTracePktCount()
Get trace file packet count (This used only for testing)
void AddToIpv4AddressNodeIdTable(std::string, uint32_t)
bool WifiPacketIsPending(uint64_t AnimUid)
double x
x coordinate of vector
void CsmaMacRxTrace(std::string context, Ptr< const Packet > p)
keep track of time values and allow control of global simulation resolution
std::string GetXMLOpen_anim(uint32_t lp)
bool CsmaPacketIsPending(uint64_t AnimUid)
#define NS_LOG_FUNCTION(parameters)
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
AnimRxInfo GetRxInfo(Ptr< const NetDevice > nd)
GetRxInfo.
static uint32_t GetNNodes(void)
std::vector< Ptr< Node > > RecalcTopoBounds()
void AddPendingWifiPacket(uint64_t AnimUid, AnimPacketInfo &)
std::vector< Ptr< Node > >::const_iterator Iterator
std::string GetPreamble(void)
bool LtePacketIsPending(uint64_t AnimUid)
Ipv4Address GetLocal(void) const
Get the local address.
std::string GetIpv4Address(Ptr< NetDevice > nd)
void WriteU64(uint64_t v)
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 EnablePacketMetadata(bool enable)
Enable Packet metadata.
static TypeId GetTypeId(void)
Get Type Id.
std::string GetXMLOpenClose_NonP2pLinkProperties(uint32_t id, std::string ipv4Address, std::string channelType)
Energy source base class.
void CsmaPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
static void SetNodeColor(Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
Helper function to set the node color.
Mobility model for which the current position does not change once it has been set and until it is se...
bool ProcessRxEnd(Ptr< const NetDevice > nd, const Time &fbRx, Vector rxLoc)
Process RxEnd notifications.
static bool IsInitialized(void)
Check if AnimationInterface is initialized.
#define NS_ASSERT(condition)
std::string GetXMLClose(std::string name)
uint64_t m_maxPktsPerFile
void WifiMacRxTrace(std::string context, Ptr< const Packet > p)
void OutputCsmaPacket(Ptr< const Packet > p, AnimPacketInfo &pktInfo, AnimRxInfo pktrxInfo)
std::map< std::string, uint32_t > m_macToNodeIdMap
void LteSpectrumPhyRxStart(std::string context, Ptr< const PacketBurst > pb)
Ptr< NetDevice > GetNetDeviceFromContext(std::string context)
Vector GetPosition(void) const
void WifiPhyTxBeginTrace(std::string context, Ptr< const Packet > p)
std::map< uint64_t, AnimPacketInfo > m_pendingWimaxPackets
void TrackIpv4RoutePaths()
NodeContainer m_routingNc
bool SetRoutingOutputFile(const std::string &fn)
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
uint64_t m_currentPktCount
std::string GetXMLOpenClose_rx(uint32_t toLp, uint32_t toId, double fbRx, double lbRx)
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 &)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
virtual void Deserialize(TagBuffer i)
Deserialize function.
void Connect(std::string path, const CallbackBase &cb)
void ConnectLteEnb(Ptr< Node > n, Ptr< LteEnbNetDevice > nd, uint32_t devIndex)
std::string GetIpv4RoutingTable(Ptr< Node > n)
void Print(std::ostream &os) const
SocketErrno
Enumeration of the possible errors returned by a socket.
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.
void WifiPhyRxBeginTrace(std::string context, Ptr< const Packet > p)
void UpdateNodeColor(Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
Helper function to update the node color.
void ProcessRxBegin(Ptr< const NetDevice > nd, const Time &fbRx)
Process RxBegin notifications.
void ResetAnimWriteCallback()
Reset the write callback function.
#define NS_FATAL_ERROR(msg)
fatal error handling
std::string GetXMLOpenClose_node(uint32_t lp, uint32_t id, double locX, double locY)
AnimWriteCallback m_writeCallback
void WifiPhyRxDropTrace(std::string context, Ptr< const Packet > p)
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.
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
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.
static void SetLinkDescription(uint32_t fromNode, uint32_t toNode, std::string linkDescription, std::string fromNodeDescription="", std::string toNodeDescription="")
Helper function to set the description for a link.
static void SetBoundary(double minX, double minY, double maxX, double maxY)
Helper function to set the topology boundary rectangle.
void SetXMLOutput()
Specify that animation commands are to be written in XML format.
double GetSeconds(void) const
std::string GetXMLOpen_packet(uint32_t fromLp, uint32_t fromId, double fbTx, double lbTx, std::string auxInfo="")
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)
std::string GetXMLOpenClose_p(std::string pktType, uint32_t fId, double fbTx, double lbTx, uint32_t tId, double fbRx, double lbRx, std::string metaInfo="", std::string auxInfo="")
static void EnablePrinting(void)
By default, packets do not keep around enough metadata to perform the operations requested by the Pri...
void SetRandomPosition(bool setRandPos)
Set random position if a Mobility Model does not exists for the node.
~AnimationInterface()
Destructor for the animator interface.
EnergyFractionMap m_nodeEnergyFraction
static Iterator End(void)
std::string GetNetAnimVersion()
Ptr< const NetDevice > m_rxnd
Ptr to receiving NetDevice.
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
void WriteNodeUpdate(uint32_t nodeId)
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
double m_fbRx
First bit receive time.
std::string m_outputFileName
double firstlastbitDelta
Time delta between First bit Rx and Last bit Rx.
static void SetNodeDescription(Ptr< Node > n, std::string descr)
Helper function to set a brief description for a given node.
void UanPhyGenRxTrace(std::string context, Ptr< const Packet >)
Ptr< NetDevice > GetDevice(uint32_t index) const
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
ByteTagIterator GetByteTagIterator(void) const
std::map< uint64_t, AnimPacketInfo > m_pendingLtePackets
void StartAnimation(bool restart=false)
Writes the topology information and sets up the appropriate animation packet tx callback.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
NS_LOG_COMPONENT_DEFINE("AnimationInterface")
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.
void OutputWirelessPacket(Ptr< const Packet > p, AnimPacketInfo &pktInfo, AnimRxInfo pktrxInfo)
static std::map< uint32_t, Rgb > nodeColors
void WifiPhyTxDropTrace(std::string context, Ptr< const Packet > p)
void AggregateObject(Ptr< Object > other)
Ipv4Address GetGateway(void) const
std::map< uint64_t, AnimPacketInfo > m_pendingCsmaPackets
void CsmaPhyTxEndTrace(std::string context, Ptr< const Packet > p)
std::string GetPacketMetadata(Ptr< const Packet > p)
std::string GetXMLOpen_wpacket(uint32_t fromLp, uint32_t fromId, double fbTx, double lbTx, double range)
int WriteN(const char *, uint32_t, FILE *f)
double m_lbTx
Last bit transmission time.
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
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
uint32_t m_txNodeId
Tx Node Id if NetDevice is unknown.
tag a set of bytes in a packet
void AddPendingUanPacket(uint64_t AnimUid, AnimPacketInfo &)
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.
std::vector< Ptr< Node > >::const_iterator Iterator
void AppendXMLRemainingEnergy(std::ostream &ostream, uint32_t id) const
void AddPendingWimaxPacket(uint64_t AnimUid, AnimPacketInfo &)
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
bool NodeHasMoved(Ptr< Node > n, Vector newLocation)
Iterator over the set of byte tags in a packet.
static Rectangle * userBoundary
std::string linkDescription
#define NS_LOG_UNCOND(msg)
Time m_routingPollInterval
double y
y coordinate of vector
TypeId GetTypeId(void) const
virtual void Serialize(TagBuffer i) const
Serialize function.
static Time Now(void)
Return the "current simulation time".
bool UanPacketIsPending(uint64_t AnimUid)
const std::vector< std::string > GetElementsFromContext(const std::string &context) const
bool SetOutputFile(const std::string &fn)
Specify that animation commands are to be written to the specified output file.
Byte tag using by Anim to uniquely identify packets.
virtual TypeId GetInstanceTypeId(void) const
Get Instance Type Id.
void StopAnimation(bool onlyAnimation=false)
Closes the interface to the animator.
double m_lbRx
Last bit receive time.
void GetTag(Tag &tag) const
Read the requested tag and store it in the user-provided tag instance.
Vector UpdatePosition(Ptr< Node > n)
bool IsPhyRxComplete()
Check if Wifi Phy Rx is Complete.
uint64_t Get(void) const
Get Uid in tag.
Ipv4 addresses are stored in host order in this class.
std::vector< Ipv4RouteTrackElement > m_ipv4RouteTrackElements
void MobilityCourseChangeTrace(Ptr< const MobilityModel > mob)
std::string m_routingFileName
std::map< uint64_t, AnimPacketInfo > m_pendingWifiPackets
uint32_t GetId(void) const
a class to store IPv4 address information on an interface
std::map< uint64_t, AnimPacketInfo > m_pendingUanPackets
std::string GetXMLOpenClose_linkupdate(uint32_t fromId, uint32_t toId, std::string)
std::string GetXMLOpenClose_routing(uint32_t id, std::string routingInfo)
Ptr< const NetDevice > m_txnd
Ptr to NetDevice that is transmitting.
std::string GetMacAddress(Ptr< NetDevice > nd)
static Iterator Begin(void)
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
#define NS_LOG_DEBUG(msg)
AnimationInterface(const std::string filename, uint64_t maxPktsPerFile=MAX_PKTS_PER_TRACE_FILE, bool usingXML=true)
Constructor.
std::string GetXMLOpenClose_rp(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
void WifiPhyTxEndTrace(std::string context, Ptr< const Packet > p)
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
void WifiPhyRxEndTrace(std::string context, Ptr< const Packet > p)
std::string fromNodeDescription
static std::map< P2pLinkNodeIdPair, LinkProperties, LinkPairCompare > linkProperties
double m_fbTx
First bit transmission time.
static bool IsFinished(void)
If there are no more events lefts to be scheduled, or if simulation time has already reached the "sto...
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 AddPendingLtePacket(uint64_t AnimUid, AnimPacketInfo &)
void AddPendingCsmaPacket(uint64_t AnimUid, AnimPacketInfo &)
void AppendXMLNodeDescription(std::ostream &ostream, uint32_t id) const
void AppendXMLNodeColor(std::ostream &ostream, const Rgb &color) const
void WriteRoutePath(uint32_t nodeId, std::string destination, Ipv4RoutePathElements rpElements)
A structure to store red, blue and green components for entities such as nodes.
std::string toNodeDescription
Time m_mobilityPollInterval
std::string GetXMLOpenClose_meta(std::string metaInfo)
void ShowNode(uint32_t nodeId, bool show=true)
Helper function to show/hide a node.
bool IsStarted(void)
Is AnimationInterface started.
Ptr< T > GetObject(void) const
bool WimaxPacketIsPending(uint64_t AnimUid)
Vector GetPosition(Ptr< Node > n)
a unique identifier for an interface.
static std::map< uint32_t, std::string > nodeDescriptions
TypeId SetParent(TypeId tid)
std::string GetXMLOpenClose_link(uint32_t fromLp, uint32_t fromId, uint32_t toLp, uint32_t toId)
std::string GetXMLOpen_topology(double minX, double minY, double maxX, double maxY)
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 ConnectWithoutContext(std::string path, const CallbackBase &cb)
void LteSpectrumPhyTxStart(std::string context, Ptr< const PacketBurst > pb)
void WimaxTxTrace(std::string context, Ptr< const Packet > p, const Mac48Address &)
std::string m_originalFileName
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.
AnimPacketInfo helper class.