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

(-)a/src/uan/model/uan-phy-dual.cc (-43 lines)
 Lines 182-197    Link Here 
182
                   DoubleValue (190),
182
                   DoubleValue (190),
183
                   MakeDoubleAccessor (&UanPhyDual::GetTxPowerDbPhy2, &UanPhyDual::SetTxPowerDbPhy2),
183
                   MakeDoubleAccessor (&UanPhyDual::GetTxPowerDbPhy2, &UanPhyDual::SetTxPowerDbPhy2),
184
                   MakeDoubleChecker<double> ())
184
                   MakeDoubleChecker<double> ())
185
    .AddAttribute ("RxGainPhy1",
186
                   "Gain added to incoming signal at receiver of Phy1.",
187
                   DoubleValue (0),
188
                   MakeDoubleAccessor (&UanPhyDual::GetRxGainDbPhy1, &UanPhyDual::SetRxGainDbPhy1),
189
                   MakeDoubleChecker<double> ())
190
    .AddAttribute ("RxGainPhy2",
191
                   "Gain added to incoming signal at receiver of Phy2.",
192
                   DoubleValue (0),
193
                   MakeDoubleAccessor (&UanPhyDual::GetRxGainDbPhy2, &UanPhyDual::SetRxGainDbPhy2),
194
                   MakeDoubleChecker<double> ())
195
    .AddAttribute ("SupportedModesPhy1",
185
    .AddAttribute ("SupportedModesPhy1",
196
                   "List of modes supported by Phy1.",
186
                   "List of modes supported by Phy1.",
197
                   UanModesListValue (UanPhyGen::GetDefaultModes ()),
187
                   UanModesListValue (UanPhyGen::GetDefaultModes ()),
 Lines 302-324    Link Here 
302
  m_phy2->SetReceiveErrorCallback (cb);
292
  m_phy2->SetReceiveErrorCallback (cb);
303
}
293
}
304
294
305
void
306
UanPhyDual::SetRxGainDb (double gain)
307
{
308
  m_phy1->SetRxGainDb (gain);
309
  m_phy2->SetRxGainDb (gain);
310
}
311
void
312
UanPhyDual::SetRxGainDbPhy1 (double gain)
313
{
314
  m_phy1->SetRxGainDb (gain);
315
}
316
317
void
318
UanPhyDual::SetRxGainDbPhy2 (double gain)
319
{
320
  m_phy2->SetRxGainDb (gain);
321
}
322
295
323
void
296
void
324
UanPhyDual::SetTxPowerDb (double txpwr)
297
UanPhyDual::SetTxPowerDb (double txpwr)
 Lines 362-383    Link Here 
362
  m_phy2->SetCcaThresholdDb (thresh);
335
  m_phy2->SetCcaThresholdDb (thresh);
363
}
336
}
364
337
365
double
366
UanPhyDual::GetRxGainDb (void)
367
{
368
  NS_LOG_WARN ("Warning: UanPhyDual::GetRxGainDb returns RxGain of Phy 1");
369
  return m_phy1->GetRxGainDb ();
370
}
371
double
372
UanPhyDual::GetRxGainDbPhy1 (void) const
373
{
374
  return m_phy1->GetRxGainDb ();
375
}
376
double
377
UanPhyDual::GetRxGainDbPhy2 (void) const
378
{
379
  return m_phy2->GetRxGainDb ();
380
}
381
338
382
double
339
double
383
UanPhyDual::GetTxPowerDb (void)
340
UanPhyDual::GetTxPowerDb (void)
(-)a/src/uan/model/uan-phy-dual.h (-10 lines)
 Lines 112-122    Link Here 
112
  virtual void StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp);
112
  virtual void StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp);
113
  virtual void SetReceiveOkCallback (RxOkCallback cb);
113
  virtual void SetReceiveOkCallback (RxOkCallback cb);
114
  virtual void SetReceiveErrorCallback (RxErrCallback cb);
114
  virtual void SetReceiveErrorCallback (RxErrCallback cb);
115
  virtual void SetRxGainDb (double gain);
116
  virtual void SetTxPowerDb (double txpwr);
115
  virtual void SetTxPowerDb (double txpwr);
117
  virtual void SetRxThresholdDb (double thresh);
116
  virtual void SetRxThresholdDb (double thresh);
118
  virtual void SetCcaThresholdDb (double thresh);
117
  virtual void SetCcaThresholdDb (double thresh);
119
  virtual double GetRxGainDb (void);
120
  virtual double GetTxPowerDb (void);
118
  virtual double GetTxPowerDb (void);
121
  virtual double GetRxThresholdDb (void);
119
  virtual double GetRxThresholdDb (void);
122
  virtual double GetCcaThresholdDb (void);
120
  virtual double GetCcaThresholdDb (void);
 Lines 178-191    Link Here 
