|
|
| 77 |
|
77 |
|
| 78 |
void |
78 |
void |
| 79 |
YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm, |
79 |
YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm, |
| 80 |
WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, Time duration) const |
80 |
WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, |
|
|
81 |
Time duration, double frequency) const |
| 81 |
{ |
82 |
{ |
| 82 |
Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<MobilityModel> (); |
83 |
Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<MobilityModel> (); |
| 83 |
NS_ASSERT (senderMobility != 0); |
84 |
NS_ASSERT (senderMobility != 0); |
| 84 |
uint32_t j = 0; |
85 |
uint32_t j = 0; |
|
|
86 |
|
| 87 |
if (m_loss->GetObject<FriisPropagationLossModel> () != 0) |
| 88 |
{ |
| 89 |
m_loss->GetObject<FriisPropagationLossModel> ()->SetFrequency(frequency * 1000000); |
| 90 |
} |
| 91 |
if (m_loss->GetObject<TwoRayGroundPropagationLossModel> () != 0) |
| 92 |
{ |
| 93 |
m_loss->GetObject<TwoRayGroundPropagationLossModel> ()->SetFrequency(frequency * 1000000); |
| 94 |
} |
| 95 |
if (m_loss->GetObject<LogDistancePropagationLossModel> () != 0) |
| 96 |
{ |
| 97 |
double refDistance = m_loss->GetObject<LogDistancePropagationLossModel> ()->GetReferenceDistance (); |
| 98 |
double C = 299792458.0; //speed of light in vacuum |
| 99 |
double lambda = C / (frequency * 1000000); |
| 100 |
double numerator = lambda * lambda; |
| 101 |
double denominator = 16 * M_PI * M_PI * refDistance * refDistance; |
| 102 |
double refLoss = -10 * log10 (numerator / denominator); |
| 103 |
m_loss->GetObject<LogDistancePropagationLossModel> ()->SetReference(refDistance, refLoss); |
| 104 |
} |
| 105 |
if (m_loss->GetObject<ThreeLogDistancePropagationLossModel> () != 0) |
| 106 |
{ |
| 107 |
double refDistance = m_loss->GetObject<ThreeLogDistancePropagationLossModel> ()->GetDistance0 (); |
| 108 |
double C = 299792458.0; //speed of light in vacuum |
| 109 |
double lambda = C / (frequency * 1000000); |
| 110 |
double numerator = lambda * lambda; |
| 111 |
double denominator = 16 * M_PI * M_PI * refDistance * refDistance; |
| 112 |
double refLoss = -10 * log10 (numerator / denominator); |
| 113 |
m_loss->GetObject<ThreeLogDistancePropagationLossModel> ()->SetReferenceLoss(refLoss); |
| 114 |
} |
| 115 |
|
| 85 |
for (PhyList::const_iterator i = m_phyList.begin (); i != m_phyList.end (); i++, j++) |
116 |
for (PhyList::const_iterator i = m_phyList.begin (); i != m_phyList.end (); i++, j++) |
| 86 |
{ |
117 |
{ |
| 87 |
if (sender != (*i)) |
118 |
if (sender != (*i)) |