Thank you mathieu for the answer,
I found out the problem. it works now when I set the transmission power in the scenario.
Actually, I aimed to set this value during the simulation run-time.
So, I added to the WifiNetDevice method some code (in red) in order to set the transmission power when a node send the frame to the network:
bool
WifiNetDevice::Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
{
NS_ASSERT (Mac48Address::IsMatchingType (dest));
Mac48Address realTo = Mac48Address::ConvertFrom (dest);
Ptr<WifiPhy> wifiphy = CreateObject<WifiPhy> ();
wifiphy->SetTxPowerStart(m_txp); wifiphy->SetTxPowerEnd(m_txp);
m_phy = wifiphy; LlcSnapHeader llc;
llc.SetType (protocolNumber);
packet->AddHeader (llc);
m_txLogger (packet, realTo);
m_mac->Enqueue (packet, realTo);
return true;
}
I added also a new method to WifiNetDevice class:
void WifiNetDevice::SetTxPower (double txp){
m_txp = txp;}This method is used by upper layer to set the tx power.
So, a node which have a packet to send sets, first, its transmission power, then it uses the WifiNetDevice send method to send the frame.
Sould I add other changes to make it works?
Many Thanks
Regards
However, this seems not working.