Skip to content

Commit d620a1e

Browse files
committed
RealisticChannelModel: rename variables for clarity
1 parent 6360a42 commit d620a1e

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

src/simu5g/stack/phy/channelmodel/LteRealisticChannelModel.cc

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,11 +1733,11 @@ bool LteRealisticChannelModel::isReceptionSuccessful(LteAirFrame *frame, UserCon
17331733
else
17341734
id = lteInfo->getSourceId();
17351735

1736-
// Get Number of RTX
1737-
unsigned char nTx = lteInfo->getTxNumber();
1736+
// Get Number of transmission attempts (includes original + retransmissions)
1737+
unsigned char transmissionAttempt = lteInfo->getTxNumber();
17381738

17391739
// consistency check
1740-
if (nTx == 0)
1740+
if (transmissionAttempt == 0)
17411741
throw cRuntimeError("Transmissions counter should not be 0");
17421742

17431743
// Get txmode
@@ -1761,9 +1761,8 @@ bool LteRealisticChannelModel::isReceptionSuccessful(LteAirFrame *frame, UserCon
17611761
// Get txmode
17621762
unsigned int itxmode = txModeToIndex[txmode];
17631763

1764-
double bler = 0;
1765-
std::vector<double> totalbler;
1766-
double finalSuccess = 1;
1764+
double blockErrorRate = 0.0;
1765+
double cumulativeSuccessProbability = 1.0;
17671766

17681767
// for statistical purposes
17691768
double sumSnr = 0.0;
@@ -1779,7 +1778,7 @@ bool LteRealisticChannelModel::isReceptionSuccessful(LteAirFrame *frame, UserCon
17791778

17801779
// Get the Bler
17811780
if (cqi == 0 || cqi > 15)
1782-
throw cRuntimeError("A packet has been transmitted with a cqi equal to 0 or greater than 15 cqi:%d txmode:%d dir:%d rb:%d cw:%d rtx:%d", cqi, lteInfo->getTxMode(), dir, band, cw, nTx);
1781+
throw cRuntimeError("A packet has been transmitted with a cqi equal to 0 or greater than 15 cqi:%d txmode:%d dir:%d rb:%d cw:%d rtx:%d", cqi, lteInfo->getTxMode(), dir, band, cw, transmissionAttempt);
17831782

17841783
// for statistical purposes
17851784
sumSnr += snrV[band];
@@ -1789,37 +1788,37 @@ bool LteRealisticChannelModel::isReceptionSuccessful(LteAirFrame *frame, UserCon
17891788
if (snr < binder_->phyPisaData.minSnr())
17901789
return false;
17911790
else if (snr > binder_->phyPisaData.maxSnr())
1792-
bler = 0;
1791+
blockErrorRate = 0.0;
17931792
else
1794-
bler = binder_->phyPisaData.getBler(itxmode, cqi - 1, snr);
1793+
blockErrorRate = binder_->phyPisaData.getBler(itxmode, cqi - 1, snr);
17951794

17961795
EV << "\t bler computation: [itxMode=" << itxmode << "] - [cqi-1=" << cqi - 1
17971796
<< "] - [snr=" << snr << "]" << endl;
17981797

1799-
double success = 1 - bler;
1798+
double blockSuccessRate = 1.0 - blockErrorRate;
18001799
// compute the success probability according to the number of RB used
1801-
double successPacket = pow(success, (double)allocation);
1800+
double allocationSuccessProbability = pow(blockSuccessRate, (double)allocation);
18021801
// compute the success probability according to the number of LB used
1803-
finalSuccess *= successPacket;
1802+
cumulativeSuccessProbability *= allocationSuccessProbability;
18041803

18051804
EV << " LteRealisticChannelModel::error direction " << dirToA(dir)
18061805
<< " node " << id << " remote unit " << dasToA(remoteUnit)
18071806
<< " Band " << band << " SNR " << snr << " CQI " << cqi
1808-
<< " BLER " << bler << " success probability " << successPacket
1809-
<< " total success probability " << finalSuccess << endl;
1807+
<< " BLER " << blockErrorRate << " success probability " << allocationSuccessProbability
1808+
<< " total success probability " << cumulativeSuccessProbability << endl;
18101809
}
18111810
}
18121811
// Compute total error probability
1813-
double per = 1 - finalSuccess;
1814-
// Harq Reduction
1815-
double totalPer = per * pow(harqReduction_, nTx - 1);
1812+
double packetErrorRate = 1.0 - cumulativeSuccessProbability;
1813+
// Apply HARQ soft combining gain
1814+
double effectiveErrorRateWithHarq = packetErrorRate * pow(harqReduction_, transmissionAttempt - 1);
18161815

1817-
double er = uniform(0.0, 1.0);
1816+
double randomSample = uniform(0.0, 1.0);
18181817

18191818
EV << " LteRealisticChannelModel::error direction " << dirToA(dir)
1820-
<< " node " << id << " total ERROR probability " << per
1821-
<< " per with H-ARQ error reduction " << totalPer
1822-
<< " - CQI[" << cqi << "]- random error extracted[" << er << "]" << endl;
1819+
<< " node " << id << " total ERROR probability " << packetErrorRate
1820+
<< " per with H-ARQ error reduction " << effectiveErrorRateWithHarq
1821+
<< " - CQI[" << cqi << "]- random error extracted[" << randomSample << "]" << endl;
18231822

18241823
// emit SINR statistic
18251824
if (collectSinrStatistics_ && usedRBs > 0) {
@@ -1833,15 +1832,16 @@ bool LteRealisticChannelModel::isReceptionSuccessful(LteAirFrame *frame, UserCon
18331832
}
18341833
}
18351834

1836-
if (er <= totalPer) {
1837-
EV << "This is NOT your lucky day (" << er << " < " << totalPer
1835+
bool receptionFailed = (randomSample <= effectiveErrorRateWithHarq);
1836+
if (receptionFailed) {
1837+
EV << "This is NOT your lucky day (" << randomSample << " < " << effectiveErrorRateWithHarq
18381838
<< ") -> do not receive." << endl;
18391839

18401840
// Signal too weak, we can't receive it
18411841
return false;
18421842
}
18431843
// Signal is strong enough, receive this Signal
1844-
EV << "This is your lucky day (" << er << " > " << totalPer
1844+
EV << "This is your lucky day (" << randomSample << " > " << effectiveErrorRateWithHarq
18451845
<< ") -> Receive AirFrame." << endl;
18461846

18471847
return true;

0 commit comments

Comments
 (0)