View | Details | Raw Unified | Return to bug 938
Collapse All | Expand All

(-)a/src/spectrum/examples/adhoc-aloha-ideal-phy-matrix-propagation-loss-model.cc (-1 / +3 lines)
 Lines 61-66    Link Here 
61
61
62
62
63
/**
63
/**
64
 * \ingroup spectrum
65
 *
64
 * Store the last pathloss value for each TX-RX pair. This is an
66
 * Store the last pathloss value for each TX-RX pair. This is an
65
 * example of how the PathlossTrace (provided by some SpectrumChannel
67
 * example of how the PathlossTrace (provided by some SpectrumChannel
66
 * implementations) work. 
68
 * implementations) work. 
 Lines 87-93    Link Here 
87
  void Print ();
89
  void Print ();
88
90
89
private:
91
private:
90
  std::map<uint32_t, std::map<uint32_t, double> > m_pathlossMap;
92
  std::map<uint32_t, std::map<uint32_t, double> > m_pathlossMap; //!< Path loss map
91
};
93
};
92
94
93
void
95
void
(-)a/src/spectrum/helper/adhoc-aloha-noack-ideal-phy-helper.h (-7 / +7 lines)
 Lines 138-150    Link Here 
138
138
139
139
140
protected:
140
protected:
141
  ObjectFactory m_phy;
141
  ObjectFactory m_phy;      //!< Object factory for the phy objects
142
  ObjectFactory m_device;
142
  ObjectFactory m_device;   //!< Object factory for the NetDevice objects
143
  ObjectFactory m_queue;
143
  ObjectFactory m_queue;    //!< Object factory for the Queue objects
144
  ObjectFactory m_antenna;
144
  ObjectFactory m_antenna;  //!< Object factory for the Antenna objects
145
  Ptr<SpectrumChannel> m_channel;
145
  Ptr<SpectrumChannel> m_channel; //!< Channel
146
  Ptr<SpectrumValue> m_txPsd;
146
  Ptr<SpectrumValue> m_txPsd;     //!< Tx power spectral density
147
  Ptr<SpectrumValue> m_noisePsd;
147
  Ptr<SpectrumValue> m_noisePsd;  //!< Noise power spectral density
148
};
148
};
149
149
150
150
(-)a/src/spectrum/helper/spectrum-analyzer-helper.cc (+6 lines)
 Lines 39-44    Link Here 
39
39
40
NS_LOG_COMPONENT_DEFINE ("SpectrumAnalyzerHelper");
40
NS_LOG_COMPONENT_DEFINE ("SpectrumAnalyzerHelper");
41
41
42
/**
43
 * \ingroup spectrum
44
 * \brief Writes a report of the Average Power Spectral Density
45
 * \param streamWrapper the wrapper to the output stream
46
 * \param avgPowerSpectralDensity Average Power Spectral Density
47
 */
42
static void
48
static void
43
WriteAveragePowerSpectralDensityReport (Ptr<OutputStreamWrapper> streamWrapper,
49
WriteAveragePowerSpectralDensityReport (Ptr<OutputStreamWrapper> streamWrapper,
44
                                        Ptr<const SpectrumValue> avgPowerSpectralDensity)
50
                                        Ptr<const SpectrumValue> avgPowerSpectralDensity)
(-)a/src/spectrum/helper/spectrum-analyzer-helper.h (-9 / +9 lines)
 Lines 39-45    Link Here 
39
39
40
/**
40
/**
41
 * \ingroup spectrum
41
 * \ingroup spectrum
42
 *
42
 * \brief Class to allow the Spectrum Analysis
43
 */
43
 */
44
class SpectrumAnalyzerHelper
44
class SpectrumAnalyzerHelper
45
{
45
{
 Lines 48-61    Link Here 
48
  ~SpectrumAnalyzerHelper ();
48
  ~SpectrumAnalyzerHelper ();
49
49
50
  /**
50
  /**
51
   * set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
51
   * Set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
52
   *
52
   *
53
   * @param channel
53
   * @param channel
54
   */
54
   */
55
  void SetChannel (Ptr<SpectrumChannel> channel);
55
  void SetChannel (Ptr<SpectrumChannel> channel);
56
56
57
  /**
57
  /**
58
   * set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
58
   * Set the SpectrumChannel that will be used by SpectrumPhy instances created by this helper
59
   *
59
   *
60
   * @param channelName
60
   * @param channelName
61
   */
61
   */
 Lines 141-153    Link Here 
141
141
142
142
143
private:
143
private:
144
  ObjectFactory m_phy;
144
  ObjectFactory m_phy;      //!< Object factory for the phy objects
145
  ObjectFactory m_device;
145
  ObjectFactory m_device;   //!< Object factory for the NetDevice objects
146
  ObjectFactory m_antenna;
146
  ObjectFactory m_antenna;  //!< Object factory for the Antenna objects
147
147
148
  Ptr<SpectrumChannel> m_channel;
148
  Ptr<SpectrumChannel> m_channel; //!< Channel
149
  Ptr<SpectrumModel> m_rxSpectrumModel;
149
  Ptr<SpectrumModel> m_rxSpectrumModel; //!< Spectrum model
150
  std::string m_prefix;
150
  std::string m_prefix; //!< Prefix for the output files
151
};
151
};
152
152
153
153
(-)a/src/spectrum/helper/spectrum-helper.h (-8 / +16 lines)
 Lines 39-49    Link Here 
39
39
40
/**
40
/**
41
 * \ingroup spectrum
41
 * \ingroup spectrum
42
 *
42
 * \brief Setup a SpectrumChannel
43
 */
43
 */