178
  /** \copydoc UanPhy::SetTxPowerDb */
176
  /** \copydoc UanPhy::SetTxPowerDb */
179
  void SetTxPowerDbPhy2 (double txpwr);
177
  void SetTxPowerDbPhy2 (double txpwr);
180
178
181
  /** \copydoc UanPhy::GetRxGainDb */
182
  double GetRxGainDbPhy1 (void) const;
183
  /** \copydoc UanPhy::GetRxGainDb */
184
  double GetRxGainDbPhy2 (void) const;
185
  /** \copydoc UanPhy::SetRxGainDb */
186
  void SetRxGainDbPhy1 (double gain);
187
  /** \copydoc UanPhy::SetRxGainDb */
188
  void SetRxGainDbPhy2 (double gain);
189
179
190
  /**
180
  /**
191
   * Get the list of available modes.
181
   * Get the list of available modes.
(-)a/src/uan/model/uan-phy-gen.cc (-18 / +2 lines)
 Lines 353-359    Link Here 
353
    m_transducer (0),
353
    m_transducer (0),
354
    m_device (0),
354
    m_device (0),
355
    m_mac (0),
355
    m_mac (0),
356
    m_rxGainDb (0),
357
    m_txPwrDb (0),
356
    m_txPwrDb (0),
358
    m_rxThreshDb (0),
357
    m_rxThreshDb (0),
359
    m_ccaThreshDb (0),
358
    m_ccaThreshDb (0),
 Lines 452-462    Link Here 
452
                   DoubleValue (190),
451
                   DoubleValue (190),
453
                   MakeDoubleAccessor (&UanPhyGen::m_txPwrDb),
452
                   MakeDoubleAccessor (&UanPhyGen::m_txPwrDb),
454
                   MakeDoubleChecker<double> ())
453
                   MakeDoubleChecker<double> ())
455
    .AddAttribute ("RxGain",
456
                   "Gain added to incoming signal at receiver.",
457
                   DoubleValue (0),
458
                   MakeDoubleAccessor (&UanPhyGen::m_rxGainDb),
459
                   MakeDoubleChecker<double> ())
460
    .AddAttribute ("SupportedModes",
454
    .AddAttribute ("SupportedModes",
461
                   "List of modes supported by this PHY.",
455
                   "List of modes supported by this PHY.",
462
                   UanModesListValue (UanPhyGen::GetDefaultModes ()),
456
                   UanModesListValue (UanPhyGen::GetDefaultModes ()),
 Lines 611-617    Link Here 
611
void
605
void
612
UanPhyGen::StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
606
UanPhyGen::StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
613
{
607
{
614
  rxPowerDb += GetRxGainDb ();
615
  NS_LOG_DEBUG ("PHY " << m_mac->GetAddress () << ": rx power after RX gain = " << rxPowerDb << " dB re uPa");
608
  NS_LOG_DEBUG ("PHY " << m_mac->GetAddress () << ": rx power after RX gain = " << rxPowerDb << " dB re uPa");
616
609
617
  switch (m_state)
610
  switch (m_state)
 Lines 783-794    Link Here 
783
776
784
777
785
void
778
void
786
UanPhyGen::SetRxGainDb (double gain)
787
{
788
  m_rxGainDb = gain;
789
790
}
791
void
792
UanPhyGen::SetTxPowerDb (double txpwr)
779
UanPhyGen::SetTxPowerDb (double txpwr)
793
{
780
{
794
  m_txPwrDb = txpwr;
781
  m_txPwrDb = txpwr;
 Lines 803-819    Link Here 
803
{
790
{
804
  m_ccaThreshDb = thresh;
791
  m_ccaThreshDb = thresh;
805
}
792
}
806
double
793
807
UanPhyGen::GetRxGainDb (void)
808
{
809
  return m_rxGainDb;
810
}
811
double
794
double
812
UanPhyGen::GetTxPowerDb (void)
795
UanPhyGen::GetTxPowerDb (void)
813
{
796
{
814
  return m_txPwrDb;
797
  return m_txPwrDb;
815
798
816
}
799
}
800
817
double
801
double
818
UanPhyGen::GetRxThresholdDb (void)
802
UanPhyGen::GetRxThresholdDb (void)
819
{
803
{
(-)a/src/uan/model/uan-phy-gen.h (-4 / +1 lines)
 Lines 253-263    Link Here 
253
  virtual bool IsStateRx (void);
253
  virtual bool IsStateRx (void);
254
  virtual bool IsStateTx (void);
254
  virtual bool IsStateTx (void);
255
  virtual bool IsStateCcaBusy (void);
255
  virtual bool IsStateCcaBusy (void);
256
  virtual void SetRxGainDb (double gain);
257
  virtual void SetTxPowerDb (double txpwr);
256
  virtual void SetTxPowerDb (double txpwr);
258
  virtual void SetRxThresholdDb (double thresh);
257
  virtual void SetRxThresholdDb (double thresh);
259
  virtual void SetCcaThresholdDb (double thresh);
258
  virtual void SetCcaThresholdDb (double thresh);
260
  virtual double GetRxGainDb (void);
261
  virtual double GetTxPowerDb (void);
259
  virtual double GetTxPowerDb (void);
262
  virtual double GetRxThresholdDb (void);
260
  virtual double GetRxThresholdDb (void);
263
  virtual double GetCcaThresholdDb (void);
261
  virtual double GetCcaThresholdDb (void);
 Lines 294-300    Link Here 
294
  Ptr<UanPhyPer> m_per;             //!< Error model.
292
  Ptr<UanPhyPer> m_per;             //!< Error model.
295
  Ptr<UanPhyCalcSinr> m_sinr;       //!< SINR calculator.
293
  Ptr<UanPhyCalcSinr> m_sinr;       //!< SINR calculator.
296
294
297
  double m_rxGainDb;                //!< Receive gain.
298
  double m_txPwrDb;                 //!< Transmit power.
295
  double m_txPwrDb;                 //!< Transmit power.
299
  double m_rxThreshDb;              //!< Receive SINR threshold.
296
  double m_rxThreshDb;              //!< Receive SINR threshold.
300
  double m_ccaThreshDb;             //!< CCA busy threshold.
297
  double m_ccaThreshDb;             //!< CCA busy threshold.
 Lines 304-310    Link Here 
304
  double m_minRxSinrDb;             //!< Minimum receive SINR during packet reception.
301
  double m_minRxSinrDb;             //!< Minimum receive SINR during packet reception.
305
  double m_rxRecvPwrDb;             //!< Receiver power.
302
  double m_rxRecvPwrDb;             //!< Receiver power.
306
  Time m_pktRxArrTime;              //!< Packet arrival time.
303
  Time m_pktRxArrTime;              //!< Packet arrival time.
307
  UanPdp m_pktRxPdp;                //!< Power delay profile of pakket.
304
  UanPdp m_pktRxPdp;                //!< Power delay profile of packet.
308
  UanTxMode m_pktRxMode;            //!< Packet transmission mode at receiver.
305
  UanTxMode m_pktRxMode;            //!< Packet transmission mode at receiver.
309
306
310
  bool m_cleared;                   //!< Flag when we've been cleared.
307
  bool m_cleared;                   //!< Flag when we've been cleared.
(-)a/src/uan/model/uan-phy.h (-12 lines)
 Lines 267-278    Link Here 
267
   */
