1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
4  * Copyright (c) 2018 Fraunhofer ESK : RLF extensions
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  * Author: Giuseppe Piro  <g.piro@poliba.it>
20  * Author: Marco Miozzo <mmiozzo@cttc.es>
21  * Modified by:
22  *          Vignesh Babu <ns3-dev@esk.fraunhofer.de> (RLF extensions)
23  */
24 
25 #ifndef LTE_UE_PHY_H
26 #define LTE_UE_PHY_H
27 
28 
29 #include <ns3/lte-phy.h>
30 #include <ns3/ff-mac-common.h>
31 
32 #include <ns3/lte-control-messages.h>
33 #include <ns3/lte-amc.h>
34 #include <ns3/lte-ue-phy-sap.h>
35 #include <ns3/lte-ue-cphy-sap.h>
36 #include <ns3/ptr.h>
37 #include <ns3/lte-amc.h>
38 #include <set>
39 #include <ns3/lte-ue-power-control.h>
40 
41 
42 namespace ns3 {
43 
44 class PacketBurst;
45 class LteEnbPhy;
46 class LteHarqPhy;
47 
48 
49 /**
50  * \ingroup lte
51  *
52  * The LteSpectrumPhy models the physical layer of LTE
53  */
54 class LteUePhy : public LtePhy
55 {
56 
57   /// allow UeMemberLteUePhySapProvider class friend access
58   friend class UeMemberLteUePhySapProvider;
59   /// allow MemberLteUeCphySapProvider<LteUePhy> class friend access
60   friend class MemberLteUeCphySapProvider<LteUePhy>;
61 
62 public:
63   /**
64    * \brief The states of the UE PHY entity
65    */
66   enum State
67   {
68     CELL_SEARCH = 0,
69     SYNCHRONIZED,
70     NUM_STATES
71   };
72 
73   /**
74    * @warning the default constructor should not be used
75    */
76   LteUePhy ();
77 
78   /**
79    *
80    * \param dlPhy the downlink LteSpectrumPhy instance
81    * \param ulPhy the uplink LteSpectrumPhy instance
82    */
83   LteUePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy);
84 
85   virtual ~LteUePhy ();
86 
87   /**
88    * \brief Get the type ID.
89    * \return the object TypeId
90    */
91   static TypeId GetTypeId (void);
92   // inherited from Object
93   virtual void DoInitialize (void);
94   virtual void DoDispose (void);
95 
96   /**
97    * \brief Get the PHY SAP provider
98    *
99    * \return a pointer to the SAP Provider
100    */
101   LteUePhySapProvider* GetLteUePhySapProvider ();
102 
103   /**
104    * \brief Set the PHY SAP User
105    *
106    * \param s a pointer to the SAP user
107    */
108   void SetLteUePhySapUser (LteUePhySapUser* s);
109 
110   /**
111    * \brief Get the CPHY SAP provider
112    *
113    * \return a pointer to the SAP Provider
114    */
115   LteUeCphySapProvider* GetLteUeCphySapProvider ();
116 
117   /**
118    * \brief Set the CPHY SAP User
119    *
120    * \param s a pointer to the SAP user
121    */
122   void SetLteUeCphySapUser (LteUeCphySapUser* s);
123 
124 
125   /**
126    * \brief Set transmit power
127    *
128    * \param pow the transmission power in dBm
129    */
130   void SetTxPower (double pow);
131 
132   /**
133    * \brief Get transmit power
134    *
135    * \return the transmission power in dBm
136    */
137   double GetTxPower () const;
138 
139   /**
140    * \brief Get Uplink power control
141    *
142    * \return ptr to UE Uplink Power Control entity
143    */
144   Ptr<LteUePowerControl> GetUplinkPowerControl () const;
145 
146   /**
147    * \brief Set noise figure
148    *
149    * \param nf the noise figure in dB
150    */
151   void SetNoiseFigure (double nf);
152 
153   /**
154    * \brief Get noise figure
155    *
156    * \return the noise figure in dB
157    */
158   double GetNoiseFigure () const;
159 
160   /**
161    * \brief Get MAC to Channel delay
162    *
163    * \returns the TTI delay between MAC and channel
164    */
165   uint8_t GetMacChDelay (void) const;
166 
167   /**
168    * \brief Get Downlink spectrum phy
169    *
170    * \return a pointer to the LteSpectrumPhy instance relative to the downlink
171    */
172   Ptr<LteSpectrumPhy> GetDlSpectrumPhy () const;
173 
174   /**
175    * \brief Get Uplink spectrum phy
176    *
177    * \return a pointer to the LteSpectrumPhy instance relative to the uplink
178    */
179   Ptr<LteSpectrumPhy> GetUlSpectrumPhy () const;
180 
181   /**
182    * \brief Create the PSD for the TX
183    *
184    * \return the pointer to the PSD
185    */
186   virtual Ptr<SpectrumValue> CreateTxPowerSpectralDensity ();
187 
188   /**
189    * \brief Set a list of sub channels to use in TX
190    *
191    * \param mask a list of sub channels
192    */
193   void SetSubChannelsForTransmission (std::vector <int> mask);
194   /**
195    * \brief Get a list of sub channels to use in RX
196    *
197    * \return a list of sub channels
198    */
199   std::vector <int> GetSubChannelsForTransmission (void);
200 
201   /**
202    * \brief Get a list of sub channels to use in RX
203    *
204    * \param mask list of sub channels
205    */
206   void SetSubChannelsForReception (std::vector <int> mask);
207   /**
208    * \brief Get a list of sub channels to use in RX
209    *
210    * \return a list of sub channels
211    */
212   std::vector <int> GetSubChannelsForReception (void);
213 
214   /**
215    * \brief Create the DL CQI feedback from SINR values perceived at
216    * the physical layer with the signal received from eNB
217    *
218    * \param sinr SINR values vector
219    * \return a DL CQI control message containing the CQI feedback
220    */
221   Ptr<DlCqiLteControlMessage> CreateDlCqiFeedbackMessage (const SpectrumValue& sinr);
222 
223 
224 
225   // inherited from LtePhy
226   virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
227   virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
228   /**
229    * \brief Create the mixed CQI report
230    *
231    * \param sinr SINR values vector
232    */
233   virtual void GenerateMixedCqiReport (const SpectrumValue& sinr);
234   virtual void ReportInterference (const SpectrumValue& interf);
235   /**
236    * \brief Create the mixed CQI report
237    *
238    * \param interf interference values vector
239    */
240   virtual void ReportDataInterference (const SpectrumValue& interf);
241   virtual void ReportRsReceivedPower (const SpectrumValue& power);
242 
243   // callbacks for LteSpectrumPhy
244   /**
245    * \brief Receive LTE control message list function
246    *
247    * \param msgList LTE control message list
248    */
249   virtual void ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> > msgList);
250   /**
251    * \brief Receive PSS function
252    *
253    * \param cellId the cell ID
254    * \param p PSS list
255    */
256   virtual void ReceivePss (uint16_t cellId, Ptr<SpectrumValue> p);
257 
258 
259   /**
260    * \brief PhySpectrum received a new PHY-PDU
261    *
262    * \param p the packet received
263    */
264   void PhyPduReceived (Ptr<Packet> p);
265 
266 
267   /**
268    * \brief trigger from eNB the start from a new frame
269    *
270    * \param frameNo frame number
271    * \param subframeNo subframe number
272    */
273   void SubframeIndication (uint32_t frameNo, uint32_t subframeNo);
274 
275 
276   /**
277    * \brief Send the SRS signal in the last symbols of the frame
278    */
279   void SendSrs ();
280 
281   /**
282    * \brief Enqueue the downlink HARQ feedback generated by LteSpectrumPhy
283    *
284    * \param mes the DlInfoListElement_s
285    */
286   virtual void EnqueueDlHarqFeedback (DlInfoListElement_s mes);
287 
288   /**
289    * \brief Set the HARQ PHY module
290    *
291    * \param harq the HARQ PHY module
292    */
293   void SetHarqPhyModule (Ptr<LteHarqPhy> harq);
294 
295   /**
296    * \brief Get state of the UE physical layer
297    *
298    * \return The current state
299    */
300   State GetState () const;
301 
302   /**
303    * TracedCallback signature for state transition events.
304    *
305    * \param [in] cellId
306    * \param [in] rnti
307    * \param [in] oldState
308    * \param [in] newState
309    */
310   typedef void (* StateTracedCallback)
311     (uint16_t cellId, uint16_t rnti, State oldState, State newState);
312 
313   /**
314    * TracedCallback signature for cell RSRP and SINR report.
315    *
316    * \param [in] cellId
317    * \param [in] rnti
318    * \param [in] rsrp
319    * \param [in] sinr
320    * \param [in] componentCarrierId
321    */
322   typedef void (* RsrpSinrTracedCallback)
323     (uint16_t cellId, uint16_t rnti,
324      double rsrp, double sinr, uint8_t componentCarrierId);
325 
326   /**
327    * TracedCallback signature for cell RSRP and RSRQ.
328    *
329    * \param [in] rnti
330    * \param [in] cellId
331    * \param [in] rsrp
332    * \param [in] rsrq
333    * \param [in] isServingCell
334    * \param [in] componentCarrierId
335    */
336   typedef void (* RsrpRsrqTracedCallback)
337     (uint16_t rnti, uint16_t cellId, double rsrp, double rsrq,
338      bool isServingCell, uint8_t componentCarrierId);
339 
340   /**
341    * TracedCallback signature for UL Phy resource blocks.
342    *
343    * \param [in] rnti
344    * \param [in] rbs Vector of resource blocks allocated for UL.
345    */
346   typedef void (* UlPhyResourceBlocksTracedCallback)
347     (uint16_t rnti, const std::vector<int>& rbs);
348 
349   /**
350    * TracedCallback signature for spectral value.
351    *
352    * \param [in] rnti
353    * \param [in] psd The spectral power density.
354    */
355   typedef void (* PowerSpectralDensityTracedCallback)
356       (uint16_t rnti, Ptr<SpectrumValue> psd);
357 
358 private:
359 
360   /**
361    * \brief Set transmit mode 1 gain function
362    *
363    * \param [in] gain
364    */
365   void SetTxMode1Gain (double gain);
366   /**
367    * Set transmit mode 2 gain function
368    *
369    * \param [in] gain
370    */
371   void SetTxMode2Gain (double gain);
372   /**
373    * \brief Set transmit mode 3 gain function
374    *
375    * \param [in] gain
376    */
377   void SetTxMode3Gain (double gain);
378   /**
379    * \brief Set transmit mode 4 gain function
380    *
381    * \param [in] gain
382    */
383   void SetTxMode4Gain (double gain);
384   /**
385    * \brief Set transmit mode 5 gain function
386    *
387    * \param [in] gain
388    */
389   void SetTxMode5Gain (double gain);
390   /**
391    * \brief Set transmit mode 6 gain function
392    *
393    * \param [in] gain
394    */
395   void SetTxMode6Gain (double gain);
396   /**
397    * \brief Set transmit mode 7 gain function
398    *
399    * \param [in] gain
400    */
401   void SetTxMode7Gain (double gain);
402   /**
403    * \brief Set transmit mode gain function
404    *
405    * \param [in] txMode
406    * \param [in] gain
407    */
408   void SetTxModeGain (uint8_t txMode, double gain);
409   /**
410    * \brief Queue subchannels for transmission function
411    *
412    * \param [in] rbMap
413    */
414   void QueueSubChannelsForTransmission (std::vector <int> rbMap);
415   /**
416    * \brief Get CQI, RSRP, and RSRQ
417    *
418    * internal method that takes care of generating CQI reports,
419    * calculating the RSRP and RSRQ metrics, and generating RSRP+SINR traces
420    *
421    * \param sinr
422    */
423   void GenerateCqiRsrpRsrq (const SpectrumValue& sinr);
424   /**
425    * \brief Layer-1 filtering of RSRP and RSRQ measurements and reporting to
426    *        the RRC entity.
427    *
428    * Initially executed at +0.200s, and then repeatedly executed with
429    * periodicity as indicated by the *UeMeasurementsFilterPeriod* attribute.
430    */
431   void ReportUeMeasurements ();
432   /**
433    * \brief Set the periodicty for the downlink periodic
434    * wideband and aperiodic subband CQI reporting.
435    *
436    * \param cqiPeriodicity The downlink CQI reporting periodicity in milliseconds
437    */
438   void SetDownlinkCqiPeriodicity (Time cqiPeriodicity);
439   /**
440    * \brief Switch the UE PHY to the given state.
441    * \param s the destination state
442    */
443   void SwitchToState (State s);
444   /**
445    * \brief Set number of Qout evaluation subframes
446    *
447    * The number passed to this method should be multiple
448    * of 10. This number specifies the total number of consecutive
449    * subframes, which corresponds to the Qout evaluation period.
450    *
451    * \param numSubframes the number of subframes
452    */
453   void SetNumQoutEvalSf (uint16_t numSubframes);
454   /**
455    * \brief Set number of Qin evaluation subframes
456    *
457    * The number passed to this method should be multiple
458    * of 10. This number specifies the total number of consecutive
459    * subframes, which corresponds to the Qin evaluation period.
460    *
461    * \param numSubframes the number of subframes
462    */
463   void SetNumQinEvalSf (uint16_t numSubframes);
464   /**
465    * \brief Get number of Qout evaluation subframes
466    *
467    * The number returned by this method specifies the
468    * total number of consecutive subframes, which corresponds
469    * to the Qout evaluation period.
470    *
471    * \return the number of consecutive subframes used for Qout evaluation
472    */
473   uint16_t GetNumQoutEvalSf () const;
474   /**
475    * \brief Get number of Qin evaluation subframes
476    *
477    * The number returned by this method specifies the
478    * total number of consecutive subframes, which corresponds
479    * to the Qin evaluation period.
480    *
481    * \return the number of consecutive subframes used for Qin evaluation
482    */
483   uint16_t GetNumQinEvalSf () const;
484 
485   // UE CPHY SAP methods
486   /**
487    * \brief Do Reset function
488    */
489   void DoReset ();
490   /**
491    * \brief Start the cell search function
492    *
493    * \param dlEarfcn the DL EARFCN
494    */
495   void DoStartCellSearch (uint32_t dlEarfcn);
496   /**
497    * \brief Synchronize with ENB function
498    *
499    * \param cellId the cell ID
500    */
501   void DoSynchronizeWithEnb (uint16_t cellId);
502   /**
503    * \brief Synchronize with ENB function
504    *
505    * \param cellId the cell ID
506    * \param dlEarfcn the DL EARFCN
507    */
508   void DoSynchronizeWithEnb (uint16_t cellId, uint32_t dlEarfcn);
509   /**
510    * \brief Set DL bandwidth function
511    *
512    * \param dlBandwidth the DL bandwidth
513    */
514   void DoSetDlBandwidth (uint16_t dlBandwidth);
515   /**
516    * \brief Configure UL uplink function
517    *
518    * \param ulEarfcn UL EARFCN
519    * \param ulBandwidth the UL bandwidth
520    */
521   void DoConfigureUplink (uint32_t ulEarfcn, uint16_t ulBandwidth);
522   /**
523    * \brief Configure reference signal power function
524    *
525    * \param referenceSignalPower reference signal power in dBm
526    */
527   void DoConfigureReferenceSignalPower (int8_t referenceSignalPower);
528   /**
529    * \brief Set RNTI function
530    *
531    * \param rnti the RNTI
532    */
533   void DoSetRnti (uint16_t rnti);
534   /**
535    * \brief Set transmission mode function
536    *
537    * \param txMode the transmission mode
538    */
539   void DoSetTransmissionMode (uint8_t txMode);
540   /**
541    * \brief Set SRS configuration index function
542    *
543    * \param srcCi the SRS configuration index
544    */
545   void DoSetSrsConfigurationIndex (uint16_t srcCi);
546   /**
547    * \brief Set PA function
548    *
549    * \param pa the PA value
550    */
551   void DoSetPa (double pa);
552   /**
553    * \brief Reset Phy after radio link failure function
554    *
555    * It resets the physical layer parameters of the
556    * UE after RLF.
557    *
558    */
559   void DoResetPhyAfterRlf ();
560   /**
561    * \brief Reset radio link failure parameters
562    *
563    * Upon receiving N311 in Sync indications from the UE
564    * PHY, the UE RRC instructs the UE PHY to reset the
565    * RLF parameters so, it can start RLF detection again.
566    *
567    */
568   void DoResetRlfParams ();
569 
570   /**
571    * \brief Start in Snyc detection function
572    *
573    * When T310 timer is started, it indicates that physical layer
574    * problems are detected at the UE and the recovery process is
575    * started by checking if the radio frames are in-sync for N311
576    * consecutive times.
577    *
578    */
579   void DoStartInSnycDetection ();
580 
581   /**
582    * \brief Radio link failure detection function
583    *
584    * Radio link monitoring is started to detect downlink radio link
585    * quality when the UE is both uplink and downlink synchronized
586    * (UE in CONNECTED_NORMALLY state).
587    * Upon detection of radio link failure, RRC connection is released
588    * and the UE starts the cell selection again. The procedure is implemented
589    * as per 3GPP TS 36.213 4.2.1 and TS 36.133 7.6. When the downlink
590    * radio link quality estimated over the last 200 ms period becomes worse than
591    * the threshold Qout, an out-of-sync indication is sent to RRC. When the
592    * downlink radio link quality estimated over the last 100 ms period becomes
593    * better than the threshold Qin, an in-sync indication is sent to RRC.
594    *
595    * \param sinrdB the average SINR value in dB measured across
596    * all resource blocks
597    *
598    */
599   void RlfDetection (double sinrdB);
600   /**
601    * \brief Initialize radio link failure parameters
602    *
603    * Upon receiving the notification about the successful RRC connection
604    * establishment, the UE phy initialize the RLF parameters to be
605    * ready for RLF detection.
606    *
607    */
608   void InitializeRlfParams ();
609   /**
610    * Set IMSI
611    *
612    * \param imsi the IMSI of the UE
613    */
614   void DoSetImsi (uint64_t imsi);
615   /**
616    * \brief Do set RSRP filter coefficient
617    *
618    * \param rsrpFilterCoefficient value. Determines the strength of
619    * smoothing effect induced by layer 3 filtering of RSRP
620    * used for uplink power control in all attached UE.
621    * If equals to 0, no layer 3 filtering is applicable.
622    */
623   void DoSetRsrpFilterCoefficient (uint8_t rsrpFilterCoefficient);
624   /**
625    * \brief Compute average SINR among the RBs
626    *
627    * \param sinr
628    * \return the average SINR value
629    */
630   double ComputeAvgSinr (const SpectrumValue& sinr);
631 
632   // UE PHY SAP methods
633   virtual void DoSendMacPdu (Ptr<Packet> p);
634   /**
635    * \brief Send LTE control message function
636    *
637    * \param msg the LTE control message
638    */
639   virtual void DoSendLteControlMessage (Ptr<LteControlMessage> msg);
640   /**
641    * \brief Send RACH preamble function
642    *
643    * \param prachId the RACH preamble ID
644    * \param raRnti the rnti
645    */
646   virtual void DoSendRachPreamble (uint32_t prachId, uint32_t raRnti);
647   /**
648    * \brief Notify PHY about the successful RRC connection
649    * establishment.
650    */
651   virtual void DoNotifyConnectionSuccessful ();
652 
653   /// A list of sub channels to use in TX.
654   std::vector <int> m_subChannelsForTransmission;
655   /// A list of sub channels to use in RX.
656   std::vector <int> m_subChannelsForReception;
657 
658   std::vector< std::vector <int> > m_subChannelsForTransmissionQueue; ///< subchannels for transmission queue
659 
660 
661   Ptr<LteAmc> m_amc; ///< AMC
662 
663   /**
664    * The `EnableUplinkPowerControl` attribute. If true, Uplink Power Control
665    * will be enabled.
666    */
667   bool m_enableUplinkPowerControl;
668   /// Pointer to UE Uplink Power Control entity.
669   Ptr<LteUePowerControl> m_powerControl;
670 
671   /// Wideband Periodic CQI. 2, 5, 10, 16, 20, 32, 40, 64, 80 or 160 ms.
672   Time m_p10CqiPeriodicity;
673   Time m_p10CqiLast; ///< last periodic CQI
674 
675   /**
676    * SubBand Aperiodic CQI. Activated by DCI format 0 or Random Access Response
677    * Grant.
678    * \note Defines a periodicity for academic studies.
679    */
680   Time m_a30CqiPeriodicity;
681   Time m_a30CqiLast; ///< last aperiodic CQI
682 
683   LteUePhySapProvider* m_uePhySapProvider; ///< UE Phy SAP provider
684   LteUePhySapUser* m_uePhySapUser; ///< UE Phy SAP user
685 
686   LteUeCphySapProvider* m_ueCphySapProvider; ///< UE CPhy SAP provider
687   LteUeCphySapUser* m_ueCphySapUser; ///< UE CPhy SAP user
688 
689   uint16_t  m_rnti; ///< the RNTI
690 
691   uint8_t m_transmissionMode; ///< the transmission mode
692   std::vector <double> m_txModeGain; ///< the transmit mode gain
693 
694   uint16_t m_srsPeriodicity; ///< SRS periodicity
695   uint16_t m_srsSubframeOffset; ///< SRS subframe offset
696   uint16_t m_srsConfigured; ///< SRS configured
697   Time     m_srsStartTime; ///< SRS start time
698 
699   double m_paLinear; ///< PA linear
700 
701   bool m_dlConfigured; ///< DL configured?
702   bool m_ulConfigured; ///< UL configured?
703 
704   /// The current UE PHY state.
705   State m_state;
706   /**
707    * The `StateTransition` trace source. Fired upon every UE PHY state
708    * transition. Exporting the serving cell ID, RNTI, old state, and new state.
709    */
710   TracedCallback<uint16_t, uint16_t, State, State> m_stateTransitionTrace;
711 
712   /// \todo Can be removed.
713   uint8_t m_subframeNo;
714 
715   bool m_rsReceivedPowerUpdated; ///< RS receive power updated?
716   SpectrumValue m_rsReceivedPower; ///< RS receive power
717 
718   bool m_rsInterferencePowerUpdated; ///< RS interference power updated?
719   SpectrumValue m_rsInterferencePower; ///< RS interference power
720 
721   bool m_dataInterferencePowerUpdated; ///< data interference power updated?
722   SpectrumValue m_dataInterferencePower; ///< data interference power
723 
724   bool m_pssReceived; ///< PSS received?
725   /// PssElement structure
726   struct PssElement
727   {
728     uint16_t cellId; ///< cell ID
729     double pssPsdSum; ///< PSS PSD sum
730     uint16_t nRB; ///< number of RB
731   };
732   std::list <PssElement> m_pssList; ///< PSS list
733 
734   /**
735    * The `RsrqUeMeasThreshold` attribute. Receive threshold for PSS on RSRQ
736    * in dB.
737    */
738   double m_pssReceptionThreshold;
739 
740   /// Summary results of measuring a specific cell. Used for layer-1 filtering.
741   struct UeMeasurementsElement
742   {
743     double rsrpSum;   ///< Sum of RSRP sample values in linear unit.
744     uint8_t rsrpNum;  ///< Number of RSRP samples.
745     double rsrqSum;   ///< Sum of RSRQ sample values in linear unit.
746     uint8_t rsrqNum;  ///< Number of RSRQ samples.
747   };
748 
749   /**
750    * Store measurement results during the last layer-1 filtering period.
751    * Indexed by the cell ID where the measurements come from.
752    */
753   std::map <uint16_t, UeMeasurementsElement> m_ueMeasurementsMap;
754   /**
755    * The `UeMeasurementsFilterPeriod` attribute. Time period for reporting UE
756    * measurements, i.e., the length of layer-1 filtering (default 200 ms).
757    */
758   Time m_ueMeasurementsFilterPeriod;
759   /// \todo Can be removed.
760   Time m_ueMeasurementsFilterLast;
761 
762   Ptr<LteHarqPhy> m_harqPhyModule; ///< HARQ phy module
763 
764   uint32_t m_raPreambleId; ///< RA preamble ID
765   uint32_t m_raRnti; ///< RA RNTI
766 
767   /**
768    * The `ReportCurrentCellRsrpSinr` trace source. Trace information regarding
769    * RSRP and average SINR (see TS 36.214). Exporting cell ID, RNTI, RSRP, and
770    * SINR. Moreover it reports the m_componentCarrierId.
771    */
772   TracedCallback<uint16_t, uint16_t, double, double, uint8_t> m_reportCurrentCellRsrpSinrTrace;
773   /**
774    * The `RsrpSinrSamplePeriod` attribute. The sampling period for reporting
775    * RSRP-SINR stats.
776    */
777   uint16_t m_rsrpSinrSamplePeriod;
778   /**
779    * The `RsrpSinrSampleCounter` attribute. The sampling counter for reporting
780    * RSRP-SINR stats.
781    */
782   uint16_t m_rsrpSinrSampleCounter;
783 
784   /**
785    * The `ReportUeMeasurements` trace source. Contains trace information
786    * regarding RSRP and RSRQ measured from a specific cell (see TS 36.214).
787    * Exporting RNTI, the ID of the measured cell, RSRP (in dBm), RSRQ (in dB),
788    * and whether the cell is the serving cell. Moreover it report the m_componentCarrierId.
789    */
790   TracedCallback<uint16_t, uint16_t, double, double, bool, uint8_t> m_reportUeMeasurements;
791 
792   EventId m_sendSrsEvent; ///< send SRS event
793 
794   /**
795    * The `UlPhyTransmission` trace source. Contains trace information regarding
796    * PHY stats from UL Tx perspective. Exporting a structure with type
797    * PhyTransmissionStatParameters.
798    */
799   TracedCallback<PhyTransmissionStatParameters> m_ulPhyTransmission;
800 
801   /**
802    * The `ReportUlPhyResourceBlocks` trace source. Contains trace information
803    * regarding PHY stats from UL Resource Blocks (RBs). Exporting an RNTI of a
804    * UE and a vector containing the indices of the RBs used for UL.
805    */
806   TracedCallback< uint16_t, const std::vector<int>& > m_reportUlPhyResourceBlocks;
807 
808   /**
809    * The `ReportsPowerSpectralDensity` trace source. Contains trace information
810    * regarding Power Spectral Density. Exporting an RNTI of a UE and a pointer
811    * to Spectrum Values.
812    */
813   TracedCallback< uint16_t, Ptr<SpectrumValue> > m_reportPowerSpectralDensity;
814 
815 
816   Ptr<SpectrumValue> m_noisePsd; ///< Noise power spectral density for
817                                  ///the configured bandwidth
818 
819   bool m_isConnected; ///< set when UE RRC is in CONNECTED_NORMALLY state
820   /**
821    * The 'Qin' attribute.
822    * corresponds to 2% block error rate of a hypothetical PDCCH transmission
823    * taking into account the PCFICH errors.
824    */
825   double m_qIn;
826 
827   /**
828    * The 'Qout' attribute.
829    * corresponds to 2% block error rate of a hypothetical PDCCH transmission
830    * taking into account the PCFICH errors.
831    */
832   double m_qOut;
833 
834   uint16_t m_numOfQoutEvalSf; ///< the downlink radio link quality is estimated over this period for detecting out-of-syncs
835   uint16_t m_numOfQinEvalSf; ///< the downlink radio link quality is estimated over this period for detecting in-syncs
836 
837   bool m_downlinkInSync; ///< when set, DL SINR evaluation for out-of-sync indications is conducted.
838   uint16_t m_numOfSubframes; ///< count the number of subframes for which the downlink radio link quality is estimated
839   uint16_t m_numOfFrames; ///< count the number of frames for which the downlink radio link quality is estimated
840   double m_sinrDbFrame; ///< the average SINR per radio frame
841   SpectrumValue m_ctrlSinrForRlf; ///< the CTRL SINR used for RLF detection
842   uint64_t m_imsi; ///< the IMSI of the UE
843   bool m_enableRlfDetection; ///< Flag to enable/disable RLF detection
844 
845 }; // end of `class LteUePhy`
846 
847 
848 }
849 
850 #endif /* LTE_UE_PHY_H */
851