44
class SpectrumChannelHelper
44
class SpectrumChannelHelper
45
{
45
{
46
public:
46
public:
47
  /**
48
   * \brief Setup a default SpectrumChannel. The Default mode is:
49
   * Channel: "ns3::SingleModelSpectrumChannel",
50
   * PropagationDelay: "ns3::ConstantSpeedPropagationDelayModel", and
51
   * SpectrumPropagationLoss: "ns3::FriisSpectrumPropagationLossModel".
52
   *
53
   * \returns a Default-configured SpectrumChannelHelper
54
   */
47
  static SpectrumChannelHelper Default ();
55
  static SpectrumChannelHelper Default ();
48
56
49
  /**
57
  /**
 Lines 190-199    Link Here 
190
  Ptr<SpectrumChannel> Create (void) const;
198
  Ptr<SpectrumChannel> Create (void) const;
191
199
192
private:
200
private:
193
  Ptr<SpectrumPropagationLossModel> m_spectrumPropagationLossModel;
201
  Ptr<SpectrumPropagationLossModel> m_spectrumPropagationLossModel; //!< Spectrum propagation loss model
194
  Ptr<PropagationLossModel> m_propagationLossModel;
202
  Ptr<PropagationLossModel> m_propagationLossModel; //!< Propagation loss model
195
  ObjectFactory m_propagationDelay;
203
  ObjectFactory m_propagationDelay; //!< Propagation delay
196
  ObjectFactory m_channel;
204
  ObjectFactory m_channel; //!< Channel
197
};
205
};
198
206
199
207
 Lines 201-207    Link Here 
201
/**
209
/**
202
 * \ingroup spectrum
210
 * \ingroup spectrum
203
 *
211
 *
204
 * create and configure several SpectrumPhy instances and connect them to a channel.
212
 * Create and configure several SpectrumPhy instances and connect them to a channel.
205
 */
213
 */
206
class SpectrumPhyHelper
214
class SpectrumPhyHelper
207
{
215
{
 Lines 269-276    Link Here 
269
277
270
278
271
private:
279
private:
272
  ObjectFactory m_phy;
280
  ObjectFactory m_phy;      //!< Object factory for the phy objects
273
  Ptr<SpectrumChannel> m_channel;
281
  Ptr<SpectrumChannel> m_channel; //!< Channel
274
};
282
};
275
283
276
284
(-)a/src/spectrum/helper/tv-spectrum-transmitter-helper.cc (-3 / +9 lines)
 Lines 34-41    Link Here 
34
34
35
NS_LOG_COMPONENT_DEFINE ("TvSpectrumTransmitterHelper");
35
NS_LOG_COMPONENT_DEFINE ("TvSpectrumTransmitterHelper");
36
36
37
// NORTH AMERICA: 84 elements (index 0 - 83); valid channels = 2 - 83
37
/// NORTH AMERICA: 84 elements (index 0 - 83); valid channels = 2 - 83
38
const int northAmericaArrayLength = 84;
38
const int northAmericaArrayLength = 84;
39
/// NORTH AMERICA start frequencies
39
const double northAmericaStartFrequencies[84] = {0, 0, 54e6, 60e6, 66e6, 76e6, 
40
const double northAmericaStartFrequencies[84] = {0, 0, 54e6, 60e6, 66e6, 76e6, 
40
  82e6, 174e6, 180e6, 186e6, 192e6, 198e6, 204e6, 210e6, 470e6, 476e6, 482e6, 
41
  82e6, 174e6, 180e6, 186e6, 192e6, 198e6, 204e6, 210e6, 470e6, 476e6, 482e6, 
41
  488e6, 494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 
42
  488e6, 494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 
 Lines 45-50    Link Here 
45
  752e6, 758e6, 764e6, 770e6, 776e6, 782e6, 788e6, 794e6, 800e6, 806e6, 812e6, 
46
  752e6, 758e6, 764e6, 770e6, 776e6, 782e6, 788e6, 794e6, 800e6, 806e6, 812e6, 
46
  818e6, 824e6, 830e6, 836e6, 842e6, 848e6, 854e6, 860e6, 866e6, 872e6, 878e6, 
47
  818e6, 824e6, 830e6, 836e6, 842e6, 848e6, 854e6, 860e6, 866e6, 872e6, 878e6, 
47
  884e6};
48
  884e6};
49
/// NORTH AMERICA end frequencies
48
const double northAmericaEndFrequencies[84] = {0, 0, 60e6, 66e6, 72e6, 82e6, 
50
const double northAmericaEndFrequencies[84] = {0, 0, 60e6, 66e6, 72e6, 82e6, 
49
  88e6, 180e6, 186e6, 192e6, 198e6, 204e6, 210e6, 216e6, 476e6, 482e6, 488e6, 
51
  88e6, 180e6, 186e6, 192e6, 198e6, 204e6, 210e6, 216e6, 476e6, 482e6, 488e6, 
50
  494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 554e6, 
52
  494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 554e6, 
 Lines 55-62    Link Here 
55
  824e6, 830e6, 836e6, 842e6, 848e6, 854e6, 860e6, 866e6, 872e6, 878e6, 884e6, 
57
  824e6, 830e6, 836e6, 842e6, 848e6, 854e6, 860e6, 866e6, 872e6, 878e6, 884e6, 
56
  890e6};
58
  890e6};
57
59
58
// EUROPE: 70 elements (index 0 - 69); valid channels = 5 - 12, 21 - 69
60
/// EUROPE: 70 elements (index 0 - 69); valid channels = 5 - 12, 21 - 69
59
const int europeArrayLength = 70;
61
const int europeArrayLength = 70;
62
/// EUROPE start frequencies
60
const double europeStartFrequencies[70] = {0, 0, 0, 0, 0, 174e6, 181e6, 188e6, 
63
const double europeStartFrequencies[70] = {0, 0, 0, 0, 0, 174e6, 181e6, 188e6, 
61
  195e6, 202e6, 209e6, 216e6, 223e6, 0, 0, 0, 0, 0, 0, 0, 0, 470e6, 478e6, 
64
  195e6, 202e6, 209e6, 216e6, 223e6, 0, 0, 0, 0, 0, 0, 0, 0, 470e6, 478e6, 
62
  486e6, 494e6, 502e6, 510e6, 518e6, 526e6, 534e6, 542e6, 550e6, 558e6, 566e6, 
65
  486e6, 494e6, 502e6, 510e6, 518e6, 526e6, 534e6, 542e6, 550e6, 558e6, 566e6, 
 Lines 64-69    Link Here 
64
  662e6, 670e6, 678e6, 686e6, 694e6, 702e6, 710e6, 718e6, 726e6, 734e6, 742e6, 
67
  662e6, 670e6, 678e6, 686e6, 694e6, 702e6, 710e6, 718e6, 726e6, 734e6, 742e6, 
65
  750e6, 758e6, 766e6, 774e6, 782e6, 790e6, 798e6, 806e6, 814e6, 822e6, 830e6, 
68
  750e6, 758e6, 766e6, 774e6, 782e6, 790e6, 798e6, 806e6, 814e6, 822e6, 830e6, 
66
  838e6, 846e6, 854e6};
69
  838e6, 846e6, 854e6};
70
/// EUROPE end frequencies
67
const double europeEndFrequencies[70] = {0, 0, 0, 0, 0, 181e6, 188e6, 195e6, 
71
const double europeEndFrequencies[70] = {0, 0, 0, 0, 0, 181e6, 188e6, 195e6, 
68
  202e6, 209e6, 216e6, 223e6, 230e6, 0, 0, 0, 0, 0, 0, 0, 0, 478e6, 486e6, 
72
  202e6, 209e6, 216e6, 223e6, 230e6, 0, 0, 0, 0, 0, 0, 0, 0, 478e6, 486e6, 
69
  494e6, 502e6, 510e6, 518e6, 526e6, 534e6, 542e6, 550e6, 558e6, 566e6, 574e6, 
73
  494e6, 502e6, 510e6, 518e6, 526e6, 534e6, 542e6, 550e6, 558e6, 566e6, 574e6, 
 Lines 72-79    Link Here 
72
  758e6, 766e6, 774e6, 782e6, 790e6, 798e6, 806e6, 814e6, 822e6, 830e6, 838e6, 
76
  758e6, 766e6, 774e6, 782e6, 790e6, 798e6, 806e6, 814e6, 822e6, 830e6, 838e6, 
73
  846e6, 854e6, 862e6};
77
  846e6, 854e6, 862e6};
74
78
75
// JAPAN: 63 elements (index 0 - 62); valid channels = 1 - 62
79
/// JAPAN: 63 elements (index 0 - 62); valid channels = 1 - 62
76
const int japanArrayLength = 63;
80
const int japanArrayLength = 63;
81
/// JAPAN start frequencies
77
const double japanStartFrequencies[63] = {0, 90e6, 96e6, 102e6, 170e6, 176e6, 
82
const double japanStartFrequencies[63] = {0, 90e6, 96e6, 102e6, 170e6, 176e6, 
78
  182e6, 188e6, 192e6, 198e6, 204e6, 210e6, 216e6, 470e6, 476e6, 482e6, 488e6, 
83
  182e6, 188e6, 192e6, 198e6, 204e6, 210e6, 216e6, 470e6, 476e6, 482e6, 488e6, 
79
  494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 554e6, 
84
  494e6, 500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 554e6, 
 Lines 81-86    Link Here 
81
  626e6, 632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6, 680e6, 686e6, 
86
  626e6, 632e6, 638e6, 644e6, 650e6, 656e6, 662e6, 668e6, 674e6, 680e6, 686e6, 
82
  692e6, 698e6, 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6, 752e6, 
87
  692e6, 698e6, 704e6, 710e6, 716e6, 722e6, 728e6, 734e6, 740e6, 746e6, 752e6, 
83
  758e6, 764e6};
88
  758e6, 764e6};
89
/// JAPAN end frequencies
84
const double japanEndFrequencies[63] = {0, 96e6, 102e6, 108e6, 176e6, 182e6, 
90
const double japanEndFrequencies[63] = {0, 96e6, 102e6, 108e6, 176e6, 182e6, 
85
  188e6, 194e6, 198e6, 204e6, 210e6, 216e6, 222e6, 476e6, 482e6, 488e6, 494e6, 
91
  188e6, 194e6, 198e6, 204e6, 210e6, 216e6, 222e6, 476e6, 482e6, 488e6, 494e6, 
86
  500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 554e6, 560e6, 
92
  500e6, 506e6, 512e6, 518e6, 524e6, 530e6, 536e6, 542e6, 548e6, 554e6, 560e6, 
(-)a/src/spectrum/helper/tv-spectrum-transmitter-helper.h (-12 / +13 lines)
 Lines 49-65    Link Here 
49
 * and location.
49
 * and location.
50
 *
50
 *
51
 * Here is an example of how to use this class:
51
 * Here is an example of how to use this class:
52
 *
52
 * \code
53
 * TvSpectrumTransmitterHelper tvTransHelper;
53
   TvSpectrumTransmitterHelper tvTransHelper;
54
 * tvTransHelper.SetChannel (channel); // provided that user has a Ptr<SpectrumChannel> ready.
54
   tvTransHelper.SetChannel (channel); // provided that user has a Ptr<SpectrumChannel> ready.
55
 * tvTransHelper.SetAttribute ("StartFrequency", DoubleValue (524e6));
55
   tvTransHelper.SetAttribute ("StartFrequency", DoubleValue (524e6));
56
 * tvTransHelper.SetAttribute ("ChannelBandwidth", DoubleValue (6e6));
56
   tvTransHelper.SetAttribute ("ChannelBandwidth", DoubleValue (6e6));
57
 * tvTransHelper.SetAttribute ("StartingTime", TimeValue (Seconds (0)));
57
   tvTransHelper.SetAttribute ("StartingTime", TimeValue (Seconds (0)));
58
 * tvTransHelper.SetAttribute ("TransmitDuration", TimeValue (Seconds (0.2)));
58
   tvTransHelper.SetAttribute ("TransmitDuration", TimeValue (Seconds (0.2)));
59
 * tvTransHelper.SetAttribute ("BasePsd", DoubleValue (22.22)); 
59
   tvTransHelper.SetAttribute ("BasePsd", DoubleValue (22.22));
60
 * tvTransHelper.SetAttribute ("TvType", EnumValue (TvSpectrumTransmitter::TVTYPE_8VSB));
60
   tvTransHelper.SetAttribute ("TvType", EnumValue (TvSpectrumTransmitter::TVTYPE_8VSB));
61
 * tvTransHelper.SetAttribute ("Antenna", StringValue ("ns3::IsotropicAntennaModel"));
61
   tvTransHelper.SetAttribute ("Antenna", StringValue ("ns3::IsotropicAntennaModel"));
62
 * tvTransHelper.Install (tvTransmitterNode); //provided that user has a NodeContainer ready.
62
   tvTransHelper.Install (tvTransmitterNode); // provided that user has a NodeContainer ready.
63
   \endcode
63
 */
64
 */
64
class TvSpectrumTransmitterHelper
65
class TvSpectrumTransmitterHelper
65
{
66
{
 Lines 204-210    Link Here 
204
  /**
205
  /**
205
   * Assigns the stream number for the uniform random number generator to use
206
   * Assigns the stream number for the uniform random number generator to use
206
   *
207
   *
207
   * @param stream first stream index to use
208
   * @param streamNum first stream index to use
208
   * @return the number of stream indices assigned by this helper
209
   * @return the number of stream indices assigned by this helper
209
   */
210
   */
210
  int64_t AssignStreams (int64_t streamNum);
211
  int64_t AssignStreams (int64_t streamNum);
(-)a/src/spectrum/helper/waveform-generator-helper.h (-5 / +6 lines)
 Lines 40-45    Link Here 
40
/**
40
/**
41
 * \ingroup spectrum
41
 * \ingroup spectrum
42
 *
42
 *
43
 * Create a Waveform generator, which can be used to inject specific noise in the channel.
43
 */
44
 */
44
class WaveformGeneratorHelper
45
class WaveformGeneratorHelper
45
{
46
{
 Lines 134-144    Link Here 
134
135
135
136
136
protected:
137
protected:
137
  ObjectFactory m_phy;
138
  ObjectFactory m_phy;      //!< Object factory for the phy objects
138
  ObjectFactory m_device;
139
  ObjectFactory m_device;   //!< Object factory for the NetDevice objects
139
  ObjectFactory m_antenna;
140
  ObjectFactory m_antenna;  //!< Object factory for the Antenna objects
140
  Ptr<SpectrumChannel> m_channel;
141
  Ptr<SpectrumChannel> m_channel; //!< Channel
141
  Ptr<SpectrumValue> m_txPsd;
142
  Ptr<SpectrumValue> m_txPsd;     //!< Tx power spectral density
142
};
143
};
143
144
144
145
(-)a/src/spectrum/model/aloha-noack-mac-header.h (-2 / +24 lines)
 Lines 30-40    Link Here 
30
30
31
/**
31
/**
32
 * \ingroup spectrum
32
 * \ingroup spectrum
33
 *  Header for the AlohaNoack NetDevice
33
 *
34
 *
34
 */
35
 */
35
class AlohaNoackMacHeader : public Header
36
class AlohaNoackMacHeader : public Header
36
{
37
{
37
public:
38
public:
39
  /**
40
   * \brief Get the type ID.
41
   * \return the object TypeId
42
   */
38
  static TypeId GetTypeId (void);
43
  static TypeId GetTypeId (void);
39
  virtual TypeId GetInstanceTypeId (void) const;
44
  virtual TypeId GetInstanceTypeId (void) const;
40
  virtual uint32_t GetSerializedSize (void) const;
45
  virtual uint32_t GetSerializedSize (void) const;
 Lines 42-55    Link Here 
42
  virtual uint32_t Deserialize (Buffer::Iterator start);
47
  virtual uint32_t Deserialize (Buffer::Iterator start);
43
  virtual void Print (std::ostream &os) const;
48
  virtual void Print (std::ostream &os) const;
44
49
50
  /**
51
   * Set the source address
52
   * \param source the source address
53
   */
45
  void SetSource (Mac48Address source);
54
  void SetSource (Mac48Address source);
55
  /**
56
   * Set the destination address
57
   * \param destination the destination address
58
   */
46
  void SetDestination (Mac48Address destination);
59
  void SetDestination (Mac48Address destination);
60
61
  /**
62
   * Get the source address
63
   * \returns the source address
64
   */
47
  Mac48Address GetSource () const;
65
  Mac48Address GetSource () const;
66
  /**
67
   * Get the destination address
68
   * \returns the destination address
69
   */
48
  Mac48Address GetDestination () const;
70
  Mac48Address GetDestination () const;
49
71
50
private:
72
private:
51
  Mac48Address m_source;
73
  Mac48Address m_source;      //!< source address
52
  Mac48Address m_destination;
74
  Mac48Address m_destination; //!< destination address
53
};
75
};
54
76
55
77
(-)a/src/spectrum/model/aloha-noack-net-device.cc (+6 lines)
 Lines 35-40    Link Here 
35
35
36
NS_LOG_COMPONENT_DEFINE ("AlohaNoackNetDevice");
36
NS_LOG_COMPONENT_DEFINE ("AlohaNoackNetDevice");
37
37
38
/**
39
 * \brief Output stream operator
40
 * \param os output stream
41
 * \param state the state to print
42
 * \return an output stream
43
 */
38
std::ostream& operator<< (std::ostream& os, AlohaNoackNetDevice::State state)
44
std::ostream& operator<< (std::ostream& os, AlohaNoackNetDevice::State state)
39
{
45
{
40
  switch (state)
46
  switch (state)
(-)a/src/spectrum/model/aloha-noack-net-device.h (-26 / +30 lines)
 Lines 59-69    Link Here 
59
class AlohaNoackNetDevice : public NetDevice
59
class AlohaNoackNetDevice : public NetDevice
60
{
60
{
61
public:
61
public:
62
  /**
63
   * State of the NetDevice
64
   */
62
  enum State
65
  enum State
63
  {
66
  {
64
    IDLE, TX, RX
67
    IDLE, //!< Idle state
68
    TX,   //!< Transmitting state
69
    RX    //!< Receiving state
65
  };
70
  };
66
71
72
  /**
73
   * \brief Get the type ID.
74
   * \return the object TypeId
75
   */
67
  static TypeId GetTypeId (void);
76
  static TypeId GetTypeId (void);
68
77
69
  AlohaNoackNetDevice ();
78
  AlohaNoackNetDevice ();
 Lines 174-210    Link Here 
174
  virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
183
  virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
175
  virtual bool SupportsSendFrom (void) const;
184
  virtual bool SupportsSendFrom (void) const;
176
185
177
178
179
180
181
private:
186
private:
187
  /**
188
   * Notification of Guard Interval end.
189
   */
182
  void NotifyGuardIntervalEnd ();
190
  void NotifyGuardIntervalEnd ();
183
  virtual void DoDispose (void);
191
  virtual void DoDispose (void);
184
192
185
  /**
193
  /**
186
   * start the transmission of a packet by contacting the PHY layer
194
   * start the transmission of a packet by contacting the PHY layer
187
   *
188
   */
195
   */
189
  void StartTransmission ();
196
  void StartTransmission ();
190
197
191
198
192
  Ptr<Queue> m_queue;
199
  Ptr<Queue> m_queue; //!< packet queue
193
200
194
  TracedCallback<Ptr<const Packet> > m_macTxTrace;
201
  TracedCallback<Ptr<const Packet> > m_macTxTrace;        //!< Tx trace
195
  TracedCallback<Ptr<const Packet> > m_macTxDropTrace;
202
  TracedCallback<Ptr<const Packet> > m_macTxDropTrace;    //!< Tx Drop trace
196
  TracedCallback<Ptr<const Packet> > m_macPromiscRxTrace;
203
  TracedCallback<Ptr<const Packet> > m_macPromiscRxTrace; //!< Promiscuous Rx trace
197
  TracedCallback<Ptr<const Packet> > m_macRxTrace;
204
  TracedCallback<Ptr<const Packet> > m_macRxTrace;        //!< Rx trace
198
205
199
  Ptr<Node>    m_node;
206
  Ptr<Node>    m_node;    //!< Node owning this NetDevice
200
  Ptr<Channel> m_channel;
207
  Ptr<Channel> m_channel; //!< Channel
201
208
202
  Mac48Address m_address;
209
  Mac48Address m_address; //!< MAC address
203
210
204
  NetDevice::ReceiveCallback m_rxCallback;
211
  NetDevice::ReceiveCallback m_rxCallback;                //!< Rx callback
205
  NetDevice::PromiscReceiveCallback m_promiscRxCallback;
212
  NetDevice::PromiscReceiveCallback m_promiscRxCallback;  //!< Promiscuous Rx callback
206
213
207
  GenericPhyTxStartCallback m_phyMacTxStartCallback;
214
  GenericPhyTxStartCallback m_phyMacTxStartCallback;      //!< Tx Start callback
208
215
209
  /**
216
  /**
210
   * List of callbacks to fire if the link changes state (up or down).
217
   * List of callbacks to fire if the link changes state (up or down).
 Lines 212-227    Link Here 
212
  TracedCallback<> m_linkChangeCallbacks;
219
  TracedCallback<> m_linkChangeCallbacks;
213
220
214
221
215
  uint32_t m_ifIndex;
222
  uint32_t m_ifIndex;     //!< Interface index
216
  mutable uint32_t m_mtu;
223
  mutable uint32_t m_mtu; //!< NetDevice MTU
217
  bool m_linkUp;
224
  bool m_linkUp;          //!< true if the link is up
218
225
219
226
  State m_state;          //!< State of the NetDevice
220
  State m_state;
227
  Ptr<Packet> m_currentPkt;  //!< Current packet
221
228
  Ptr<Object> m_phy;      //!< PHY object
222
  Ptr<Packet> m_currentPkt;
223
224
  Ptr<Object> m_phy;
225
};
229
};
226
230
227
231
(-)a/src/spectrum/model/constant-spectrum-propagation-loss.h (-4 / +19 lines)
 Lines 25-49    Link Here 
25
25
26
namespace ns3 {
26
namespace ns3 {
27
27
28
28
/**
29
 * \ingroup spectrum
30
 *
31
 * A Constant (fixed) propagation loss. The loss is not dependent on the distance.
32
 */
29
class ConstantSpectrumPropagationLossModel : public SpectrumPropagationLossModel
33
class ConstantSpectrumPropagationLossModel : public SpectrumPropagationLossModel
30
{
34
{
31
public:
35
public:
32
  ConstantSpectrumPropagationLossModel ();
36
  ConstantSpectrumPropagationLossModel ();
33
  ~ConstantSpectrumPropagationLossModel ();
37
  ~ConstantSpectrumPropagationLossModel ();
34
38
39
  /**
40
   * \brief Get the type ID.
41
   * \return the object TypeId
42
   */
35
  static TypeId GetTypeId ();
43
  static TypeId GetTypeId ();
36
44
37
  virtual Ptr<SpectrumValue> DoCalcRxPowerSpectralDensity (Ptr<const SpectrumValue> txPsd,
45
  virtual Ptr<SpectrumValue> DoCalcRxPowerSpectralDensity (Ptr<const SpectrumValue> txPsd,
38
                                                           Ptr<const MobilityModel> a,
46
                                                           Ptr<const MobilityModel> a,
39
                                                           Ptr<const MobilityModel> b) const;
47
                                                           Ptr<const MobilityModel> b) const;
40
48
  /**
49
   * Set the propagation loss
50
   * \param lossDb the propagation loss [dB]
51
   */
41
  void SetLossDb (double lossDb);
52
  void SetLossDb (double lossDb);
53
  /**
54
   * Get the propagation loss
55
   * \returns the propagation loss [dB]
56
   */
42
  double GetLossDb () const;
57
  double GetLossDb () const;
43
58
44
protected:
59
protected:
45
  double m_lossDb;
60
  double m_lossDb;      //!< Propagation loss [dB]
46
  double m_lossLinear;
61
  double m_lossLinear;  //!< Propagation loss (linear)
47
private:
62
private:
48
};
63
};
49
64
(-)a/src/spectrum/model/friis-spectrum-propagation-loss.h (-12 / +13 lines)
 Lines 32-38    Link Here 
32
32
33
/**
33
/**
34
 * \ingroup spectrum
34
 * \ingroup spectrum
35
 * \brief Friis spectrum propagation loss model
35
 *
36
 *
37
 * The propagation loss is calculated according to a simplified version of Friis'
38
 * formula in which antenna gains are unitary:
39
 *
40
 * \f$ L = \frac{4 \pi * d * f}{C^2}\f$
41
 *
42
 * where C = 3e8 m/s is the light speed in the vacuum. The intended
43
 * use is to calculate Prx = Ptx * G
36
 */
44
 */
37
class FriisSpectrumPropagationLossModel : public SpectrumPropagationLossModel
45
class FriisSpectrumPropagationLossModel : public SpectrumPropagationLossModel
38
{
46
{
 Lines 41-46    Link Here 
41
  FriisSpectrumPropagationLossModel ();
49
  FriisSpectrumPropagationLossModel ();
42
  ~FriisSpectrumPropagationLossModel ();
50
  ~FriisSpectrumPropagationLossModel ();
43
51
52
  /**
53
   * \brief Get the type ID.
54
   * \return the object TypeId
55
   */
44
  static TypeId GetTypeId ();
56
  static TypeId GetTypeId ();
45
57
46
58
 Lines 51-64    Link Here 
51
63
52
  /**
64
  /**
53
   * Return the propagation loss L according to a simplified version of Friis'
65
   * Return the propagation loss L according to a simplified version of Friis'
54
   * formula in which antenna gains are unitary:
66
   * formula in which antenna gains are unitary
55
   *
56
   *      (4 * pi * d * f) ^ 2
57
   * L = ----------------------
58
   *               C^2
59
   *
60
   * where C = 3e8 m/s is the light speed in the vacuum. The intended
61
   * use is to calculate Prx = Ptx * G
62
   *
67
   *
63
   * @param f frequency in Hz
68
   * @param f frequency in Hz
64
   * @param d distance in m
69
   * @param d distance in m
 Lines 66-75    Link Here 
66
   * @return if Prx < Ptx then return Prx; else return Ptx
71
   * @return if Prx < Ptx then return Prx; else return Ptx
67
   */
72
   */
68
  double CalculateLoss (double f, double d) const;
73
  double CalculateLoss (double f, double d) const;
69
70
protected:
71
  double m_propagationSpeed;
72
73
};
74
};
74
75
75
76
(-)a/src/spectrum/model/half-duplex-ideal-phy.cc (+6 lines)
 Lines 71-76    Link Here 
71
  SpectrumPhy::DoDispose ();
71
  SpectrumPhy::DoDispose ();
72
}
72
}
73
73
74
/**
75
 * \brief Output stream operator
76
 * \param os output stream
77
 * \param s the state to print
78
 * \return an output stream
79
 */
74
std::ostream& operator<< (std::ostream& os, HalfDuplexIdealPhy::State s)
80
std::ostream& operator<< (std::ostream& os, HalfDuplexIdealPhy::State s)
75
{
81
{
76
  switch (s)
82
  switch (s)
(-)a/src/spectrum/model/half-duplex-ideal-phy.h (-45 / +55 lines)
 Lines 84-96    Link Here 
84
84
85
  /**
85
  /**
86
   *  PHY states
86
   *  PHY states
87
   *
88
   */
87
   */
89
  enum State
88
  enum State
90
  {
89
  {
91
    IDLE, TX, RX
90
    IDLE, //!< Idle state
91
    TX,   //!< Transmitting state
92
    RX    //!< Receiving state
92
  };
93
  };
93
94
95
  /**
96
   * \brief Get the type ID.
97
   * \return the object TypeId
98
   */
94
  static TypeId GetTypeId (void);
99
  static TypeId GetTypeId (void);
95
100
96
  // inherited from SpectrumPhy
101
  // inherited from SpectrumPhy
 Lines 105-121    Link Here 
105
110
106
111
107
  /**
112
  /**
108
   * set the Power Spectral Density of outgoing signals in power units
113
   * \brief Set the Power Spectral Density of outgoing signals in power units
109
   * (Watt, Pascal...) per Hz.
114
   * (Watt, Pascal...) per Hz.
110
   *
115
   *
111
   * @param txPsd
116
   * @param txPsd Tx Power Spectral Density
112
   */
117
   */
113
  void SetTxPowerSpectralDensity (Ptr<SpectrumValue> txPsd);
118
  void SetTxPowerSpectralDensity (Ptr<SpectrumValue> txPsd);
114
119
115
  /**
120
  /**
116
   *
121
   * \brief Set the Noise Power Spectral Density in power units
117
   * @param noisePsd the Noise Power Spectral Density in power units
118
   * (Watt, Pascal...) per Hz.
122
   * (Watt, Pascal...) per Hz.
123
   * @param noisePsd the Noise Power Spectral Density
119
   */
124
   */
120
  void SetNoisePowerSpectralDensity (Ptr<const SpectrumValue> noisePsd);
125
  void SetNoisePowerSpectralDensity (Ptr<const SpectrumValue> noisePsd);
121
126
 Lines 132-160    Link Here 
132
  bool StartTx (Ptr<Packet> p);
137
  bool StartTx (Ptr<Packet> p);
133
138
134
  /**
139
  /**
135
   * set the PHY rate to be used by this PHY.
140
   * Set the PHY rate to be used by this PHY.
136
   *
141
   *
137
   * @param rate
142
   * @param rate DataRate
138
   */
143
   */
139
  void SetRate (DataRate rate);
144
  void SetRate (DataRate rate);
140
145
141
  /**
146
  /**
147
   * Get the PHY rate to be used by this PHY.
142
   *
148
   *
143
   * @return the PHY rate used by this PHY.
149
   * @return the PHY rate used by this PHY.
144
   */
150
   */
145
  DataRate GetRate () const;
151
  DataRate GetRate () const;
146
152
147
  /**
153
  /**
148
   * set the callback for the end of a TX, as part of the
154
   * Set the callback for the end of a TX, as part of the
149
   * interconnections betweenthe PHY and the MAC
155
   * interconnections between the PHY and the MAC
150
   *
156
   *
151
   * @param c the callback
157
   * @param c the callback
152
   */
158
   */
153
  void SetGenericPhyTxEndCallback (GenericPhyTxEndCallback c);
159
  void SetGenericPhyTxEndCallback (GenericPhyTxEndCallback c);
154
160
155
  /**
161
  /**
156
   * set the callback for the start of RX, as part of the
162
   * Set the callback for the start of RX, as part of the
157
   * interconnections betweenthe PHY and the MAC
163
   * interconnections between the PHY and the MAC
158
   *
164
   *
159
   * @param c the callback
165
   * @param c the callback
160
   */
166
   */
 Lines 162-168    Link Here 
162
168
163
  /**
169
  /**
164
   * set the callback for the end of a RX in error, as part of the
170
   * set the callback for the end of a RX in error, as part of the
165
   * interconnections betweenthe PHY and the MAC
171
   * interconnections between the PHY and the MAC
166
   *
172
   *
167
   * @param c the callback
173
   * @param c the callback
168
   */
174
   */
 Lines 170-176    Link Here 
170
176
171
  /**
177
  /**
172
   * set the callback for the successful end of a RX, as part of the
178
   * set the callback for the successful end of a RX, as part of the
173
   * interconnections betweenthe PHY and the MAC
179
   * interconnections between the PHY and the MAC
174
   *
180
   *
175
   * @param c the callback
181
   * @param c the callback
176
   */
182
   */
 Lines 186-237    Link Here 
186
private:
192
private:
187
  virtual void DoDispose (void);
193
  virtual void DoDispose (void);
188
194
195
  /**
196
   * Change the PHY state
197
   * \param newState new state
198
   */
189
  void ChangeState (State newState);
199
  void ChangeState (State newState);
200
  /**
201
   * End the current Tx
202
   */
190
  void EndTx ();
203
  void EndTx ();
204
  /**
205
   * About current Rx
206
   */
191
  void AbortRx ();
207
  void AbortRx ();
208
  /**
209
   * End current Rx
210
   */
192
  void EndRx ();
211
  void EndRx ();
193
212
194
  EventId m_endRxEventId;
213
  EventId m_endRxEventId; //!< End Rx event
195
214
196
  Ptr<MobilityModel> m_mobility;
215
  Ptr<MobilityModel> m_mobility;  //!< Mobility model
197
  Ptr<AntennaModel> m_antenna;
216
  Ptr<AntennaModel> m_antenna;    //!< Antenna model
198
  Ptr<NetDevice> m_netDevice;
217
  Ptr<NetDevice> m_netDevice;     //!< NetDevice connected to theis phy
199
  Ptr<SpectrumChannel> m_channel;
218
  Ptr<SpectrumChannel> m_channel; //!< Channel
200
219
201
  Ptr<SpectrumValue> m_txPsd;
220
  Ptr<SpectrumValue> m_txPsd;       //!< Tx power spectral density
202
  Ptr<const SpectrumValue> m_rxPsd;
221
  Ptr<const SpectrumValue> m_rxPsd; //!< Rx power spectral density
203
  Ptr<Packet> m_txPacket;
222
  Ptr<Packet> m_txPacket; //!< Tx packet
204
  Ptr<Packet> m_rxPacket;
223
  Ptr<Packet> m_rxPacket; //!< Rx packet
205
224
206
  DataRate m_rate;
225
  DataRate m_rate;  //!< Datarate
226
  State m_state;    //!< PHY state
207
227
208
  State m_state;
228
  TracedCallback<Ptr<const Packet> > m_phyTxStartTrace; //!< Trace - Tx start
229
  TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;   //!< Trace - Tx end
230
  TracedCallback<Ptr<const Packet> > m_phyRxStartTrace; //!< Trace - Rx start
231
  TracedCallback<Ptr<const Packet> > m_phyRxAbortTrace; //!< Trace - Rx abort
232
  TracedCallback<Ptr<const Packet> > m_phyRxEndOkTrace; //!< Trace - Tx end (ok)
233
  TracedCallback<Ptr<const Packet> > m_phyRxEndErrorTrace;  //!< Trace - Rx end (error)
209
234
210
  TracedCallback<Ptr<const Packet> > m_phyTxStartTrace;
235
  GenericPhyTxEndCallback        m_phyMacTxEndCallback;       //!< Callback - Tx end
211
  TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;
236
  GenericPhyRxStartCallback      m_phyMacRxStartCallback;     //!< Callback - Rx start
212
  TracedCallback<Ptr<const Packet> > m_phyRxStartTrace;
237
  GenericPhyRxEndErrorCallback   m_phyMacRxEndErrorCallback;  //!< Callback - Rx error
213
  TracedCallback<Ptr<const Packet> > m_phyRxAbortTrace;
238
  GenericPhyRxEndOkCallback      m_phyMacRxEndOkCallback;     //!< Callback - Rx end
214
  TracedCallback<Ptr<const Packet> > m_phyRxEndOkTrace;
215
  TracedCallback<Ptr<const Packet> > m_phyRxEndErrorTrace;
216
239
217
  GenericPhyTxEndCallback        m_phyMacTxEndCallback;
240
  SpectrumInterference m_interference; //!< Received interference
218
  GenericPhyRxStartCallback      m_phyMacRxStartCallback;
219
  GenericPhyRxEndErrorCallback   m_phyMacRxEndErrorCallback;
220
  GenericPhyRxEndOkCallback      m_phyMacRxEndOkCallback;
221
222
  SpectrumInterference m_interference;
223
241
224
};
242
};
225
243
226
227
228
229
230
231
}
244
}
232
245
233
246
234
235
236
237
#endif /* HALF_DUPLEX_IDEAL_PHY_H */
247
#endif /* HALF_DUPLEX_IDEAL_PHY_H */
(-)a/src/spectrum/model/microwave-oven-spectrum-value-helper.cc (-3 / +12 lines)
 Lines 25-34    Link Here 
25
25
26
NS_LOG_COMPONENT_DEFINE ("MicrowaveOvenSpectrumValue");
26
NS_LOG_COMPONENT_DEFINE ("MicrowaveOvenSpectrumValue");
27
27
28
/// Spectrum model for the 5MHz model (model #2)
28
static Ptr<SpectrumModel> g_MicrowaveOvenSpectrumModel5Mhz;
29
static Ptr<SpectrumModel> g_MicrowaveOvenSpectrumModel5Mhz;
30
/// Spectrum model for the 6MHz model (model #1)
29
static Ptr<SpectrumModel> g_MicrowaveOvenSpectrumModel6Mhz;
31
static Ptr<SpectrumModel> g_MicrowaveOvenSpectrumModel6Mhz;
30
32
31
33
/**
34
 * \ingroup spectrum
35
 * Init a static class containing the MWO #2 model (5Mhz)
36
 */
32
static class MicrowaveOvenSpectrumModel5MhzInitializer
37
static class MicrowaveOvenSpectrumModel5MhzInitializer
33
{
38
{
34
public:
39
public:
 Lines 47-56    Link Here 
47
    NS_LOG_LOGIC ("bands.size () :" << bands.size ());
52
    NS_LOG_LOGIC ("bands.size () :" << bands.size ());
48
    g_MicrowaveOvenSpectrumModel5Mhz = Create<SpectrumModel> (bands);
53
    g_MicrowaveOvenSpectrumModel5Mhz = Create<SpectrumModel> (bands);
49
  }
54
  }
50
} g_MicrowaveOvenSpectrumModel5MhzInitializerInstance;
55
} g_MicrowaveOvenSpectrumModel5MhzInitializerInstance; //!< MWO model #2
51
56
52
57
53
58
59
/**
60
 * \ingroup spectrum
61
 * Init a static class containing the MWO #1 model (6Mhz)
62
 */
54
static class MicrowaveOvenSpectrumModel6MhzInitializer
63
static class MicrowaveOvenSpectrumModel6MhzInitializer
55
{
64
{
56
public:
65
public:
 Lines 69-75    Link Here 
69
    NS_LOG_LOGIC ("bands.size () :" << bands.size ());
78
    NS_LOG_LOGIC ("bands.size () :" << bands.size ());
70
    g_MicrowaveOvenSpectrumModel6Mhz = Create<SpectrumModel> (bands);
79
    g_MicrowaveOvenSpectrumModel6Mhz = Create<SpectrumModel> (bands);
71
  }
80
  }
72
} g_MicrowaveOvenSpectrumModel6MhzInitializerInstance;
81
} g_MicrowaveOvenSpectrumModel6MhzInitializerInstance; //!< MWO model #1
73
82
74
83
75
84
(-)a/src/spectrum/model/multi-model-spectrum-channel.cc (+6 lines)
 Lines 46-51    Link Here 
46
NS_OBJECT_ENSURE_REGISTERED (MultiModelSpectrumChannel);
46
NS_OBJECT_ENSURE_REGISTERED (MultiModelSpectrumChannel);
47
47
48
48
49
/**
50
 * \brief Output stream operator
51
 * \param lhs output stream
52
 * \param rhs the TxSpectrumModelInfoMap to print
53
 * \return an output stream
54
 */
49
std::ostream& operator<< (std::ostream& lhs, TxSpectrumModelInfoMap_t& rhs)
55
std::ostream& operator<< (std::ostream& lhs, TxSpectrumModelInfoMap_t& rhs)
50
{
56
{
51
  for (TxSpectrumModelInfoMap_t::iterator it = rhs.begin ();
57
  for (TxSpectrumModelInfoMap_t::iterator it = rhs.begin ();
(-)a/src/spectrum/model/multi-model-spectrum-channel.h (-32 / +56 lines)
 Lines 33-75    Link Here 
33
namespace ns3 {
33
namespace ns3 {
34
34
35
35
36
/**
37
 * \ingroup spectrum
38
 * Container: SpectrumModelUid_t, SpectrumConverter
39
 */
36
typedef std::map<SpectrumModelUid_t, SpectrumConverter> SpectrumConverterMap_t;
40
typedef std::map<SpectrumModelUid_t, SpectrumConverter> SpectrumConverterMap_t;
37
41
38
39
/**
42
/**
40
 * \ingroup spectrum
43
 * \ingroup spectrum
41
 *
44
 * The Tx spectrum model information. This class is used to convert
45
 * one spectrum model into another one.
42
 */
46
 */
43
class TxSpectrumModelInfo
47
class TxSpectrumModelInfo
44
{
48
{
45
public:
49
public:
50
  /**
51
   * Constructor
52
   * \param txSpectrumModel the Tx Spectrum model
53
   */
46
  TxSpectrumModelInfo (Ptr<const SpectrumModel> txSpectrumModel);
54
  TxSpectrumModelInfo (Ptr<const SpectrumModel> txSpectrumModel);
47
55
48
  Ptr<const SpectrumModel> m_txSpectrumModel;
56
  Ptr<const SpectrumModel> m_txSpectrumModel;     //!< Tx Spectrum model
49
  SpectrumConverterMap_t m_spectrumConverterMap;
57
  SpectrumConverterMap_t m_spectrumConverterMap;  //!< Spectrum converter
50
};
58
};
51
59
52
typedef std::map<SpectrumModelUid_t, TxSpectrumModelInfo> TxSpectrumModelInfoMap_t;
53
54
60
55
/**
61
/**
56
 * \ingroup spectrum
62
 * \ingroup spectrum
57
 *
63
 * Container: SpectrumModelUid_t, TxSpectrumModelInfo
64
 */
65
typedef std::map<SpectrumModelUid_t, TxSpectrumModelInfo> TxSpectrumModelInfoMap_t;
66
67
68
/**
69
 * \ingroup spectrum
70
 * The Rx spectrum model information. This class is used to convert
71
 * one spectrum model into another one.
58
 */
72
 */
59
class RxSpectrumModelInfo
73
class RxSpectrumModelInfo
60
{
74
{
61
public:
75
public:
76
  /**
77
   * Constructor
78
   * \param rxSpectrumModel the Rx Spectrum model
79
   */
62
  RxSpectrumModelInfo (Ptr<const SpectrumModel> rxSpectrumModel);
80
  RxSpectrumModelInfo (Ptr<const SpectrumModel> rxSpectrumModel);
63
81
64
  Ptr<const SpectrumModel> m_rxSpectrumModel;
82
  Ptr<const SpectrumModel> m_rxSpectrumModel;  //!< Rx Spectrum model
65
  std::set<Ptr<SpectrumPhy> > m_rxPhySet;
83
  std::set<Ptr<SpectrumPhy> > m_rxPhySet;      //!< Container of the Rx Spectrum phy objects
66
};
84
};
67
85
86
/**
87
 * \ingroup spectrum
88
 * Container: SpectrumModelUid_t, RxSpectrumModelInfo
89
 */
68
typedef std::map<SpectrumModelUid_t, RxSpectrumModelInfo> RxSpectrumModelInfoMap_t;
90
typedef std::map<SpectrumModelUid_t, RxSpectrumModelInfo> RxSpectrumModelInfoMap_t;
69
91
70
92
71
72
73
/**
93
/**
74
 * \ingroup spectrum
94
 * \ingroup spectrum
75
 *
95
 *
 Lines 89-94    Link Here 
89
public:
109
public:
90
  MultiModelSpectrumChannel ();
110
  MultiModelSpectrumChannel ();
91
111
112
  /**
113
   * \brief Get the type ID.
114
   * \return the object TypeId
115
   */
92
  static TypeId GetTypeId (void);
116
  static TypeId GetTypeId (void);
93
117
94
  // inherited from SpectrumChannel
118
  // inherited from SpectrumChannel
 Lines 103-108    Link Here 
103
  virtual uint32_t GetNDevices (void) const;
127
  virtual uint32_t GetNDevices (void) const;
104
  virtual Ptr<NetDevice> GetDevice (uint32_t i) const;
128
  virtual Ptr<NetDevice> GetDevice (uint32_t i) const;
105
129
130
  /**
131
   * Get the frequency-dependent propagation loss model.
132
   * \returns a pointer to the propagation loss model.
133
   */
106
  virtual Ptr<SpectrumPropagationLossModel> GetSpectrumPropagationLossModel (void);
134
  virtual Ptr<SpectrumPropagationLossModel> GetSpectrumPropagationLossModel (void);
107
135
108
136
 Lines 113-119    Link Here 
113
141
114
private:
142
private:
115
  /**
143
  /**
116
   * this method checks if m_rxSpectrumModelInfoMap contains an entry
144
   * This method checks if m_rxSpectrumModelInfoMap contains an entry
117
   * for the given TX SpectrumModel. If such entry exists, it returns
145
   * for the given TX SpectrumModel. If such entry exists, it returns
118
   * an interator pointing to it. If not, it creates a new entry in
146
   * an interator pointing to it. If not, it creates a new entry in
119
   * m_txSpectrumMpodelInfoMap, and returns an iterator to it.
147
   * m_txSpectrumMpodelInfoMap, and returns an iterator to it.
 Lines 125-185    Link Here 
125
  TxSpectrumModelInfoMap_t::const_iterator FindAndEventuallyAddTxSpectrumModel (Ptr<const SpectrumModel> txSpectrumModel);
153
  TxSpectrumModelInfoMap_t::const_iterator FindAndEventuallyAddTxSpectrumModel (Ptr<const SpectrumModel> txSpectrumModel);
126
154
127
  /**
155
  /**
128
   * used internally to reschedule transmission after the propagation delay
156
   * Used internally to reschedule transmission after the propagation delay
129
   *
157
   *
130
   * @param params
158
   * @param params
131
   * @param receiver
159
   * @param receiver
132
   */
160
   */
133
  virtual void StartRx (Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver);
161
  virtual void StartRx (Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver);
134
162
135
136
137
  /**
163
  /**
138
   * propagation delay model to be used with this channel
164
   * Propagation delay model to be used with this channel
139
   *
140
   */
165
   */
141
  Ptr<PropagationDelayModel> m_propagationDelay;
166
  Ptr<PropagationDelayModel> m_propagationDelay;
142
167
143
  /**
168
  /**
144
    * single-frequency propagation loss model to be used with this channel
169
   * Single-frequency propagation loss model to be used with this channel
145
    *
170
   */
146
    */
147
  Ptr<PropagationLossModel> m_propagationLoss;
171
  Ptr<PropagationLossModel> m_propagationLoss;
148
172
149
  /**
173
  /**
150
   * frequency-dependent propagation loss model to be used with this channel
174
   * Frequency-dependent propagation loss model to be used with this channel
151
   *
152
   */
175
   */
153
  Ptr<SpectrumPropagationLossModel> m_spectrumPropagationLoss;
176
  Ptr<SpectrumPropagationLossModel> m_spectrumPropagationLoss;
154
177
155
156
  /**
178
  /**
157
   * data structure holding, for each TX SpectrumModel,  all the
179
   * Data structure holding, for each TX SpectrumModel,  all the
158
   * converters to any RX SpectrumModel, and all the corresponding
180
   * converters to any RX SpectrumModel, and all the corresponding
159
   * SpectrumPhy instances.
181
   * SpectrumPhy instances.
160
   *
161
   */
182
   */
162
  TxSpectrumModelInfoMap_t m_txSpectrumModelInfoMap;
183
  TxSpectrumModelInfoMap_t m_txSpectrumModelInfoMap;
163
184
164
165
  /**
185
  /**
166
   * data structure holding, for each RX spectrum model, all the
186
   * Data structure holding, for each RX spectrum model, all the
167
   * corresponding SpectrumPhy instances.
187
   * corresponding SpectrumPhy instances.
168
   *
169
   */
188
   */
170
  RxSpectrumModelInfoMap_t m_rxSpectrumModelInfoMap;
189
  RxSpectrumModelInfoMap_t m_rxSpectrumModelInfoMap;
171
190
191
  /**
192
   * Number of device connected to the channel
193
   */
172
  uint32_t m_numDevices;
194
  uint32_t m_numDevices;
173
195
196
  /**
197
   * Maximum loss [dB]. Any device above this loss is considered out of range.
198
   */
174
  double m_maxLossDb;
199
  double m_maxLossDb;
175
200
201
  /**
202
   * TracedCallback - PathLoss
203
   */
176
  TracedCallback<Ptr<SpectrumPhy>, Ptr<SpectrumPhy>, double > m_pathLossTrace;
204
  TracedCallback<Ptr<SpectrumPhy>, Ptr<SpectrumPhy>, double > m_pathLossTrace;
177
};
205
};
178
206
179
180
181
}
207
}
182
208
183
184
185
#endif /* MULTI_MODEL_SPECTRUM_CHANNEL_H */
209
#endif /* MULTI_MODEL_SPECTRUM_CHANNEL_H */
(-)a/src/spectrum/model/non-communicating-net-device.h (-6 / +8 lines)
 Lines 54-59    Link Here 
54
class NonCommunicatingNetDevice : public NetDevice
54
class NonCommunicatingNetDevice : public NetDevice
55
{
55
{
56
public:
56
public:
57
  /**
58
   * \brief Get the type ID.
59
   * \return the object TypeId
60
   */
57
  static TypeId GetTypeId (void);
61
  static TypeId GetTypeId (void);
58
62
59
  NonCommunicatingNetDevice ();
63
  NonCommunicatingNetDevice ();
 Lines 123-134    Link Here 
123
private:
127
private:
124
  virtual void DoDispose (void);
128
  virtual void DoDispose (void);
125
129
126
  Ptr<Node>    m_node;
130
  Ptr<Node>    m_node;    //!< node this NetDevice is associated to
127
  Ptr<Channel> m_channel;
131
  Ptr<Channel> m_channel; //!< Channel used by the NetDevice
128
132
  uint32_t m_ifIndex;     //!< Interface index
129
  uint32_t m_ifIndex;
133
  Ptr<Object> m_phy;      //!< Phy object
130
131
  Ptr<Object> m_phy;
132
};
134
};
133
135
134
136
(-)a/src/spectrum/model/single-model-spectrum-channel.h (-18 / +21 lines)
 Lines 43-51    Link Here 
43
public:
43
public:
44
  SingleModelSpectrumChannel ();
44
  SingleModelSpectrumChannel ();
45
45
46
  /**
47
   * \brief Get the type ID.
48
   * \return the object TypeId
49
   */
46
  static TypeId GetTypeId (void);
50
  static TypeId GetTypeId (void);
47
51
48
49
  // inherited from SpectrumChannel
52
  // inherited from SpectrumChannel
50
  virtual void AddPropagationLossModel (Ptr<PropagationLossModel> loss);
53
  virtual void AddPropagationLossModel (Ptr<PropagationLossModel> loss);
51
  virtual void AddSpectrumPropagationLossModel (Ptr<SpectrumPropagationLossModel> loss);
54
  virtual void AddSpectrumPropagationLossModel (Ptr<SpectrumPropagationLossModel> loss);
 Lines 58-73    Link Here 
58
  virtual uint32_t GetNDevices (void) const;
61
  virtual uint32_t GetNDevices (void) const;
59
  virtual Ptr<NetDevice> GetDevice (uint32_t i) const;
62
  virtual Ptr<NetDevice> GetDevice (uint32_t i) const;
60
63
61
64
  /// Container: SpectrumPhy objects
62
  typedef std::vector<Ptr<SpectrumPhy> > PhyList;
65
  typedef std::vector<Ptr<SpectrumPhy> > PhyList;
63
66
67
  /**
68
   * Get the frequency-dependent propagation loss model.
69
   * \returns a pointer to the propagation loss model.
70
   */
64
  virtual Ptr<SpectrumPropagationLossModel> GetSpectrumPropagationLossModel (void);
71
  virtual Ptr<SpectrumPropagationLossModel> GetSpectrumPropagationLossModel (void);
65
72
66
private:
73
private:
67
  virtual void DoDispose ();
74
  virtual void DoDispose ();
68
75
69
  /**
76
  /**
70
   * used internally to reschedule transmission after the propagation delay
77
   * Used internally to reschedule transmission after the propagation delay
71
   *
78
   *
72
   * @param params
79
   * @param params
73
   * @param receiver
80
   * @param receiver
 Lines 75-81    Link Here 
75
  void StartRx (Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver);
82
  void StartRx (Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver);
76
83
77
  /**
84
  /**
78
   * list of SpectrumPhy instances attached to
85
   * List of SpectrumPhy instances attached to
79
   * the channel
86
   * the channel
80
   */
87
   */
81
  PhyList m_phyList;
88
  PhyList m_phyList;
 Lines 86-121    Link Here 
86
   */
93
   */
87
  Ptr<const SpectrumModel> m_spectrumModel;
94
  Ptr<const SpectrumModel> m_spectrumModel;
88
95
89
90
  /**
96
  /**
91
   * propagation delay model to be used with this channel
97
   * Propagation delay model to be used with this channel
92
   *
93
   */
98
   */
94
  Ptr<PropagationDelayModel> m_propagationDelay;
99
  Ptr<PropagationDelayModel> m_propagationDelay;
95
100
96
97
  /**
101
  /**
98
    * single-frequency propagation loss model to be used with this channel
102
   * Single-frequency propagation loss model to be used with this channel
99
    *
103
   */
100
    */
101
  Ptr<PropagationLossModel> m_propagationLoss;
104
  Ptr<PropagationLossModel> m_propagationLoss;
102
105
103
  /**
106
  /**
104
   * frequency-dependent propagation loss model to be used with this channel
107
   * Frequency-dependent propagation loss model to be used with this channel
105
   *
106
   */
108
   */
107
  Ptr<SpectrumPropagationLossModel> m_spectrumPropagationLoss;
109
  Ptr<SpectrumPropagationLossModel> m_spectrumPropagationLoss;
108
110
109
111
  /**
112
   * Maximum loss [dB]. Any device above this loss is considered out of range.
113
   */
110
  double m_maxLossDb;
114
  double m_maxLossDb;
111
115
116
  /**
117
   * TracedCallback - PathLoss
118
   */
112
  TracedCallback<Ptr<SpectrumPhy>, Ptr<SpectrumPhy>, double > m_pathLossTrace;
119
  TracedCallback<Ptr<SpectrumPhy>, Ptr<SpectrumPhy>, double > m_pathLossTrace;
113
};
120
};
114
121
115
116
117
}
122
}
118
123
119
120
121
#endif /* SINGLE_MODEL_SPECTRUM_CHANNEL_H */
124
#endif /* SINGLE_MODEL_SPECTRUM_CHANNEL_H */
(-)a/src/spectrum/model/spectrum-analyzer.cc (-1 / +1 lines)
 Lines 74-80    Link Here 
