From 37631d0758b4c67669d59797a010be536e266215 Mon Sep 17 00:00:00 2001 From: Tim Schubert Date: Fri, 28 Aug 2020 21:29:57 +0200 Subject: [PATCH] Use speed of light in air --- examples/leo-delay-tracing-example.cc | 1 - helper/leo-channel-helper.cc | 4 +++- helper/leo-channel-helper.h | 1 + model/leo-propagation-loss-model.h | 1 + model/mock-channel.cc | 6 ++++++ model/mock-channel.h | 6 ++++-- 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/examples/leo-delay-tracing-example.cc b/examples/leo-delay-tracing-example.cc index 94153b7..ae77c2e 100644 --- a/examples/leo-delay-tracing-example.cc +++ b/examples/leo-delay-tracing-example.cc @@ -143,7 +143,6 @@ int main (int argc, char *argv[]) //aodv.Set ("RreqRetries", UintegerValue (1000)); //aodv.Set ("RerrRateLimit", UintegerValue (1000)); //aodv.Set ("RreqRateLimit", UintegerValue (10)); - aodv.Set ("TtlIncrement", UintegerValue (5)); aodv.Set ("TtlThreshold", UintegerValue (25)); aodv.Set ("NetDiameter", UintegerValue (50)); stack.SetRoutingHelper (aodv); diff --git a/helper/leo-channel-helper.cc b/helper/leo-channel-helper.cc index 41a2c27..48a6ce7 100644 --- a/helper/leo-channel-helper.cc +++ b/helper/leo-channel-helper.cc @@ -39,7 +39,8 @@ LeoChannelHelper::LeoChannelHelper () m_channelFactory.Set ("PropagationDelay", StringValue ("ns3::ConstantSpeedPropagationDelayModel")); m_propagationLossFactory.SetTypeId ("ns3::LeoPropagationLossModel"); - + m_propagationDelayFactory.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel"); + m_propagationDelayFactory.Set ("Speed", DoubleValue (LEO_SPEED_OF_LIGHT_IN_AIR)); } LeoChannelHelper::LeoChannelHelper (std::string constellation) : @@ -338,6 +339,7 @@ LeoChannelHelper::Install (std::vector > &satellites, std::vector channel = m_channelFactory.Create (); channel->SetPropagationLoss (m_propagationLossFactory.Create ()); + channel->SetPropagationDelay (m_propagationLossFactory.Create ()); NetDeviceContainer container; diff --git a/helper/leo-channel-helper.h b/helper/leo-channel-helper.h index d9baa5c..3a98701 100644 --- a/helper/leo-channel-helper.h +++ b/helper/leo-channel-helper.h @@ -62,6 +62,7 @@ private: ObjectFactory m_channelFactory; ObjectFactory m_propagationLossFactory; + ObjectFactory m_propagationDelayFactory; void SetQueue (ObjectFactory &factory, std::string type, diff --git a/model/leo-propagation-loss-model.h b/model/leo-propagation-loss-model.h index 7c1478f..108ddbf 100644 --- a/model/leo-propagation-loss-model.h +++ b/model/leo-propagation-loss-model.h @@ -7,6 +7,7 @@ #include #define LEO_PROP_EARTH_RAD 6.37101e6 +#define LEO_SPEED_OF_LIGHT_IN_AIR 299702458 namespace ns3 { diff --git a/model/mock-channel.cc b/model/mock-channel.cc index fec4bac..318ed30 100644 --- a/model/mock-channel.cc +++ b/model/mock-channel.cc @@ -191,4 +191,10 @@ MockChannel::Deliver ( return true; } +void +MockChannel::SetPropagationDelay (Ptr delay) +{ + m_propagationDelay = delay; +} + } // namespace ns3 diff --git a/model/mock-channel.h b/model/mock-channel.h index a529234..d40e5ba 100644 --- a/model/mock-channel.h +++ b/model/mock-channel.h @@ -72,9 +72,12 @@ public: std::size_t GetNDevices (void) const; virtual bool TransmitStart (Ptr p, uint32_t devId, Address dst, Time txTime) = 0; - Ptr GetPropagationLoss () const; + Ptr GetPropagationLoss (void) const; void SetPropagationLoss (Ptr model); + Ptr GetPropagationDelay (void) const; + void SetPropagationDelay (Ptr delay); + protected: TracedCallback, // Packet being transmitted Ptr, // Transmitting NetDevice @@ -89,7 +92,6 @@ protected: */ Time GetPropagationDelay (Ptr first, Ptr second, Time txTime) const; - Ptr GetPropagationDelay () const; Ptr GetDevice (Address &addr) const; bool Deliver ( Ptr p, Ptr src, Ptr dst, Time txTime);