// for each app, setup the app parameters int nodeId = 0; { bsmApp->Setup (i, nodeId, totalTime, wavePacketSize, waveInterval, gpsAccuracyNs, chAccessMode, txMaxDelay); nodeId++; } }
Also , When closely looking at bsm-application.cc it can be seen that the application starts and calculates the number of wave packets to be sent for the whole simulation.
GenerateWaveTraffic works accordingly and
thus limits the scope of dynamic waveInterval in the current wave module.
So i think dynamic wave-interval functionality would require a lot of additional work in both these files. Correct me if i am wrong ?
TxInfo tx;tx.channelNumber = CCH; tx.priority = 7; //highest priority.tx.txPowerLevel = 7;tx.dataRate = WifiMode("OfdmRate6MbpsBW10MHz"); // You can change this dynamically, per packet.Ptr<Packet> packet = Create <Packet> (m_packetSize);
//Broadcast the packet as WSMP (0x88dc) where m_waveDevice is of type WaveNetDevicem_waveDevice->SendX (packet, Mac48Address::GetBroadcast(), 0x88dc, tx);
// for some condition
{
NS_LOG_UNCOND("beacon interval is 0.5s ");
Ptr<Node> node;
for (NodeContainer::Iterator i = nodes.Begin (); i != nodes.End (); ++i)
{
node = (*i);
for (uint32_t j = 0; j < node->GetNApplications (); j++)
{
Ptr<CustomApplication> app_i = DynamicCast<CustomApplication> (node->GetApplication (j));
app_i->SetBroadcastInterval (Seconds(0.5));
}
}
}
void changeDataRate(NodeContainer& nodes, uint32_t c)
{
uint32_t m_packetSize ;
Ptr<Node> node;
for (NodeContainer::Iterator i = nodes.Begin (); i != nodes.End (); ++i)
{
node = (*i);
if ( node->GetId() == c)
{
Ptr<NetDevice> dev = node->GetDevice (0);
Ptr<WaveNetDevice> m_waveDevice = DynamicCast <WaveNetDevice> (dev);
//(3,6,9,12,18,24,27) for supported modes https://www.nsnam.org/doxygen/wifi-phy_8cc_source.html
TxInfo tx;
tx.dataRate = WifiMode("OfdmRate3MbpsBW10MHz");
m_packetSize = 200;
Ptr<Packet> packet = Create <Packet> (m_packetSize);
m_waveDevice->SendX (packet, Mac48Address::GetBroadcast(), 0x88dc, tx);
NS_LOG_UNCOND("tx data rate of node("<< node->GetId()<<") is" << " 3Mbps");
// Simulator::Schedule (Seconds(0.1), &changeDataRate,nodes,c);
}
}
}
class CustomApplication
{
public:
...
void SetWifiMode (WifiMode mode);
...
private:
WifiMode m_mode;
...
}
CustomApplication::SetWifiMode (WifiMode mode)
{
m_mode = mode
}
CustomApplication::BroadcastInformation ()
{
TxInfo tx;
tx.mode = m_mode;
...
// proceed to broadcast the packet (and subsequent packets) with this data rate until you call SetWifiMode with a different mode.
}
Ptr <Node> n = NodeList::GetNode (0); //you can also use the node container.
Ptr <CustomApplication> c_app = DynamicCast<CustomApplication> (n->GetApplication (0)); //assuming only one application installed in node.
c_app->SetWifiMode ( WifiMode("OfdmRate3MbpsBw10MHz") );
tx.dataRate = m_mode; // instead of
tx.mode = m_mode;
regards,
G.
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/f0e72939-bde4-48a5-8796-b7ff82615a03%40googlegroups.com.