74
    .SetGroupName ("Spectrum")
74
    .SetGroupName ("Spectrum")
75
    .AddConstructor<SpectrumAnalyzer> ()
75
    .AddConstructor<SpectrumAnalyzer> ()
76
    .AddAttribute ("Resolution",
76
    .AddAttribute ("Resolution",
77
                   "The lengh of the time interval over which the "
77
                   "The length of the time interval over which the "
78
                   "power spectral density of incoming signals is averaged",
78
                   "power spectral density of incoming signals is averaged",
79
                   TimeValue (MilliSeconds (1)),
79
                   TimeValue (MilliSeconds (1)),
80
                   MakeTimeAccessor (&SpectrumAnalyzer::m_resolution),
80
                   MakeTimeAccessor (&SpectrumAnalyzer::m_resolution),
(-)a/src/spectrum/model/spectrum-analyzer.h (-15 / +34 lines)
 Lines 38-44    Link Here 
38
/**
38
/**
39
 * \ingroup spectrum
39
 * \ingroup spectrum
40
 *
40
 *
41
 * Simple SpectrumPhy implemetation that averages the spectrum power
41
 * Simple SpectrumPhy implementation that averages the spectrum power
42
 * density of incoming transmissions to produce a spectrogram.
42
 * density of incoming transmissions to produce a spectrogram.
43
 *
43
 *
44
 *
44
 *
 Lines 52-60    Link Here 
52
  SpectrumAnalyzer ();
52
  SpectrumAnalyzer ();
53
  virtual ~SpectrumAnalyzer ();
53
  virtual ~SpectrumAnalyzer ();
54
54
55
  /**
56
   * \brief Get the type ID.
57
   * \return the object TypeId
58
   */
55
  static TypeId GetTypeId (void);
59
  static TypeId GetTypeId (void);
56
60
57
// inherited from SpectrumPhy
61
  // inherited from SpectrumPhy
58
  void SetChannel (Ptr<SpectrumChannel> c);
62
  void SetChannel (Ptr<SpectrumChannel> c);
59
  void SetMobility (Ptr<MobilityModel> m);
63
  void SetMobility (Ptr<MobilityModel> m);
60
  void SetDevice (Ptr<NetDevice> d);
64
  void SetDevice (Ptr<NetDevice> d);
 Lines 68-79    Link Here 
68
  /**
72
  /**
69
   * Set the spectrum model used by the SpectrumAnalyzer to represent incoming signals
73
   * Set the spectrum model used by the SpectrumAnalyzer to represent incoming signals
70
   *
74
   *
71
   * @param m
75
   * @param m the Rx Spectrum model
72
   */
76
   */
73
  void SetRxSpectrumModel (Ptr<SpectrumModel> m);
77
  void SetRxSpectrumModel (Ptr<SpectrumModel> m);
74
78
75
  /** 
79
  /** 
76
   * set the AntennaModel to be used
80
   * Set the AntennaModel to be used
77
   * 
81
   * 
78
   * \param a the Antenna Model
82
   * \param a the Antenna Model
79
   */
83
   */
 Lines 96-120    Link Here 
96
  void DoDispose ();
100
  void DoDispose ();
97
101
98
private:
102
private:
99
  Ptr<MobilityModel> m_mobility;
103
  Ptr<MobilityModel> m_mobility;    //!< Pointer to the mobility model
100
  Ptr<AntennaModel> m_antenna;
104
  Ptr<AntennaModel> m_antenna;      //!< Pointer to the Antenna model
101
  Ptr<NetDevice> m_netDevice;
105
  Ptr<NetDevice> m_netDevice;       //!< Pointer to the NetDevice using this object
102
  Ptr<SpectrumChannel> m_channel;
106
  Ptr<SpectrumChannel> m_channel;   //!< Pointer to the channel to be analyzed
103
107
108
  /**
109
   * Generates a report of the data collected so far.
110
   *
111
   * This function is called periodically.
112
   */
104
  virtual void GenerateReport ();
113
  virtual void GenerateReport ();
105
114
115
  /**
116
   * Adds a signal to the data collected.
117
   */
106
  void AddSignal (Ptr<const SpectrumValue> psd);
118
  void AddSignal (Ptr<const SpectrumValue> psd);
119
  /**
120
   * Removes a signal to the data collected.
121
   */
107
  void SubtractSignal  (Ptr<const SpectrumValue> psd);
122
  void SubtractSignal  (Ptr<const SpectrumValue> psd);
123
  /**
124
   * Updates the data about the received Energy
125
   */
108
  void UpdateEnergyReceivedSoFar ();
126
  void UpdateEnergyReceivedSoFar ();
109
127
110
  Ptr<SpectrumModel> m_spectrumModel;
128
  Ptr<SpectrumModel> m_spectrumModel;             //!< Spectrum model
111
  Ptr<SpectrumValue> m_sumPowerSpectralDensity;
129
  Ptr<SpectrumValue> m_sumPowerSpectralDensity;   //!< Sum of the received PSD
112
  Ptr<SpectrumValue> m_energySpectralDensity;
130
  Ptr<SpectrumValue> m_energySpectralDensity;     //!< Energy spectral density
113
  double m_noisePowerSpectralDensity;
131
  double m_noisePowerSpectralDensity;             //!< Noise power spectral density
114
  Time m_resolution;
132
  Time m_resolution;                              //!< Time resolution
115
  Time m_lastChangeTime;
133
  Time m_lastChangeTime;                          //!< When the last update happened
116
  bool m_active;
134
  bool m_active;                                  //!< True if the analyzer is active
117
135
136
  /// TracedCallback - average power spectral density report.
118
  TracedCallback<Ptr<const SpectrumValue> > m_averagePowerSpectralDensityReportTrace;
137
  TracedCallback<Ptr<const SpectrumValue> > m_averagePowerSpectralDensityReportTrace;
119
138
120
};
139
};
(-)a/src/spectrum/model/spectrum-channel.h (-5 / +9 lines)
 Lines 47-57    Link Here 