267
   */
268
  virtual void SetReceiveErrorCallback (RxErrCallback cb) = 0;
268
  virtual void SetReceiveErrorCallback (RxErrCallback cb) = 0;
269
269
270
  /**
271
   * Set the receiver gain.
272
   *
273
   * \param gain Gain added at receiver, in dB.
274
   */
275
  virtual void SetRxGainDb (double gain) = 0;
276
270
277
  /**
271
  /**
278
   * Set the transmit power.
272
   * Set the transmit power.
 Lines 297-308    Link Here 
297
   */
291
   */
298
  virtual void SetCcaThresholdDb (double thresh) = 0;
292
  virtual void SetCcaThresholdDb (double thresh) = 0;
299
293
300
  /**
301
   * Get the receiver gain added to signal at receiver in dB.
302
   *
303
   * \return The gain.
304
   */
305
  virtual double GetRxGainDb (void) = 0;
306
294
307
  /**
295
  /**
308
   * Get the current transmit power, in dB.
296
   * Get the current transmit power, in dB.
(-)a/src/uan/model/uan-transducer-hd.cc (-2 / +32 lines)
 Lines 25-31    Link Here 
25
#include "uan-channel.h"
25
#include "uan-channel.h"
26
#include "ns3/log.h"
26
#include "ns3/log.h"
27
#include "ns3/pointer.h"
27
#include "ns3/pointer.h"
28
28
#include "ns3/double.h"
29
29
30
namespace ns3 {
30
namespace ns3 {
31
31
 Lines 37-43    Link Here 
37
  : UanTransducer (),
37
  : UanTransducer (),
38
    m_state (RX),
38
    m_state (RX),
39
    m_endTxTime (Seconds (0)),
39
    m_endTxTime (Seconds (0)),
40
    m_cleared (false)
40
    m_cleared (false),
41
    m_rxGainDb (0)
41
{
42
{
42
}
43
}
43
44
 Lines 91-96    Link Here 
91
    .SetParent<UanTransducer> ()
92
    .SetParent<UanTransducer> ()
92
    .SetGroupName ("Uan")
93
    .SetGroupName ("Uan")
93
    .AddConstructor<UanTransducerHd> ()
94
    .AddConstructor<UanTransducerHd> ()
95
    .AddAttribute ("RxGainDb",
96
                   "Gain in Db added to incoming signal at receiver.",
97
                   DoubleValue (0),
98
                   MakeDoubleAccessor (&UanTransducerHd::m_rxGainDb),
99
                   MakeDoubleChecker<double> ())
94
  ;
100
  ;
95
  return tid;
101
  return tid;
96
}
102
}
 Lines 122-132    Link Here 
122
}
128
}
123
129
124
void
130
void
131
UanTransducerHd::SetRxGainDb (double gainDb)
132
{
133
  m_rxGainDb = gainDb;
134
}
135
136
double
137
UanTransducerHd::GetRxGainDb (void)
138
{
139
  return m_rxGainDb;
140
}
141
142
double
143
UanTransducerHd::ApplyRxGainDb(double rxPowerDb, UanTxMode mode)
144
{
145
	rxPowerDb += GetRxGainDb ();
146
	NS_LOG_DEBUG ( "Rx power after RX gain = " << rxPowerDb << " db re uPa");
147
	return rxPowerDb;
148
}
149
150
void
125
UanTransducerHd::Receive (Ptr<Packet> packet,
151
UanTransducerHd::Receive (Ptr<Packet> packet,
126
                          double rxPowerDb,
152
                          double rxPowerDb,
127
                          UanTxMode txMode,
153
                          UanTxMode txMode,
128
                          UanPdp pdp)
154
                          UanPdp pdp)
129
{
155
{
156
  //Apply receiver gain in dB
157
  rxPowerDb = ApplyRxGainDb(rxPowerDb, txMode);
158
159
130
  UanPacketArrival arrival (packet,
160
  UanPacketArrival arrival (packet,
131
                            rxPowerDb,
161
                            rxPowerDb,
132
                            txMode,
162
                            txMode,
(-)a/src/uan/model/uan-transducer-hd.h (+4 lines)
 Lines 52-57    Link Here 
52
  virtual bool IsRx (void) const;
52
  virtual bool IsRx (void) const;
53
  virtual bool IsTx (void) const;
53
  virtual bool IsTx (void) const;
54
  virtual const ArrivalList &GetArrivalList (void) const;
54
  virtual const ArrivalList &GetArrivalList (void) const;
55
  virtual double ApplyRxGainDb(double rxPowerDb, UanTxMode mode);
56
  virtual void SetRxGainDb (double gainDb);  
57
  virtual double GetRxGainDb (void);
55
  virtual void Receive (Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp);
58
  virtual void Receive (Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp);
56
  virtual void Transmit (Ptr<UanPhy> src, Ptr<Packet> packet, double txPowerDb, UanTxMode txMode);
59
  virtual void Transmit (Ptr<UanPhy> src, Ptr<Packet> packet, double txPowerDb, UanTxMode txMode);
57
  virtual void SetChannel (Ptr<UanChannel> chan);
60
  virtual void SetChannel (Ptr<UanChannel> chan);
 Lines 68-73    Link Here 
68
  EventId m_endTxEvent;       //!< Event scheduled for end of transmission.
71
  EventId m_endTxEvent;       //!< Event scheduled for end of transmission.
69
  Time m_endTxTime;           //!< Time at which transmission will be completed.
72
  Time m_endTxTime;           //!< Time at which transmission will be completed.
70
  bool m_cleared;             //!< Flab when we've been cleared.
73
  bool m_cleared;             //!< Flab when we've been cleared.
74
  double m_rxGainDb;          //!< Receive gain in Db.
71
75
72
  /**
76
  /**
73
   * Remove an entry from the arrival list.
77
   * Remove an entry from the arrival list.
(-)a/src/uan/model/uan-transducer.h (+18 lines)
 Lines 182-187    Link Here 
182
   */
182
   */
183
  virtual const ArrivalList &GetArrivalList (void) const = 0;
183
  virtual const ArrivalList &GetArrivalList (void) const = 0;
184
  /**
184
  /**
185
   * Set the receiver gain.
186
   *
187
   * \param gainDb Gain added at receiver, in dB.
188
   */
189
  virtual void SetRxGainDb (double gainDb) = 0;  
190
  /**
191
   * Get the receiver gain added to signal at receiver in dB.
192
   *
193
   * \return The gain.
194
   */
195
  virtual double GetRxGainDb (void) = 0;
196
  /**
197
   * Apply receiver gain in dB to the received power.
198
   *
199
   * \return Updated receive power with gain applied.
200
   */
201
  virtual double ApplyRxGainDb(double rxPowerDb, UanTxMode mode) = 0;
202
  /**
185
   * Notify this object that a new packet has arrived at this nodes location
203
   * Notify this object that a new packet has arrived at this nodes location
186
   *
204
   *
187
   * \param packet Packet arriving.
205
   * \param packet Packet arriving.

Return to bug 2492