1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 2 /* 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) 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: Nicola Baldo <nbaldo@cttc.es> 20 * Budiarto Herman <budiarto.herman@magister.fi> 21 * Modified by: 22 * Danilo Abrignani <danilo.abrignani@unibo.it> (Carrier Aggregation - GSoC 2015) 23 * Biljana Bojovic <biljana.bojovic@cttc.es> (Carrier Aggregation) 24 * Vignesh Babu <ns3-dev@esk.fraunhofer.de> (RLF extensions) 25 */ 26 27 #ifndef LTE_UE_RRC_H 28 #define LTE_UE_RRC_H 29 30 #include <ns3/object.h> 31 #include <ns3/packet.h> 32 #include <ns3/lte-ue-cmac-sap.h> 33 #include <ns3/lte-pdcp-sap.h> 34 #include <ns3/lte-as-sap.h> 35 #include <ns3/lte-ue-cphy-sap.h> 36 #include <ns3/lte-rrc-sap.h> 37 #include <ns3/traced-callback.h> 38 #include "ns3/component-carrier-ue.h" 39 #include <ns3/lte-ue-ccm-rrc-sap.h> 40 #include <vector> 41 42 #include <map> 43 #include <set> 44 45 #define MIN_NO_CC 1 46 #define MAX_NO_CC 5 // this is the maximum number of carrier components allowed by 3GPP up to R13 47 48 namespace ns3 { 49 50 51 /** 52 * \brief Artificial delay of UE measurements procedure. 53 * 54 * i.e. the period between the time layer-1-filtered measurements from PHY 55 * layer is received and the earliest time the actual measurement report 56 * submission to the serving cell is invoked. 57 * 58 * This delay exists because of racing condition between several UE measurements 59 * functions which happen to be scheduled at the same time. The delay ensures 60 * that: 61 * - measurements (e.g., layer-3 filtering) are always performed before 62 * reporting, thus the latter always use the latest measured RSRP and RSRQ; 63 * and 64 * - time-to-trigger check is always performed before the reporting, so there 65 * would still be chance for it to cancel the reporting if necessary. 66 */ 67 static const Time UE_MEASUREMENT_REPORT_DELAY = MicroSeconds (1); 68 69 70 class LteRlc; 71 class LteMacSapProvider; 72 class LteUeCmacSapUser; 73 class LteUeCmacSapProvider; 74 class LteDataRadioBearerInfo; 75 class LteSignalingRadioBearerInfo; 76 77 /** 78 * 79 * 80 */ 81 class LteUeRrc : public Object 82 { 83 84 /// allow UeMemberLteUeCmacSapUser class friend access 85 friend class UeMemberLteUeCmacSapUser; 86 /// allow UeRrcMemberLteEnbCmacSapUser class friend access 87 friend class UeRrcMemberLteEnbCmacSapUser; 88 /// allow LtePdcpSpecificLtePdcpSapUser<LteUeRrc> class friend access 89 friend class LtePdcpSpecificLtePdcpSapUser<LteUeRrc>; 90 /// allow MemberLteAsSapProvider<LteUeRrc> class friend access 91 friend class MemberLteAsSapProvider<LteUeRrc>; 92 /// allow MemberLteUeCphySapUser<LteUeRrc> class friend access 93 friend class MemberLteUeCphySapUser<LteUeRrc>; 94 /// allow MemberLteUeRrcSapProvider<LteUeRrc> class friend access 95 friend class MemberLteUeRrcSapProvider<LteUeRrc>; 96 /// allow MemberLteUeCcmRrcSapUser<LteUeRrc> class friend access 97 friend class MemberLteUeCcmRrcSapUser<LteUeRrc>; 98 99 public: 100 101 /** 102 * The states of the UE RRC entity 103 * 104 */ 105 enum State 106 { 107 IDLE_START = 0, 108 IDLE_CELL_SEARCH, 109 IDLE_WAIT_MIB_SIB1, 110 IDLE_WAIT_MIB, 111 IDLE_WAIT_SIB1, 112 IDLE_CAMPED_NORMALLY, 113 IDLE_WAIT_SIB2, 114 IDLE_RANDOM_ACCESS, 115 IDLE_CONNECTING, 116 CONNECTED_NORMALLY, 117 CONNECTED_HANDOVER, 118 CONNECTED_PHY_PROBLEM, 119 CONNECTED_REESTABLISHING, 120 NUM_STATES 121 }; 122 123 124 /** 125 * create an RRC instance for use within an ue 126 * 127 */ 128 LteUeRrc (); 129 130 131 /** 132 * Destructor 133 */ 134 virtual ~LteUeRrc (); 135 136 137 // inherited from Object 138 private: 139 virtual void DoInitialize (void); 140 virtual void DoDispose (void); 141 public: 142 /** 143 * \brief Get the type ID. 144 * \return the object TypeId 145 */ 146 static TypeId GetTypeId (void); 147 148 /// Initiaize SAP 149 void InitializeSap (void); 150 151 /** 152 * set the CPHY SAP this RRC should use to interact with the PHY 153 * 154 * \param s the CPHY SAP Provider 155 */ 156 void SetLteUeCphySapProvider (LteUeCphySapProvider * s); 157 /** 158 * set the CPHY SAP this RRC should use to interact with the PHY 159 * 160 * \param s the CPHY SAP Provider 161 * \param index the index 162 */ 163 void SetLteUeCphySapProvider (LteUeCphySapProvider * s, uint8_t index); 164 165 /** 166 * 167 * 168 * \return s the CPHY SAP User interface offered to the PHY by this RRC 169 */ 170 LteUeCphySapUser* GetLteUeCphySapUser (); 171 /** 172 * 173 * \param index the index 174 * \return s the CPHY SAP User interface offered to the PHY by this RRC 175 */ 176 LteUeCphySapUser* GetLteUeCphySapUser (uint8_t index); 177 178 /** 179 * set the CMAC SAP this RRC should interact with 180 * \brief This function is overloaded to maintain backward compatibility 181 * \param s the CMAC SAP Provider to be used by this RRC 182 */ 183 void SetLteUeCmacSapProvider (LteUeCmacSapProvider * s); 184 /** 185 * set the CMAC SAP this RRC should interact with 186 * \brief This function is overloaded to maintain backward compatibility 187 * \param s the CMAC SAP Provider to be used by this RRC 188 * \param index the index 189 */ 190 void SetLteUeCmacSapProvider (LteUeCmacSapProvider * s, uint8_t index); 191 192 /** 193 * \brief This function is overloaded to maintain backward compatibility 194 * \return s the CMAC SAP User interface offered to the MAC by this RRC 195 */ 196 LteUeCmacSapUser* GetLteUeCmacSapUser (); 197 /** 198 * \brief This function is overloaded to maintain backward compatibility 199 * \param index the index 200 * \return s the CMAC SAP User interface offered to the MAC by this RRC 201 */ 202 LteUeCmacSapUser* GetLteUeCmacSapUser (uint8_t index); 203 204 205 /** 206 * set the RRC SAP this RRC should interact with 207 * 208 * \param s the RRC SAP User to be used by this RRC 209 */ 210 void SetLteUeRrcSapUser (LteUeRrcSapUser * s); 211 212 /** 213 * 214 * 215 * \return s the RRC SAP Provider interface offered to the MAC by this RRC 216 */ 217 LteUeRrcSapProvider* GetLteUeRrcSapProvider (); 218 219 /** 220 * set the MAC SAP provider. The ue RRC does not use this 221 * directly, but it needs to provide it to newly created RLC instances. 222 * 223 * \param s the MAC SAP provider that will be used by all 224 * newly created RLC instances 225 */ 226 void SetLteMacSapProvider (LteMacSapProvider* s); 227 228 /** 229 * Set the AS SAP user to interact with the NAS entity 230 * 231 * \param s the AS SAP user 232 */ 233 void SetAsSapUser (LteAsSapUser* s); 234 235 /** 236 * 237 * 238 * \return the AS SAP provider exported by this RRC 239 */ 240 LteAsSapProvider* GetAsSapProvider (); 241 242 /** 243 * set the Component Carrier Management SAP this RRC should interact with 244 * 245 * \param s the Component Carrier Management SAP Provider to be used by this RRC 246 */ 247 void SetLteCcmRrcSapProvider (LteUeCcmRrcSapProvider * s); 248 249 /** 250 * Get the Component Carrier Management SAP offered by this RRC 251 * \return s the Component Carrier Management SAP User interface offered to the 252 * carrier component selection algorithm by this RRC 253 */ 254 LteUeCcmRrcSapUser* GetLteCcmRrcSapUser (); 255 256 /** 257 * 258 * \param imsi the unique UE identifier 259 */ 260 void SetImsi (uint64_t imsi); 261 262 /** 263 * \brief Store the previous cell id 264 * 265 * \param cellId The cell id of the previous cell the UE was attached to 266 */ 267 void StorePreviousCellId (uint16_t cellId); 268 269 /** 270 * 271 * \return imsi the unique UE identifier 272 */ 273 uint64_t GetImsi (void) const; 274 275 /** 276 * 277 * \return the C-RNTI of the user 278 */ 279 uint16_t GetRnti () const; 280 281 /** 282 * 283 * \return the CellId of the attached Enb 284 */ 285 uint16_t GetCellId () const; 286 287 /** 288 * \return the uplink bandwidth in RBs 289 */ 290 uint8_t GetUlBandwidth () const; 291 292 /** 293 * \return the downlink bandwidth in RBs 294 */ 295 uint8_t GetDlBandwidth () const; 296 297 /** 298 * \return the downlink carrier frequency (EARFCN) 299 */ 300 uint32_t GetDlEarfcn () const; 301 302 /** 303 * \return the uplink carrier frequency (EARFCN) 304 */ 305 uint32_t GetUlEarfcn () const; 306 307 /** 308 * 309 * \return the current state 310 */ 311 State GetState () const; 312 313 /** 314 * \brief Get the previous cell id 315 * 316 * \return The cell Id of the previous cell the UE was attached to. 317 */ 318 uint16_t GetPreviousCellId () const; 319 320 /** 321 * 322 * 323 * \param val true if RLC SM is to be used, false if RLC UM/AM are to be used 324 */ 325 void SetUseRlcSm (bool val); 326 327 /** 328 * TracedCallback signature for imsi, cellId and rnti events. 329 * 330 * \param [in] imsi 331 * \param [in] cellId 332 */ 333 typedef void (* CellSelectionTracedCallback) 334 (uint64_t imsi, uint16_t cellId); 335 336 /** 337 * TracedCallback signature for imsi, cellId and rnti events. 338 * 339 * \param [in] imsi 340 * \param [in] cellId 341 * \param [in] rnti 342 */ 343 typedef void (* ImsiCidRntiTracedCallback) 344 (uint64_t imsi, uint16_t cellId, uint16_t rnti); 345 346 /** 347 * TracedCallback signature for MIBRecieved, Sib1Received and 348 * HandoverStart events. 349 * 350 * \param [in] imsi 351 * \param [in] cellId 352 * \param [in] rnti 353 * \param [in] otherCid 354 */ 355 typedef void (* MibSibHandoverTracedCallback) 356 (uint64_t imsi, uint16_t cellId, uint16_t rnti, uint16_t otherCid); 357 358 /** 359 * TracedCallback signature for state transition events. 360 * 361 * \param [in] imsi 362 * \param [in] cellId 363 * \param [in] rnti 364 * \param [in] oldState 365 * \param [in] newState 366 */ 367 typedef void (* StateTracedCallback) 368 (uint64_t imsi, uint16_t cellId, uint16_t rnti, 369 State oldState, State newState); 370 371 /** 372 * TracedCallback signature for secondary carrier configuration events. 373 * 374 * \param [in] Pointer to UE RRC 375 * \param [in] List of LteRrcSap::SCellToAddMod 376 */ 377 typedef void (* SCarrierConfiguredTracedCallback) 378 (Ptr<LteUeRrc>, std::list<LteRrcSap::SCellToAddMod>); 379 380 /** 381 * TracedCallback signature for in-sync and out-of-sync detection events. 382 * 383 * 384 * \param [in] imsi 385 * \param [in] rnti 386 * \param [in] cellId 387 * \param [in] type 388 * \param [in] count 389 */ 390 typedef void (*PhySyncDetectionTracedCallback) 391 (uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string type, uint16_t count); 392 393 /** 394 * TracedCallback signature for imsi, cellId, rnti and counter for 395 * random access events. 396 * 397 * \param [in] imsi 398 * \param [in] cellId 399 * \param [in] rnti 400 * \param [in] count 401 */ 402 typedef void (* ImsiCidRntiCountTracedCallback) 403 (uint64_t imsi, uint16_t cellId, uint16_t rnti, uint8_t count); 404 405 406 private: 407 408 409 // PDCP SAP methods 410 /** 411 * Receive PDCP SDU function 412 * 413 * \param params LtePdcpSapUser::ReceivePdcpSduParameters 414 */ 415 void DoReceivePdcpSdu (LtePdcpSapUser::ReceivePdcpSduParameters params); 416 417 // CMAC SAP methods 418 /** 419 * Set temporary cell rnti function 420 * 421 * \param rnti RNTI 422 */ 423 void DoSetTemporaryCellRnti (uint16_t rnti); 424 /// Notify random access successful function 425 void DoNotifyRandomAccessSuccessful (); 426 /// Notify random access failed function 427 void DoNotifyRandomAccessFailed (); 428 429 // LTE AS SAP methods 430 /** 431 * Set CSG white list function 432 * 433 * \param csgId CSG ID 434 */ 435 void DoSetCsgWhiteList (uint32_t csgId); 436 /** 437 * Force camped on ENB function 438 * 439 * \param cellId the cell ID 440 * \param dlEarfcn the DL EARFCN 441 */ 442 void DoForceCampedOnEnb (uint16_t cellId, uint32_t dlEarfcn); 443 /** 444 * Start cell selection function 445 * 446 * \param dlEarfcn the DL EARFCN 447 */ 448 void DoStartCellSelection (uint32_t dlEarfcn); 449 /// Connect function 450 void DoConnect (); 451 /** 452 * Send data function 453 * 454 * \param packet the packet 455 * \param bid the BID 456 */ 457 void DoSendData (Ptr<Packet> packet, uint8_t bid); 458 /// Disconnect function 459 void DoDisconnect (); 460 461 // CPHY SAP methods 462 /** 463 * Receive master information block function 464 * 465 * \param cellId the cell ID 466 * \param msg LteRrcSap::MasterInformationBlock 467 */ 468 void DoRecvMasterInformationBlock (uint16_t cellId, 469 LteRrcSap::MasterInformationBlock msg); 470 /** 471 * Receive system information block type 1 function 472 * 473 * \param cellId the cell ID 474 * \param msg LteRrcSap::SystemInformationBlockType1 475 */ 476 void DoRecvSystemInformationBlockType1 (uint16_t cellId, 477 LteRrcSap::SystemInformationBlockType1 msg); 478 /** 479 * Report UE measurements function 480 * 481 * \param params LteUeCphySapUser::UeMeasurementsParameters 482 */ 483 void DoReportUeMeasurements (LteUeCphySapUser::UeMeasurementsParameters params); 484 485 // RRC SAP methods 486 487 /** 488 * Part of the RRC protocol. Implement the LteUeRrcSapProvider::CompleteSetup interface. 489 * \param params the LteUeRrcSapProvider::CompleteSetupParameters 490 */ 491 void DoCompleteSetup (LteUeRrcSapProvider::CompleteSetupParameters params); 492 /** 493 * Part of the RRC protocol. Implement the LteUeRrcSapProvider::RecvSystemInformation interface. 494 * \param msg the LteRrcSap::SystemInformation 495 */ 496 void DoRecvSystemInformation (LteRrcSap::SystemInformation msg); 497 /** 498 * Part of the RRC protocol. Implement the LteUeRrcSapProvider::RecvRrcConnectionSetup interface. 499 * \param msg the LteRrcSap::RrcConnectionSetup 500 */ 501 void DoRecvRrcConnectionSetup (LteRrcSap::RrcConnectionSetup msg); 502 /** 503 * Part of the RRC protocol. Implement the LteUeRrcSapProvider::RecvRrcConnectionReconfiguration interface. 504 * \param msg the LteRrcSap::RrcConnectionReconfiguration 505 */ 506 void DoRecvRrcConnectionReconfiguration (LteRrcSap::RrcConnectionReconfiguration msg); 507 /** 508 * Part of the RRC protocol. Implement the LteUeRrcSapProvider::RecvRrcConnectionReestablishment interface. 509 * \param msg LteRrcSap::RrcConnectionReestablishment 510 */ 511 void DoRecvRrcConnectionReestablishment (LteRrcSap::RrcConnectionReestablishment msg); 512 /** 513 * Part of the RRC protocol. Implement the LteUeRrcSapProvider::RecvRrcConnectionReestablishmentReject interface. 514 * \param msg LteRrcSap::RrcConnectionReestablishmentReject 515 */ 516 void DoRecvRrcConnectionReestablishmentReject (LteRrcSap::RrcConnectionReestablishmentReject msg); 517 /** 518 * Part of the RRC protocol. Implement the LteUeRrcSapProvider::RecvRrcConnectionRelease interface. 519 * \param msg LteRrcSap::RrcConnectionRelease 520 */ 521 void DoRecvRrcConnectionRelease (LteRrcSap::RrcConnectionRelease msg); 522 /** 523 * Part of the RRC protocol. Implement the LteUeRrcSapProvider::RecvRrcConnectionReject interface. 524 * \param msg the LteRrcSap::RrcConnectionReject 525 */ 526 void DoRecvRrcConnectionReject (LteRrcSap::RrcConnectionReject msg); 527 528 /** 529 * RRC CCM SAP USER Method 530 * \param noOfComponentCarriers the number of component carriers 531 */ 532 void DoSetNumberOfComponentCarriers (uint16_t noOfComponentCarriers); 533 534 535 // INTERNAL METHODS 536 537 /** 538 * \brief Go through the list of measurement results, choose the one with the 539 * strongest RSRP, and tell PHY to synchronize to it. 540 * 541 * \warning This function is a part of the *initial cell selection* procedure, 542 * hence must be only executed during IDLE mode. 543 */ 544 void SynchronizeToStrongestCell (); 545 546 /** 547 * \brief Performs cell selection evaluation to the current serving cell. 548 * 549 * \warning This function is a part of the *initial cell selection* procedure, 550 * hence must be only executed during IDLE mode and specifically 551 * during the state when the UE just received the first SIB1 message 552 * from the serving cell. 553 * 554 * This function assumes that the required information for the evaluation 555 * procedure have been readily gathered, such as *measurement results*, MIB, 556 * and SIB1. Please refer to the LTE module's Design Documentation for more 557 * details on the evaluation process. 558 * 559 * If the cell passes the evaluation, the UE will immediately camp to it. 560 * Otherwise, the UE will pick another cell and restart the cell selection 561 * procedure. 562 */ 563 void EvaluateCellForSelection (); 564 565 /** 566 * \brief Update the current measurement configuration #m_varMeasConfig. 567 * \param mc measurements to be performed by the UE 568 * 569 * Implements Section 5.5.2 "Measurement configuration" of 3GPP TS 36.331. 570 * The supported subfunctions are: 571 * - Measurement object removal 572 * - Measurement object addition/ modification 573 * - Reporting configuration removal 574 * - Reporting configuration addition/ modification 575 * - Quantity configuration 576 * - Measurement identity removal 577 * - Measurement identity addition/ modification 578 * 579 * The subfunctions that will be invoked are determined by the content of 580 * the given measurement configuration. 581 * 582 * Note the existence of some chain reaction behaviours: 583 * - Removal of measurement object or reporting configuration also removes any 584 * impacted measurement identities. 585 * - Removal of measurement identity also removes any associated *reporting 586 * entry* from #m_varMeasReportList. 587 * - Modification to measurement object or reporting configuration also 588 * removes any reporting entries of the impacted measurement identities 589 * from #m_varMeasReportList. 590 * - Modification to quantity configuration also removes all existing 591 * reporting entries from #m_varMeasReportList, regardless of measurement 592 * identity. 593 * 594 * Some unsupported features: 595 * - List of neighbouring cells 596 * - List of black cells 597 * - CGI reporting 598 * - Periodical reporting configuration 599 * - Measurement gaps 600 * - s-Measure 601 * - Speed-dependent scaling 602 * 603 * \warning There is a possibility that the input argument (of type 604 * LteRrcSap::MeasConfig) may contain information in fields related 605 * to the unsupported features. In such case, the function will raise 606 * an error. 607 * 608 * The measurement configuration given as an argument is typically provided by 609 * the serving eNodeB. It is transmitted through the RRC protocol when the UE 610 * joins the cell, e.g., by connection establishment or by incoming handover. 611 * The information inside the argument can be configured from the eNodeB side, 612 * which would then equally apply to all other UEs attached to the same 613 * eNodeB. See the LTE module's User Documentation for more information on 614 * configuring this. 615 * 616 * \sa LteRrcSap::MeasConfig, LteUeRrc::m_varMeasReportList 617 */ 618 void ApplyMeasConfig (LteRrcSap::MeasConfig mc); 619 620 /** 621 * \brief Keep the given measurement result as the latest measurement figures, 622 * to be utilised by UE RRC functions. 623 * \param cellId the cell ID of the measured cell 624 * \param rsrp measured RSRP value to be saved (in dBm) 625 * \param rsrq measured RSRQ value to be saved (in dB) 626 * \param useLayer3Filtering 627 * \todo Remove the useLayer3Filtering argument 628 * 629 * Implements Section 5.5.3.2 "Layer 3 filtering" of 3GPP TS 36.331. *Layer-3 630 * filtering* is applied to the given measurement results before saved to 631 * #m_storedMeasValues. The filtering is however disabled when the UE is in 632 * IDLE mode, i.e., saving unfiltered values. 633 * 634 * Layer-3 filtering is influenced by a filter coefficient, which determines 635 * the strength of the filtering. This coefficient is provided by the active 636 * *quantity configuration* in #m_varMeasConfig, which is configured by the 637 * LteUeRrc::ApplyMeasConfig. Details on how the coefficient works and how to 638 * modify it can be found in LTE module's Design Documentation. 639 * 640 * \sa LteUeRrc::m_storedMeasValues 641 */ 642 void SaveUeMeasurements (uint16_t cellId, double rsrp, double rsrq, 643 bool useLayer3Filtering); 644 645 /** 646 * \brief keep the given measurement result as the latest measurement figures, 647 * to be utilised by UE RRC functions. 648 * \param cellId the cell ID of the measured cell 649 * \param rsrp measured RSRP value to be saved (in dBm) 650 * \param rsrq measured RSRQ value to be saved (in dB) 651 * \param useLayer3Filtering 652 * \param componentCarrierId 653 * \todo Remove the useLayer3Filtering argument 654 * 655 * As for SaveUeMeasurements, this function aims to store the latest measurements 656 * related to the secondary component carriers. 657 * in the current implementation it saves only measurements related on the serving 658 * secondary carriers while, measurements related to the Neighbor Cell are filtered 659 */ 660 661 void SaveScellUeMeasurements (uint16_t cellId, double rsrp, double rsrq, 662 bool useLayer3Filtering, uint16_t componentCarrierId); 663 /** 664 * \brief Evaluate the reporting criteria of a measurement identity and 665 * invoke some reporting actions based on the result. 666 * \param measId the measurement identity to be evaluated 667 * 668 * Implements Section 5.5.4.1 "Measurement report triggering - General" of 669 * 3GPP TS 36.331. This function take into use the latest measurement results 670 * and evaluate them against the *entering condition* and the *leaving 671 * condition* of the measurement identity's reporting criteria. The evaluation 672 * also take into account other defined criteria, such as *hysteresis* and 673 * *time-to-trigger*. 674 * 675 * The entering and leaving condition to be evaluated are determined by the 676 * *event type* of the measurement identity's reporting criteria. As defined 677 * in LteRrcSap::ReportConfigEutra, there 5 supported events. The gore details 678 * of these events can be found in Section 5.5.4 of 3GPP TS 36.331. 679 * 680 * An applicable entering condition (i.e., the condition evaluates to true) 681 * will insert a new *reporting entry* to #m_varMeasReportList, so 682 * *measurement reports* would be produced and submitted to eNodeB. On the 683 * other hand, an applicable leaving condition will remove the related 684 * reporting entry from #m_varMeasReportList, so submission of related 685 * measurement reports to eNodeB will be suspended. 686 */ 687 void MeasurementReportTriggering (uint8_t measId); 688 689 /** 690 * \brief Produce a proper measurement report from the given measurement 691 * identity's reporting entry in #m_varMeasReportList and then submit 692 * it to the serving eNodeB. 693 * \param measId the measurement identity which report is to be submitted. 694 * 695 * Implements Section 5.5.5 "Measurement reporting" of 3GPP TS 36.331. 696 * Producing a *measurement report* involves several tasks such as: 697 * - including the measurement results of the serving cell into the report; 698 * - selecting some neighbour cells which triggered the reporting (i.e., those 699 * in *cellsTriggeredList*) to be included in the report; 700 * - sorting the order of neighbour cells in the report by their RSRP or RSRQ 701 * measurement results (the highest comes first); and 702 * - ensuring the number of neighbour cells in the report is under the 703 * *maxReportCells* limit defined by the measurement identity's reporting 704 * configuration. 705 * 706 * The RSRP and RSRQ measurement results included in the report are expressed 707 * in 3GPP-specified range format. They are converted from dBm and dB units 708 * using EutranMeasurementMapping::Dbm2RsrpRange and 709 * EutranMeasurementMapping::Db2RsrqRange functions. 710 * 711 * Measurement report is submitted to the serving eNodeB through the *RRC 712 * protocol*. The LteUeRrcSapUser::SendMeasurementReport method of the *UE RRC 713 * SAP* facilitates this submission. 714 * 715 * After the submission, the function will repeat itself after a certain 716 * interval. The interval length may vary from 120 ms to 60 minutes and is 717 * determined by the *report interval* parameter specified by the measurement 718 * identity's reporting configuration. 719 */ 720 void SendMeasurementReport (uint8_t measId); 721 722 /** 723 * Apply radio resource config dedicated. 724 * \param rrcd LteRrcSap::RadioResourceConfigDedicated 725 */ 726 void ApplyRadioResourceConfigDedicated (LteRrcSap::RadioResourceConfigDedicated rrcd); 727 /** 728 * Apply radio resource config dedicated secondary carrier. 729 * \param nonCec LteRrcSap::NonCriticalExtensionConfiguration 730 */ 731 void ApplyRadioResourceConfigDedicatedSecondaryCarrier (LteRrcSap::NonCriticalExtensionConfiguration nonCec); 732 /// Start connection function 733 void StartConnection (); 734 /** 735 * \brief Leave connected mode method 736 * Resets the UE back to an appropiate state depending 737 * on the nature of cause. For example, the UE is move 738 * to the IDLE_START state upon radio link failure. At 739 * RRC, all radio bearers except SRB 0 are removed, 740 * measurement reports are cleared and the appropriate 741 * flags are reset to their default values. This method 742 * in turn triggers the reset methods of UE PHY and MAC layers. 743 */ 744 void LeaveConnectedMode (); 745 /// Dispose old SRB1 746 void DisposeOldSrb1 (); 747 /** 748 * Bid 2 DR bid. 749 * \param bid the BID 750 * \returns the DR bid 751 */ 752 uint8_t Bid2Drbid (uint8_t bid); 753 /** 754 * Switch the UE RRC to the given state. 755 * \param s the destination state 756 */ 757 void SwitchToState (State s); 758 759 std::map<uint8_t, uint8_t> m_bid2DrbidMap; ///< bid to DR bid map 760 761 std::vector<LteUeCphySapUser*> m_cphySapUser; ///< UE CPhy SAP user 762 std::vector<LteUeCphySapProvider*> m_cphySapProvider; ///< UE CPhy SAP provider 763 764 std::vector<LteUeCmacSapUser*> m_cmacSapUser; ///< UE CMac SAP user 765 std::vector<LteUeCmacSapProvider*> m_cmacSapProvider; ///< UE CMac SAP provider 766 767 LteUeRrcSapUser* m_rrcSapUser; ///< RRC SAP user 768 LteUeRrcSapProvider* m_rrcSapProvider; ///< RRC SAP provider 769 770 LteMacSapProvider* m_macSapProvider; ///< MAC SAP provider 771 LtePdcpSapUser* m_drbPdcpSapUser; ///< DRB PDCP SAP user 772 773 LteAsSapProvider* m_asSapProvider; ///< AS SAP provider 774 LteAsSapUser* m_asSapUser; ///< AS SAP user 775 776 // Receive API calls from the LteUeComponentCarrierManager instance. 777 // LteCcmRrcSapUser* m_ccmRrcSapUser; 778 /// Interface to the LteUeComponentCarrierManage instance. 779 LteUeCcmRrcSapProvider* m_ccmRrcSapProvider; ///< CCM RRC SAP provider 780 LteUeCcmRrcSapUser* m_ccmRrcSapUser; ///< CCM RRC SAP user 781 782 /// The current UE RRC state. 783 State m_state; 784 785 /// The unique UE identifier. 786 uint64_t m_imsi; 787 /** 788 * The `C-RNTI` attribute. Cell Radio Network Temporary Identifier. 789 */ 790 uint16_t m_rnti; 791 /** 792 * The `CellId` attribute. Serving cell identifier. 793 */ 794 uint16_t m_cellId; 795 796 /** 797 * The `Srb0` attribute. SignalingRadioBearerInfo for SRB0. 798 */ 799 Ptr<LteSignalingRadioBearerInfo> m_srb0; 800 /** 801 * The `Srb1` attribute. SignalingRadioBearerInfo for SRB1. 802 */ 803 Ptr<LteSignalingRadioBearerInfo> m_srb1; 804 /** 805 * SRB1 configuration before RRC connection reconfiguration. To be deleted 806 * soon by DisposeOldSrb1(). 807 */ 808 Ptr<LteSignalingRadioBearerInfo> m_srb1Old; 809 /** 810 * The `DataRadioBearerMap` attribute. List of UE RadioBearerInfo for Data 811 * Radio Bearers by LCID. 812 */ 813 std::map <uint8_t, Ptr<LteDataRadioBearerInfo> > m_drbMap; 814 815 /** 816 * True if RLC SM is to be used, false if RLC UM/AM are to be used. 817 * Can be modified using SetUseRlcSm(). 818 */ 819 bool m_useRlcSm; 820 821 uint8_t m_lastRrcTransactionIdentifier; ///< last RRC transaction identifier 822 823 LteRrcSap::PdschConfigDedicated m_pdschConfigDedicated; ///< the PDSCH condig dedicated 824 825 uint16_t m_dlBandwidth; /**< Downlink bandwidth in RBs. */ 826 uint16_t m_ulBandwidth; /**< Uplink bandwidth in RBs. */ 827 828 uint32_t m_dlEarfcn; /**< Downlink carrier frequency. */ 829 uint32_t m_ulEarfcn; /**< Uplink carrier frequency. */ 830 std::list<LteRrcSap::SCellToAddMod> m_sCellToAddModList; /**< Secondary carriers. */ 831 832 /** 833 * The `MibReceived` trace source. Fired upon reception of Master Information 834 * Block. Exporting IMSI, the serving cell ID, RNTI, and the source cell ID. 835 */ 836 TracedCallback<uint64_t, uint16_t, uint16_t, uint16_t> m_mibReceivedTrace; 837 /** 838 * The `Sib1Received` trace source. Fired upon reception of System 839 * Information Block Type 1. Exporting IMSI, the serving cell ID, RNTI, and 840 * the source cell ID. 841 */ 842 TracedCallback<uint64_t, uint16_t, uint16_t, uint16_t> m_sib1ReceivedTrace; 843 /** 844 * The `Sib2Received` trace source. Fired upon reception of System 845 * Information Block Type 2. Exporting IMSI, the serving cell ID, RNTI. 846 */ 847 TracedCallback<uint64_t, uint16_t, uint16_t> m_sib2ReceivedTrace; 848 /** 849 * The `StateTransition` trace source. Fired upon every UE RRC state 850 * transition. Exporting IMSI, the serving cell ID, RNTI, old state, and new 851 * state. 852 */ 853 TracedCallback<uint64_t, uint16_t, uint16_t, State, State> m_stateTransitionTrace; 854 /** 855 * The `InitialCellSelectionEndOk` trace source. Fired upon successful 856 * initial cell selection procedure. Exporting IMSI and the selected cell ID. 857 */ 858 TracedCallback<uint64_t, uint16_t> m_initialCellSelectionEndOkTrace; 859 /** 860 * The `InitialCellSelectionEndError` trace source. Fired upon failed initial 861 * cell selection procedure. Exporting IMSI and the cell ID under evaluation. 862 */ 863 TracedCallback<uint64_t, uint16_t> m_initialCellSelectionEndErrorTrace; 864 /** 865 * The `RandomAccessSuccessful` trace source. Fired upon successful 866 * completion of the random access procedure. Exporting IMSI, cell ID, and 867 * RNTI. 868 */ 869 TracedCallback<uint64_t, uint16_t, uint16_t> m_randomAccessSuccessfulTrace; 870 /** 871 * The `RandomAccessError` trace source. Fired upon failure of the random 872 * access procedure. Exporting IMSI, cell ID, and RNTI. 873 */ 874 TracedCallback<uint64_t, uint16_t, uint16_t> m_randomAccessErrorTrace; 875 /** 876 * The `ConnectionEstablished` trace source. Fired upon successful RRC 877 * connection establishment. Exporting IMSI, cell ID, and RNTI. 878 */ 879 TracedCallback<uint64_t, uint16_t, uint16_t> m_connectionEstablishedTrace; 880 /** 881 * The `ConnectionTimeout` trace source. Fired upon timeout RRC connection 882 * establishment because of T300. Exporting IMSI, cell ID, and RNTI. 883 */ 884 TracedCallback<uint64_t, uint16_t, uint16_t, uint8_t> m_connectionTimeoutTrace; 885 /** 886 * The `ConnectionReconfiguration` trace source. Fired upon RRC connection 887 * reconfiguration. Exporting IMSI, cell ID, and RNTI. 888 */ 889 TracedCallback<uint64_t, uint16_t, uint16_t> m_connectionReconfigurationTrace; 890 /** 891 * The `HandoverStart` trace source. Fired upon start of a handover 892 * procedure. Exporting IMSI, source cell ID, RNTI, and target cell ID. 893 */ 894 TracedCallback<uint64_t, uint16_t, uint16_t, uint16_t> m_handoverStartTrace; 895 /** 896 * The `HandoverEndOk` trace source. Fired upon successful termination of a 897 * handover procedure. Exporting IMSI, cell ID, and RNTI. 898 */ 899 TracedCallback<uint64_t, uint16_t, uint16_t> m_handoverEndOkTrace; 900 /** 901 * The `HandoverEndError` trace source. Fired upon failure of a handover 902 * procedure. Exporting IMSI, cell ID, and RNTI. 903 */ 904 TracedCallback<uint64_t, uint16_t, uint16_t> m_handoverEndErrorTrace; 905 /** 906 * The `SCarrierConfigured` trace source. Fired after the configuration 907 * of secondary carriers received through RRC Connection Reconfiguration 908 * message. 909 */ 910 TracedCallback<Ptr<LteUeRrc>, std::list<LteRrcSap::SCellToAddMod> > m_sCarrierConfiguredTrace; 911 /** 912 * The `Srb1Created` trace source. Fired when SRB1 is created, i.e. 913 * the RLC and PDCP entities are created for logical channel = 1. 914 * Exporting IMSI, cell ID, and RNTI 915 */ 916 TracedCallback<uint64_t, uint16_t, uint16_t> m_srb1CreatedTrace; 917 /** 918 * The `DrbCreated` trace source. Fired when DRB is created, i.e. 919 * the RLC and PDCP entities are created for one logical channel. 920 * Exporting IMSI, cell ID, RNTI, LCID. 921 */ 922 TracedCallback<uint64_t, uint16_t, uint16_t, uint8_t> m_drbCreatedTrace; 923 /** 924 * The 'PhySyncDetection' trace source. Fired when UE RRC 925 * receives in-sync or out-of-sync indications from UE PHY 926 * 927 */ 928 TracedCallback<uint64_t, uint16_t, uint16_t, std::string, uint8_t> m_phySyncDetectionTrace; 929 /** 930 * The 'RadioLinkFailure' trace source. Fired when T310 timer expires. 931 * 932 */ 933 TracedCallback<uint64_t, uint16_t, uint16_t> m_radioLinkFailureTrace; 934 935 /// True if a connection request by upper layers is pending. 936 bool m_connectionPending; 937 /// True if MIB was received for the current cell. 938 bool m_hasReceivedMib; 939 /// True if SIB1 was received for the current cell. 940 bool m_hasReceivedSib1; 941 /// True if SIB2 was received for the current cell. 942 bool m_hasReceivedSib2; 943 944 /// Stored content of the last SIB1 received. 945 LteRrcSap::SystemInformationBlockType1 m_lastSib1; 946 947 /// List of cell ID of acceptable cells for cell selection that have been detected. 948 std::set<uint16_t> m_acceptableCell; 949 950 /// List of CSG ID which this UE entity has access to. 951 uint32_t m_csgWhiteList; 952 953 954 // INTERNAL DATA STRUCTURE RELATED TO UE MEASUREMENTS 955 956 /** 957 * \brief Includes the accumulated configuration of the measurements to be 958 * performed by the UE. 959 * 960 * Based on 3GPP TS 36.331 section 7.1. Also note that some optional variables 961 * in the specification are omitted. 962 */ 963 struct VarMeasConfig 964 { 965 std::map<uint8_t, LteRrcSap::MeasIdToAddMod> measIdList; ///< measure ID list 966 std::map<uint8_t, LteRrcSap::MeasObjectToAddMod> measObjectList; ///< measure object list 967 std::map<uint8_t, LteRrcSap::ReportConfigToAddMod> reportConfigList; ///< report config list 968 LteRrcSap::QuantityConfig quantityConfig; ///< quantity config 969 double aRsrp; ///< RSRP 970 double aRsrq; ///< RSRQ 971 }; 972 973 /** 974 * \brief Includes the accumulated configuration of the measurements to be 975 * performed by the UE. 976 * 977 * Based on 3GPP TS 36.331 section 7.1. 978 */ 979 VarMeasConfig m_varMeasConfig; 980 981 /** 982 * \brief Represents a single measurement reporting entry., which includes 983 * information about a measurement for which the triggering conditions 984 * have been met. 985 * 986 * Based on 3GPP TS 36.331 section 7.1. 987 */ 988 struct VarMeasReport 989 { 990 uint8_t measId; ///< measure ID 991 std::set<uint16_t> cellsTriggeredList; ///< note: only E-UTRA is supported. 992 uint32_t numberOfReportsSent; ///< number of reports sent 993 EventId periodicReportTimer; ///< periodic report timer 994 }; 995 996 /** 997 * \brief The list of active reporting entries, indexed by the measurement 998 * identity which triggered the reporting. Includes information about 999 * measurements for which the triggering conditions have been met. 1000 */ 1001 std::map<uint8_t, VarMeasReport> m_varMeasReportList; 1002 1003 /** 1004 * \brief List of cell IDs which are responsible for a certain trigger. 1005 */ 1006 typedef std::list<uint16_t> ConcernedCells_t; 1007 1008 /** 1009 * \brief Compose a new reporting entry of the given measurement identity, 1010 * insert it into #m_varMeasReportList, and set it up for submission 1011 * to eNodeB. 1012 * \param measId the measurement identity which the new reporting entry will 1013 * be based upon 1014 * \param enteringCells the cells which are responsible for triggering the 1015 * reporting (i.e., successfully fulfilling the entering 1016 * condition of the measurement identity) and will be 1017 * included in the measurement report. 1018 * 1019 * \note If an existing reporting entry with the same measurement identity has 1020 * already existed in #m_varMeasReportList, the function will update it 1021 * by adding the entering cells into the existing reporting entry. 1022 * \note When time-to-trigger is enabled for this measurement identity, the 1023 * function will also remove the related trigger from the 1024 * #m_enteringTriggerQueue. 1025 */ 1026 void VarMeasReportListAdd (uint8_t measId, ConcernedCells_t enteringCells); 1027 1028 /** 1029 * \brief Remove some cells from an existing reporting entry in 1030 * #m_varMeasReportList. 1031 * \param measId the measurement identity to be removed from 1032 * #m_varMeasReportList, must already exists there, otherwise 1033 * an error would be raised 1034 * \param leavingCells the cells which are about to be removed 1035 * \param reportOnLeave when true, will make the function send one last 1036 * measurement report to eNodeB before removing it 1037 * 1038 * \note If a given cell is not found in the reporting entry, the function 1039 * will quietly continue. 1040 * \note If the removal has removed all the cells in the reporting entry, the 1041 * function will remove the reporting entry as well. 1042 * \note When time-to-trigger is enabled for this measurement identity, the 1043 * function will also remove the related trigger from the 1044 * #m_leavingTriggerQueue. 1045 */ 1046 void VarMeasReportListErase (uint8_t measId, ConcernedCells_t leavingCells, 1047 bool reportOnLeave); 1048 1049 /** 1050 * \brief Remove the reporting entry of the given measurement identity from 1051 * #m_varMeasReportList. 1052 * \param measId the measurement identity to be removed from 1053 * #m_varMeasReportList, must already exists there, otherwise 1054 * an error would be raised 1055 * 1056 * Any events or triggers related with this measurement identity will be 1057 * canceled as well. 1058 */ 1059 void VarMeasReportListClear (uint8_t measId); 1060 1061 /** 1062 * \brief Represents a measurement result from a certain cell. 1063 */ 1064 struct MeasValues 1065 { 1066 double rsrp; ///< Measured RSRP in dBm. 1067 double rsrq; ///< Measured RSRQ in dB. 1068 Time timestamp; ///< Not used. \todo Should be removed. 1069 }; 1070 1071 /** 1072 * \brief Internal storage of the latest measurement results from all detected 1073 * detected cells, indexed by the cell ID where the measurement was 1074 * taken from. 1075 * 1076 * Each *measurement result* comprises of RSRP (in dBm) and RSRQ (in dB). 1077 * 1078 * In IDLE mode, the measurement results are used by the *initial cell 1079 * selection* procedure. While in CONNECTED mode, *layer-3 filtering* is 1080 * applied to the measurement results and they are used by *UE measurements* 1081 * function (LteUeRrc::MeasurementReportTriggering and 1082 * LteUeRrc::SendMeasurementReport). 1083 */ 1084 std::map<uint16_t, MeasValues> m_storedMeasValues; 1085 1086 /** 1087 * \brief Stored measure values per carrier. 1088 */ 1089 std::map<uint16_t, std::map <uint8_t, MeasValues> > m_storedMeasValuesPerCarrier; 1090 1091 /** 1092 * \brief Internal storage of the latest measurement results from all detected 1093 * detected Secondary carrier component, indexed by the carrier component ID 1094 * where the measurement was taken from. 1095 * 1096 * Each *measurement result* comprises of RSRP (in dBm) and RSRQ (in dB). 1097 * 1098 * In IDLE mode, the measurement results are used by the *initial cell 1099 * selection* procedure. While in CONNECTED mode, *layer-3 filtering* is 1100 * applied to the measurement results and they are used by *UE measurements* 1101 * function: 1102 * - LteUeRrc::MeasurementReportTriggering: in this case it is not set any 1103 * measurement related to secondary carrier components since the 1104 * A6 event is not implemented 1105 * - LteUeRrc::SendMeasurementReport: in this case the report are sent. 1106 */ 1107 std::map<uint16_t, MeasValues> m_storedScellMeasValues; 1108 1109 /** 1110 * \brief Represents a single triggered event from a measurement identity 1111 * which reporting criteria have been fulfilled, but delayed by 1112 * time-to-trigger. 1113 */ 1114 struct PendingTrigger_t 1115 { 1116 uint8_t measId; ///< The measurement identity which raised the trigger. 1117 ConcernedCells_t concernedCells; ///< The list of cells responsible for this trigger. 1118 EventId timer; ///< The pending reporting event, scheduled at the end of the time-to-trigger. 1119 }; 1120 1121 /** 1122 * \brief List of triggers that were raised because entering condition have 1123 * been true, but are still delayed from reporting it by 1124 * time-to-trigger. 1125 * 1126 * The list is indexed by the measurement identity where the trigger 1127 * originates from. The enclosed event will run at the end of the 1128 * time-to-trigger and insert a *reporting entry* to #m_varMeasReportList. 1129 */ 1130 std::map<uint8_t, std::list<PendingTrigger_t> > m_enteringTriggerQueue; 1131 1132 /** 1133 * \brief List of triggers that were raised because leaving condition have 1134 * been true, but are still delayed from stopping the reporting by 1135 * time-to-trigger. 1136 * 1137 * The list is indexed by the measurement identity where the trigger 1138 * originates from. The enclosed event will run at the end of the 1139 * time-to-trigger and remove the associated *reporting entry* from 1140 * #m_varMeasReportList. 1141 */ 1142 std::map<uint8_t, std::list<PendingTrigger_t> > m_leavingTriggerQueue; 1143 1144 /** 1145 * \brief Clear all the waiting triggers in #m_enteringTriggerQueue which are 1146 * associated with the given measurement identity. 1147 * \param measId the measurement identity to be processed, must already exists 1148 * in #m_enteringTriggerQueue, otherwise an error would be 1149 * raised 1150 * 1151 * \note The function may conclude that there is nothing to be removed. In 1152 * this case, the function will simply ignore quietly. 1153 * 1154 * This function is used when the entering condition of the measurement 1155 * identity becomes no longer true. Therefore all the waiting triggers for 1156 * this measurement identity in #m_enteringTriggerQueue have become invalid 1157 * and must be canceled. 1158 * 1159 * \sa LteUeRrc::m_enteringTriggerQueue 1160 */ 1161 void CancelEnteringTrigger (uint8_t measId); 1162 1163 /** 1164 * \brief Remove a specific cell from the waiting triggers in 1165 * #m_enteringTriggerQueue which belong to the given measurement 1166 * identity. 1167 * \param measId the measurement identity to be processed, must already exists 1168 * in #m_enteringTriggerQueue, otherwise an error would be 1169 * raised 1170 * \param cellId the cell ID to be removed from the waiting triggers 1171 * 1172 * \note The function may conclude that there is nothing to be removed. In 1173 * this case, the function will simply ignore quietly. 1174 * 1175 * This function is used when a specific neighbour cell no longer fulfills 1176 * the entering condition of the measurement identity. Thus the cell must be 1177 * removed from all the waiting triggers for this measurement identity in 1178 * #m_enteringTriggerQueue. 1179 * 1180 * \sa LteUeRrc::m_enteringTriggerQueue 1181 */ 1182 void CancelEnteringTrigger (uint8_t measId, uint16_t cellId); 1183 1184 /** 1185 * \brief Clear all the waiting triggers in #m_leavingTriggerQueue which are 1186 * associated with the given measurement identity. 1187 * \param measId the measurement identity to be processed, must already exists 1188 * in #m_leavingTriggerQueue, otherwise an error would be 1189 * raised 1190 * 1191 * \note The function may conclude that there is nothing to be removed. In 1192 * this case, the function will simply ignore quietly. 1193 * 1194 * This function is used when the leaving condition of the measurement 1195 * identity becomes no longer true. Therefore all the waiting triggers for 1196 * this measurement identity in #m_leavingTriggerQueue have become invalid 1197 * and must be canceled. 1198 * 1199 * \sa LteUeRrc::m_leavingTriggerQueue 1200 */ 1201 void CancelLeavingTrigger (uint8_t measId); 1202 1203 /** 1204 * \brief Remove a specific cell from the waiting triggers in 1205 * #m_leavingTriggerQueue which belong to the given measurement 1206 * identity. 1207 * \param measId the measurement identity to be processed, must already exists 1208 * in #m_leavingTriggerQueue, otherwise an error would be 1209 * raised 1210 * \param cellId the cell ID to be removed from the waiting triggers 1211 * 1212 * \note The function may conclude that there is nothing to be removed. In 1213 * this case, the function will simply ignore quietly. 1214 * 1215 * This function is used when a specific neighbour cell no longer fulfills 1216 * the leaving condition of the measurement identity. Thus the cell must be 1217 * removed from all the waiting triggers for this measurement identity in 1218 * #m_leavingTriggerQueue. 1219 * 1220 * \sa LteUeRrc::m_leavingTriggerQueue 1221 */ 1222 void CancelLeavingTrigger (uint8_t measId, uint16_t cellId); 1223 1224 /** 1225 * The `T300` attribute. Timer for RRC connection establishment procedure 1226 * (i.e., the procedure is deemed as failed if it takes longer than this). 1227 * See Section 7.3 of 3GPP TS 36.331. 1228 */ 1229 Time m_t300; 1230 1231 /** 1232 * \brief Invokes ConnectionEstablishmentTimeout() if RRC connection 1233 * establishment procedure for this UE takes longer than T300. 1234 */ 1235 EventId m_connectionTimeout; 1236 1237 /** 1238 * \brief Invoked after timer T300 expires, notifying upper layers that RRC 1239 * connection establishment procedure has failed. 1240 */ 1241 void ConnectionTimeout (); 1242 1243 /** 1244 * The 'T310' attribute. After detecting N310 out-of-sync indications, 1245 * if number of in-sync indications detected is less than N311 before this 1246 * time, then the radio link is considered to have failed and the UE 1247 * transitions to state CONNECTED_PHY_PROMLEM and eventually IDLE_START 1248 * and UE context at eNodeB is destroyed. RRC connection re-establishment 1249 * is not initiated after this time. See 3GPP TS 36.331 7.3. 1250 */ 1251 Time m_t310; 1252 1253 /** 1254 * The 'N310' attribute. This specifies the maximum 1255 * consecutive out-of-sync indications from lower layers. 1256 */ 1257 uint8_t m_n310; 1258 1259 /** 1260 * The 'N311' attribute. This specifies the minimum 1261 * consecutive in-sync indications from lower layers. 1262 */ 1263 uint8_t m_n311; 1264 1265 /** 1266 * Time limit (given by m_t310) before the radio link is considered to have failed. 1267 * It is set upon detecting physical layer problems i.e. upon receiving 1268 * N310 consecutive out-of-sync indications from lower layers. Calling 1269 * LteUeRrc::RadioLinkFailureDetected() when it expires. 1270 * It is cancelled upon receiving N311 consecutive in-sync indications. Upon 1271 * expiry, the UE transitions to RRC_IDLE and no RRC connection 1272 * re-establishment is initiated. 1273 */ 1274 EventId m_radioLinkFailureDetected; 1275 1276 uint8_t m_noOfSyncIndications; ///< number of in-sync or out-of-sync indications coming from PHY layer 1277 1278 bool m_leaveConnectedMode; ///< true if UE NAS ask UE RRC to leave connected mode, e.g., after RLF, i.e. T310 has expired 1279 1280 uint16_t m_previousCellId; ///< the cell id of the previous cell UE was attached to 1281 1282 uint8_t m_connEstFailCountLimit; ///< the counter value for T300 timer expiration received from the eNB 1283 1284 uint8_t m_connEstFailCount; ///< the counter to count T300 timer expiration 1285 /** 1286 * \brief Radio link failure detected function 1287 * 1288 * Upon detection of radio link failure, the UE is reverted 1289 * back to idle state and the UE context at eNodeB and EPC 1290 * is deleted, thus releasing the RRC connection. The eNodeB is notified 1291 * in an ideal way since there is no radio link failure detection 1292 * implemented at the eNodeB. If the deletion process is not synchronous, 1293 * then errors occur due to triggering of assert messages. 1294 */ 1295 void RadioLinkFailureDetected (); 1296 1297 /** 1298 * \brief Do notify in sync function 1299 * 1300 * Triggered upon receiving an in sync indication from UE PHY. 1301 * When the count equals N311, then T310 is cancelled. 1302 */ 1303 void DoNotifyInSync (); 1304 1305 /** 1306 * \brief Do notify out of sync function 1307 * 1308 * Triggered upon receiving an out of sync indication from UE PHY. 1309 * When the count equals N310, then T310 is started. 1310 */ 1311 void DoNotifyOutOfSync (); 1312 1313 /** 1314 * \brief Do reset sync indication counter function 1315 * 1316 * Reset the sync indication counter 1317 * if the Qin or Qout condition at PHY 1318 * is not fulfilled for the number of 1319 * consecutive frames. 1320 */ 1321 void DoResetSyncIndicationCounter (); 1322 1323 /** 1324 * \brief Reset radio link failure parameters 1325 * 1326 * RLF timers and counters should be rest upon: 1327 * 1328 * - If the UE received N311 in Sync indications from the UE 1329 * PHY. 1330 * - If the UE receives RRCConnectionReconfiguration including 1331 * the mobilityControlInfo (TS 36.331 sec 5.3.5.4) 1332 * 1333 * Inside this method the UE RRC also instructs the UE PHY to reset the 1334 * RLF parameters so, it can start RLF detection again. 1335 * 1336 */ 1337 void ResetRlfParams (); 1338 1339 public: 1340 /** 1341 * The number of component carriers. 1342 */ 1343 uint16_t m_numberOfComponentCarriers; 1344 1345 }; // end of class LteUeRrc 1346 1347 1348 } // namespace ns3 1349 1350 #endif // LTE_UE_RRC_H 1351