47
{
47
{
48
public:
48
public:
49
  virtual ~SpectrumChannel ();
49
  virtual ~SpectrumChannel ();
50
51
  /**
52
   * \brief Get the type ID.
53
   * \return the object TypeId
54
   */
50
  static TypeId GetTypeId (void);
55
  static TypeId GetTypeId (void);
51
56
52
53
  /**
57
  /**
54
   * set the single-frequency propagation loss model to be used
58
   * Set the single-frequency propagation loss model to be used
55
   * \warning only models that do not depend on the TX power should be used.
59
   * \warning only models that do not depend on the TX power should be used.
56
   *
60
   *
57
   * \param loss a pointer to the propagation loss model to be used.
61
   * \param loss a pointer to the propagation loss model to be used.
 Lines 59-71    Link Here 
59
  virtual void AddPropagationLossModel (Ptr<PropagationLossModel> loss) = 0;
63
  virtual void AddPropagationLossModel (Ptr<PropagationLossModel> loss) = 0;
60
64
61
  /**
65
  /**
62
   * set the frequency-dependent propagation loss model to be used
66
   * Set the frequency-dependent propagation loss model to be used
63
   * \param loss a pointer to the propagation loss model to be used.
67
   * \param loss a pointer to the propagation loss model to be used.
64
   */
68
   */
65
  virtual void AddSpectrumPropagationLossModel (Ptr<SpectrumPropagationLossModel> loss) = 0;
69
  virtual void AddSpectrumPropagationLossModel (Ptr<SpectrumPropagationLossModel> loss) = 0;
66
70
67
  /**
71
  /**
68
   * set the  propagation delay model to be used
72
   * Set the  propagation delay model to be used
69
   * \param delay Ptr to the propagation delay model to be used.
73
   * \param delay Ptr to the propagation delay model to be used.
70
   */
74
   */
71
  virtual void SetPropagationDelayModel (Ptr<PropagationDelayModel> delay) = 0;
75
  virtual void SetPropagationDelayModel (Ptr<PropagationDelayModel> delay) = 0;
 Lines 79-85    Link Here 
79
  virtual void StartTx (Ptr<SpectrumSignalParameters> params) = 0;
83
  virtual void StartTx (Ptr<SpectrumSignalParameters> params) = 0;
80
84
81
  /**
85
  /**
82
   * @brief add a SpectrumPhy to a channel, so it can receive packets
86
   * @brief Add a SpectrumPhy to a channel, so it can receive packets
83
   *
87
   *
84
   * This method is used to attach a SpectrumPhy instance to a
88
   * This method is used to attach a SpectrumPhy instance to a
85
   * SpectrumChannel instance, so that the SpectrumPhy can receive
89
   * SpectrumChannel instance, so that the SpectrumPhy can receive
(-)a/src/spectrum/model/spectrum-converter.h (-3 / +3 lines)
 Lines 78-86    Link Here 
78
   */
78
   */
79
  double GetCoefficient (const BandInfo& from, const BandInfo& to) const;
79
  double GetCoefficient (const BandInfo& from, const BandInfo& to) const;
80
80
81
  std::vector<std::vector<double> > m_conversionMatrix; // /< matrix of conversion coefficients
81
  std::vector<std::vector<double> > m_conversionMatrix; //!< matrix of conversion coefficients
82
  Ptr<const SpectrumModel> m_fromSpectrumModel;  // /<  the SpectrumModel this SpectrumConverter instance can convert from
82
  Ptr<const SpectrumModel> m_fromSpectrumModel;  //!<  the SpectrumModel this SpectrumConverter instance can convert from
83
  Ptr<const SpectrumModel> m_toSpectrumModel;    // /<  the SpectrumModel this SpectrumConverter instance can convert to
83
  Ptr<const SpectrumModel> m_toSpectrumModel;    //!<  the SpectrumModel this SpectrumConverter instance can convert to
84
84
85
};
85
};
86
86
(-)a/src/spectrum/model/spectrum-error-model.cc (+13 lines)
 Lines 43-48    Link Here 
