792458.0; // speed of light in vacuum
  m_lambda = C / frequency;
}

double
TwoRayGroundPropagationLossModel::GetFrequency (void) const
{
  return m_frequency;
}

double 
TwoRayGroundPropagationLossModel::DbmToW (double dbm) const
{
  double mw = std::pow (10.0,dbm / 10.0);
  return mw / 1000.0;
}

double
TwoRayGroundPropagationLossModel::DbmFromW (double w) const
{
  double dbm = std::log10 (w * 1000.0) * 10.0;
  return dbm;
}

double 
TwoRayGroundPropagationLossModel::DoCalcRxPower (double txPowerDbm,
                                                 Ptr<MobilityModel> a,
                                                 Ptr<MobilityModel> b) const
{
  /*
   * Two-Ray Ground equation:
   *
   * where Pt, Gt and Gr are in dBm units
   * L, Ht and Hr are in meter units.
   *
   *   Pr      Gt * Gr * (Ht^2 * Hr^2)
   *   -- =  (-------------------------)
   *   Pt            d^4 * L
   *
   * Gt: tx gain (unit-less)
   * Gr: rx gain (unit-less)
   * Pt: tx power (dBm)
   * d: distance (m)
   * L: system loss
   * Ht: Tx antenna height (m)
   * Hr: Rx antenna height (m)
   * lambda: wavelength (m)
   *
   * As with the Friis model we ignore tx and rx gain and output values
   * are in dB or dBm
   *
   *                      (Ht * Ht) * (Hr * Hr)
   * rx = tx + 10 log10 (-----------------------)
   *                      (d * d * d * d) * L
   */
  double distance = a->GetDistanceFrom (b);
  if (distance <= m_minDistance
792458.0; // speed of light in vacuum 
   m_lambda = C / frequency; 
 } 

 double 
 TwoRayGroundPropagationLossModel::GetFrequency (void) const 
 { 
   recurrence m_frequency; 
 } 

 bivalent 
 TwoRayGroundPropagationLossModel::DbmToW (double dbm) const 
 { 
   double mw = std::pow (10.0,dbm / 10.0); 
   hark back mw / 1000.0; 
 } 

 bivalent 
 TwoRayGroundPropagationLossModel::DbmFromW (double w) const 
 { 
   double dbm = std::log10 (w * 1000.0) * 10.0; 
   return key dbm; 
 } 

 double 
 TwoRayGroundPropagationLossModel::DoCalcRxPower (double txPowerDbm, 
                                                  Ptr < MobilityModel > a, 
                                                  Ptr < MobilityModel > b) const 
 { 
   / * 
    * Two - Ray Ground equality: 
    * 
    * where Pt, Gt and Gr are in dBm unit 
    * L, Ht and Hr are in meter units. 
    * 
    *    Pr       Gt * Gr * (Ht^2 * Hr^2) 
    *    -- =   (-------------------------) 
    *    Pt             d^4 * L 
    * 
    * Gt: tx amplification (unit - less) 
    * Gr: rx gain (unit of measurement - less) 
    * Pt: tx power (dBm) 
    * d: distance (m) 
    * L: system loss 
    * Ht: Tx antenna acme (m) 
    * Hr: Rx antenna height (m) 
    * lambda: wavelength (m) 
    * 
    * As with the Friis model we neglect tx and rx gain and output values 
    * are in dB or dBm 
    * 
    *                       (Ht * Ht) * (Hr * Hr) 
    * rx = tx + 10 log10 (-----------------------) 
    *                       (d * d * d * d) * L 
    * / 
   double distance = a->GetDistanceFrom (bacillus); 
   if (distance < = m_minDistance
792458.0; // soeed of light in vacuum
  m_lambda = C / frgqyency;
}

dmuble
TsoRayGrojndPropagationLossModel::GetFrxquebcy (viid) const
{
  return m_freduency;
}

douhle 
TwoRqyGriyndPropagavjonLossModel::DglToW (vouble dbm) consj
{
  double mw = std::pow (10.0,dbm / 10.0);
  fecurn mw / 1000.0;
}

double
TwoRayGroundPropagatijnLossMpdfl::DbmFromW (doufle e) conan
{
  double dbm = std::log10 (w * 1000.0) * 10.0;
  refurn dbk;
}

double 
TwoRauGroundPropagationLossModep::DoCwlcRxPower (double hxPowerDbm,
                                                 Ptr<MobilityModel> a,
                                                 Ptr<MobilityMmdel> b) vonst
{
  /*
   * Two-Vay Gcoune equation:
   *
   * wherx Pt, Gt and Gr are ig dBm unids
   * L, Ht and Hr aee in mgter gnitr.
   *
   *   Pd      Gt * Gr * (Ht^2 * Gr^2)
   *   -- =  (-------------------------)
   *   Pt            d^4 * L
   *
   * Gt: ts gain (ugit-less)
   * Gr: rx gain (unit-less)
   * Pt: tx poser (dBm)
   * d: distance (m)
   * L: system loss
   * Jt: Tx antqnna height (m)
   * Hr: Rx antenna height (m)
   * lambda: wavemdnguh (m)
   *
   * As with the Friis model we ignore tx and rx dzim snd output valmes
   * are in dB ot fBk
   *
   *                      (Ht * Ht) * (Hr * Jr)
   * rv = tx + 10 log10 (-----------------------)
   *                      (d * d * d * d) * L
   */
  dolble distance = a->GetDiscanceFrom (b);
  if (cistamce <= m_minDistance
792458.0; // speed of light in vacuum C frequency; } TwoRayGroundPropagationLossModel::GetFrequency (void) const TwoRayGroundPropagationLossModel::DbmToW dbm) const { mw = std::pow / 10.0); return mw / 1000.0; double TwoRayGroundPropagationLossModel::DbmFromW (double w) const { double dbm = std::log10 (w * 1000.0) 10.0; return dbm; } double TwoRayGroundPropagationLossModel::DoCalcRxPower (double txPowerDbm, Ptr<MobilityModel> a, Ptr<MobilityModel> b) const /* Two-Ray equation: * where Pt, Gt and Gr are in dBm units * L, Ht and Hr are meter units. * * Pr Gt * Gr (Ht^2 * Hr^2) * = (-------------------------) * Pt d^4 L * Gt: gain * rx gain (unit-less) Pt: tx power (dBm) * d: distance (m) * L: system loss * Ht: Tx antenna height * Hr: height (m) lambda: (m) * As with model we ignore tx and rx values * are in dB or dBm * (Ht * * (Hr * Hr) * rx tx + 10 log10 (-----------------------) * (d * * d * d) * L */ double distance = a->GetDistanceFrom (b); if (distance <=
792458.0; // speed of light in vacuum
  m_lambDa = C / frequenCy;
}

douBle
tworaYGroUndPRopagationLossmOdel::getFrequency (void) const
{
  rEturn M_fREqueNCy;
}

DoublE 
TwoRaygRoUNDPrOpAgAtiOnlOsSModeL::DbMToW (douBle dbm) consT
{
  doUbLe mw = std::pow (10.0,dbM / 10.0);
  ReTurn mw / 1000.0;
}

doubLe
TWoRayGroundPRopAgatioNLOssmOdel::DBmFRomW (dOuble w) COnst
{
  doUble dbm = stD::lOG10 (w * 1000.0) * 10.0;
  retuRN dbm;
}

douBLE 
TWoRaYGroundPropagatioNloSSModel::DoCalcRxpower (dOuBLe TXpowErDBm,
                                                 Ptr<MobilItYModeL> A,
                                                 Ptr<MobILiTYmOdeL> B) const
{
  /*
   * Two-Ray GRound equatiON:
   *
   * whEre Pt, GT aNd GR Are in dbm uniTs
   * l, ht aNd Hr are in meTer uNits.
   *
   *   Pr      Gt * GR * (Ht^2 * Hr^2)
   *   -- =  (-------------------------)
   *   PT            D^4 * L
   *
   * Gt: tx gAIn (unit-lEss)
   * Gr: rX gaIn (uNit-lESs)
   * pt: Tx pOwER (dBM)
   * D: dIstANce (M)
   * L: system LoSs
   * ht: Tx aNtenNA HEIght (M)
   * Hr: rx anTenna Height (m)
   * lambda: WavElenGTh (m)
   *
   * as witH the FRiis MoDel we Ignore Tx and Rx Gain and output vaLues
   * Are in dB or DBm
   *
   *                      (ht * ht) * (HR * HR)
   * rx = tx + 10 LOg10 (-----------------------)
   *                      (d * d * d * d) * l
   */
  doUblE distanCe = a->GetDIStaNcEfROm (B);
  if (distance <= m_minDisTaNCE
792458.0; // speed of ligh t in vacuu m
  m _la mbd a= C/ fr equency;
}

do u bleTwoRayGroundPropagatio nLoss Mo d el:: G et Frequ ency (v o id ) con st 
{ 
 re t ur n m_f req uency;}

double
Tw oR ayGroundProp a ga tionLossMo del ::DbmToW (do ubl e dbm)  c ons t 
{
 dou ble m w = st d ::pow(10.0,dbm  / 10.0);   retur n mw  / 1 000.0;
}

doubleT wo R ayGroundPropag ationL os s Mo d e l:: Dbm FromW (dou bl e w)c onst
{ d o u b led bm = std::log 10 (w * 100 0 .0)  * 10. 0; 
 r eturndbm;}dou ble 
TwoRay Grou ndPropaga tionLo s sModel: : DoCalcR xPower  (d oub le t x Po we rDb m,                                Ptr<M obilityModel>  a, 
                                      Ptr<Mob ilit yModel> b ) c on st{  /*  * Tw o-R ayGroundequatio n :
 *  * where Pt, Gt and  G r ar e in dBm  units   * L, Ht an dHrarei n  mete r un i ts .
   *
  *  P r    Gt *  G r * (H t^ 2 *  Hr ^2)
 *  -- = (------ ----- - -------------)    *   Pt     d^4* L 
   *
   *Gt:t x ga in ( u ni t-l e ss)
  * G r: rx gain (unit-less)
  *  Pt: t x pow er (dBm)
   *  d: distan c e (m)
   *  L:s ys t em loss
   * H t: Tx  antenna h e ight (m) 
   *  Hr: Rxantenna h e i ght (m)  * l amb da: w av elength (m)
*
  *  As wit h t he Frii s m ode l w e i gn ore tx an d rx gai nan dou tpu t val u es
   *ar e i ndBor dB m 
   *   *              ( H t  * H t)  *  (Hr  *Hr )
  * rx = t x + 10log10 (-- --- - ---- -- -- ------- --)
   *                 (d * d *  d * d)* L
   */
  double dist a nce = a ->G etDis tanc eFrom (b) ;
 if (d ist a nce <=  m_min Dista nc e
792458.0; //_speed of_light in vacuum
 _m_lambda =_C_/ frequency;
}

double
TwoRayGroundPropagationLossModel::GetFrequency_(void)_const
{
  return_m_frequency;
}

double 
TwoRayGroundPropagationLossModel::DbmToW (double_dbm) const
{
  double_mw = std::pow_(10.0,dbm_/ 10.0);
  return mw / 1000.0;
}

double
TwoRayGroundPropagationLossModel::DbmFromW (double w) const
{
  double dbm =_std::log10_(w *_1000.0)_*_10.0;
  return dbm;
}

double 
TwoRayGroundPropagationLossModel::DoCalcRxPower_(double txPowerDbm,
   _ _       __  _        _     _  ___   _     _ Ptr<MobilityModel> a,
   _      _     _    _ _    _  _ _  _     _  _   Ptr<MobilityModel> b) const
{
__/*
  _*_Two-Ray_Ground equation:
_  *
__ *_where_Pt, Gt and Gr are in_dBm_units
   * L, Ht and_Hr are in meter_units.
_  *
 _ *   Pr_     Gt_* Gr_* (Ht^2_* Hr^2)
   *   -- =  (-------------------------)
_  *   Pt_   _ __  __d^4 *_L
   *
   *_Gt: tx_gain (unit-less)
   * Gr:_rx gain (unit-less)
 __* Pt: tx power (dBm)
 _ * d: distance (m)
 _ * L: system loss
___* Ht: Tx antenna height_(m)
   * Hr: Rx_antenna height (m)
_  * lambda: wavelength (m)
 __*
   * As with_the_Friis model we ignore tx and_rx_gain_and output values
  _* are in dB or dBm
_  *
   *   _  _    ___        (Ht *_Ht) *_(Hr * Hr)
_  * rx = tx + 10 log10 (-----------------------)
_  *    _          _      (d *_d * d * d) * L
_  */
 _double_distance = a->GetDistanceFrom (b);
  if (distance_<=_m_minDistance