src/wifi/model/wifi-phy.h
changeset 10424 9d29c9a5ddcb
parent 10139 17a71cd49da3
child 10483 e3a02ed14587
equal deleted inserted replaced
10423:dface7efc30d 10424:9d29c9a5ddcb
   160   static TypeId GetTypeId (void);
   160   static TypeId GetTypeId (void);
   161 
   161 
   162   WifiPhy ();
   162   WifiPhy ();
   163   virtual ~WifiPhy ();
   163   virtual ~WifiPhy ();
   164 
   164 
       
   165   /**
       
   166    * Return the minimum available transmission power level (dBm).
       
   167    *
       
   168    * \return the minimum available transmission power level in dBm
       
   169    */
   165   virtual double GetTxPowerStart (void) const = 0;
   170   virtual double GetTxPowerStart (void) const = 0;
       
   171   /**
       
   172    * Return the maximum available transmission power level (dBm).
       
   173    *
       
   174    * \return the maximum available transmission power level in dBm
       
   175    */
   166   virtual double GetTxPowerEnd (void) const = 0;
   176   virtual double GetTxPowerEnd (void) const = 0;
   167   /**
   177   /**
   168    * \returns the number of tx power levels available for this PHY.
   178    * \return the number of tx power levels available for this PHY.
   169    */
   179    */
   170   virtual uint32_t GetNTxPower (void) const = 0;
   180   virtual uint32_t GetNTxPower (void) const = 0;
   171 
   181 
   172   /**
   182   /**
   173    * \param callback the callback to invoke
   183    * \param callback the callback to invoke
   196    * PHY-level events.
   206    * PHY-level events.
   197    */
   207    */
   198   virtual void RegisterListener (WifiPhyListener *listener) = 0;
   208   virtual void RegisterListener (WifiPhyListener *listener) = 0;
   199 
   209 
   200   /**
   210   /**
   201    * \returns true of the current state of the PHY layer is WifiPhy::IDLE, false otherwise.
   211    * \return true of the current state of the PHY layer is WifiPhy::IDLE, false otherwise.
   202    */
   212    */
   203   virtual bool IsStateIdle (void) = 0;
   213   virtual bool IsStateIdle (void) = 0;
   204   /**
   214   /**
   205    * \returns true of the current state of the PHY layer is WifiPhy::CCA_BUSY, false otherwise.
   215    * \return true of the current state of the PHY layer is WifiPhy::CCA_BUSY, false otherwise.
   206    */
   216    */
   207   virtual bool IsStateCcaBusy (void) = 0;
   217   virtual bool IsStateCcaBusy (void) = 0;
   208   /**
   218   /**
   209    * \returns true of the current state of the PHY layer is not WifiPhy::IDLE, false otherwise.
   219    * \return true of the current state of the PHY layer is not WifiPhy::IDLE, false otherwise.
   210    */
   220    */
   211   virtual bool IsStateBusy (void) = 0;
   221   virtual bool IsStateBusy (void) = 0;
   212   /**
   222   /**
   213    * \returns true of the current state of the PHY layer is WifiPhy::RX, false otherwise.
   223    * \return true of the current state of the PHY layer is WifiPhy::RX, false otherwise.
   214    */
   224    */
   215   virtual bool IsStateRx (void) = 0;
   225   virtual bool IsStateRx (void) = 0;
   216   /**
   226   /**
   217    * \returns true of the current state of the PHY layer is WifiPhy::TX, false otherwise.
   227    * \return true of the current state of the PHY layer is WifiPhy::TX, false otherwise.
   218    */
   228    */
   219   virtual bool IsStateTx (void) = 0;
   229   virtual bool IsStateTx (void) = 0;
   220   /**
   230   /**
   221    * \returns true of the current state of the PHY layer is WifiPhy::SWITCHING, false otherwise.
   231    * \return true of the current state of the PHY layer is WifiPhy::SWITCHING, false otherwise.
   222    */
   232    */
   223   virtual bool IsStateSwitching (void) = 0;
   233   virtual bool IsStateSwitching (void) = 0;
   224   /**
   234   /**
   225    * \returns the amount of time since the current state has started.
   235    * \return the amount of time since the current state has started.
   226    */
   236    */
   227   virtual Time GetStateDuration (void) = 0;
   237   virtual Time GetStateDuration (void) = 0;
   228   /**
   238   /**
   229    * \returns the predicted delay until this PHY can become WifiPhy::IDLE.
   239    * \return the predicted delay until this PHY can become WifiPhy::IDLE.
   230    *
   240    *
   231    * The PHY will never become WifiPhy::IDLE _before_ the delay returned by
   241    * The PHY will never become WifiPhy::IDLE _before_ the delay returned by
   232    * this method but it could become really idle later.
   242    * this method but it could become really idle later.
   233    */
   243    */
   234   virtual Time GetDelayUntilIdle (void) = 0;
   244   virtual Time GetDelayUntilIdle (void) = 0;
   235 
   245 
       
   246   /**
       
   247    * Return the start time of the last received packet.
       
   248    *
       
   249    * \return the start time of the last received packet
       
   250    */
   236   virtual Time GetLastRxStartTime (void) const = 0;
   251   virtual Time GetLastRxStartTime (void) const = 0;
   237 
   252 
   238   /**
   253   /**
   239    * \param size the number of bytes in the packet to send
   254    * \param size the number of bytes in the packet to send
   240    * \param txvector the transmission parameters used for this packet
   255    * \param txvector the transmission parameters used for this packet
   311    * necessarily proper) of the OperationalRateSet (which is
   326    * necessarily proper) of the OperationalRateSet (which is
   312    * logically, if not actually, a property of the associated
   327    * logically, if not actually, a property of the associated
   313    * WifiRemoteStationManager), which itself is a superset (again, not
   328    * WifiRemoteStationManager), which itself is a superset (again, not
   314    * necessarily proper) of the BSSBasicRateSet.
   329    * necessarily proper) of the BSSBasicRateSet.
   315    *
   330    *
   316    * \returns the number of transmission modes supported by this PHY.
   331    * \return the number of transmission modes supported by this PHY.
   317    *
   332    *
   318    * \sa WifiPhy::GetMode()
   333    * \sa WifiPhy::GetMode()
   319    */
   334    */
   320   virtual uint32_t GetNModes (void) const = 0;
   335   virtual uint32_t GetNModes (void) const = 0;
   321   /**
   336   /**
   330    * logically, if not actually, a property of the associated
   345    * logically, if not actually, a property of the associated
   331    * WifiRemoteStationManager), which itself is a superset (again, not
   346    * WifiRemoteStationManager), which itself is a superset (again, not
   332    * necessarily proper) of the BSSBasicRateSet.
   347    * necessarily proper) of the BSSBasicRateSet.
   333    *
   348    *
   334    * \param mode index in array of supported modes
   349    * \param mode index in array of supported modes
   335    * \returns the mode whose index is specified.
   350    * \return the mode whose index is specified.
   336    *
   351    *
   337    * \sa WifiPhy::GetNModes()
   352    * \sa WifiPhy::GetNModes()
   338    */
   353    */
   339   virtual WifiMode GetMode (uint32_t mode) const = 0;
   354   virtual WifiMode GetMode (uint32_t mode) const = 0;
   340   /**
   355   /**
   341    * \param txMode the transmission mode
   356    * \param txMode the transmission mode
   342    * \param ber the probability of bit error rate
   357    * \param ber the probability of bit error rate
   343    * \returns the minimum snr which is required to achieve
   358    * \return the minimum snr which is required to achieve
   344    *          the requested ber for the specified transmission mode. (W/W)
   359    *          the requested ber for the specified transmission mode. (W/W)
   345    */
   360    */
   346   virtual double CalculateSnr (WifiMode txMode, double ber) const = 0;
   361   virtual double CalculateSnr (WifiMode txMode, double ber) const = 0;
   347    /**
   362    /**
   348    * The WifiPhy::NBssMembershipSelectors() and WifiPhy::BssMembershipSelector() methods are used
   363    * The WifiPhy::NBssMembershipSelectors() and WifiPhy::BssMembershipSelector() methods are used
   352    * BssMemebershipSelectorSet, and which is stored as WifiPhy::m_bssMembershipSelectorSet.
   367    * BssMemebershipSelectorSet, and which is stored as WifiPhy::m_bssMembershipSelectorSet.
   353    *
   368    *
   354    * This was introduced with 11n
   369    * This was introduced with 11n
   355    *
   370    *
   356    * \param selector index in array of supported memeberships
   371    * \param selector index in array of supported memeberships
   357    * \returns the memebership selector whose index is specified.
   372    * \return the memebership selector whose index is specified.
   358    *
   373    *
   359    * \sa WifiPhy::NBssMembershipSelectors()
   374    * \sa WifiPhy::NBssMembershipSelectors()
   360    */
   375    */
   361   virtual uint32_t GetNBssMembershipSelectors (void) const=0;
   376   virtual uint32_t GetNBssMembershipSelectors (void) const=0;
   362 
   377 
   369    * BssMemebershipSelectorSet, and which is stored as WifiPhy::m_bssMembershipSelectorSet.
   384    * BssMemebershipSelectorSet, and which is stored as WifiPhy::m_bssMembershipSelectorSet.
   370    *
   385    *
   371    * This was introduced with 11n
   386    * This was introduced with 11n
   372    *
   387    *
   373    * \param selector index in array of supported memeberships
   388    * \param selector index in array of supported memeberships
   374    * \returns a WifiModeList that contains the WifiModes associrated with the selected index.
   389    * \return a WifiModeList that contains the WifiModes associrated with the selected index.
   375    *
   390    *
   376    * \sa WifiPhy::GetMembershipSelectorModes()
   391    * \sa WifiPhy::GetMembershipSelectorModes()
   377    */
   392    */
   378   virtual WifiModeList GetMembershipSelectorModes(uint32_t selector)=0;
   393   virtual WifiModeList GetMembershipSelectorModes(uint32_t selector)=0;
   379   /**
   394   /**
   384    * DeviceMcsSet, and which is stored as WifiPhy::m_deviceMcsSet.
   399    * DeviceMcsSet, and which is stored as WifiPhy::m_deviceMcsSet.
   385    *
   400    *
   386    * This was introduced with 11n
   401    * This was introduced with 11n
   387    *
   402    *
   388    * \param Mcs index in array of supported Mcs
   403    * \param Mcs index in array of supported Mcs
   389    * \returns the Mcs index whose index is specified.
   404    * \return the Mcs index whose index is specified.
   390    *
   405    *
   391    * \sa WifiPhy::GetNMcs()
   406    * \sa WifiPhy::GetNMcs()
   392    */
   407    */
   393   virtual uint8_t GetNMcs (void) const=0;
   408   virtual uint8_t GetNMcs (void) const=0;
   394   virtual uint8_t GetMcs (uint8_t mcs) const=0;
   409   virtual uint8_t GetMcs (uint8_t mcs) const=0;
   403    *
   418    *
   404    * Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1)
   419    * Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1)
   405    *
   420    *
   406    * where Starting channel frequency is standard-dependent, see SetStandard()
   421    * where Starting channel frequency is standard-dependent, see SetStandard()
   407    * as defined in IEEE 802.11-2007 17.3.8.3.2.
   422    * as defined in IEEE 802.11-2007 17.3.8.3.2.
       
   423    *
       
   424    * \param id the channel number
   408    */
   425    */
   409   virtual void SetChannelNumber (uint16_t id) = 0;
   426   virtual void SetChannelNumber (uint16_t id) = 0;
   410   /// Return current channel number, see SetChannelNumber()
   427   /**  
       
   428    * Return current channel number.
       
   429    *
       
   430    * \return the current channel number
       
   431    */
   411   virtual uint16_t GetChannelNumber () const = 0;
   432   virtual uint16_t GetChannelNumber () const = 0;
   412 
   433 
       
   434   /**
       
   435    * Configure the PHY-level parameters for different Wi-Fi standard.
       
   436    *
       
   437    * \param standard the Wi-Fi standard
       
   438    */
   413   virtual void ConfigureStandard (enum WifiPhyStandard standard) = 0;
   439   virtual void ConfigureStandard (enum WifiPhyStandard standard) = 0;
   414 
   440 
       
   441   /**
       
   442    * Return the WifiChannel this WifiPhy is connected to.
       
   443    *
       
   444    * \return the WifiChannel this WifiPhy is connected to
       
   445    */
   415   virtual Ptr<WifiChannel> GetChannel (void) const = 0;
   446   virtual Ptr<WifiChannel> GetChannel (void) const = 0;
   416 
   447 
   417   static WifiMode GetDsssRate1Mbps ();
   448   static WifiMode GetDsssRate1Mbps ();
   418   static WifiMode GetDsssRate2Mbps ();
   449   static WifiMode GetDsssRate2Mbps ();
   419   static WifiMode GetDsssRate5_5Mbps ();
   450   static WifiMode GetDsssRate5_5Mbps ();
   486 
   517 
   487 
   518 
   488   /**
   519   /**
   489    * Public method used to fire a PhyTxBegin trace.  Implemented for encapsulation
   520    * Public method used to fire a PhyTxBegin trace.  Implemented for encapsulation
   490    * purposes.
   521    * purposes.
       
   522    *
       
   523    * \param packet the packet being transmitted
   491    */
   524    */
   492   void NotifyTxBegin (Ptr<const Packet> packet);
   525   void NotifyTxBegin (Ptr<const Packet> packet);
   493 
   526 
   494   /**
   527   /**
   495    * Public method used to fire a PhyTxEnd trace.  Implemented for encapsulation
   528    * Public method used to fire a PhyTxEnd trace.  Implemented for encapsulation
   496    * purposes.
   529    * purposes.
       
   530    *
       
   531    * \param packet the packet that was transmitted
   497    */
   532    */
   498   void NotifyTxEnd (Ptr<const Packet> packet);
   533   void NotifyTxEnd (Ptr<const Packet> packet);
   499 
   534 
   500   /**
   535   /**
   501    * Public method used to fire a PhyTxDrop trace.  Implemented for encapsulation
   536    * Public method used to fire a PhyTxDrop trace.  Implemented for encapsulation
   502    * purposes.
   537    * purposes.
       
   538    *
       
   539    * \param packet the packet that was failed to transmitted
   503    */
   540    */
   504   void NotifyTxDrop (Ptr<const Packet> packet);
   541   void NotifyTxDrop (Ptr<const Packet> packet);
   505 
   542 
   506   /**
   543   /**
   507    * Public method used to fire a PhyRxBegin trace.  Implemented for encapsulation
   544    * Public method used to fire a PhyRxBegin trace.  Implemented for encapsulation
   508    * purposes.
   545    * purposes.
       
   546    *
       
   547    * \param packet the packet being received
   509    */
   548    */
   510   void NotifyRxBegin (Ptr<const Packet> packet);
   549   void NotifyRxBegin (Ptr<const Packet> packet);
   511 
   550 
   512   /**
   551   /**
   513    * Public method used to fire a PhyRxEnd trace.  Implemented for encapsulation
   552    * Public method used to fire a PhyRxEnd trace.  Implemented for encapsulation
   514    * purposes.
   553    * purposes.
       
   554    *
       
   555    * \param packet the packet received
   515    */
   556    */
   516   void NotifyRxEnd (Ptr<const Packet> packet);
   557   void NotifyRxEnd (Ptr<const Packet> packet);
   517 
   558 
   518   /**
   559   /**
   519    * Public method used to fire a PhyRxDrop trace.  Implemented for encapsulation
   560    * Public method used to fire a PhyRxDrop trace.  Implemented for encapsulation
   520    * purposes.
   561    * purposes.
       
   562    *
       
   563    * \param packet the packet that was not successfully received
   521    */
   564    */
   522   void NotifyRxDrop (Ptr<const Packet> packet);
   565   void NotifyRxDrop (Ptr<const Packet> packet);
   523 
   566 
   524   /**
   567   /**
   525    *
   568    *
   526    * Public method used to fire a MonitorSniffer trace for a wifi packet being received.  Implemented for encapsulation
   569    * Public method used to fire a MonitorSniffer trace for a wifi packet being received.  Implemented for encapsulation
   527    * purposes.
   570    * purposes.
   528    *
   571    *
   529    * @param packet the packet being received
   572    * \param packet the packet being received
   530    * @param channelFreqMhz the frequency in MHz at which the packet is
   573    * \param channelFreqMhz the frequency in MHz at which the packet is
   531    * received. Note that in real devices this is normally the
   574    *        received. Note that in real devices this is normally the
   532    * frequency to which  the receiver is tuned, and this can be
   575    *        frequency to which  the receiver is tuned, and this can be
   533    * different than the frequency at which the packet was originally
   576    *        different than the frequency at which the packet was originally
   534    * transmitted. This is because it is possible to have the receiver
   577    *        transmitted. This is because it is possible to have the receiver
   535    * tuned on a given channel and still to be able to receive packets
   578    *        tuned on a given channel and still to be able to receive packets
   536    * on a nearby channel.
   579    *        on a nearby channel.
   537    * @param channelNumber the channel on which the packet is received
   580    * \param channelNumber the channel on which the packet is received
   538    * @param rate the PHY data rate in units of 500kbps (i.e., the same
   581    * \param rate the PHY data rate in units of 500kbps (i.e., the same
   539    * units used both for the radiotap and for the prism header)
   582    *        units used both for the radiotap and for the prism header)
   540    * @param isShortPreamble true if short preamble is used, false otherwise
   583    * \param isShortPreamble true if short preamble is used, false otherwise
   541    * @param signalDbm signal power in dBm
   584    * \param signalDbm signal power in dBm
   542    * @param noiseDbm  noise power in dBm
   585    * \param noiseDbm  noise power in dBm
   543    */
   586    */
   544   void NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble,
   587   void NotifyMonitorSniffRx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble,
   545                              double signalDbm, double noiseDbm);
   588                              double signalDbm, double noiseDbm);
   546 
   589 
   547   /**
   590   /**
   548    *
   591    *
   549    * Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.  Implemented for encapsulation
   592    * Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.  Implemented for encapsulation
   550    * purposes.
   593    * purposes.
   551    *
   594    *
   552    * @param packet the packet being transmitted
   595    * \param packet the packet being transmitted
   553    * @param channelFreqMhz the frequency in MHz at which the packet is
   596    * \param channelFreqMhz the frequency in MHz at which the packet is
   554    * transmitted.
   597    *        transmitted.
   555    * @param channelNumber the channel on which the packet is transmitted
   598    * \param channelNumber the channel on which the packet is transmitted
   556    * @param rate the PHY data rate in units of 500kbps (i.e., the same
   599    * \param rate the PHY data rate in units of 500kbps (i.e., the same
   557    * units used both for the radiotap and for the prism header)
   600    *        units used both for the radiotap and for the prism header)
   558    * @param isShortPreamble true if short preamble is used, false otherwise
   601    * \param isShortPreamble true if short preamble is used, false otherwise
       
   602    * \param txPower the transmission power in dBm
   559    */
   603    */
   560   void NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, uint8_t txPower);
   604   void NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, uint8_t txPower);
   561 
   605 
   562  /**
   606  /**
   563   * Assign a fixed random variable stream number to the random variables
   607   * Assign a fixed random variable stream number to the random variables
   568   * \return the number of stream indices assigned by this model
   612   * \return the number of stream indices assigned by this model
   569   */
   613   */
   570   virtual int64_t AssignStreams (int64_t stream) = 0;
   614   virtual int64_t AssignStreams (int64_t stream) = 0;
   571 
   615 
   572   /**
   616   /**
   573    * \param the operating frequency on this node.
   617    * \param freq the operating frequency on this node.
   574    */
   618    */
   575   virtual void SetFrequency (uint32_t freq)=0;
   619   virtual void SetFrequency (uint32_t freq)=0;
       
   620   /**
       
   621    * \return the operating frequency on this node
       
   622    */
   576   virtual uint32_t GetFrequency (void) const=0;
   623   virtual uint32_t GetFrequency (void) const=0;
   577   /**
   624   /**
   578    * \param the number of transmitters on this node.
   625    * \param tx the number of transmitters on this node.
   579    */
   626    */
   580   virtual void SetNumberOfTransmitAntennas (uint32_t tx)=0;
   627   virtual void SetNumberOfTransmitAntennas (uint32_t tx)=0;
   581 
   628 
       
   629   /**
       
   630    * \return the number of transmit antenna on this device
       
   631    */
   582   virtual uint32_t GetNumberOfTransmitAntennas (void) const=0;
   632   virtual uint32_t GetNumberOfTransmitAntennas (void) const=0;
   583    /**
   633    /**
   584    * \param the number of recievers on this node.
   634    * \param rx the number of recievers on this node.
   585    */
   635    */
   586   virtual void SetNumberOfReceiveAntennas (uint32_t rx)=0 ;
   636   virtual void SetNumberOfReceiveAntennas (uint32_t rx)=0 ;
   587   /**
   637   /**
   588    * \returns the number of recievers on this node.
   638    * \return the number of recievers on this node.
   589    */
   639    */
   590   virtual uint32_t GetNumberOfReceiveAntennas (void) const=0;
   640   virtual uint32_t GetNumberOfReceiveAntennas (void) const=0;
   591   /**
   641   /**
   592    * \paramif short guard interval is supported or not
   642    * \param guardInterval Enable or disable short guard interval
   593    */
   643    */
   594    virtual void SetGuardInterval (bool GuardInterval)=0;
   644    virtual void SetGuardInterval (bool guardInterval)=0;
   595    /**
   645    /**
   596    *  \returns if short guard interval is supported or not
   646    *  \return true if short guard interval is supported, false otherwise
   597    */
   647    */
   598   virtual bool GetGuardInterval (void) const = 0;
   648   virtual bool GetGuardInterval (void) const = 0;
   599   /**
   649   /**
   600    * \paramif LDPC is supported or not
   650    * \param ldpc Enable or disable LDPC
   601    */
   651    */
   602   virtual void SetLdpc (bool Ldpc)=0;
   652   virtual void SetLdpc (bool ldpc)=0;
   603   /**
   653   /**
   604    * \returns if LDPC is supported or not
   654    * \return true if LDPC is supported, false otherwise
   605    */
   655    */
   606   virtual bool GetLdpc (void) const=0;
   656   virtual bool GetLdpc (void) const=0;
   607   /**
   657   /**
   608    * \paramif STBC is supported or not
   658    * \param stbc Enable or disable STBC is supported
   609    */
   659    */
   610   virtual void SetStbc (bool stbc)=0;
   660   virtual void SetStbc (bool stbc)=0;
   611   /**
   661   /**
   612    *  \returns if STBC is supported or not
   662    *  \return true if STBC is supported, false otherwise
   613    */
   663    */
   614   virtual bool GetStbc (void) const=0;
   664   virtual bool GetStbc (void) const=0;
   615    
   665    
   616   /**
   666   /**
   617    * \paramif GreenField is supported or not
   667    * \param greenfield Enable or disable GreenField
   618    */
   668    */
   619   virtual void SetGreenfield (bool greenfield)=0;
   669   virtual void SetGreenfield (bool greenfield)=0;
   620   /**
   670   /**
   621    *  \returns if Green field is supported or not
   671    * \return true if Greenfield is supported, false otherwise
   622    */
   672    */
   623   virtual bool GetGreenfield (void) const=0;
   673   virtual bool GetGreenfield (void) const=0;
   624   /**
   674   /**
   625    * \paramif channel bonding 40 MHz is supported or not
   675    * \return true if channel bonding 40 MHz is supported, false otherwise
   626    */
   676    */
   627   virtual bool GetChannelBonding (void) const = 0;
   677   virtual bool GetChannelBonding (void) const = 0;
   628   /**
   678   /**
   629    *  \returns if channel bonding is supported or not
   679    *  \param channelbonding Enable or disable channel bonding
   630    */
   680    */
   631   virtual void SetChannelBonding (bool channelbonding) = 0 ;
   681   virtual void SetChannelBonding (bool channelbonding) = 0 ;
   632 
   682 
   633 private:
   683 private:
   634   /**
   684   /**