43
{
43
{
44
}
44
}
45
45
46
47
NS_OBJECT_ENSURE_REGISTERED (ShannonSpectrumErrorModel);
48
49
TypeId
50
ShannonSpectrumErrorModel::GetTypeId ()
51
{
52
  static TypeId tid = TypeId ("ns3::ShannonSpectrumErrorModel")
53
    .SetParent<SpectrumErrorModel> ()
54
    .SetGroupName ("Spectrum")
55
    ;
56
  return tid;
57
}
58
46
void
59
void
47
ShannonSpectrumErrorModel::DoDispose ()
60
ShannonSpectrumErrorModel::DoDispose ()
48
{
61
{
(-)a/src/spectrum/model/spectrum-error-model.h (-2 / +30 lines)
 Lines 35-49    Link Here 
35
/**
35
/**
36
 * \ingroup spectrum
36
 * \ingroup spectrum
37
 *
37
 *
38
 * Base class for Spectrum error models.
38
 */
39
 */
39
class SpectrumErrorModel :  public Object
40
class SpectrumErrorModel :  public Object
40
{
41
{
41
public:
42
public:
42
43
44
  /**
45
   * \brief Get the type ID.
46
   * \return the object TypeId
47
   */
43
  static TypeId GetTypeId ();
48
  static TypeId GetTypeId ();
44
  virtual ~SpectrumErrorModel ();
49
  virtual ~SpectrumErrorModel ();
50
51
  /**
52
   * Start a packet reception
53
   * \param p the packet
54
   */
45
  virtual void StartRx (Ptr<const Packet> p) = 0;
55
  virtual void StartRx (Ptr<const Packet> p) = 0;
56
57
  /**
58
   * Evaluates a chunk
59
   * \param sinr the SpectrumValue experienced by the Chunk
60
   * \param duration the Chunk length
61
   */
46
  virtual void EvaluateChunk (const SpectrumValue& sinr, Time duration) = 0;
62
  virtual void EvaluateChunk (const SpectrumValue& sinr, Time duration) = 0;
63
64
  /**
65
   * Checks if the packet being received is correct
66
   * \returns true if the packet is correct.
67
   */
47
  virtual bool IsRxCorrect () = 0;
68
  virtual bool IsRxCorrect () = 0;
48
};
69
};
49
70
 Lines 62-75    Link Here 
62
  virtual void DoDispose ();
83
  virtual void DoDispose ();
63
84
64
public:
85
public:
86
87
  /**
88
   * \brief Get the type ID.
89
   * \return the object TypeId
90
   */
91
  static TypeId GetTypeId ();
92
65
  // inherited from SpectrumErrorModel
93
  // inherited from SpectrumErrorModel
66
  void StartRx (Ptr<const Packet> p);
94
  void StartRx (Ptr<const Packet> p);
67
  void EvaluateChunk (const SpectrumValue& sinr, Time duration);
95
  void EvaluateChunk (const SpectrumValue& sinr, Time duration);
68
  bool IsRxCorrect ();
96
  bool IsRxCorrect ();
69
97
70
private:
98
private:
71
  uint32_t m_bytes;
99
  uint32_t m_bytes;             //!< Length of the packet being received
72
  uint32_t m_deliverableBytes;
100
  uint32_t m_deliverableBytes;  //!< Bytes that can be received according to the Shnanon's formula
73
101
74
};
102
};
75
103
(-)a/src/spectrum/model/spectrum-interference.cc (+11 lines)
 Lines 30-35    Link Here 
