Fix rach_cfg.nof_groupA_preambles

This commit is contained in:
Xavier Arteaga 2021-04-19 13:09:57 +02:00 committed by Andre Puschmann
parent aadbe6d880
commit 77b6b60b82
2 changed files with 26 additions and 14 deletions

View File

@ -379,7 +379,9 @@ void set_mac_cfg_t_rach_cfg_common(mac_cfg_t* cfg, const asn1::rrc::rach_cfg_com
cfg->rach_cfg.messagePowerOffsetGroupB =
asn1_type.preamb_info.preambs_group_a_cfg.msg_pwr_offset_group_b.to_number();
} else {
cfg->rach_cfg.nof_groupA_preambles = 0;
// If the field is not signalled, the size of the random access preambles group A [6] is equal to
// numberOfRA-Preambles
cfg->rach_cfg.nof_groupA_preambles = cfg->rach_cfg.nof_preambles;
}
// Power ramping

View File

@ -111,10 +111,6 @@ void ra_proc::read_params()
maskIndex = 0; // same
}
if (rach_cfg.nof_groupA_preambles == 0) {
rach_cfg.nof_groupA_preambles = rach_cfg.nof_preambles;
}
phy_interface_mac_lte::prach_info_t prach_info = phy_h->prach_get_info();
delta_preamble_db = delta_preamble_db_table[prach_info.preamble_format % 5];
@ -231,31 +227,43 @@ void ra_proc::initialization()
void ra_proc::resource_selection()
{
ra_group_t sel_group;
uint32_t nof_groupB_preambles = rach_cfg.nof_preambles - rach_cfg.nof_groupA_preambles;
uint32_t nof_groupB_preambles = 0;
if (rach_cfg.nof_groupA_preambles > 0) {
nof_groupB_preambles = rach_cfg.nof_preambles - rach_cfg.nof_groupA_preambles;
}
// If ra-PreambleIndex (Random Access Preamble) and ra-PRACH-MaskIndex (PRACH Mask Index) have been
// explicitly signalled and ra-PreambleIndex is not 000000:
if (preambleIndex > 0) {
// Preamble is chosen by Higher layers (ie Network)
// the Random Access Preamble and the PRACH Mask Index are those explicitly signalled.
sel_maskIndex = maskIndex;
sel_preamble = (uint32_t)preambleIndex;
} else {
// Preamble is chosen by MAC UE
// else the Random Access Preamble shall be selected by the UE as follows:
if (!mux_unit->msg3_is_transmitted()) {
if (nof_groupB_preambles &&
// If Msg3 has not yet been transmitted, the UE shall:
// if Random Access Preambles group B exists and if the potential message size (data available for transmission
// plus MAC header and, where required, MAC control elements) is greater than messageSizeGroupA and if the
// pathloss is less than P CMAX preambleInitialReceivedTargetPower deltaPreambleMsg3
// messagePowerOffsetGroupB, then:
if (nof_groupB_preambles > 0 &&
new_ra_msg_len > rach_cfg.messageSizeGroupA) { // Check also pathloss (Pcmax,deltaPreamble and powerOffset)
// select the Random Access Preambles group B;
sel_group = RA_GROUP_B;
} else {
// else:
// select the Random Access Preambles group A.
sel_group = RA_GROUP_A;
}
last_msg3_group = sel_group;
} else {
// else, if Msg3 is being retransmitted, the UE shall:
// select the same group of Random Access Preambles as was used for the preamble transmission attempt
// corresponding to the first transmission of Msg3.
sel_group = last_msg3_group;
}
// randomly select a Random Access Preamble within the selected group. The random function shall be such
// that each of the allowed selections can be chosen with equal probability;
if (sel_group == RA_GROUP_A) {
if (rach_cfg.nof_groupA_preambles) {
if (rach_cfg.nof_groupA_preambles > 0) {
// randomly choose preamble from [0 nof_groupA_preambles)
sel_preamble = rand() % rach_cfg.nof_groupA_preambles;
} else {
@ -273,6 +281,8 @@ void ra_proc::resource_selection()
return;
}
}
// set PRACH Mask Index to 0.
sel_maskIndex = 0;
}