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