30
30
31
NS_LOG_COMPONENT_DEFINE ("SpectrumInterference");
31
NS_LOG_COMPONENT_DEFINE ("SpectrumInterference");
32
32
33
TypeId
34
SpectrumInterference::GetTypeId ()
35
{
36
  static TypeId tid = TypeId ("ns3::SpectrumInterference")
37
    .SetParent<Object> ()
38
    .SetGroupName ("Spectrum")
39
    ;
40
  return tid;
41
}
42
43
33
SpectrumInterference::SpectrumInterference ()
44
SpectrumInterference::SpectrumInterference ()
34
  : m_receiving (false),
45
  : m_receiving (false),
35
    m_rxSignal (0),
46
    m_rxSignal (0),
(-)a/src/spectrum/model/spectrum-interference.h (-23 / +39 lines)
 Lines 50-63    Link Here 
50
  virtual ~SpectrumInterference ();
50
  virtual ~SpectrumInterference ();
51
51
52
  /**
52
  /**
53
   * set the SpectrumErrorModel to be used.
53
   * \brief Get the type ID.
54
   * \return the object TypeId
55
   */
56
  static TypeId GetTypeId ();
57
58
  /**
59
   * Set the SpectrumErrorModel to be used.
54
   *
60
   *
55
   * @param e
61
   * @param e the error model
56
   */
62
   */
57
  void SetErrorModel (Ptr<SpectrumErrorModel> e);
63
  void SetErrorModel (Ptr<SpectrumErrorModel> e);
58
64
59
  /**
65
  /**
60
   * notify that the PHY is starting a RX attempt
66
   * Notify that the PHY is starting a RX attempt
61
   *
67
   *
62
   * @param p the packet corresponding to the signal being RX
68
   * @param p the packet corresponding to the signal being RX
63
   * @param rxPsd the power spectral density of the signal being RX
69
   * @param rxPsd the power spectral density of the signal being RX
 Lines 65-76    Link Here 
65
  void StartRx (Ptr<const Packet> p, Ptr<const SpectrumValue> rxPsd);
71
  void StartRx (Ptr<const Packet> p, Ptr<const SpectrumValue> rxPsd);
66
72
67
  /**
73
  /**
68
   * notify that the PHY has aborted RX
74
   * Notify that the PHY has aborted RX
69
   */
75
   */
70
  void AbortRx ();
76
  void AbortRx ();
71
77
72
  /**
78
  /**
73
   * notify that the RX attempt has ended. The receiving PHY must call
79
   * Notify that the RX attempt has ended. The receiving PHY must call
74
   * this method upon RX end in order to:
80
   * this method upon RX end in order to:
75
   * 1) know if RX was successful or not
81
   * 1) know if RX was successful or not
76
   * 2) free up resources that might eventually be used for the
82
   * 2) free up resources that might eventually be used for the
 Lines 84-100    Link Here 
84
90
85
91
86
  /**
92
  /**
87
   * notify that a new signal is being perceived in the medium. This
93
   * Notify that a new signal is being perceived in the medium. This
88
   * method is to be called for all incoming signal, regardless of
94
   * method is to be called for all incoming signal, regardless of
89
   * wether they're useful signals or interferers.
95
   * whether they're useful signals or interferers.
90
   *
96
   *
91
   * @param spd the power spectral density of the new signal
97
   * @param spd the power spectral density of the new signal
92
   * @param duration the duration of the new signal
98
   * @param duration the duration of the new signal
93
   */
99
   */
94
  void AddSignal (Ptr<const SpectrumValue> spd, const Time duration);
100
  void AddSignal (Ptr<const SpectrumValue> spd, const Time duration);
95
101
96
97
  /**
102
  /**
103
   * Set the Noise Power Spectral Density
98
   *
104
   *
99
   * @param noisePsd the Noise Power Spectral Density in power units
105
   * @param noisePsd the Noise Power Spectral Density in power units
100
   * (Watt, Pascal...) per Hz.
106
   * (Watt, Pascal...) per Hz.
 Lines 106-135    Link Here 
106
  void DoDispose ();
112
  void DoDispose ();
107
113
108
private:
114
private:
115
116
  /**
117
   * Evaluate a Chunk, depending on the Rx status and the last update time
118
   */
109
  void ConditionallyEvaluateChunk ();
119
  void ConditionallyEvaluateChunk ();
120
  /**
121
   * Adds a signal perceived in the medium.
122
   * @param spd the power spectral density of the new signal
123
   */
110
  void DoAddSignal  (Ptr<const SpectrumValue> spd);
124
  void DoAddSignal  (Ptr<const SpectrumValue> spd);
125
  /**
126
    * Removes a signal perceived in the medium.
127
    * @param spd the power spectral density of the new signal
128
    */
111
  void DoSubtractSignal  (Ptr<const SpectrumValue> spd);
129
  void DoSubtractSignal  (Ptr<const SpectrumValue> spd);
112
130
131
  bool m_receiving; //!< True if in Rx status
113
132
133
  /**
134
   * Stores the power spectral density of the signal whose RX is being attempted
135
   */
136
  Ptr<const SpectrumValue> m_rxSignal;
114
137
115
  bool m_receiving;
