24 #include <ns3/simulator.h>
30 NS_LOG_COMPONENT_DEFINE(
"SatInterference");
38 Address satEarthStationAddress)
39 : m_startTime(Simulator::Now()),
40 m_endTime(m_startTime + rxDuration),
43 m_satEarthStationAddress(satEarthStationAddress)
54 NS_LOG_FUNCTION(
this);
62 NS_LOG_FUNCTION(
this);
64 return m_endTime - m_startTime;
70 NS_LOG_FUNCTION(
this);
78 NS_LOG_FUNCTION(
this);
86 NS_LOG_FUNCTION(
this);
94 NS_LOG_FUNCTION(
this);
96 return m_satEarthStationAddress;
108 static TypeId tid = TypeId(
"ns3::SatInterference").SetParent<Object>();
128 Ptr<SatInterference::InterferenceChangeEvent>
131 NS_LOG_FUNCTION(
this << duration.GetSeconds() << power << rxAddress);
133 return DoAdd(duration, power, rxAddress);
136 std::vector<std::pair<double, double>>
139 NS_LOG_FUNCTION(
this);
143 std::map<Ptr<SatInterference::InterferenceChangeEvent>,
bool>::iterator iter;
144 bool wasCollisionReported =
true;
150 wasCollisionReported =
false;
154 if (!wasCollisionReported)
156 NS_LOG_INFO(
"Packet collision!");
166 NS_LOG_FUNCTION(
this);
177 NS_LOG_FUNCTION(
this);
181 std::pair<std::map<Ptr<SatInterference::InterferenceChangeEvent>,
bool>::iterator,
bool> result;
186 NS_FATAL_ERROR(
"SatInterference::NotifyRxStart - Event already exists");
195 NS_LOG_FUNCTION(
this);
210 NS_LOG_FUNCTION(
this);
212 std::map<Ptr<SatInterference::InterferenceChangeEvent>,
bool>::iterator result =
217 NS_FATAL_ERROR(
"SatInterference::HasCollision - Event not found");
220 return result->second;
Time GetEndTime(void) const
~InterferenceChangeEvent()
Destructor of Event for satellite interference.
Time GetDuration(void) const
double GetRxPower(void) const
Address GetSatEarthStationAddress(void) const
InterferenceChangeEvent(uint32_t id, Time duration, double rxPower, Address satEarthStationAddress)
Constructor of Event for satellite interference.
uint32_t GetId(void) const
Time GetStartTime(void) const
Abstract class defining interface for interference calculations objects.
TypeId GetInstanceTypeId(void) const
Derived from Object.
virtual void DoNotifyRxStart(Ptr< SatInterference::InterferenceChangeEvent > event)=0
Notifies that RX is started by a receiver.
void Reset(void)
Resets current interference.
virtual std::vector< std::pair< double, double > > DoCalculate(Ptr< SatInterference::InterferenceChangeEvent > event)=0
Calculates interference power for the given reference Sets final power at end time to finalPower.
Ptr< SatInterference::InterferenceChangeEvent > Add(Time rxDuration, double rxPower, Address rxAddress)
Adds interference power to interference object.
uint32_t m_currentlyReceiving
~SatInterference()
Destructor for Satellite interference base class.
virtual Ptr< SatInterference::InterferenceChangeEvent > DoAdd(Time rxDuration, double rxPower, Address rxAddress)=0
Adds interference power to interference object.
static TypeId GetTypeId(void)
Derived from Object.
virtual void DoNotifyRxEnd(Ptr< SatInterference::InterferenceChangeEvent > event)=0
Notifies that RX is ended by a receiver.
virtual void NotifyRxEnd(Ptr< SatInterference::InterferenceChangeEvent > event)
Notifies that RX is ended by a receiver.
virtual void DoReset(void)=0
Resets current interference.
virtual void NotifyRxStart(Ptr< SatInterference::InterferenceChangeEvent > event)
Notifies that RX is started by a receiver.
virtual bool HasCollision(Ptr< SatInterference::InterferenceChangeEvent > event)
Checks whether the packet has collided.
std::vector< std::pair< double, double > > Calculate(Ptr< SatInterference::InterferenceChangeEvent > event)
Calculates interference power for the given reference.
SatInterference()
Constructor for Satellite interference base class.
std::map< Ptr< SatInterference::InterferenceChangeEvent >, bool > m_packetCollisions
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.