From 1352cf85db9562e653f08e9d5f264d6047ad23cf Mon Sep 17 00:00:00 2001 From: Federico Guerra Date: Wed, 16 Aug 2017 16:52:11 -0700 Subject: [PATCH] uan: (fixes #2299) WOSS integration + FH-FSK Interference rev. --- src/uan/model/uan-channel.h | 11 +++++------ src/uan/model/uan-net-device.cc | 11 +++++++++++ src/uan/model/uan-net-device.h | 4 ++-- src/uan/model/uan-phy-gen.cc | 20 +++++++++++++------- src/uan/model/uan-phy-gen.h | 8 ++++++++ src/uan/model/uan-prop-model.h | 7 +++++++ 6 files changed, 46 insertions(+), 15 deletions(-) diff --git a/src/uan/model/uan-channel.h b/src/uan/model/uan-channel.h index 144734eec..dd0b9b9b0 100644 --- a/src/uan/model/uan-channel.h +++ b/src/uan/model/uan-channel.h @@ -72,8 +72,8 @@ public: * \param txPowerDb Transmission power in dB. * \param txmode UanTxMode defining modulation of transmitted packet. */ - void TxPacket (Ptr src, Ptr packet, double txPowerDb, - UanTxMode txmode); + virtual void TxPacket (Ptr src, Ptr packet, double txPowerDb, + UanTxMode txmode); /** * Adds device to receiver list for this channel. @@ -111,12 +111,12 @@ public: * Clear all pointer references. */ void Clear (void); -private: +protected: UanDeviceList m_devList; //!< The list of devices on this channel. Ptr m_prop; //!< The propagation model. Ptr m_noise; //!< The noise model. /** Has Clear ever been called on the channel. */ - bool m_cleared; + bool m_cleared; /** * Send a packet up to the receiving UanTransducer. @@ -128,8 +128,7 @@ private: * \param pdp PDP of arriving signal. */ void SendUp (uint32_t i, Ptr packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp); - -protected: + virtual void DoDispose (void); }; // class UanChannel diff --git a/src/uan/model/uan-net-device.cc b/src/uan/model/uan-net-device.cc index 10f83868f..6f772c3c2 100644 --- a/src/uan/model/uan-net-device.cc +++ b/src/uan/model/uan-net-device.cc @@ -78,6 +78,17 @@ UanNetDevice::Clear () } } +void +UanNetDevice::DoInitialize (void) +{ + m_phy->Initialize (); + m_mac->Initialize (); + m_channel->Initialize (); + m_trans->Initialize (); + + NetDevice::DoInitialize (); +} + void UanNetDevice::DoDispose () { diff --git a/src/uan/model/uan-net-device.h b/src/uan/model/uan-net-device.h index ddaeb73a2..8cdfad35f 100644 --- a/src/uan/model/uan-net-device.h +++ b/src/uan/model/uan-net-device.h @@ -190,8 +190,8 @@ private: bool m_cleared; protected: - virtual void DoDispose (); - + virtual void DoDispose (void); + virtual void DoInitialize (void); }; // class UanNetDevice } // namespace ns3 diff --git a/src/uan/model/uan-phy-gen.cc b/src/uan/model/uan-phy-gen.cc index 15b9ab382..671296f7f 100644 --- a/src/uan/model/uan-phy-gen.cc +++ b/src/uan/model/uan-phy-gen.cc @@ -150,14 +150,17 @@ UanPhyCalcSinrFhFsk::CalcSinrDb (Ptr pkt, if (std::abs (pit->GetAmp ()) > maxAmp) { maxAmp = std::abs (pit->GetAmp ()); - maxTapDelay = pit->GetDelay ().GetSeconds (); + // Modified in order to subtract delay of first tap (maxTapDelay appears to be used later in code + // as delay from first reception, not from TX time) + maxTapDelay = pit->GetDelay ().GetSeconds () - pdp.GetTap(0).GetDelay().GetSeconds(); } } double effRxPowerDb = rxPowerDb + KpToDb (csp); - - double isiUpa = rxPowerDb * pdp.SumTapsFromMaxNc (Seconds (ts + clearingTime), Seconds (ts)); + //It appears to be just the first elements of the sum in Parrish paper, + // "System Design Considerations for Undersea Networks: Link and Multiple Access Protocols", eq. 14 + double isiUpa = DbToKp(rxPowerDb) * pdp.SumTapsFromMaxNc (Seconds (ts + clearingTime), Seconds (ts)); // added DpToKp() UanTransducer::ArrivalList::const_iterator it = arrivalList.begin (); double intKp = -DbToKp (effRxPowerDb); for (; it != arrivalList.end (); it++) @@ -178,20 +181,23 @@ UanPhyCalcSinrFhFsk::CalcSinrDb (Ptr pkt, } double intPower = 0.0; - if (tDelta < ts) + if (tDelta < ts) // Case where there is overlap of a symbol due to interferer arriving just after desired signal { + //Appears to be just the first two elements of the sum in Parrish paper, eq. 14 intPower += intPdp.SumTapsNc (Seconds (0), Seconds (ts - tDelta)); intPower += intPdp.SumTapsNc (Seconds (ts - tDelta + clearingTime), Seconds (2 * ts - tDelta + clearingTime)); } - else + else // Account for case where there's overlap of a symbol due to interferer arriving with a tDelta of a symbol + clearing time later { + // Appears to be just the first two elements of the sum in Parrish paper, eq. 14 Time start = Seconds (ts + clearingTime - tDelta); - Time end = start + Seconds (ts); + Time end = /*start +*/ Seconds (ts); // Should only sum over portion of ts that overlaps, not entire ts intPower += intPdp.SumTapsNc (start, end); start = start + Seconds (ts + clearingTime); - end = start + Seconds (ts); + //Should only sum over portion of ts that overlaps, not entire ts + end = end + Seconds (ts + clearingTime); //start + Seconds (ts); intPower += intPdp.SumTapsNc (start, end); } intKp += DbToKp (it->GetRxPowerDb ()) * intPower; diff --git a/src/uan/model/uan-phy-gen.h b/src/uan/model/uan-phy-gen.h index 36c165a8b..6cf0ec514 100644 --- a/src/uan/model/uan-phy-gen.h +++ b/src/uan/model/uan-phy-gen.h @@ -177,6 +177,14 @@ public: * clearing time between symbols transmitted on the same frequency. * This clearing time combats ISI from channel delay spread and also has * a byproduct of possibly reducing interference from other transmitted packets. + * + * Thanks to Randall Plate for the latest model revision based on the following + * papers: + *
    + *
  • Parrish, "System Design Considerations for Undersea Networks: Link and Multiple Access Protocols" + *
  • Siderius, "Effects of Ocean Thermocline Variability on Noncoherent Underwater Acoustic Communications" + *
  • Rao, "Channel Coding Techniques for Wireless Communications", ch 2 + *
*/ class UanPhyCalcSinrFhFsk : public UanPhyCalcSinr { diff --git a/src/uan/model/uan-prop-model.h b/src/uan/model/uan-prop-model.h index b13a832ab..51e1426e1 100644 --- a/src/uan/model/uan-prop-model.h +++ b/src/uan/model/uan-prop-model.h @@ -234,6 +234,13 @@ public: */ std::complex SumTapsFromMaxC (Time delay, Time duration) const; + /** + * Creates a new UanPdp normalized to its non coherent sum. + * \see SumTapsNc + * \returns the new PDP + */ + UanPdp NormalizeToSumNc (void); + /** * Get a unit impulse PDP at time 0. *