138
  /**
139
   * Stores the spectral power density of the sum of incoming signals;
140
   * does not include noise, includes the SPD of the signal being RX
141
   */
142
  Ptr<SpectrumValue> m_allSignals;
116
143
117
  Ptr<const SpectrumValue> m_rxSignal; /**< stores the power spectral density of
144
  Ptr<const SpectrumValue> m_noise; //!< Noise spectral power density
118
                                  * the signal whose RX is being
119
                                  * attempted
120
                                  */
121
145
122
  Ptr<SpectrumValue> m_allSignals; /**< stores the spectral
146
  Time m_lastChangeTime;     //!< the time of the last change in m_TotalPower
123
                                    * power density of the sum of incoming signals;
124
                                    * does not include noise, includes the SPD of the signal being RX
125
                                    */
126
147
127
  Ptr<const SpectrumValue> m_noise;
148
  Ptr<SpectrumErrorModel> m_errorModel; //!< Error model
128
129
  Time m_lastChangeTime;     /**< the time of the last change in
130
                                m_TotalPower */
131
132
  Ptr<SpectrumErrorModel> m_errorModel;
133
149
134
150
135
151
(-)a/src/spectrum/model/spectrum-model.h (-8 / +21 lines)
 Lines 44-56    Link Here 
44
 */
44
 */
45
struct BandInfo
45
struct BandInfo
46
{
46
{
47
  double fl; ///< lower limit of subband
47
  double fl; //!< lower limit of subband
48
  double fc; ///< center frequency
48
  double fc; //!< center frequency
49
  double fh; ///< upper limit of subband
49
  double fh; //!< upper limit of subband
50
};
50
};
51
51
52
52
53
/// Container of BandInfo
53
typedef std::vector<BandInfo> Bands;
54
typedef std::vector<BandInfo> Bands;
55
56
/// Uid for SpectrumModels
54
typedef uint32_t SpectrumModelUid_t;
57
typedef uint32_t SpectrumModelUid_t;
55
58
56
/**
59
/**
 Lines 63-68    Link Here 
63
class SpectrumModel : public SimpleRefCount<SpectrumModel>
66
class SpectrumModel : public SimpleRefCount<SpectrumModel>
64
{
67
{
65
public:
68
public:
69
  /**
70
   * Comparison operator. Returns true if the two SpectumModels are identical
71
   * \param lhs left operand
72
   * \param rhs right operand
73
   * \returns true if the two operands are identical
74
   */
66
  friend bool operator== (const SpectrumModel& lhs, const SpectrumModel& rhs);
75
  friend bool operator== (const SpectrumModel& lhs, const SpectrumModel& rhs);
67
76
68
  /**
77
  /**
 Lines 102-116    Link Here 
102
   */
111
   */
103
  SpectrumModelUid_t GetUid () const;
112
  SpectrumModelUid_t GetUid () const;
104
113
105
114
  /**
115
   * Const Iterator to the model Bands container start.
116
   */
106
  Bands::const_iterator Begin () const;
117
  Bands::const_iterator Begin () const;
118
  /**
119
   * Const Iterator to the model Bands container end.
120
   */
107
  Bands::const_iterator End () const;
121
  Bands::const_iterator End () const;
108
122
109
private:
123
private:
110
  Bands m_bands;         ///< actual definition of frequency bands
124
  Bands m_bands;         //!< Actual definition of frequency bands within this SpectrumModel
111
                         /// within this SpectrumModel
125
  SpectrumModelUid_t m_uid;        //!< unique id for a given set of frequencies
112
  SpectrumModelUid_t m_uid;        ///< unique id for a given set of frequencies
126
  static SpectrumModelUid_t m_uidCount;    //!< counter to assign m_uids
113
  static SpectrumModelUid_t m_uidCount;    ///< counter to assign m_uids
114
};
127
};
115
128
116
129
(-)a/src/spectrum/model/spectrum-phy.h (-4 / +19 lines)
 Lines 49-65    Link Here 
49
  SpectrumPhy ();
49
  SpectrumPhy ();
50
  virtual ~SpectrumPhy ();
50
  virtual ~SpectrumPhy ();
51
51
52
  /**
53
   * \brief Get the type ID.
54
   * \return the object TypeId
55
   */
52
  static TypeId GetTypeId (void);
56
  static TypeId GetTypeId (void);
53
57
54
  /**
58
  /**
55
   * set the associated NetDevice instance
59
   * Set the associated NetDevice instance
56
   *
60
   *
57
   * @param d the NetDevice instance
61
   * @param d the NetDevice instance
58
   */
62
   */
59
  virtual void SetDevice (Ptr<NetDevice> d) = 0;
63
  virtual void SetDevice (Ptr<NetDevice> d) = 0;
60
64
61
  /**
65
  /**
62
   * get the associated NetDevice instance
66
   * Get the associated NetDevice instance
63
   *
67
   *
64
   * @return a Ptr to the associated NetDevice instance
68
   * @return a Ptr to the associated NetDevice instance
65
   */
69
   */
 Lines 73-79    Link Here 
73
  virtual void SetMobility (Ptr<MobilityModel> m) = 0;
77
  virtual void SetMobility (Ptr<MobilityModel> m) = 0;
74
78
75
  /**
79
  /**
76
   * get the associated MobilityModel instance
80
   * Get the associated MobilityModel instance
77
   *
81
   *
78
   * @return a Ptr to the associated MobilityModel instance
82
   * @return a Ptr to the associated MobilityModel instance
79
   */
83
   */
 Lines 95-101    Link Here 
95
  virtual Ptr<const SpectrumModel> GetRxSpectrumModel () const = 0;
99
  virtual Ptr<const SpectrumModel> GetRxSpectrumModel () const = 0;
96
100
97
  /**
101
  /**
98
   * get the AntennaModel used by the NetDevice for reception
102
   * Get the AntennaModel used by the NetDevice for reception
99
   *
103
   *
100
   * @return a Ptr to the AntennaModel used by the NetDevice for reception
104
   * @return a Ptr to the AntennaModel used by the NetDevice for reception
101
   */
105
   */
 Lines 109-115    Link Here 
109
  virtual void StartRx (Ptr<SpectrumSignalParameters> params) = 0;
113
  virtual void StartRx (Ptr<SpectrumSignalParameters> params) = 0;
110
114
111
private:
115
private:
116
  /**
117
   * \brief Copy constructor
118
   *
119
   * Defined and unimplemented to avoid misuse
120
   */
112
  SpectrumPhy (SpectrumPhy const &);
121
  SpectrumPhy (SpectrumPhy const &);
122
  /**
123
   * \brief Copy constructor
124
   *
125
   * Defined and unimplemented to avoid misuse
126
   * \returns
127
   */
113
  SpectrumPhy& operator= (SpectrumPhy const &);
128
  SpectrumPhy& operator= (SpectrumPhy const &);
114
};
129
};
115
130
(-)a/src/spectrum/model/spectrum-propagation-loss-model.h (-8 / +10 lines)
 Lines 47-57    Link Here 
47
  SpectrumPropagationLossModel ();
47
  SpectrumPropagationLossModel ();
48
  virtual ~SpectrumPropagationLossModel ();
48
  virtual ~SpectrumPropagationLossModel ();
49
49
50
  /**
51
   * \brief Get the type ID.
52
   * \return the object TypeId
53
   */
50
  static TypeId GetTypeId ();
54
  static TypeId GetTypeId ();
51
55
52
53
  /**
56
  /**
54
   * used to chain various instances of SpectrumPropagationLossModel
57
   * Used to chain various instances of SpectrumPropagationLossModel
55
   *
58
   *
56
   * @param next
59
   * @param next
57
   */
60
   */
 Lines 63-74    Link Here 
63
   * @param txPsd the SpectrumValue representing the power spectral
66
   * @param txPsd the SpectrumValue representing the power spectral
64
   * density of the transmission. Watt units are to be used for radio
67
   * density of the transmission. Watt units are to be used for radio
65
   * communications, and Pascal units for acoustic communications
68
   * communications, and Pascal units for acoustic communications
66
   * (e.g. underwater).
69
   * (e.g., underwater).
67
   *
70
   *
68
   * @param a sender mobility
71
   * @param a sender mobility
69
   * @param b receiver mobility
72
   * @param b receiver mobility
70
   *
73
   *
71
   * @return set of values vs frequency representing the received
74
   * @return set of values Vs frequency representing the received
72
   * power in the same units used for the txPower parameter.
75
   * power in the same units used for the txPower parameter.
73
   */
76
   */
74
  Ptr<SpectrumValue> CalcRxPowerSpectralDensity (Ptr<const SpectrumValue> txPsd,
77
  Ptr<SpectrumValue> CalcRxPowerSpectralDensity (Ptr<const SpectrumValue> txPsd,
 Lines 82-101    Link Here 
82
private:
85
private:
83
  /**
86
  /**
84
   *
87
   *
85
   *
88
   * @param txPsd set of values Vs frequency representing the
86
   * @param txPsd set of values vs frequency representing the
87
   * transmission power. See SpectrumChannel for details.
89
   * transmission power. See SpectrumChannel for details.
88
   * @param a sender mobility
90
   * @param a sender mobility
89
   * @param b receiver mobility
91
   * @param b receiver mobility
90
   *
92
   *
91
   * @return set of values vs frequency representing the received
93
   * @return set of values Vs frequency representing the received
92
   * power in the same units used for the txPower parameter.
94
   * power in the same units used for the txPower parameter.
93
   */
95
   */
94
  virtual Ptr<SpectrumValue> DoCalcRxPowerSpectralDensity (Ptr<const SpectrumValue> txPsd,
96
  virtual Ptr<SpectrumValue> DoCalcRxPowerSpectralDensity (Ptr<const SpectrumValue> txPsd,
95
                                                           Ptr<const MobilityModel> a,
97
                                                           Ptr<const MobilityModel> a,
96
                                                           Ptr<const MobilityModel> b) const = 0;
98
                                                           Ptr<const MobilityModel> b) const = 0;
97
99
98
  Ptr<SpectrumPropagationLossModel> m_next;
100
  Ptr<SpectrumPropagationLossModel> m_next; //!< SpectrumPropagationLossModel chained to this one.
99
};
101
};
100
102
101
103
(-)a/src/spectrum/model/spectrum-signal-parameters.h (+2 lines)
 Lines 35-40    Link Here 
35
class AntennaModel;
35
class AntennaModel;
36
36
37
/**
37
/**
38
 * \ingroup spectrum
39
 *
38
 * This struct provides the generic signal representation to be used by
40
 * This struct provides the generic signal representation to be used by
39
 * all wireless technologies. Any specific wireless technology is
41
 * all wireless technologies. Any specific wireless technology is
40
 * allowed to define additional signal parameters by inheriting from this
42
 * allowed to define additional signal parameters by inheriting from this
(-)a/src/spectrum/model/spectrum-value.cc (+6 lines)
 Lines 416-421    Link Here 
416
}
416
}
417
417
418
418
419
/**
420
 * \brief Output stream operator
421
 * \param os output stream
422
 * \param pvf the SpectrumValue to print
423
 * \return an output stream
424
 */
