|
149 |
if (std::abs (pit->GetAmp ()) > maxAmp) |
149 |
if (std::abs (pit->GetAmp ()) > maxAmp) |
150 |
{ |
150 |
{ |
151 |
maxAmp = std::abs (pit->GetAmp ()); |
151 |
maxAmp = std::abs (pit->GetAmp ()); |
152 |
// Modified in order to subtract delay of first tap (maxTapDelay appears to be used later in code |
152 |
// Modified in order to subtract delay of first tap (maxTapDelay appears to be used later in code |
153 |
// as delay from first reception, not from TX time) |
153 |
// as delay from first reception, not from TX time) |
154 |
maxTapDelay = pit->GetDelay ().GetSeconds () - pdp.GetTap(0).GetDelay().GetSeconds(); |
154 |
maxTapDelay = pit->GetDelay ().GetSeconds () - pdp.GetTap (0).GetDelay ().GetSeconds (); |
155 |
} |
155 |
} |
156 |
} |
156 |
} |
157 |
|
157 |
|
158 |
|
158 |
|
159 |
double effRxPowerDb = rxPowerDb + KpToDb (csp); |
159 |
double effRxPowerDb = rxPowerDb + KpToDb (csp); |
160 |
//It appears to be just the first elements of the sum in Parrish paper, |
160 |
//It appears to be just the first elements of the sum in Parrish paper, |
161 |
// "System Design Considerations for Undersea Networks: Link and Multiple Access Protocols", eq. 14 |
161 |
// "System Design Considerations for Undersea Networks: Link and Multiple Access Protocols", eq. 14 |
162 |
double isiUpa = DbToKp(rxPowerDb) * pdp.SumTapsFromMaxNc (Seconds (ts + clearingTime), Seconds (ts)); // added DpToKp() |
162 |
double isiUpa = DbToKp (rxPowerDb) * pdp.SumTapsFromMaxNc (Seconds (ts + clearingTime), Seconds (ts)); // added DpToKp() |
163 |
UanTransducer::ArrivalList::const_iterator it = arrivalList.begin (); |
163 |
UanTransducer::ArrivalList::const_iterator it = arrivalList.begin (); |
164 |
double intKp = -DbToKp (effRxPowerDb); |
164 |
double intKp = -DbToKp (effRxPowerDb); |
165 |
for (; it != arrivalList.end (); it++) |
165 |
for (; it != arrivalList.end (); it++) |
|
493 |
/*************** UanPhyGen definition *****************/ |
493 |
/*************** UanPhyGen definition *****************/ |
494 |
UanPhyGen::UanPhyGen () |
494 |
UanPhyGen::UanPhyGen () |
495 |
: UanPhy (), |
495 |
: UanPhy (), |
496 |
m_state (IDLE), |
496 |
m_state (IDLE), |
497 |
m_channel (0), |
497 |
m_channel (0), |
498 |
m_transducer (0), |
498 |
m_transducer (0), |
499 |
m_device (0), |
499 |
m_device (0), |
500 |
m_mac (0), |
500 |
m_mac (0), |
501 |
m_txPwrDb (0), |
501 |
m_txPwrDb (0), |
502 |
m_rxThreshDb (0), |
502 |
m_rxThreshDb (0), |
503 |
m_ccaThreshDb (0), |
503 |
m_ccaThreshDb (0), |
504 |
m_pktRx (0), |
504 |
m_pktRx (0), |
505 |
m_pktTx (0), |
505 |
m_pktTx (0), |
506 |
m_cleared (false) |
506 |
m_cleared (false) |
507 |
{ |
507 |
{ |
508 |
m_pg = CreateObject<UniformRandomVariable> (); |
508 |
m_pg = CreateObject<UniformRandomVariable> (); |
509 |
|
509 |
|
|
741 |
m_state = IDLE; |
741 |
m_state = IDLE; |
742 |
} |
742 |
} |
743 |
UpdatePowerConsumption (IDLE); |
743 |
UpdatePowerConsumption (IDLE); |
|
|
744 |
|
745 |
NotifyListenersTxEnd (); |
744 |
} |
746 |
} |
745 |
|
747 |
|
746 |
void |
748 |
void |
|
1004 |
UanPhyGen::SetSleepMode (bool sleep ) |
1006 |
UanPhyGen::SetSleepMode (bool sleep ) |
1005 |
{ |
1007 |
{ |
1006 |
if (sleep ) |
1008 |
if (sleep ) |
1007 |
{ |
1009 |
{ |
1008 |
m_state = SLEEP; |
1010 |
m_state = SLEEP; |
1009 |
if (!m_energyCallback.IsNull ()) |
1011 |
if (!m_energyCallback.IsNull ()) |
1010 |
{ |
1012 |
{ |
1011 |
m_energyCallback (SLEEP); |
1013 |
m_energyCallback (SLEEP); |
1012 |
} |
1014 |
} |
1013 |
} |
1015 |
} |
1014 |
else if (m_state == SLEEP) |
1016 |
else if (m_state == SLEEP) |
1015 |
{ |
1017 |
{ |
1016 |
if (GetInterferenceDb ((Ptr<Packet>) 0) > m_ccaThreshDb) |
1018 |
if (GetInterferenceDb ((Ptr<Packet>) 0) > m_ccaThreshDb) |
|
1155 |
} |
1157 |
} |
1156 |
} |
1158 |
} |
1157 |
|
1159 |
|
|
|
1160 |
void |
1161 |
UanPhyGen::NotifyListenersTxEnd (void) |
1162 |
{ |
1163 |
ListenerList::const_iterator it = m_listeners.begin (); |
1164 |
for (; it != m_listeners.end (); it++) |
1165 |
{ |
1166 |
(*it)->NotifyTxEnd (); |
1167 |
} |
1168 |
} |
1169 |
|
1158 |
uint32_t |
1170 |
uint32_t |
1159 |
UanPhyGen::GetNModes (void) |
1171 |
UanPhyGen::GetNModes (void) |
1160 |
{ |
1172 |
{ |