satellite-interference.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Sami Rantanen <sami.rantanen@magister.fi>
19  */
20 
21 #ifndef SATELLITE_INTERFERENCE_H
22 #define SATELLITE_INTERFERENCE_H
23 
24 #include <ns3/mac48-address.h>
25 #include <ns3/nstime.h>
26 #include <ns3/object.h>
27 #include <ns3/simple-ref-count.h>
28 
29 #include <map>
30 #include <stdint.h>
31 #include <utility>
32 #include <vector>
33 
34 namespace ns3
35 {
36 
41 class SatInterference : public Object
42 {
43  public:
47  class InterferenceChangeEvent : public SimpleRefCount<SatInterference::InterferenceChangeEvent>
48  {
49  public:
57  InterferenceChangeEvent(uint32_t id,
58  Time duration,
59  double rxPower,
60  Address satEarthStationAddress);
61 
66 
70  uint32_t GetId(void) const;
71 
75  Time GetDuration(void) const;
76 
80  Time GetStartTime(void) const;
81 
85  Time GetEndTime(void) const;
86 
90  double GetRxPower(void) const;
91 
95  Address GetSatEarthStationAddress(void) const;
96 
97  private:
99  Time m_endTime;
100  double m_rxPower;
101  uint32_t m_id;
103  };
104 
108  static TypeId GetTypeId(void);
109 
113  TypeId GetInstanceTypeId(void) const;
114 
118  SatInterference();
119 
124 
135  Ptr<SatInterference::InterferenceChangeEvent> Add(Time rxDuration,
136  double rxPower,
137  Address rxAddress);
138 
145  std::vector<std::pair<double, double>> Calculate(
146  Ptr<SatInterference::InterferenceChangeEvent> event);
147 
151  void Reset(void);
152 
157  virtual void NotifyRxStart(Ptr<SatInterference::InterferenceChangeEvent> event);
158 
163  virtual void NotifyRxEnd(Ptr<SatInterference::InterferenceChangeEvent> event);
164 
170  virtual bool HasCollision(Ptr<SatInterference::InterferenceChangeEvent> event);
171 
172  private:
184  virtual Ptr<SatInterference::InterferenceChangeEvent> DoAdd(Time rxDuration,
185  double rxPower,
186  Address rxAddress) = 0;
187 
197  virtual std::vector<std::pair<double, double>> DoCalculate(
198  Ptr<SatInterference::InterferenceChangeEvent> event) = 0;
199 
205  virtual void DoReset(void) = 0;
206 
214  virtual void DoNotifyRxStart(Ptr<SatInterference::InterferenceChangeEvent> event) = 0;
215 
223  virtual void DoNotifyRxEnd(Ptr<SatInterference::InterferenceChangeEvent> event) = 0;
224 
227 
231  std::map<Ptr<SatInterference::InterferenceChangeEvent>, bool> m_packetCollisions;
232 
237 };
238 
239 } // namespace ns3
240 
241 #endif /* SATELLITE_INTERFERENCE_H */
Event for identifying interference change events (receiving)
~InterferenceChangeEvent()
Destructor of Event for satellite interference.
InterferenceChangeEvent(uint32_t id, Time duration, double rxPower, Address satEarthStationAddress)
Constructor of Event for satellite interference.
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.
SatInterference(const SatInterference &o)
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.
SatInterference & operator=(const SatInterference &o)
~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.