419
std::ostream&
425
std::ostream&
420
operator << (std::ostream& os, const SpectrumValue& pvf)
426
operator << (std::ostream& os, const SpectrumValue& pvf)
421
{
427
{
(-)a/src/spectrum/model/spectrum-value.h (-11 / +72 lines)
 Lines 30-35    Link Here 
30
namespace ns3 {
30
namespace ns3 {
31
31
32
32
33
/// Container for element values
33
typedef std::vector<double> Values;
34
typedef std::vector<double> Values;
34
35
35
/**
36
/**
 Lines 283-289    Link Here 
283
  /**
284
  /**
284
   * unary plus operator
285
   * unary plus operator
285
   *
286
   *
286
   *
287
   * @param rhs Right Hand Side of the operator
287
   * @return the value of *this
288
   * @return the value of *this
288
   */
289
   */
289
  friend SpectrumValue operator+ (const SpectrumValue& rhs);
290
  friend SpectrumValue operator+ (const SpectrumValue& rhs);
 Lines 291-297    Link Here 
291
  /**
292
  /**
292
   * unary minus operator
293
   * unary minus operator
293
   *
294
   *
294
   *
295
   * @param rhs Right Hand Side of the operator
295
   * @return the value of - *this
296
   * @return the value of - *this
296
   */
297
   */
297
  friend SpectrumValue operator- (const SpectrumValue& rhs);
298
  friend SpectrumValue operator- (const SpectrumValue& rhs);
 Lines 452-458    Link Here 
452
453
453
  /**
454
  /**
454
   *
455
   *
455
   *
456
   * @param lhs the base
456
   * @param lhs the base
457
   * @param rhs the exponent
457
   * @param rhs the exponent
458
   *
458
   *
 Lines 512-544    Link Here 
512
512
513
513
514
private:
514
private:
515
  /**
516
   * Add a SpectrumValue (element to element addition)
517
   * \param x SpectrumValue
518
   */
515
  void Add (const SpectrumValue& x);
519
  void Add (const SpectrumValue& x);
520
  /**
521
   * Add a flat value to all the current elements
522
   * \param s flat value
523
   */
516
  void Add (double s);
524
  void Add (double s);
525
  /**
526
   * Subtracts a SpectrumValue (element by element subtraction)
527
   * \param x SpectrumValue
528
   */
517
  void Subtract (const SpectrumValue& x);
529
  void Subtract (const SpectrumValue& x);
530
  /**
531
   * Subtracts a flat value to all the current elements
532
   * \param s flat value
533
   */
518
  void Subtract (double s);
534
  void Subtract (double s);
535
  /**
536
   * Multiplies for a SpectrumValue (element to element multiplication)
537
   * \param x SpectrumValue
538
   */
519
  void Multiply (const SpectrumValue& x);
539
  void Multiply (const SpectrumValue& x);
540
  /**
541
   * Multiplies for a flat value to all the current elements
542
   * \param s flat value
543
   */
520
  void Multiply (double s);
544
  void Multiply (double s);
545
  /**
546
   * Divides by a SpectrumValue (element to element division)
547
   * \param x SpectrumValue
548
   */
521
  void Divide (const SpectrumValue& x);
549
  void Divide (const SpectrumValue& x);
550
  /**
551
   * Divides by a flat value to all the current elements
552
   * \param s flat value
553
   */
522
  void Divide (double s);
554
  void Divide (double s);
555
  /**
556
   * Change the values sign
557
   */
523
  void ChangeSign ();
558
  void ChangeSign ();
559
  /**
560
   * Shift the values to the left
561
   */
524
  void ShiftLeft (int n);
562
  void ShiftLeft (int n);
563
  /**
564
   * Shift the values to the right
565
   */
525
  void ShiftRight (int n);
566
  void ShiftRight (int n);
567
  /**
568
   * Modifies each element so that it each element is raised to the exponent
569
   *
570
   * \param exp the exponent
571
   */
526
  void Pow (double exp);
572
  void Pow (double exp);
573
  /**
574
   * Modifies each element so that it is
575
   * the base raised to each element value
576
   *
577
   * \param base the base
578
   */
527
  void Exp (double base);
579
  void Exp (double base);
580
  /**
581
   * Applies a Log10 to each the elements
582
   */
528
  void Log10 ();
583
  void Log10 ();
584
  /**
585
   * Applies a Log2 to each the elements
586
   */
529
  void Log2 ();
587
  void Log2 ();
588
  /**
589
   * Applies a Log to each the elements
590
   */
530
  void Log ();
591
  void Log ();
531
592
532
  Ptr<const SpectrumModel> m_spectrumModel;
593
  Ptr<const SpectrumModel> m_spectrumModel; //!< The spectrum model
533
594
534
595
535
/**
596
  /**
536
 * Set of values which implement the codomain of the functions in
597
   * Set of values which implement the codomain of the functions in
537
 * the Function Space defined by SpectrumValue. There is no restriction
598
   * the Function Space defined by SpectrumValue. There is no restriction
538
 * on what these values represent (a transmission power density, a
599
   * on what these values represent (a transmission power density, a
539
 * propagation loss, etc.).
600
   * propagation loss, etc.).
540
 *
601
   *
541
 */
602
   */
542
  Values m_values;
603
  Values m_values;
543
604
544
605
(-)a/src/spectrum/model/tv-spectrum-transmitter.cc (-4 / +16 lines)
 Lines 185-196    Link Here 
185
  return m_channel;
185
  return m_channel;
186
}
186
}
187
187
188
// Used as key for map containing created spectrum models
188
/// Used as key for map containing created spectrum models
189
struct TvSpectrumModelId
189
struct TvSpectrumModelId
190
{
190
{
191
  /**
192
   * Constructor
193
   * \param stFreq Start frequency [Hz]
194
   * \param bwidth Bandwidth [Hz]
195
   */
191
  TvSpectrumModelId (double stFreq, double bwidth);
196
  TvSpectrumModelId (double stFreq, double bwidth);
192
  double startFrequency;
197
  double startFrequency;  //!< Start frequency [Hz]
193
  double bandwidth;
198
  double bandwidth;       //!< Bandwidth [Hz]
194
};
199
};
195
200
196
TvSpectrumModelId::TvSpectrumModelId (double stFreq, double bwidth)
201
TvSpectrumModelId::TvSpectrumModelId (double stFreq, double bwidth)
 Lines 199-204    Link Here 
199
{
204
{
200
}
205
}
201
206
207
/**
208
 * Minus-than operator
209
 * \param a left operand
210
 * \param b right operand
211
 * \returns true if the left operand has a lower starting frequency
212
 *          or a smaller bandwidth (if both have the same starting freq.)
213
 */
202
bool
214
bool
203
operator < (const TvSpectrumModelId& a, const TvSpectrumModelId& b)
215
operator < (const TvSpectrumModelId& a, const TvSpectrumModelId& b)
204
{
216
{
 Lines 206-212    Link Here 
206
           ( (a.startFrequency == b.startFrequency) && (a.bandwidth < b.bandwidth) ) );
218
           ( (a.startFrequency == b.startFrequency) && (a.bandwidth < b.bandwidth) ) );
207
}
219
}
208
220
209
// Stores created spectrum models
221
/// Stores created spectrum models
210
static std::map<TvSpectrumModelId, Ptr<SpectrumModel> > g_tvSpectrumModelMap;
222
static std::map<TvSpectrumModelId, Ptr<SpectrumModel> > g_tvSpectrumModelMap;
211
223
212
/** 
224
/** 
(-)a/src/spectrum/model/tv-spectrum-transmitter.h (-2 / +2 lines)
 Lines 57-64    Link Here 
57
    TVTYPE_COFDM
57
    TVTYPE_COFDM
58
  };
58
  };
59
  
59
  
60
  TvSpectrumTransmitter (); //!< Default constructor
60
  TvSpectrumTransmitter ();
61
  virtual ~TvSpectrumTransmitter (); //!< Destructor
61
  virtual ~TvSpectrumTransmitter ();
62
  
62
  
63
  /**
63
  /**
64
   * Register this type.
64
   * Register this type.
(-)a/src/spectrum/model/waveform-generator.h (-11 / +18 lines)
 Lines 57-62    Link Here 
57
  WaveformGenerator ();
57
  WaveformGenerator ();
58
  virtual ~WaveformGenerator ();
58
  virtual ~WaveformGenerator ();
59
59
60
  /**
61
   * \brief Get the type ID.
62
   * \return the object TypeId
63
   */
60
  static TypeId GetTypeId (void);
64
  static TypeId GetTypeId (void);
61
65
62
  // inherited from SpectrumPhy
66
  // inherited from SpectrumPhy
 Lines 129-149    Link Here 
129
private:
133
private:
130
  virtual void DoDispose (void);
134
  virtual void DoDispose (void);
131
135
132
  Ptr<MobilityModel> m_mobility;
136
  Ptr<MobilityModel> m_mobility;  //!< Mobility model
133
  Ptr<AntennaModel> m_antenna;
137
  Ptr<AntennaModel> m_antenna;    //!< Antenna model
134
  Ptr<NetDevice> m_netDevice;
138
  Ptr<NetDevice> m_netDevice;     //!< Owning NetDevice
135
  Ptr<SpectrumChannel> m_channel;
139
  Ptr<SpectrumChannel> m_channel; //!< Channel
136
140
141
  /**
142
   * Generates a waveform
143
   */
137
  virtual void GenerateWaveform ();
144
  virtual void GenerateWaveform ();
138
145
139
  Ptr<SpectrumValue> m_txPowerSpectralDensity;
146
  Ptr<SpectrumValue> m_txPowerSpectralDensity; //!< Tx PSD
140
  Time   m_period;
147
  Time   m_period;    //!< Period
141
  double m_dutyCycle;
148
  double m_dutyCycle; //!< Duty Cycle (should be in [0,1])
142
  Time m_startTime;
149
  Time m_startTime;   //!< Start time
143
  EventId m_nextWave;
150
  EventId m_nextWave; //!< Next waveform generation event
144
151
145
  TracedCallback<Ptr<const Packet> > m_phyTxStartTrace;
152
  TracedCallback<Ptr<const Packet> > m_phyTxStartTrace; //!< TracedCallback: Tx start
146
  TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;
153
  TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;   //!< TracedCallback: Tx end
147
};
154
};
148
155
149
156
(-)a/src/spectrum/model/wifi-spectrum-value-helper.cc (-2 / +5 lines)
 Lines 23-29    Link Here 
23
23
24
namespace ns3 {
24
namespace ns3 {
25
25
26
26
/// The Wi-Fi spectrum model
27
static Ptr<SpectrumModel> g_WifiSpectrumModel5Mhz;
27
static Ptr<SpectrumModel> g_WifiSpectrumModel5Mhz;
28
28
29
WifiSpectrumValueHelper::~WifiSpectrumValueHelper ()
29
WifiSpectrumValueHelper::~WifiSpectrumValueHelper ()
 Lines 34-39    Link Here 
34
{
34
{
35
}
35
}
36
36
37
/**
38
 * Static class to initialize the values for the Wi-Fi spectrum model
39
 */
37
static class WifiSpectrumModel5MhzInitializer
40
static class WifiSpectrumModel5MhzInitializer
38
{
41
{
39
public:
42
public:
 Lines 50-56    Link Here 
50
      }
53
      }
51
    g_WifiSpectrumModel5Mhz = Create<SpectrumModel> (bands);
54
    g_WifiSpectrumModel5Mhz = Create<SpectrumModel> (bands);
52
  }
55
  }
53
} g_WifiSpectrumModel5MhzInitializerInstance;
56
} g_WifiSpectrumModel5MhzInitializerInstance; //!< initialization instance for WifiSpectrumModel5Mhz
54
57
55
58
56
59
(-)a/src/spectrum/model/wifi-spectrum-value-helper.h (-14 / +17 lines)
 Lines 31-70    Link Here 
31
/**
31
/**
32
 * \ingroup spectrum
32
 * \ingroup spectrum
33
 *
33
 *
34
 * this abstract class defines the interface for interacting with all WifiSpectrumValue implementations.
34
 * This abstract class defines the interface for interacting with all WifiSpectrumValue implementations.
35
 *
35
 *
36
 */
36
 */
37
class WifiSpectrumValueHelper
37
class WifiSpectrumValueHelper
38
{
38
{
39
public:
39
public:
40
  virtual ~WifiSpectrumValueHelper ();
40
  virtual ~WifiSpectrumValueHelper ();
41
  /*
41
  /**
42
   * Creates a SpectrumValue instance which
43
   * has a constant value for all frequencies
42
   *
44
   *
43
   * @param value the constant value
45
   * @param psd the constant value
44
   *
46
   *
45
   * @return a Ptr to a newly created SpectrumValue instance which
47
   * @return a Ptr to a newly created SpectrumValue
46
   * has a constant value for all frequencies
47
   */
48
   */
48
  virtual Ptr<SpectrumValue> CreateConstant (double psd) = 0;
49
  virtual Ptr<SpectrumValue> CreateConstant (double psd) = 0;
49
50
50
  /*
51
  /**
52
   * Creates a SpectrumValue instance which
53
   * represents the TX Power Spectral Density  of a wifi device
54
   * corresponding to the provided parameters
51
   *
55
   *
52
   * @param txPower the total TX power in W
56
   * @param txPower the total TX power in W
53
   * @param channel the number of the channel
57
   * @param channel the number of the channel
54
   *
58
   *
55
   * @return a Ptr to a newly created SpectrumValue instance which
59
   * @return a Ptr to a newly created SpectrumValue
56
   * represents the TX Power Spectral Density  of a wifi device
57
   * corresponding to the provided parameters
58
   */
60
   */
59
  virtual Ptr<SpectrumValue> CreateTxPowerSpectralDensity (double txPower, uint32_t channel) = 0;
61
  virtual Ptr<SpectrumValue> CreateTxPowerSpectralDensity (double txPower, uint32_t channel) = 0;
60
62
61
  /*
63
  /**
64
   * Creates a pectrumValue instance which
65
   * represents the frequency response of the RF filter which is used
66
   * by a wifi device to receive signals when tuned to a particular channel
62
   *
67
   *
63
   * @param channel the number of the channel
68
   * @param channel the number of the channel
64
   *
69
   *
65
   * @return a Ptr to a newly created SpectrumValue instance which
70
   * @return a Ptr to a newly created SpectrumValue
66
   * represents the frequency response of the RF filter which is used
67
   * by a wifi device to receive signals when tuned to a particular channel
68
   */
71
   */
69
  virtual Ptr<SpectrumValue> CreateRfFilter (uint32_t channel) = 0;
72
  virtual Ptr<SpectrumValue> CreateRfFilter (uint32_t channel) = 0;
70
73
 Lines 79-85    Link Here 
79
 * 5 MHz spectrum resolution.
82
 * 5 MHz spectrum resolution.
80
 *
83
 *
81
 */
84
 */
82
class WifiSpectrumValue5MhzFactory
85
class WifiSpectrumValue5MhzFactory : public WifiSpectrumValueHelper
83
{
86
{
84
public:
87
public:
85
  virtual ~WifiSpectrumValue5MhzFactory ();
88
  virtual ~WifiSpectrumValue5MhzFactory ();

Return to bug 938