Section: 5.7.9.2 Initiation
Content: If the UE supports storage of mobility history information, the UE shall: 1> If the UE supports PSCell mobility history information and upon addition of a PSCell: 2> include an entry in visitedPSCellInfoList in variable VarMobilityHistoryReport possibly after performing the following, if necessary: 3> if visitedPSCellInfoListReport is available in the visitedCellInfoList in variable VarMobilityHistoryReport: 4> for the oldest PCell entry in visitedCellInfoList including visitedPSCellInfoListReport; 5> remove the oldest entry in the visitedPSCellInfoListReport; 3> else: 4> remove the oldest entry in visitedPSCellInfoList in variable VarMobilityHistoryReport; 2> for the included entry: 3> set the field timeSpent of the entry according to following: 4> if this is the first PSCell entry for the current PCell since entering the current PCell in RRC_CONNECTED: 5> include the entry as the time spent with no PSCell since entering the current PCell in RRC_CONNECTED; 4> else: 5> include the time spent with no PSCell since last PSCell release since entering the current PCell in RRC_CONNECTED; 1> If the UE supports PSCell mobility history information and upon change, or release of a PSCell while being connected to the current PCell: 2> include an entry in visitedPSCellInfoList of the variable VarMobilityHistoryReport possibly after performing the following, if necessary: 3> if visitedPSCellInfoListReport is available in the visitedCellInfoList in variable VarMobilityHistoryReport: 4> for the oldest PCell entry in visitedCellInfoList including visitedPSCellInfoListReport; 5> remove the oldest entry in the visitedPSCellInfoListReport; 3> else: 4> remove the oldest entry in visitedPSCellInfoList in variable VarMobilityHistoryReport; 2> for the included entry: 3> if the global cell identity of the previous PSCell is available: 4> include the global cell identity of that cell in the field visitedCellId of the entry; 3> else: 4> include the physical cell identity and carrier frequency of that cell in the field visitedCellId of the entry; 3> set the field timeSpent of the entry as the time spent in the previous PSCell while being connected to the current PCell; 1> Upon change of suitable cell, consisting of PCell in RRC_CONNECTED (for NR or E-UTRA cell) or serving cell in RRC_INACTIVE (for NR cell) or in RRC_IDLE (for NR or E-UTRA cell), to another NR or E-UTRA cell, or when entering any cell selection' state from 'camped normally' state in NR or LTE or when entering 'any cell selection' state from a suitable cell in RRC_CONNECTED state in NR or LTE: 2> include an entry in visitedCellInfoList of the variable VarMobilityHistoryReport possibly after removing the oldest entry, if necessary, according to following: 3> if the global cell identity of the previous PCell/serving cell is available: 4> include the global cell identity of that cell in the field visitedCellId of the entry; 3> else: 4> include the physical cell identity and carrier frequency of that cell in the field visitedCellId of the entry; 3> set the field timeSpent of the entry as the time spent in the previous PCell/serving cell; 3> if the UE supports PSCell mobility history information and if the UE continues to be connected to the same PSCell during the change of the PCell in RRC_CONNECTED; or 3> if the UE supports PSCell mobility history information and if the UE changes PSCell at the same time as the change of the PCell in RRC_CONNECTED; or 3> if the UE supports PSCell mobility history information and if the PSCell is released at the same time as the change of the PCell in RRC_CONNECTED: 4> include an entry in visitedPSCellInfoList of the variable VarMobilityHistoryReport possibly after performing the following, if necessary: 5> if visitedPSCellInfoListReport is available in the visitedCellInfoList in variable VarMobilityHistoryReport: 6> for the oldest PCell entry in visitedCellInfoList including visitedPSCellInfoListReport; 7> remove the oldest entry in the visitedPSCellInfoListReport; 5> else: 6> remove the oldest entry in visitedPSCellInfoList in variable VarMobilityHistoryReport; 4> for the included entry: 5> if the global cell identity of the PSCell (in case the UE continues to be connected to the same PSCell) or the previous PSCell (in case the UE changes PSCell, or in case PSCell is released) is available: 6> include the global cell identity of that cell in the field visitedCellId of the entry; 5> else: 6> include the physical cell identity and carrier frequency of that cell in the field visitedCellId of the entry; 5> set the field timeSpent of the entry as the time spent in the PSCell, while being connected to previous PCell; 3> if the UE supports PSCell mobility history information and if the UE was not configured with a PSCell at the time of change of PCell in RRC_CONNECTED: 4> include an entry in visitedPSCellInfoList after performing the following, if necessary; 5> if visitedPSCellInfoListReport is available in the visitedCellInfoList in variable VarMobilityHistoryReport: 6> for the oldest PCell entry in visitedCellInfoList including visitedPSCellInfoListReport; 7> remove the oldest entry in the visitedPSCellInfoListReport; 5> else: 6> remove the oldest entry in visitedPSCellInfoList in variable VarMobilityHistoryReport; 4> for the included entry: 5> set the field timeSpent of the entry as the time without PSCell according to the following: 6> if the UE experienced a PSCell release since entering the previous PCell in RRC_CONNECTED: 7> include the time spent with no PSCell since last PSCell release since entering the previous PCell in RRC_CONNECTED; 6> else: 7> include the time spent with no PSCell since entering the previous PCell in RRC_CONNECTED; 3> if the UE supports PSCell mobility history information and if visitedPSCellInfoList exists in VarMobilityHistoryReport: 4> include visitedPSCellInfoList in VarMobilityHistoryReport in the visitedPSCellInfoListReport within the entry of the visitedCellInfoList associated to the latest PCell entry; 4> remove visitedPSCellInfoList from the variable VarMobilityHistoryReport; 1> if the UE supports PSCell mobility history information and upon entering 'camped normally' state in NR (in RRC_IDLE or RRC_INACTIVE) or E-UTRA (in RRC_IDLE) while previously in RRC_CONNECTED state NR or LTE while not connected to a PSCell: 2> include an entry in visitedPSCellInfoList after performing the following, if necessary; 3> if visitedPSCellInfoListReport is available in the visitedCellInfoList in variable VarMobilityHistoryReport: 4> for the oldest PCell entry in visitedCellInfoList including visitedPSCellInfoListReport; 5> remove the oldest entry in the visitedPSCellInfoListReport; 3> else: 4> remove the oldest entry in visitedPSCellInfoList in variable VarMobilityHistoryReport; 2> for the included entry: 3> set the field timeSpent of the entry as the time without PSCell according to the following: 4> if the UE experienced a PSCell release since entering the current PCell in RRC_CONNECTED: 5> include the time spent with no PSCell since last PSCell release after entering the current PCell in RRC_CONNECTED; 4> else: 5> include the time spent with no PSCell since entering the current PCell in RRC_CONNECTED; 1> upon entering 'camped normally' state in NR (in RRC_IDLE or RRC_INACTIVE) or E-UTRA (in RRC_IDLE) while previously in 'any cell selection' state or 'camped on any cell' state in NR or LTE: 2> include an entry in variable VarMobilityHistoryReport possibly after removing the oldest entry, if necessary, according to following: 3> set the field timeSpent of the entry as the time spent in 'any cell selection' state and/or 'camped on any cell' state in NR or LTE.