A Discrete-Event Network Simulator
API
lte-ue-phy.cc
Go to the documentation of this file.
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 * Marco Miozzo <marco.miozzo@cttc.es>
21 * Nicola Baldo <nbaldo@cttc.es>
22 * Modified by:
23 * Vignesh Babu <ns3-dev@esk.fraunhofer.de> (RLF extensions)
24 */
25
26#include <ns3/object-factory.h>
27#include <ns3/log.h>
28#include <ns3/node.h>
29#include <cfloat>
30#include <cmath>
31#include <ns3/simulator.h>
32#include <ns3/double.h>
33#include "lte-ue-phy.h"
34#include "lte-enb-phy.h"
35#include "lte-net-device.h"
36#include "lte-ue-net-device.h"
37#include "lte-enb-net-device.h"
39#include "lte-amc.h"
40#include "lte-ue-mac.h"
41#include "ff-mac-common.h"
42#include "lte-chunk-processor.h"
43#include <ns3/lte-common.h>
44#include <ns3/pointer.h>
45#include <ns3/boolean.h>
46#include <ns3/lte-ue-power-control.h>
47
48namespace ns3 {
49
50NS_LOG_COMPONENT_DEFINE ("LteUePhy");
51
52
53
61static const Time UL_DATA_DURATION = NanoSeconds (1e6 - 71429 - 1);
62
68
69
70
71
73// member SAP forwarders
75
78{
79public:
86
87 // inherited from LtePhySapProvider
88 virtual void SendMacPdu (Ptr<Packet> p);
90 virtual void SendRachPreamble (uint32_t prachId, uint32_t raRnti);
91 virtual void NotifyConnectionSuccessful ();
92
93private:
95};
96
98{}
99
100void
102{
103 m_phy->DoSendMacPdu (p);
104}
105
106void
108{
110}
111
112void
114{
115 m_phy->DoSendRachPreamble (prachId, raRnti);
116}
117
118void
120{
122}
123
124
126// LteUePhy methods
128
130static const std::string g_uePhyStateName[LteUePhy::NUM_STATES] =
131{
132 "CELL_SEARCH",
133 "SYNCHRONIZED"
134};
135
140static inline const std::string & ToString (LteUePhy::State s)
141{
142 return g_uePhyStateName[s];
143}
144
145
147
148
150{
151 NS_LOG_FUNCTION (this);
152 NS_FATAL_ERROR ("This constructor should not be called");
153}
154
156 : LtePhy (dlPhy, ulPhy),
157 m_uePhySapUser (0),
158 m_ueCphySapUser (0),
159 m_state (CELL_SEARCH),
160 m_subframeNo (0),
161 m_rsReceivedPowerUpdated (false),
162 m_rsInterferencePowerUpdated (false),
163 m_dataInterferencePowerUpdated (false),
164 m_pssReceived (false),
165 m_ueMeasurementsFilterPeriod (MilliSeconds (200)),
166 m_ueMeasurementsFilterLast (MilliSeconds (0)),
167 m_rsrpSinrSampleCounter (0),
168 m_imsi (0)
169{
170 m_amc = CreateObject <LteAmc> ();
171 m_powerControl = CreateObject <LteUePowerControl> ();
175
176 NS_ASSERT_MSG (Simulator::Now ().GetNanoSeconds () == 0,
177 "Cannot create UE devices after simulation started");
179
180 DoReset ();
181}
182
183
185{
186 m_txModeGain.clear ();
187}
188
189void
191{
192 NS_LOG_FUNCTION (this);
193 delete m_uePhySapProvider;
194 delete m_ueCphySapProvider;
196}
197
198
199
200TypeId
202{
203 static TypeId tid = TypeId ("ns3::LteUePhy")
204 .SetParent<LtePhy> ()
205 .SetGroupName ("Lte")
206 .AddConstructor<LteUePhy> ()
207 .AddAttribute ("TxPower",
208 "Transmission power in dBm",
209 DoubleValue (10.0),
212 MakeDoubleChecker<double> ())
213 .AddAttribute ("NoiseFigure",
214 "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
215 " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
216 "\"the difference in decibels (dB) between"
217 " the noise output of the actual receiver to the noise output of an "
218 " ideal receiver with the same overall gain and bandwidth when the receivers "
219 " are connected to sources at the standard noise temperature T0.\" "
220 "In this model, we consider T0 = 290K.",
221 DoubleValue (9.0),
224 MakeDoubleChecker<double> ())
225 .AddAttribute ("TxMode1Gain",
226 "Transmission mode 1 gain in dB",
227 DoubleValue (0.0),
229 MakeDoubleChecker<double> ())
230 .AddAttribute ("TxMode2Gain",
231 "Transmission mode 2 gain in dB",
232 DoubleValue (4.2),
234 MakeDoubleChecker<double> ())
235 .AddAttribute ("TxMode3Gain",
236 "Transmission mode 3 gain in dB",
237 DoubleValue (-2.8),
239 MakeDoubleChecker<double> ())
240 .AddAttribute ("TxMode4Gain",
241 "Transmission mode 4 gain in dB",
242 DoubleValue (0.0),
244 MakeDoubleChecker<double> ())
245 .AddAttribute ("TxMode5Gain",
246 "Transmission mode 5 gain in dB",
247 DoubleValue (0.0),
249 MakeDoubleChecker<double> ())
250 .AddAttribute ("TxMode6Gain",
251 "Transmission mode 6 gain in dB",
252 DoubleValue (0.0),
254 MakeDoubleChecker<double> ())
255 .AddAttribute ("TxMode7Gain",
256 "Transmission mode 7 gain in dB",
257 DoubleValue (0.0),
259 MakeDoubleChecker<double> ())
260 .AddTraceSource ("ReportCurrentCellRsrpSinr",
261 "RSRP and SINR statistics.",
263 "ns3::LteUePhy::RsrpSinrTracedCallback")
264 .AddAttribute ("RsrpSinrSamplePeriod",
265 "The sampling period for reporting RSRP-SINR stats (default value 1)",
266 UintegerValue (1),
268 MakeUintegerChecker<uint16_t> ())
269 .AddTraceSource ("ReportUlPhyResourceBlocks",
270 "UL transmission PHY layer resource blocks.",
272 "ns3::LteUePhy::UlPhyResourceBlocksTracedCallback")
273 .AddTraceSource ("ReportPowerSpectralDensity",
274 "Power Spectral Density data.",
276 "ns3::LteUePhy::PowerSpectralDensityTracedCallback")
277 .AddTraceSource ("UlPhyTransmission",
278 "DL transmission PHY layer statistics.",
280 "ns3::PhyTransmissionStatParameters::TracedCallback")
281 .AddAttribute ("DlSpectrumPhy",
282 "The downlink LteSpectrumPhy associated to this LtePhy",
284 PointerValue (),
286 MakePointerChecker <LteSpectrumPhy> ())
287 .AddAttribute ("UlSpectrumPhy",
288 "The uplink LteSpectrumPhy associated to this LtePhy",
290 PointerValue (),
292 MakePointerChecker <LteSpectrumPhy> ())
293 .AddAttribute ("RsrqUeMeasThreshold",
294 "Receive threshold for PSS on RSRQ [dB]",
295 DoubleValue (-1000.0),
297 MakeDoubleChecker<double> ())
298 .AddAttribute ("UeMeasurementsFilterPeriod",
299 "Time period for reporting UE measurements, i.e., the"
300 "length of layer-1 filtering.",
301 TimeValue (MilliSeconds (200)),
304 .AddAttribute ("DownlinkCqiPeriodicity",
305 "Periodicity in milliseconds for reporting the"
306 "wideband and subband downlink CQIs to the eNB",
310 .AddTraceSource ("ReportUeMeasurements",
311 "Report UE measurements RSRP (dBm) and RSRQ (dB).",
313 "ns3::LteUePhy::RsrpRsrqTracedCallback")
314 .AddTraceSource ("StateTransition",
315 "Trace fired upon every UE PHY state transition",
317 "ns3::LteUePhy::StateTracedCallback")
318 .AddAttribute ("EnableUplinkPowerControl",
319 "If true, Uplink Power Control will be enabled.",
320 BooleanValue (true),
323 .AddAttribute ("Qout",
324 "corresponds to 10% block error rate of a hypothetical PDCCH transmission"
325 "taking into account the PCFICH errors with transmission parameters."
326 "see 3GPP TS 36.213 4.2.1 and TS 36.133 7.6",
327 DoubleValue (-5),
329 MakeDoubleChecker<double> ())
330 .AddAttribute ("Qin",
331 "corresponds to 2% block error rate of a hypothetical PDCCH transmission"
332 "taking into account the PCFICH errors with transmission parameters."
333 "see 3GPP TS 36.213 4.2.1 and TS 36.133 7.6",
334 DoubleValue (-3.9),
336 MakeDoubleChecker<double> ())
337 .AddAttribute ("NumQoutEvalSf",
338 "This specifies the total number of consecutive subframes"
339 "which corresponds to the Qout evaluation period",
340 UintegerValue (200), //see 3GPP 3GPP TS 36.133 7.6.2.1
343 MakeUintegerChecker<uint16_t> ())
344 .AddAttribute ("NumQinEvalSf",
345 "This specifies the total number of consecutive subframes"
346 "which corresponds to the Qin evaluation period",
347 UintegerValue (100), //see 3GPP 3GPP TS 36.133 7.6.2.1
350 MakeUintegerChecker<uint16_t> ())
351 .AddAttribute ("EnableRlfDetection",
352 "If true, RLF detection will be enabled.",
353 BooleanValue (true),
356 ;
357 return tid;
358}
359
360void
362{
363 NS_LOG_FUNCTION (this);
364
365 NS_ABORT_MSG_IF (!m_netDevice, "LteNetDevice is not available in LteUePhy");
366 Ptr<Node> node = m_netDevice->GetNode ();
367 NS_ABORT_MSG_IF (!node, "Node is not available in the LteNetDevice of LteUePhy");
368 uint32_t nodeId = node->GetId ();
369
370 //ScheduleWithContext() is needed here to set context for logs,
371 //because Initialize() is called outside of Node::AddDevice().
372
374
376}
377
378void
380{
381 NS_LOG_FUNCTION (this);
382 m_uePhySapUser = s;
383}
384
387{
388 NS_LOG_FUNCTION (this);
389 return (m_uePhySapProvider);
390}
391
392
393void
395{
396 NS_LOG_FUNCTION (this);
397 m_ueCphySapUser = s;
398}
399
402{
403 NS_LOG_FUNCTION (this);
404 return (m_ueCphySapProvider);
405}
406
407void
409{
410 NS_LOG_FUNCTION (this << nf);
411 m_noiseFigure = nf;
412}
413
414double
416{
417 NS_LOG_FUNCTION (this);
418 return m_noiseFigure;
419}
420
421void
423{
424 NS_LOG_FUNCTION (this << pow);
425 m_txPower = pow;
427}
428
429double
431{
432 NS_LOG_FUNCTION (this);
433 return m_txPower;
434}
435
438{
439 NS_LOG_FUNCTION (this);
440 return m_powerControl;
441}
442
443uint8_t
445{
446 return (m_macChTtiDelay);
447}
448
451{
453}
454
457{
458 return m_uplinkSpectrumPhy;
459}
460
461void
462LteUePhy::SetNumQoutEvalSf (uint16_t numSubframes)
463{
464 NS_LOG_FUNCTION (this << numSubframes);
465 NS_ABORT_MSG_IF (numSubframes % 10 != 0, "Number of subframes used for Qout "
466 "evaluation must be multiple of 10");
467 m_numOfQoutEvalSf = numSubframes;
468}
469
470void
471LteUePhy::SetNumQinEvalSf (uint16_t numSubframes)
472{
473 NS_LOG_FUNCTION (this << numSubframes);
474 NS_ABORT_MSG_IF (numSubframes % 10 != 0, "Number of subframes used for Qin "
475 "evaluation must be multiple of 10");
476 m_numOfQinEvalSf = numSubframes;
477}
478
479uint16_t
481{
482 NS_LOG_FUNCTION (this);
483 return m_numOfQoutEvalSf;
484}
485
486uint16_t
488{
489 NS_LOG_FUNCTION (this);
490 return m_numOfQinEvalSf;
491}
492
493void
495{
496 NS_LOG_FUNCTION (this);
497
498 SetMacPdu (p);
499}
500
501
502void
504{
506}
507
508void
510{
511 NS_LOG_FUNCTION (this);
512
514
516 m_uplinkSpectrumPhy->SetTxPowerSpectralDensity (txPsd);
517}
518
519
520void
522{
523 NS_LOG_FUNCTION (this);
525}
526
527
528std::vector <int>
530{
531 NS_LOG_FUNCTION (this);
533}
534
535
536std::vector <int>
538{
539 NS_LOG_FUNCTION (this);
541}
542
543
546{
547 NS_LOG_FUNCTION (this);
550
551 return psd;
552}
553
554void
556{
557 NS_LOG_FUNCTION (this);
567 if (m_cellId == 0)
568 {
569 return;
570 }
571 m_ctrlSinrForRlf = sinr;
572 GenerateCqiRsrpRsrq (sinr);
573}
574
575void
577{
578 NS_LOG_FUNCTION (this << sinr);
579
581 NS_ASSERT (m_cellId > 0);
582
583 if (m_dlConfigured && m_ulConfigured && (m_rnti > 0))
584 {
585 // check periodic wideband CQI
587 {
588 NS_LOG_DEBUG ("Reporting P10 CQI at : " << Simulator::Now ().As (Time::MS)
589 << ". Last reported at : " << m_p10CqiLast.As (Time::MS));
590 Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
592 if (msg)
593 {
595 }
597 }
598 // check aperiodic high-layer configured subband CQI
600 {
601 NS_LOG_DEBUG ("Reporting A30 CQI at : " << Simulator::Now ().As (Time::MS)
602 << ". Last reported at : " << m_a30CqiLast.As (Time::MS));
603 Ptr<LteUeNetDevice> thisDevice = GetDevice ()->GetObject<LteUeNetDevice> ();
605 if (msg)
606 {
608 }
610 }
611 }
612
613 // Generate PHY trace
616 {
617 NS_ASSERT_MSG (m_rsReceivedPowerUpdated, " RS received power info obsolete");
618 // RSRP evaluated as averaged received power among RBs
619 double sum = 0.0;
620 uint8_t rbNum = 0;
621 Values::const_iterator it;
623 {
624 // convert PSD [W/Hz] to linear power [W] for the single RE
625 // we consider only one RE for the RS since the channel is
626 // flat within the same RB
627 double powerTxW = ((*it) * 180000.0) / 12.0;
628 sum += powerTxW;
629 rbNum++;
630 }
631 double rsrp = (rbNum > 0) ? (sum / rbNum) : DBL_MAX;
632 // averaged SINR among RBs
633 double avSinr = ComputeAvgSinr (sinr);
634
635 NS_LOG_INFO (this << " cellId " << m_cellId << " rnti " << m_rnti << " RSRP " << rsrp << " SINR " << avSinr << " ComponentCarrierId " << (uint16_t) m_componentCarrierId);
636 //trigger RLF detection only when UE has an active RRC connection
637 //and RLF detection attribute is set to true
639 {
640 double avrgSinrForRlf = ComputeAvgSinr (m_ctrlSinrForRlf);
641 RlfDetection (10 * log10 (avrgSinrForRlf));
642 }
643
646 }
647
648 if (m_pssReceived)
649 {
650 // measure instantaneous RSRQ now
651 NS_ASSERT_MSG (m_rsInterferencePowerUpdated, " RS interference power info obsolete");
652
653 std::list <PssElement>::iterator itPss = m_pssList.begin ();
654 while (itPss != m_pssList.end ())
655 {
656 uint16_t rbNum = 0;
657 double rssiSum = 0.0;
658
659 Values::const_iterator itIntN = m_rsInterferencePower.ConstValuesBegin ();
660 Values::const_iterator itPj = m_rsReceivedPower.ConstValuesBegin ();
661 for (itPj = m_rsReceivedPower.ConstValuesBegin ();
663 itIntN++, itPj++)
664 {
665 rbNum++;
666 // convert PSD [W/Hz] to linear power [W] for the single RE
667 double interfPlusNoisePowerTxW = ((*itIntN) * 180000.0) / 12.0;
668 double signalPowerTxW = ((*itPj) * 180000.0) / 12.0;
669 rssiSum += (2 * (interfPlusNoisePowerTxW + signalPowerTxW));
670 }
671
672 NS_ASSERT (rbNum == (*itPss).nRB);
673 double rsrq_dB = 10 * log10 ((*itPss).pssPsdSum / rssiSum);
674
675 if (rsrq_dB > m_pssReceptionThreshold)
676 {
677 NS_LOG_INFO (this << " PSS RNTI " << m_rnti << " cellId " << m_cellId
678 << " has RSRQ " << rsrq_dB << " and RBnum " << rbNum);
679 // store measurements
680 std::map <uint16_t, UeMeasurementsElement>::iterator itMeasMap;
681 itMeasMap = m_ueMeasurementsMap.find ((*itPss).cellId);
682 if (itMeasMap != m_ueMeasurementsMap.end ())
683 {
684 (*itMeasMap).second.rsrqSum += rsrq_dB;
685 (*itMeasMap).second.rsrqNum++;
686 }
687 else
688 {
689 NS_LOG_WARN ("race condition of bug 2091 occurred");
690 }
691 }
692
693 itPss++;
694
695 } // end of while (itPss != m_pssList.end ())
696
697 m_pssList.clear ();
698
699 } // end of if (m_pssReceived)
700
701} // end of void LteUePhy::GenerateCtrlCqiReport (const SpectrumValue& sinr)
702
703double
705{
706 NS_LOG_FUNCTION (this);
707
708 // averaged SINR among RBs
709 double sum = 0.0;
710 uint8_t rbNum = 0;
711 Values::const_iterator it;
712
713 for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
714 {
715 sum += (*it);
716 rbNum++;
717 }
718
719 double avrgSinr = (rbNum > 0) ? (sum / rbNum) : DBL_MAX;
720
721 return avrgSinr;
722}
723
724void
726{
727 // Not used by UE, CQI are based only on RS
728}
729
730void
732{
733 NS_LOG_FUNCTION (this);
734
744 if (m_cellId == 0)
745 {
746 return;
747 }
748
750 //NOTE: The SINR received by this method is
751 //based on CTRL, which is not used to compute
752 //PDSCH (i.e., data) based SINR. It is used
753 //for RLF detection.
754 m_ctrlSinrForRlf = sinr;
755
758 {
759 // we have a measurement of interf + noise for the denominator
760 // of SINR = S/(I+N)
761 mixedSinr /= m_dataInterferencePower;
763 NS_LOG_LOGIC ("data interf measurement available, SINR = " << mixedSinr);
764 }
765 else
766 {
767 // we did not see any interference on data, so interference is
768 // there and we have only noise at the denominator of SINR
769 mixedSinr /= (*m_noisePsd);
770 NS_LOG_LOGIC ("no data interf measurement available, SINR = " << mixedSinr);
771 }
772
773 /*
774 * some RBs are not used in PDSCH and their SINR is very high
775 * for example with bandwidth 25, last RB is not used
776 * it can make avgSinr value very high, what is incorrect
777 */
778 uint32_t rbgSize = GetRbgSize ();
779 uint32_t modulo = m_dlBandwidth % rbgSize;
780 double avgMixedSinr = 0;
781 uint32_t usedRbgNum = 0;
782 for (uint32_t i = 0; i < (m_dlBandwidth - 1 - modulo); i++)
783 {
784 usedRbgNum++;
785 avgMixedSinr += mixedSinr[i];
786 }
787 avgMixedSinr = avgMixedSinr / usedRbgNum;
788 for (uint32_t i = 0; i < modulo; i++)
789 {
790 mixedSinr[m_dlBandwidth - 1 - i] = avgMixedSinr;
791 }
792
793 GenerateCqiRsrpRsrq (mixedSinr);
794}
795
796void
798{
799 NS_LOG_FUNCTION (this << interf);
801 m_rsInterferencePower = interf;
802}
803
804void
806{
807 NS_LOG_FUNCTION (this << interf);
808
811}
812
813void
815{
816 NS_LOG_FUNCTION (this << power);
818 m_rsReceivedPower = power;
819
821 {
822 double sum = 0;
823 uint32_t rbNum = 0;
824 Values::const_iterator it;
826 {
827 double powerTxW = ((*it) * 180000);
828 sum += powerTxW;
829 rbNum++;
830 }
831 double rsrp = 10 * log10 (sum) + 30;
832
833 NS_LOG_INFO ("RSRP: " << rsrp);
834 m_powerControl->SetRsrp (rsrp);
835 }
836}
837
840{
841 NS_LOG_FUNCTION (this);
842
843
844 // apply transmission mode gain
846 SpectrumValue newSinr = sinr;
847 newSinr *= m_txModeGain.at (m_transmissionMode);
848
849 // CREATE DlCqiLteControlMessage
850 Ptr<DlCqiLteControlMessage> msg = Create<DlCqiLteControlMessage> ();
851 CqiListElement_s dlcqi;
852 std::vector<int> cqi;
854 {
855 cqi = m_amc->CreateCqiFeedbacks (newSinr, m_dlBandwidth);
856
858 int nbSubChannels = cqi.size ();
859 double cqiSum = 0.0;
860 int activeSubChannels = 0;
861 // average the CQIs of the different RBs
862 for (int i = 0; i < nbSubChannels; i++)
863 {
864 if (cqi.at (i) != -1)
865 {
866 cqiSum += cqi.at (i);
867 activeSubChannels++;
868 }
869 NS_LOG_DEBUG (this << " subch " << i << " cqi " << cqi.at (i));
870 }
871 dlcqi.m_rnti = m_rnti;
872 dlcqi.m_ri = 1; // not yet used
873 dlcqi.m_cqiType = CqiListElement_s::P10; // Peridic CQI using PUCCH wideband
874 NS_ASSERT_MSG (nLayer > 0, " nLayer negative");
875 NS_ASSERT_MSG (nLayer < 3, " nLayer limit is 2s");
876 for (int i = 0; i < nLayer; i++)
877 {
878 if (activeSubChannels > 0)
879 {
880 dlcqi.m_wbCqi.push_back ((uint16_t) cqiSum / activeSubChannels);
881 }
882 else
883 {
884 // approximate with the worst case -> CQI = 1
885 dlcqi.m_wbCqi.push_back (1);
886 }
887 }
888 //NS_LOG_DEBUG (this << " Generate P10 CQI feedback " << (uint16_t) cqiSum / activeSubChannels);
889 dlcqi.m_wbPmi = 0; // not yet used
890 // dl.cqi.m_sbMeasResult others CQI report modes: not yet implemented
891 }
893 {
894 cqi = m_amc->CreateCqiFeedbacks (newSinr, GetRbgSize ());
896 int nbSubChannels = cqi.size ();
897 int rbgSize = GetRbgSize ();
898 double cqiSum = 0.0;
899 int cqiNum = 0;
900 SbMeasResult_s rbgMeas;
901 //NS_LOG_DEBUG (this << " Create A30 CQI feedback, RBG " << rbgSize << " cqiNum " << nbSubChannels << " band " << (uint16_t)m_dlBandwidth);
902 for (int i = 0; i < nbSubChannels; i++)
903 {
904 if (cqi.at (i) != -1)
905 {
906 cqiSum += cqi.at (i);
907 }
908 // else "nothing" no CQI is treated as CQI = 0 (worst case scenario)
909 cqiNum++;
910 if (cqiNum == rbgSize)
911 {
912 // average the CQIs of the different RBGs
913 //NS_LOG_DEBUG (this << " RBG CQI " << (uint16_t) cqiSum / rbgSize);
915 hlCqi.m_sbPmi = 0; // not yet used
916 for (int i = 0; i < nLayer; i++)
917 {
918 hlCqi.m_sbCqi.push_back ((uint16_t) cqiSum / rbgSize);
919 }
920 rbgMeas.m_higherLayerSelected.push_back (hlCqi);
921 cqiSum = 0.0;
922 cqiNum = 0;
923 }
924 }
925 dlcqi.m_rnti = m_rnti;
926 dlcqi.m_ri = 1; // not yet used
927 dlcqi.m_cqiType = CqiListElement_s::A30; // Aperidic CQI using PUSCH
928 //dlcqi.m_wbCqi.push_back ((uint16_t) cqiSum / nbSubChannels);
929 dlcqi.m_wbPmi = 0; // not yet used
930 dlcqi.m_sbMeasResult = rbgMeas;
931 }
932
933 msg->SetDlCqi (dlcqi);
934 return msg;
935}
936
937
938void
940{
941 NS_LOG_FUNCTION (this << Simulator::Now ());
942 NS_LOG_DEBUG (this << " Report UE Measurements ");
943
945
946 std::map <uint16_t, UeMeasurementsElement>::iterator it;
947 for (it = m_ueMeasurementsMap.begin (); it != m_ueMeasurementsMap.end (); it++)
948 {
949 double avg_rsrp = (*it).second.rsrpSum / (double)(*it).second.rsrpNum;
950 double avg_rsrq = (*it).second.rsrqSum / (double)(*it).second.rsrqNum;
951 /*
952 * In CELL_SEARCH state, this may result in avg_rsrq = 0/0 = -nan.
953 * UE RRC must take this into account when receiving measurement reports.
954 * TODO remove this shortcoming by calculating RSRQ during CELL_SEARCH
955 */
956 NS_LOG_DEBUG (this << " CellId " << (*it).first
957 << " RSRP " << avg_rsrp
958 << " (nSamples " << (uint16_t)(*it).second.rsrpNum << ")"
959 << " RSRQ " << avg_rsrq
960 << " (nSamples " << (uint16_t)(*it).second.rsrqNum << ")"
961 << " ComponentCarrierID " << (uint16_t)m_componentCarrierId);
962
964 newEl.m_cellId = (*it).first;
965 newEl.m_rsrp = avg_rsrp;
966 newEl.m_rsrq = avg_rsrq;
967 ret.m_ueMeasurementsList.push_back (newEl);
969
970 // report to UE measurements trace
971 m_reportUeMeasurements (m_rnti, (*it).first, avg_rsrp, avg_rsrq, ((*it).first == m_cellId ? 1 : 0), m_componentCarrierId);
972 }
973
974 // report to RRC
976
977 m_ueMeasurementsMap.clear ();
979}
980
981void
983{
984 NS_LOG_FUNCTION (this << cqiPeriodicity);
985 m_a30CqiPeriodicity = cqiPeriodicity;
986 m_p10CqiPeriodicity = cqiPeriodicity;
987}
988
989void
991{
992 NS_LOG_FUNCTION (this << msg);
993
994 SetControlMessages (msg);
995}
996
997void
999{
1000 NS_LOG_FUNCTION (this << raPreambleId);
1001
1002 // unlike other control messages, RACH preamble is sent ASAP
1003 Ptr<RachPreambleLteControlMessage> msg = Create<RachPreambleLteControlMessage> ();
1004 msg->SetRapId (raPreambleId);
1005 m_raPreambleId = raPreambleId;
1006 m_raRnti = raRnti;
1007 m_controlMessagesQueue.at (0).push_back (msg);
1008}
1009
1010void
1012{
1018 if (m_componentCarrierId == 0)
1019 {
1020 m_isConnected = true;
1021 // Initialize the parameters for radio link failure detection
1023 }
1024}
1025
1026
1027
1028void
1030{
1031 NS_LOG_FUNCTION (this);
1032
1033 std::list<Ptr<LteControlMessage> >::iterator it;
1034 NS_LOG_DEBUG (this << " I am rnti = " << m_rnti << " and I received msgs " << (uint16_t) msgList.size ());
1035 for (it = msgList.begin (); it != msgList.end (); it++)
1036 {
1037 Ptr<LteControlMessage> msg = (*it);
1038
1039 if (msg->GetMessageType () == LteControlMessage::DL_DCI)
1040 {
1041 Ptr<DlDciLteControlMessage> msg2 = DynamicCast<DlDciLteControlMessage> (msg);
1042
1043 DlDciListElement_s dci = msg2->GetDci ();
1044 if (dci.m_rnti != m_rnti)
1045 {
1046 // DCI not for me
1047 continue;
1048 }
1049
1050 if (dci.m_resAlloc != 0)
1051 {
1052 NS_FATAL_ERROR ("Resource Allocation type not implemented");
1053 }
1054
1055 std::vector <int> dlRb;
1056
1057 // translate the DCI to Spectrum framework
1058 uint32_t mask = 0x1;
1059 for (int i = 0; i < 32; i++)
1060 {
1061 if (((dci.m_rbBitmap & mask) >> i) == 1)
1062 {
1063 for (int k = 0; k < GetRbgSize (); k++)
1064 {
1065 dlRb.push_back ((i * GetRbgSize ()) + k);
1066// NS_LOG_DEBUG(this << " RNTI " << m_rnti << " RBG " << i << " DL-DCI allocated PRB " << (i*GetRbgSize()) + k);
1067 }
1068 }
1069 mask = (mask << 1);
1070 }
1072 {
1074 }
1075
1076
1077 // send TB info to LteSpectrumPhy
1078 NS_LOG_DEBUG (this << " UE " << m_rnti << " DL-DCI " << dci.m_rnti << " bitmap " << dci.m_rbBitmap);
1079 for (uint8_t i = 0; i < dci.m_tbsSize.size (); i++)
1080 {
1081 m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_ndi.at (i), dci.m_tbsSize.at (i), dci.m_mcs.at (i), dlRb, i, dci.m_harqProcess, dci.m_rv.at (i), true /* DL */);
1082 }
1083
1085
1086
1087 }
1088 else if (msg->GetMessageType () == LteControlMessage::UL_DCI)
1089 {
1090 // set the uplink bandwidth according to the UL-CQI
1091 Ptr<UlDciLteControlMessage> msg2 = DynamicCast<UlDciLteControlMessage> (msg);
1092 UlDciListElement_s dci = msg2->GetDci ();
1093 if (dci.m_rnti != m_rnti)
1094 {
1095 // DCI not for me
1096 continue;
1097 }
1098 NS_LOG_INFO (this << " UL DCI");
1099 std::vector <int> ulRb;
1100 for (int i = 0; i < dci.m_rbLen; i++)
1101 {
1102 ulRb.push_back (i + dci.m_rbStart);
1103 //NS_LOG_DEBUG (this << " UE RB " << i + dci.m_rbStart);
1104 }
1107 // fire trace of UL Tx PHY stats
1108 HarqProcessInfoList_t harqInfoList = m_harqPhyModule->GetHarqProcessInfoUl (m_rnti, 0);
1110 params.m_cellId = m_cellId;
1111 params.m_imsi = 0; // it will be set by DlPhyTransmissionCallback in LteHelper
1113 params.m_rnti = m_rnti;
1114 params.m_txMode = 0; // always SISO for UE
1115 params.m_layer = 0;
1116 params.m_mcs = dci.m_mcs;
1117 params.m_size = dci.m_tbSize;
1118 params.m_rv = harqInfoList.size ();
1119 params.m_ndi = dci.m_ndi;
1121 m_ulPhyTransmission (params);
1122 // pass the info to the MAC
1124 }
1125 else if (msg->GetMessageType () == LteControlMessage::RAR)
1126 {
1127 Ptr<RarLteControlMessage> rarMsg = DynamicCast<RarLteControlMessage> (msg);
1128 if (rarMsg->GetRaRnti () == m_raRnti)
1129 {
1130 for (std::list<RarLteControlMessage::Rar>::const_iterator it = rarMsg->RarListBegin (); it != rarMsg->RarListEnd (); ++it)
1131 {
1132 if (it->rapId != m_raPreambleId)
1133 {
1134 // UL grant not for me
1135 continue;
1136 }
1137 else
1138 {
1139 NS_LOG_INFO ("received RAR RNTI " << m_raRnti);
1140 // set the uplink bandwidth according to the UL grant
1141 std::vector <int> ulRb;
1142 for (int i = 0; i < it->rarPayload.m_grant.m_rbLen; i++)
1143 {
1144 ulRb.push_back (i + it->rarPayload.m_grant.m_rbStart);
1145 }
1146
1148 // pass the info to the MAC
1150 // reset RACH variables with out of range values
1151 m_raPreambleId = 255;
1152 m_raRnti = 11;
1153 }
1154 }
1155 }
1156 }
1157 else if (msg->GetMessageType () == LteControlMessage::MIB)
1158 {
1159 NS_LOG_INFO ("received MIB");
1160 NS_ASSERT (m_cellId > 0);
1161 Ptr<MibLteControlMessage> msg2 = DynamicCast<MibLteControlMessage> (msg);
1163 }
1164 else if (msg->GetMessageType () == LteControlMessage::SIB1)
1165 {
1166 NS_LOG_INFO ("received SIB1");
1167 NS_ASSERT (m_cellId > 0);
1168 Ptr<Sib1LteControlMessage> msg2 = DynamicCast<Sib1LteControlMessage> (msg);
1170 }
1171 else
1172 {
1173 // pass the message to UE-MAC
1175 }
1176
1177 }
1178
1179
1180}
1181
1182
1183void
1185{
1186 NS_LOG_FUNCTION (this << cellId << (*p));
1187
1188 double sum = 0.0;
1189 uint16_t nRB = 0;
1190 Values::const_iterator itPi;
1191 for (itPi = p->ConstValuesBegin (); itPi != p->ConstValuesEnd (); itPi++)
1192 {
1193 // convert PSD [W/Hz] to linear power [W] for the single RE
1194 double powerTxW = ((*itPi) * 180000.0) / 12.0;
1195 sum += powerTxW;
1196 nRB++;
1197 }
1198
1199 // measure instantaneous RSRP now
1200 double rsrp_dBm = 10 * log10 (1000 * (sum / (double)nRB));
1201 NS_LOG_INFO (this << " PSS RNTI " << m_rnti << " cellId " << m_cellId
1202 << " has RSRP " << rsrp_dBm << " and RBnum " << nRB);
1203 // note that m_pssReceptionThreshold does not apply here
1204
1205 // store measurements
1206 std::map <uint16_t, UeMeasurementsElement>::iterator itMeasMap = m_ueMeasurementsMap.find (cellId);
1207 if (itMeasMap == m_ueMeasurementsMap.end ())
1208 {
1209 // insert new entry
1211 newEl.rsrpSum = rsrp_dBm;
1212 newEl.rsrpNum = 1;
1213 newEl.rsrqSum = 0;
1214 newEl.rsrqNum = 0;
1215 m_ueMeasurementsMap.insert (std::pair <uint16_t, UeMeasurementsElement> (cellId, newEl));
1216 }
1217 else
1218 {
1219 (*itMeasMap).second.rsrpSum += rsrp_dBm;
1220 (*itMeasMap).second.rsrpNum++;
1221 }
1222
1223 /*
1224 * Collect the PSS for later processing in GenerateCtrlCqiReport()
1225 * (to be called from ChunkProcessor after RX is finished).
1226 */
1227 m_pssReceived = true;
1228 PssElement el;
1229 el.cellId = cellId;
1230 el.pssPsdSum = sum;
1231 el.nRB = nRB;
1232 m_pssList.push_back (el);
1233
1234} // end of void LteUePhy::ReceivePss (uint16_t cellId, Ptr<SpectrumValue> p)
1235
1236
1237void
1239{
1241}
1242
1243
1244void
1246{
1247 NS_LOG_FUNCTION (this << frameNo << subframeNo);
1248
1249 NS_ASSERT_MSG (frameNo > 0, "the SRS index check code assumes that frameNo starts at 1");
1250
1251 // refresh internal variables
1254 m_pssReceived = false;
1255
1256 if (m_ulConfigured)
1257 {
1258 // update uplink transmission mask according to previous UL-CQIs
1259 std::vector <int> rbMask = m_subChannelsForTransmissionQueue.at (0);
1261
1262 // shift the queue
1263 for (uint8_t i = 1; i < m_macChTtiDelay; i++)
1264 {
1266 }
1268
1270 {
1271
1272 NS_ASSERT_MSG (subframeNo > 0 && subframeNo <= 10, "the SRS index check code assumes that subframeNo starts at 1");
1273 if ((((frameNo - 1) * 10 + (subframeNo - 1)) % m_srsPeriodicity) == m_srsSubframeOffset)
1274 {
1275 NS_LOG_INFO ("frame " << frameNo << " subframe " << subframeNo << " sending SRS (offset=" << m_srsSubframeOffset << ", period=" << m_srsPeriodicity << ")");
1278 this);
1279 }
1280 }
1281
1282 std::list<Ptr<LteControlMessage> > ctrlMsg = GetControlMessages ();
1283 // send packets in queue
1284 NS_LOG_LOGIC (this << " UE - start slot for PUSCH + PUCCH - RNTI " << m_rnti << " CELLID " << m_cellId);
1285 // send the current burts of packets
1287 if (pb)
1288 {
1290 {
1293 }
1294 m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, UL_DATA_DURATION);
1295 }
1296 else
1297 {
1298 // send only PUCCH (ideal: fake null bandwidth signal)
1299 if (ctrlMsg.size () > 0)
1300 {
1301 NS_LOG_LOGIC (this << " UE - start TX PUCCH (NO PUSCH)");
1302 std::vector <int> dlRb;
1303
1305 {
1307 }
1308
1310 m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, UL_DATA_DURATION);
1311 }
1312 else
1313 {
1314 NS_LOG_LOGIC (this << " UE - UL NOTHING TO SEND");
1315 }
1316 }
1317 } // m_configured
1318
1319 // trigger the MAC
1320 m_uePhySapUser->SubframeIndication (frameNo, subframeNo);
1321
1322 m_subframeNo = subframeNo;
1323 ++subframeNo;
1324 if (subframeNo > 10)
1325 {
1326 ++frameNo;
1327 subframeNo = 1;
1328 }
1329
1330 // schedule next subframe indication
1331 Simulator::Schedule (Seconds (GetTti ()), &LteUePhy::SubframeIndication, this, frameNo, subframeNo);
1332}
1333
1334
1335void
1337{
1338 NS_LOG_FUNCTION (this << " UE " << m_rnti << " start tx SRS, cell Id " << (uint32_t) m_cellId);
1339 NS_ASSERT (m_cellId > 0);
1340 // set the current tx power spectral density (full bandwidth)
1341 std::vector <int> dlRb;
1342 for (uint8_t i = 0; i < m_ulBandwidth; i++)
1343 {
1344 dlRb.push_back (i);
1345 }
1346
1348 {
1350 }
1351
1353 m_uplinkSpectrumPhy->StartTxUlSrsFrame ();
1354}
1355
1356
1357void
1359{
1360 NS_LOG_FUNCTION (this);
1361
1362 m_rnti = 0;
1363 m_cellId = 0;
1364 m_isConnected = false;
1366 m_srsPeriodicity = 0;
1367 m_srsConfigured = false;
1368 m_dlConfigured = false;
1369 m_ulConfigured = false;
1370 m_raPreambleId = 255; // value out of range
1371 m_raRnti = 11; // value out of range
1375 m_paLinear = 1;
1376
1380
1381 m_packetBurstQueue.clear ();
1382 m_controlMessagesQueue.clear ();
1384 for (int i = 0; i < m_macChTtiDelay; i++)
1385 {
1386 Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
1387 m_packetBurstQueue.push_back (pb);
1388 std::list<Ptr<LteControlMessage> > l;
1389 m_controlMessagesQueue.push_back (l);
1390 }
1391 std::vector <int> ulRb;
1393
1395 m_downlinkSpectrumPhy->Reset ();
1396 m_uplinkSpectrumPhy->Reset ();
1397 m_pssList.clear ();
1402 m_downlinkSpectrumPhy->m_interferenceCtrl->EndRx ();
1403 m_downlinkSpectrumPhy->m_interferenceData->EndRx ();
1404
1405} // end of void LteUePhy::DoReset ()
1406
1407void
1409{
1410 NS_LOG_FUNCTION (this << dlEarfcn);
1411 m_dlEarfcn = dlEarfcn;
1412 DoSetDlBandwidth (6); // configure DL for receiving PSS
1414}
1415
1416void
1417LteUePhy::DoSynchronizeWithEnb (uint16_t cellId, uint32_t dlEarfcn)
1418{
1419 NS_LOG_FUNCTION (this << cellId << dlEarfcn);
1420 m_dlEarfcn = dlEarfcn;
1421 DoSynchronizeWithEnb (cellId);
1422}
1423
1424void
1426{
1427 NS_LOG_FUNCTION (this << cellId);
1428
1429 if (cellId == 0)
1430 {
1431 NS_FATAL_ERROR ("Cell ID shall not be zero");
1432 }
1433
1434 m_cellId = cellId;
1435 m_downlinkSpectrumPhy->SetCellId (cellId);
1436 m_uplinkSpectrumPhy->SetCellId (cellId);
1437
1438 // configure DL for receiving the BCH with the minimum bandwidth
1439 DoSetDlBandwidth (6);
1440
1441 m_dlConfigured = false;
1442 m_ulConfigured = false;
1443
1445}
1446
1447uint16_t
1449{
1450 return m_cellId;
1451}
1452
1455{
1456 return m_dlEarfcn;
1457}
1458
1459void
1460LteUePhy::DoSetDlBandwidth (uint16_t dlBandwidth)
1461{
1462 NS_LOG_FUNCTION (this << (uint32_t) dlBandwidth);
1463 if (m_dlBandwidth != dlBandwidth or !m_dlConfigured)
1464 {
1465 m_dlBandwidth = dlBandwidth;
1466
1467 static const int Type0AllocationRbg[4] = {
1468 10, // RGB size 1
1469 26, // RGB size 2
1470 63, // RGB size 3
1471 110 // RGB size 4
1472 }; // see table 7.1.6.1-1 of 36.213
1473 for (int i = 0; i < 4; i++)
1474 {
1475 if (dlBandwidth < Type0AllocationRbg[i])
1476 {
1477 m_rbgSize = i + 1;
1478 break;
1479 }
1480 }
1481
1483 m_downlinkSpectrumPhy->SetNoisePowerSpectralDensity (m_noisePsd);
1484 m_downlinkSpectrumPhy->GetChannel ()->AddRx (m_downlinkSpectrumPhy);
1485 }
1486 m_dlConfigured = true;
1487}
1488
1489
1490void
1491LteUePhy::DoConfigureUplink (uint32_t ulEarfcn, uint16_t ulBandwidth)
1492{
1493 m_ulEarfcn = ulEarfcn;
1494 m_ulBandwidth = ulBandwidth;
1495 m_ulConfigured = true;
1496}
1497
1498void
1500{
1501 NS_LOG_FUNCTION (this);
1502 m_powerControl->ConfigureReferenceSignalPower (referenceSignalPower);
1503}
1504
1505void
1506LteUePhy::DoSetRnti (uint16_t rnti)
1507{
1508 NS_LOG_FUNCTION (this << rnti);
1509 m_rnti = rnti;
1510
1513}
1514
1515void
1517{
1518 NS_LOG_FUNCTION (this << (uint16_t)txMode);
1519 m_transmissionMode = txMode;
1520 m_downlinkSpectrumPhy->SetTransmissionMode (txMode);
1521}
1522
1523void
1525{
1526 NS_LOG_FUNCTION (this << srcCi);
1529 m_srsConfigured = true;
1530
1531 // a guard time is needed for the case where the SRS periodicity is changed dynamically at run time
1532 // if we use a static one, we can have a 0ms guard time
1534 NS_LOG_DEBUG (this << " UE SRS P " << m_srsPeriodicity << " RNTI " << m_rnti << " offset " << m_srsSubframeOffset << " cellId " << m_cellId << " CI " << srcCi);
1535}
1536
1537void
1539{
1540 NS_LOG_FUNCTION (this << pa);
1541 m_paLinear = pow (10,(pa / 10));
1542}
1543
1544void
1545LteUePhy::DoSetRsrpFilterCoefficient (uint8_t rsrpFilterCoefficient)
1546{
1547 NS_LOG_FUNCTION (this << (uint16_t) (rsrpFilterCoefficient));
1548 m_powerControl->SetRsrpFilterCoefficient (rsrpFilterCoefficient);
1549}
1550
1551void
1553{
1554 NS_LOG_FUNCTION (this);
1555 m_downlinkSpectrumPhy->m_harqPhyModule->ClearDlHarqBuffer (m_rnti); //flush HARQ buffers
1558 m_pssReceived = false;
1559 DoReset ();
1560}
1561
1562void
1564{
1565 NS_LOG_FUNCTION (this);
1566
1568}
1569
1570void
1572{
1573 NS_LOG_FUNCTION (this);
1574 // indicates that the downlink radio link quality has to be monitored for in-sync indications
1575 m_downlinkInSync = false;
1576}
1577
1578void
1579LteUePhy::DoSetImsi (uint64_t imsi)
1580{
1581 NS_LOG_FUNCTION (this);
1582 m_imsi = imsi;
1583}
1584
1585void
1587{
1588 NS_LOG_FUNCTION (this);
1589 m_numOfSubframes = 0;
1590 m_sinrDbFrame = 0;
1591 m_numOfFrames = 0;
1592 m_downlinkInSync = true;
1593}
1594
1595void
1597{
1598 NS_LOG_FUNCTION (this << sinrDb);
1599 m_sinrDbFrame += sinrDb;
1601 NS_LOG_LOGIC ("No of Subframes: " << m_numOfSubframes << " UE synchronized: " << m_downlinkInSync);
1602 //check for out_of_snyc indications first when UE is both DL and UL synchronized
1603 //m_downlinkInSync=true indicates that the evaluation is for out-of-sync indications
1605 {
1611 {
1612 m_numOfFrames++; //increment the counter if a frame cannot be decoded
1613 NS_LOG_LOGIC ("No of Frames which cannot be decoded: " << m_numOfFrames);
1614 }
1615 else
1616 {
1622 NS_LOG_INFO ("Resetting frame counter at phy. Current value = " << m_numOfFrames);
1623 m_numOfFrames = 0;
1624 // Also reset the sync indicator counter at RRC
1626 }
1627 m_numOfSubframes = 0;
1628 m_sinrDbFrame = 0;
1629 }
1636 {
1637 NS_LOG_LOGIC ("At " << Simulator::Now ().As (Time::MS)
1638 << " ms UE PHY sending out of snyc indication to UE RRC layer");
1640 m_numOfFrames = 0;
1641 }
1642 //check for in_snyc indications when T310 timer is started
1643 //m_downlinkInSync=false indicates that the evaluation is for in-sync indications
1644 if (!m_downlinkInSync && m_numOfSubframes == 10)
1645 {
1652 {
1653 m_numOfFrames++; //increment the counter if a frame can be decoded
1654 NS_LOG_LOGIC ("No of Frames successfully decoded: " << m_numOfFrames);
1655 }
1656 else
1657 {
1663 m_numOfFrames = 0;
1664 // Also reset the sync indicator counter at RRC
1666 }
1667 m_numOfSubframes = 0;
1668 m_sinrDbFrame = 0;
1669 }
1675 {
1676 NS_LOG_LOGIC ("At " << Simulator::Now ().As (Time::MS)
1677 << " ms UE PHY sending in snyc indication to UE RRC layer");
1679 m_numOfFrames = 0;
1680 }
1681}
1682
1683
1684void
1686{
1687 SetTxModeGain (1, gain);
1688}
1689
1690void
1692{
1693 SetTxModeGain (2, gain);
1694}
1695
1696void
1698{
1699 SetTxModeGain (3, gain);
1700}
1701
1702void
1704{
1705 SetTxModeGain (4, gain);
1706}
1707
1708void
1710{
1711 SetTxModeGain (5, gain);
1712}
1713
1714void
1716{
1717 SetTxModeGain (6, gain);
1718}
1719
1720void
1722{
1723 SetTxModeGain (7, gain);
1724}
1725
1726
1727void
1728LteUePhy::SetTxModeGain (uint8_t txMode, double gain)
1729{
1730 NS_LOG_FUNCTION (this << gain);
1731 if (txMode > 0)
1732 {
1733 // convert to linear
1734 double gainLin = std::pow (10.0, (gain / 10.0));
1735 if (m_txModeGain.size () < txMode)
1736 {
1737 m_txModeGain.resize (txMode);
1738 }
1739 m_txModeGain.at (txMode - 1) = gainLin;
1740 }
1741 // forward the info to DL LteSpectrumPhy
1742 m_downlinkSpectrumPhy->SetTxModeGain (txMode, gain);
1743}
1744
1745
1746
1747void
1749{
1750 NS_LOG_FUNCTION (this);
1751 // get the feedback from LteSpectrumPhy and send it through ideal PUCCH to eNB
1752 Ptr<DlHarqFeedbackLteControlMessage> msg = Create<DlHarqFeedbackLteControlMessage> ();
1753 msg->SetDlHarqFeedback (m);
1754 SetControlMessages (msg);
1755}
1756
1757void
1759{
1760 m_harqPhyModule = harq;
1761}
1762
1763
1766{
1767 NS_LOG_FUNCTION (this);
1768 return m_state;
1769}
1770
1771
1772void
1774{
1775 NS_LOG_FUNCTION (this << newState);
1776 State oldState = m_state;
1777 m_state = newState;
1778 NS_LOG_INFO (this << " cellId=" << m_cellId << " rnti=" << m_rnti
1779 << " UePhy " << ToString (oldState)
1780 << " --> " << ToString (newState));
1781 m_stateTransitionTrace (m_cellId, m_rnti, oldState, newState);
1782}
1783
1784
1785} // namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:37
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
The LtePhy models the physical layer of LTE.
Definition: lte-phy.h:53
double m_txPower
Transmission power in dBm.
Definition: lte-phy.h:249
void DoDispose()
Destructor implementation.
Definition: lte-phy.cc:78
uint8_t GetRbgSize(void) const
Definition: lte-phy.cc:186
uint16_t GetSrsPeriodicity(uint16_t srcCi) const
Definition: lte-phy.cc:150
std::vector< Ptr< PacketBurst > > m_packetBurstQueue
A queue of packet bursts to be sent.
Definition: lte-phy.h:289
uint16_t m_ulBandwidth
The UL bandwidth in number of PRBs.
Definition: lte-phy.h:269
Ptr< LteNetDevice > GetDevice() const
Get the device where the phy layer is attached.
Definition: lte-phy.cc:100
Ptr< PacketBurst > GetPacketBurst(void)
Definition: lte-phy.cc:198
uint8_t m_componentCarrierId
component carrier Id used to address sap
Definition: lte-phy.h:311
double m_noiseFigure
Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
Definition: lte-phy.h:261
uint32_t m_ulEarfcn
The uplink carrier frequency.
Definition: lte-phy.h:286
uint16_t m_dlBandwidth
The DL bandwidth in number of PRBs.
Definition: lte-phy.h:274
Ptr< LteSpectrumPhy > m_downlinkSpectrumPhy
The downlink LteSpectrumPhy associated to this LtePhy.
Definition: lte-phy.h:238
void SetMacPdu(Ptr< Packet > p)
Definition: lte-phy.cc:192
uint16_t GetSrsSubframeOffset(uint16_t srcCi) const
Definition: lte-phy.cc:168
Ptr< LteNetDevice > m_netDevice
Pointer to the NetDevice where this PHY layer is attached.
Definition: lte-phy.h:232
std::vector< std::list< Ptr< LteControlMessage > > > m_controlMessagesQueue
A queue of control messages to be sent.
Definition: lte-phy.h:291
uint16_t m_cellId
Cell identifier.
Definition: lte-phy.h:308
void SetControlMessages(Ptr< LteControlMessage > m)
Definition: lte-phy.cc:217
std::list< Ptr< LteControlMessage > > GetControlMessages(void)
Definition: lte-phy.cc:225
uint32_t m_dlEarfcn
The downlink carrier frequency.
Definition: lte-phy.h:281
Ptr< LteSpectrumPhy > m_uplinkSpectrumPhy
The uplink LteSpectrumPhy associated to this LtePhy.
Definition: lte-phy.h:243
double GetTti(void) const
Definition: lte-phy.cc:142
uint8_t m_rbgSize
The RB group size according to the bandwidth.
Definition: lte-phy.h:276
uint8_t m_macChTtiDelay
Delay between MAC and channel layer in terms of TTIs.
Definition: lte-phy.h:301
static Ptr< SpectrumValue > CreateUlTxPowerSpectralDensity(uint16_t earfcn, uint16_t bandwidth, double powerTx, std::vector< int > activeRbs)
create a spectrum value representing the uplink power spectral density of a signal to be transmitted.
static Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(uint32_t earfcn, uint16_t bandwidth, double noiseFigure)
create a SpectrumValue that models the power spectral density of AWGN
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
virtual void NotifyInSync()=0
Send an in sync indication to UE RRC.
virtual void ReportUeMeasurements(UeMeasurementsParameters params)=0
Send a report of RSRP and RSRQ values perceived from PSS by the PHY entity (after applying layer-1 fi...
virtual void RecvMasterInformationBlock(uint16_t cellId, LteRrcSap::MasterInformationBlock mib)=0
Relay an MIB message from the PHY entity to the RRC layer.
virtual void RecvSystemInformationBlockType1(uint16_t cellId, LteRrcSap::SystemInformationBlockType1 sib1)=0
Relay an SIB1 message from the PHY entity to the RRC layer.
virtual void NotifyOutOfSync()=0
Send an out of sync indication to UE RRC.
virtual void ResetSyncIndicationCounter()=0
Reset the sync indication counter.
The LteUeNetDevice class implements the UE net device.
The LteSpectrumPhy models the physical layer of LTE.
Definition: lte-ue-phy.h:55
void SetTxMode1Gain(double gain)
Set transmit mode 1 gain function.
Definition: lte-ue-phy.cc:1685
SpectrumValue m_dataInterferencePower
data interference power
Definition: lte-ue-phy.h:733
virtual void DoInitialize(void)
Initialize() implementation.
Definition: lte-ue-phy.cc:361
void SetSubChannelsForTransmission(std::vector< int > mask)
Set a list of sub channels to use in TX.
Definition: lte-ue-phy.cc:509
friend class MemberLteUeCphySapProvider< LteUePhy >
allow MemberLteUeCphySapProvider<LteUePhy> class friend access
Definition: lte-ue-phy.h:60
void SetHarqPhyModule(Ptr< LteHarqPhy > harq)
Set the HARQ PHY module.
Definition: lte-ue-phy.cc:1758
void DoSetDlBandwidth(uint16_t dlBandwidth)
Set DL bandwidth function.
Definition: lte-ue-phy.cc:1460
uint16_t GetNumQinEvalSf() const
Get number of Qin evaluation subframes.
Definition: lte-ue-phy.cc:487
void SetTxMode3Gain(double gain)
Set transmit mode 3 gain function.
Definition: lte-ue-phy.cc:1697
uint16_t m_numOfQinEvalSf
the downlink radio link quality is estimated over this period for detecting in-syncs
Definition: lte-ue-phy.h:846
LteUePhySapUser * m_uePhySapUser
UE Phy SAP user.
Definition: lte-ue-phy.h:695
uint16_t DoGetCellId()
Get cell ID.
Definition: lte-ue-phy.cc:1448
uint16_t m_rsrpSinrSampleCounter
The RsrpSinrSampleCounter attribute.
Definition: lte-ue-phy.h:793
virtual void ReportDataInterference(const SpectrumValue &interf)
Create the mixed CQI report.
Definition: lte-ue-phy.cc:805
void QueueSubChannelsForTransmission(std::vector< int > rbMap)
Queue subchannels for transmission function.
Definition: lte-ue-phy.cc:1238
void DoConfigureUplink(uint32_t ulEarfcn, uint16_t ulBandwidth)
Configure UL uplink function.
Definition: lte-ue-phy.cc:1491
virtual void ReceivePss(uint16_t cellId, Ptr< SpectrumValue > p)
Receive PSS function.
Definition: lte-ue-phy.cc:1184
uint16_t m_srsPeriodicity
SRS periodicity.
Definition: lte-ue-phy.h:705
void DoResetPhyAfterRlf()
Reset Phy after radio link failure function.
Definition: lte-ue-phy.cc:1552
virtual void DoNotifyConnectionSuccessful()
Notify PHY about the successful RRC connection establishment.
Definition: lte-ue-phy.cc:1011
bool m_dlConfigured
DL configured?
Definition: lte-ue-phy.h:712
LteUePhySapProvider * GetLteUePhySapProvider()
Get the PHY SAP provider.
Definition: lte-ue-phy.cc:386
Time m_srsStartTime
SRS start time.
Definition: lte-ue-phy.h:708
TracedCallback< uint16_t, Ptr< SpectrumValue > > m_reportPowerSpectralDensity
The ReportsPowerSpectralDensity trace source.
Definition: lte-ue-phy.h:824
double GetNoiseFigure() const
Get noise figure.
Definition: lte-ue-phy.cc:415
virtual void GenerateDataCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Data frame (used for PUSCH CQIs)
Definition: lte-ue-phy.cc:725
Time m_p10CqiLast
last periodic CQI
Definition: lte-ue-phy.h:684
std::map< uint16_t, UeMeasurementsElement > m_ueMeasurementsMap
Store measurement results during the last layer-1 filtering period.
Definition: lte-ue-phy.h:764
LteUePhySapProvider * m_uePhySapProvider
UE Phy SAP provider.
Definition: lte-ue-phy.h:694
uint16_t GetNumQoutEvalSf() const
Get number of Qout evaluation subframes.
Definition: lte-ue-phy.cc:480
bool m_rsInterferencePowerUpdated
RS interference power updated?
Definition: lte-ue-phy.h:729
virtual void ReceiveLteControlMessageList(std::list< Ptr< LteControlMessage > > msgList)
Receive LTE control message list function.
Definition: lte-ue-phy.cc:1029
Ptr< SpectrumValue > m_noisePsd
Noise power spectral density for the configured bandwidth.
Definition: lte-ue-phy.h:827
uint32_t DoGetDlEarfcn()
Get DL EARFCN.
Definition: lte-ue-phy.cc:1454
double ComputeAvgSinr(const SpectrumValue &sinr)
Compute average SINR among the RBs.
Definition: lte-ue-phy.cc:704
void SetLteUePhySapUser(LteUePhySapUser *s)
Set the PHY SAP User.
Definition: lte-ue-phy.cc:379
std::vector< std::vector< int > > m_subChannelsForTransmissionQueue
subchannels for transmission queue
Definition: lte-ue-phy.h:669
virtual void DoSendRachPreamble(uint32_t prachId, uint32_t raRnti)
Send RACH preamble function.
Definition: lte-ue-phy.cc:998
void DoStartCellSearch(uint32_t dlEarfcn)
Start the cell search function.
Definition: lte-ue-phy.cc:1408
void SetTxMode6Gain(double gain)
Set transmit mode 6 gain function.
Definition: lte-ue-phy.cc:1715
LteUeCphySapProvider * m_ueCphySapProvider
UE CPhy SAP provider.
Definition: lte-ue-phy.h:697
void DoReset()
Do Reset function.
Definition: lte-ue-phy.cc:1358
void SetNumQoutEvalSf(uint16_t numSubframes)
Set number of Qout evaluation subframes.
Definition: lte-ue-phy.cc:462
State m_state
The current UE PHY state.
Definition: lte-ue-phy.h:716
bool m_pssReceived
PSS received?
Definition: lte-ue-phy.h:735
TracedCallback< uint16_t, uint16_t, double, double, uint8_t > m_reportCurrentCellRsrpSinrTrace
The ReportCurrentCellRsrpSinr trace source.
Definition: lte-ue-phy.h:783
void DoSetImsi(uint64_t imsi)
Set IMSI.
Definition: lte-ue-phy.cc:1579
void SetTxMode2Gain(double gain)
Set transmit mode 2 gain function.
Definition: lte-ue-phy.cc:1691
void DoSetRsrpFilterCoefficient(uint8_t rsrpFilterCoefficient)
Do set RSRP filter coefficient.
Definition: lte-ue-phy.cc:1545
Ptr< LteUePowerControl > m_powerControl
Pointer to UE Uplink Power Control entity.
Definition: lte-ue-phy.h:680
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity()
Create the PSD for the TX.
Definition: lte-ue-phy.cc:545
void DoConfigureReferenceSignalPower(int8_t referenceSignalPower)
Configure reference signal power function.
Definition: lte-ue-phy.cc:1499
std::list< PssElement > m_pssList
PSS list.
Definition: lte-ue-phy.h:743
void SubframeIndication(uint32_t frameNo, uint32_t subframeNo)
trigger from eNB the start from a new frame
Definition: lte-ue-phy.cc:1245
static TypeId GetTypeId(void)
Get the type ID.
Definition: lte-ue-phy.cc:201
Ptr< LteUePowerControl > GetUplinkPowerControl() const
Get Uplink power control.
Definition: lte-ue-phy.cc:437
void RlfDetection(double sinrdB)
Radio link failure detection function.
Definition: lte-ue-phy.cc:1596
std::vector< double > m_txModeGain
the transmit mode gain
Definition: lte-ue-phy.h:703
State GetState() const
Get state of the UE physical layer.
Definition: lte-ue-phy.cc:1765
SpectrumValue m_rsReceivedPower
RS receive power.
Definition: lte-ue-phy.h:727
void DoSynchronizeWithEnb(uint16_t cellId)
Synchronize with ENB function.
Definition: lte-ue-phy.cc:1425
uint8_t GetMacChDelay(void) const
Get MAC to Channel delay.
Definition: lte-ue-phy.cc:444
void DoSetSrsConfigurationIndex(uint16_t srcCi)
Set SRS configuration index function.
Definition: lte-ue-phy.cc:1524
uint16_t m_srsSubframeOffset
SRS subframe offset.
Definition: lte-ue-phy.h:706
uint8_t m_subframeNo
Definition: lte-ue-phy.h:724
uint16_t m_srsConfigured
SRS configured.
Definition: lte-ue-phy.h:707
virtual void GenerateCtrlCqiReport(const SpectrumValue &sinr)
generate a CQI report based on the given SINR of Ctrl frame
Definition: lte-ue-phy.cc:555
uint16_t m_rsrpSinrSamplePeriod
The RsrpSinrSamplePeriod attribute.
Definition: lte-ue-phy.h:788
uint64_t m_imsi
the IMSI of the UE
Definition: lte-ue-phy.h:853
uint16_t m_rnti
the RNTI
Definition: lte-ue-phy.h:700
bool m_enableUplinkPowerControl
The EnableUplinkPowerControl attribute.
Definition: lte-ue-phy.h:678
Ptr< LteSpectrumPhy > GetDlSpectrumPhy() const
Get Downlink spectrum phy.
Definition: lte-ue-phy.cc:450
void SetTxMode5Gain(double gain)
Set transmit mode 5 gain function.
Definition: lte-ue-phy.cc:1709
void DoSetTransmissionMode(uint8_t txMode)
Set transmission mode function.
Definition: lte-ue-phy.cc:1516
bool m_enableRlfDetection
Flag to enable/disable RLF detection.
Definition: lte-ue-phy.h:854
Time m_a30CqiLast
last aperiodic CQI
Definition: lte-ue-phy.h:692
void GenerateCqiRsrpRsrq(const SpectrumValue &sinr)
Get CQI, RSRP, and RSRQ.
Definition: lte-ue-phy.cc:576
SpectrumValue m_rsInterferencePower
RS interference power.
Definition: lte-ue-phy.h:730
std::vector< int > GetSubChannelsForTransmission(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:529
void DoResetRlfParams()
Reset radio link failure parameters.
Definition: lte-ue-phy.cc:1563
void SetDownlinkCqiPeriodicity(Time cqiPeriodicity)
Set the periodicty for the downlink periodic wideband and aperiodic subband CQI reporting.
Definition: lte-ue-phy.cc:982
Ptr< LteHarqPhy > m_harqPhyModule
HARQ phy module.
Definition: lte-ue-phy.h:773
virtual void DoDispose(void)
Destructor implementation.
Definition: lte-ue-phy.cc:190
EventId m_sendSrsEvent
send SRS event
Definition: lte-ue-phy.h:803
double m_qIn
The 'Qin' attribute.
Definition: lte-ue-phy.h:836
void SetNoiseFigure(double nf)
Set noise figure.
Definition: lte-ue-phy.cc:408
virtual void ReportInterference(const SpectrumValue &interf)
generate a report based on the linear interference and noise power perceived during DATA frame NOTE: ...
Definition: lte-ue-phy.cc:797
friend class UeMemberLteUePhySapProvider
allow UeMemberLteUePhySapProvider class friend access
Definition: lte-ue-phy.h:58
TracedCallback< uint16_t, const std::vector< int > & > m_reportUlPhyResourceBlocks
The ReportUlPhyResourceBlocks trace source.
Definition: lte-ue-phy.h:817
void DoSetPa(double pa)
Set PA function.
Definition: lte-ue-phy.cc:1538
Ptr< DlCqiLteControlMessage > CreateDlCqiFeedbackMessage(const SpectrumValue &sinr)
Create the DL CQI feedback from SINR values perceived at the physical layer with the signal received ...
Definition: lte-ue-phy.cc:839
LteUeCphySapUser * m_ueCphySapUser
UE CPhy SAP user.
Definition: lte-ue-phy.h:698
void SetNumQinEvalSf(uint16_t numSubframes)
Set number of Qin evaluation subframes.
Definition: lte-ue-phy.cc:471
void DoStartInSnycDetection()
Start in Snyc detection function.
Definition: lte-ue-phy.cc:1571
void SetLteUeCphySapUser(LteUeCphySapUser *s)
Set the CPHY SAP User.
Definition: lte-ue-phy.cc:394
double m_sinrDbFrame
the average SINR per radio frame
Definition: lte-ue-phy.h:851
virtual ~LteUePhy()
Definition: lte-ue-phy.cc:184
TracedCallback< uint16_t, uint16_t, State, State > m_stateTransitionTrace
The StateTransition trace source.
Definition: lte-ue-phy.h:721
void SetSubChannelsForReception(std::vector< int > mask)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:521
bool m_rsReceivedPowerUpdated
RS receive power updated?
Definition: lte-ue-phy.h:726
void SwitchToState(State s)
Switch the UE PHY to the given state.
Definition: lte-ue-phy.cc:1773
TracedCallback< uint16_t, uint16_t, double, double, bool, uint8_t > m_reportUeMeasurements
The ReportUeMeasurements trace source.
Definition: lte-ue-phy.h:801
double m_paLinear
PA linear.
Definition: lte-ue-phy.h:710
TracedCallback< PhyTransmissionStatParameters > m_ulPhyTransmission
The UlPhyTransmission trace source.
Definition: lte-ue-phy.h:810
bool m_isConnected
set when UE RRC is in CONNECTED_NORMALLY state
Definition: lte-ue-phy.h:830
Ptr< LteAmc > m_amc
AMC.
Definition: lte-ue-phy.h:672
std::vector< int > m_subChannelsForReception
A list of sub channels to use in RX.
Definition: lte-ue-phy.h:667
void InitializeRlfParams()
Initialize radio link failure parameters.
Definition: lte-ue-phy.cc:1586
void PhyPduReceived(Ptr< Packet > p)
PhySpectrum received a new PHY-PDU.
Definition: lte-ue-phy.cc:503
LteUeCphySapProvider * GetLteUeCphySapProvider()
Get the CPHY SAP provider.
Definition: lte-ue-phy.cc:401
bool m_ulConfigured
UL configured?
Definition: lte-ue-phy.h:713
virtual void ReportRsReceivedPower(const SpectrumValue &power)
generate a report based on the linear RS power perceived during CTRL frame NOTE: used only by UE for ...
Definition: lte-ue-phy.cc:814
SpectrumValue m_ctrlSinrForRlf
the CTRL SINR used for RLF detection
Definition: lte-ue-phy.h:852
Time m_ueMeasurementsFilterPeriod
The UeMeasurementsFilterPeriod attribute.
Definition: lte-ue-phy.h:769
uint16_t m_numOfFrames
count the number of frames for which the downlink radio link quality is estimated
Definition: lte-ue-phy.h:850
bool m_downlinkInSync
when set, DL SINR evaluation for out-of-sync indications is conducted.
Definition: lte-ue-phy.h:848
uint16_t m_numOfQoutEvalSf
the downlink radio link quality is estimated over this period for detecting out-of-syncs
Definition: lte-ue-phy.h:845
void SetTxMode7Gain(double gain)
Set transmit mode 7 gain function.
Definition: lte-ue-phy.cc:1721
void DoSetRnti(uint16_t rnti)
Set RNTI function.
Definition: lte-ue-phy.cc:1506
virtual void DoSendMacPdu(Ptr< Packet > p)
Queue the MAC PDU to be sent (according to m_macChTtiDelay)
Definition: lte-ue-phy.cc:494
double GetTxPower() const
Get transmit power.
Definition: lte-ue-phy.cc:430
virtual void EnqueueDlHarqFeedback(DlInfoListElement_s mes)
Enqueue the downlink HARQ feedback generated by LteSpectrumPhy.
Definition: lte-ue-phy.cc:1748
std::vector< int > m_subChannelsForTransmission
A list of sub channels to use in TX.
Definition: lte-ue-phy.h:665
Time m_p10CqiPeriodicity
Wideband Periodic CQI. 2, 5, 10, 16, 20, 32, 40, 64, 80 or 160 ms.
Definition: lte-ue-phy.h:683
bool m_dataInterferencePowerUpdated
data interference power updated?
Definition: lte-ue-phy.h:732
void SetTxPower(double pow)
Set transmit power.
Definition: lte-ue-phy.cc:422
State
The states of the UE PHY entity.
Definition: lte-ue-phy.h:67
uint16_t m_numOfSubframes
count the number of subframes for which the downlink radio link quality is estimated
Definition: lte-ue-phy.h:849
void SetTxMode4Gain(double gain)
Set transmit mode 4 gain function.
Definition: lte-ue-phy.cc:1703
virtual void DoSendLteControlMessage(Ptr< LteControlMessage > msg)
Send LTE control message function.
Definition: lte-ue-phy.cc:990
Time m_a30CqiPeriodicity
SubBand Aperiodic CQI.
Definition: lte-ue-phy.h:691
Ptr< LteSpectrumPhy > GetUlSpectrumPhy() const
Get Uplink spectrum phy.
Definition: lte-ue-phy.cc:456
void ReportUeMeasurements()
Layer-1 filtering of RSRP and RSRQ measurements and reporting to the RRC entity.
Definition: lte-ue-phy.cc:939
double m_pssReceptionThreshold
The RsrqUeMeasThreshold attribute.
Definition: lte-ue-phy.h:749
uint32_t m_raPreambleId
RA preamble ID.
Definition: lte-ue-phy.h:775
double m_qOut
The 'Qout' attribute.
Definition: lte-ue-phy.h:843
void SendSrs()
Send the SRS signal in the last symbols of the frame.
Definition: lte-ue-phy.cc:1336
virtual void GenerateMixedCqiReport(const SpectrumValue &sinr)
Create the mixed CQI report.
Definition: lte-ue-phy.cc:731
uint8_t m_transmissionMode
the transmission mode
Definition: lte-ue-phy.h:702
void SetTxModeGain(uint8_t txMode, double gain)
Set transmit mode gain function.
Definition: lte-ue-phy.cc:1728
std::vector< int > GetSubChannelsForReception(void)
Get a list of sub channels to use in RX.
Definition: lte-ue-phy.cc:537
uint32_t m_raRnti
RA RNTI.
Definition: lte-ue-phy.h:776
Service Access Point (SAP) offered by the UE-PHY to the UE-MAC.
Service Access Point (SAP) offered by the PHY to the MAC.
virtual void ReceivePhyPdu(Ptr< Packet > p)=0
Receive Phy Pdu funtion.
virtual void SubframeIndication(uint32_t frameNo, uint32_t subframeNo)=0
Trigger the start from a new frame (input from Phy layer)
virtual void ReceiveLteControlMessage(Ptr< LteControlMessage > msg)=0
Receive SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel.
void SetCellId(uint16_t cellId)
Set the cell ID function.
void SetRsrp(double value)
Set RSRP function.
void ConfigureReferenceSignalPower(int8_t referenceSignalPower)
Configure reference signal power (dBm) function.
void SetRnti(uint16_t rnti)
Set the RNTI function.
double GetPucchTxPower(std::vector< int > rb)
Get PUCCH transmit power function.
void SetTxPower(double value)
Set transmit power function.
void SetRsrpFilterCoefficient(uint8_t rsrpFilterCoefficient)
Set RSRP function.
double GetPuschTxPower(std::vector< int > rb)
Get PUSCH transmit power function.
void ReportTpc(uint8_t tpc)
Set RSRP function.
double GetSrsTxPower(std::vector< int > rb)
Get SRS transmit power function.
uint32_t GetId(void) const
Definition: node.cc:109
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:353
Hold objects of type Ptr<T>.
Definition: pointer.h:37
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:555
static void ScheduleWithContext(uint32_t context, Time const &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition: simulator.h:570
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
Set of values corresponding to a given SpectrumModel.
Values::const_iterator ConstValuesBegin() const
Values::const_iterator ConstValuesEnd() const
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
@ MS
millisecond
Definition: nstime.h:116
int64_t GetMilliSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:384
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:418
AttributeValue implementation for Time.
Definition: nstime.h:1309
static uint8_t TxMode2LayerNum(uint8_t txMode)
Transmit mode 2 layer number.
Definition: lte-common.cc:212
a unique identifier for an interface.
Definition: type-id.h:59
@ ATTR_GET
The attribute can be read.
Definition: type-id.h:64
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
UeMemberLteUePhySapProvider class.
Definition: lte-ue-phy.cc:78
virtual void SendLteControlMessage(Ptr< LteControlMessage > msg)
Send SendLteControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel.
Definition: lte-ue-phy.cc:107
virtual void SendRachPreamble(uint32_t prachId, uint32_t raRnti)
Send a preamble on the PRACH.
Definition: lte-ue-phy.cc:113
virtual void SendMacPdu(Ptr< Packet > p)
Send the MAC PDU to the channel.
Definition: lte-ue-phy.cc:101
virtual void NotifyConnectionSuccessful()
Notify PHY about the successful RRC connection establishment.
Definition: lte-ue-phy.cc:119
UeMemberLteUePhySapProvider(LteUePhy *phy)
Constructor.
Definition: lte-ue-phy.cc:97
Hold an unsigned integer type.
Definition: uinteger.h:44
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:85
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:42
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Definition: pointer.h:227
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1310
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:45
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:206
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:274
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:290
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:266
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:282
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1269
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1245
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1253
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
#define UL_PUSCH_TTIS_DELAY
Definition: lte-common.h:28
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const std::string g_uePhyStateName[LteUePhy::NUM_STATES]
Map each of UE PHY states to its string representation.
Definition: lte-ue-phy.cc:130
static const Time UL_DATA_DURATION
Duration of the data portion of a UL subframe.
Definition: lte-ue-phy.cc:61
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:522
static const Time UL_SRS_DELAY_FROM_SUBFRAME_START
Delay from subframe start to transmission of SRS.
Definition: lte-ue-phy.cc:67
std::vector< HarqProcessInfoElement_t > HarqProcessInfoList_t
HarqProcessInfoList_t typedef.
Definition: lte-harq-phy.h:48
static const int Type0AllocationRbg[4]
Type 0 RGB allocation.
static const std::string & ToString(EpcUeNas::State s)
Definition: epc-ue-nas.cc:50
phy
Definition: third.py:84
#define list
See section 4.3.24 cqiListElement.
std::vector< uint8_t > m_wbCqi
wb CQI
struct SbMeasResult_s m_sbMeasResult
sb measure result
uint8_t m_wbPmi
wb PMI
uint16_t m_rnti
RNTI.
See section 4.3.1 dlDciListElement.
Definition: ff-mac-common.h:94
std::vector< uint8_t > m_ndi
New data indicator.
uint8_t m_harqProcess
HARQ process.
uint32_t m_rbBitmap
RB bitmap.
Definition: ff-mac-common.h:96
std::vector< uint8_t > m_mcs
MCS.
uint8_t m_resAlloc
The type of resource allocation.
Definition: ff-mac-common.h:98
std::vector< uint16_t > m_tbsSize
The TBs size.
Definition: ff-mac-common.h:99
std::vector< uint8_t > m_rv
Redundancy version.
uint8_t m_tpc
Tx power control command.
See section 4.3.23 dlInfoListElement.
See section 4.3.27 higherLayerSelected.
std::vector< uint8_t > m_sbCqi
sb CQI
Parameters of the ReportUeMeasurements primitive: RSRP [dBm] and RSRQ [dB] See section 5....
UeMeasurementsParameters structure.
uint8_t m_componentCarrierId
component carrier ID
std::vector< struct UeMeasurementsElement > m_ueMeasurementsList
UE measurement list.
PssElement structure.
Definition: lte-ue-phy.h:738
uint16_t cellId
cell ID
Definition: lte-ue-phy.h:739
double pssPsdSum
PSS PSD sum.
Definition: lte-ue-phy.h:740
uint16_t nRB
number of RB
Definition: lte-ue-phy.h:741
Summary results of measuring a specific cell. Used for layer-1 filtering.
Definition: lte-ue-phy.h:753
double rsrqSum
Sum of RSRQ sample values in linear unit.
Definition: lte-ue-phy.h:756
uint8_t rsrpNum
Number of RSRP samples.
Definition: lte-ue-phy.h:755
double rsrpSum
Sum of RSRP sample values in linear unit.
Definition: lte-ue-phy.h:754
uint8_t rsrqNum
Number of RSRQ samples.
Definition: lte-ue-phy.h:757
PhyTransmissionStatParameters structure.
Definition: lte-common.h:187
uint8_t m_ndi
new data indicator flag
Definition: lte-common.h:197
int64_t m_timestamp
in millisecond
Definition: lte-common.h:188
uint8_t m_layer
the layer (cw) of the transmission
Definition: lte-common.h:193
uint16_t m_size
Size of transport block.
Definition: lte-common.h:195
uint64_t m_imsi
IMSI of the scheduled UE.
Definition: lte-common.h:190
uint16_t m_rnti
C-RNTI scheduled.
Definition: lte-common.h:191
uint8_t m_txMode
the transmission Mode
Definition: lte-common.h:192
uint8_t m_rv
the redundancy version (HARQ)
Definition: lte-common.h:196
uint16_t m_cellId
Cell ID of the attached Enb.
Definition: lte-common.h:189
uint8_t m_ccId
component carrier id
Definition: lte-common.h:198
uint8_t m_mcs
MCS for transport block.
Definition: lte-common.h:194
See section 4.3.25 sbMeasResult.
std::vector< struct HigherLayerSelected_s > m_higherLayerSelected
higher layer selected
See section 4.3.2 ulDciListElement.