This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-trx/+/14674 ) Change subject: sigProcLib: Add C/I (Carrier-to-Interference ratio) computation ...................................................................... sigProcLib: Add C/I (Carrier-to-Interference ratio) computation Related: OS#4006 Change-Id: Ib4ceec553f2e5f77bf3f6777724968456a180f5e --- M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 2 files changed, 51 insertions(+), 13 deletions(-) Approvals: laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index c22009a..860bbe4 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -1454,6 +1454,33 @@ }; /* + * Computes C/I (Carrier-to-Interference ratio) in dB (deciBels). + * It is computed from the training sequence of each received burst, + * by comparing the "ideal" training sequence with the actual one. + */ +static float computeCI(const signalVector *burst, CorrelationSequence *sync, + float toa, int start, complex xcorr) +{ + float S, C; + int ps; + + /* Integer position where the sequence starts */ + ps = start + 1 - sync->sequence->size() + (int)roundf(toa); + + /* Estimate Signal power */ + S = 0.0f; + for (int i=0, j=ps; i<(int)sync->sequence->size(); i++,j++) + S += (*burst)[j].norm2(); + S /= sync->sequence->size(); + + /* Esimate Carrier power */ + C = xcorr.norm2() / ((sync->sequence->size() - 1) * sync->gain.abs()); + + /* Interference = Signal - Carrier, so C/I = C / (S - C) */ + return 3.0103f * log2f(C / (S - C)); +} + +/* * Detect a burst based on correlation and peak-to-average ratio * * For one sampler-per-symbol, perform fast peak detection (no interpolation) @@ -1468,6 +1495,8 @@ { const signalVector *corr_in; signalVector *dec = NULL; + complex xcorr; + int rc = 1; if (sps == 4) { dec = downsampleBurst(burst); @@ -1480,35 +1509,42 @@ /* Correlate */ if (!convolve(corr_in, sync->sequence, &corr, CUSTOM, start, len)) { - delete dec; - return -1; + rc = -1; + goto del_ret; } - delete dec; - /* Running at the downsampled rate at this point */ sps = 1; /* Peak detection - place restrictions at correlation edges */ ebp->amp = fastPeakDetect(corr, &ebp->toa); - if ((ebp->toa < 3 * sps) || (ebp->toa > len - 3 * sps)) - return 0; + if ((ebp->toa < 3 * sps) || (ebp->toa > len - 3 * sps)) { + rc = 0; + goto del_ret; + } - /* Peak -to-average ratio */ - if (computePeakRatio(&corr, sps, ebp->toa, ebp->amp) < thresh) - return 0; + /* Peak-to-average ratio */ + if (computePeakRatio(&corr, sps, ebp->toa, ebp->amp) < thresh) { + rc = 0; + goto del_ret; + } - /* Compute peak-to-average ratio. Reject if we don't have enough values */ - ebp->amp = peakDetect(corr, &ebp->toa, NULL); + /* Refine TOA and correlation value */ + xcorr = peakDetect(corr, &ebp->toa, NULL); + + /* Compute C/I */ + ebp->ci = computeCI(corr_in, sync, ebp->toa, start, xcorr); /* Normalize our channel gain */ - ebp->amp = ebp->amp / sync->gain; + ebp->amp = xcorr / sync->gain; /* Compensate for residuate time lag */ ebp->toa = ebp->toa - sync->toa; - return 1; +del_ret: + delete dec; + return rc; } static float maxAmplitude(const signalVector &burst) @@ -1563,6 +1599,7 @@ } else if (!rc) { ebp->amp = 0.0f; ebp->toa = 0.0f; + ebp->ci = 0.0f; return clipping?-SIGERR_CLIP:SIGERR_NONE; } diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 6d4ca9b..fd9a5f0 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -111,6 +111,7 @@ complex amp; float toa; uint8_t tsc; + float ci; }; /** 8-PSK/GMSK/RACH burst detector -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/14674 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Ib4ceec553f2e5f77bf3f6777724968456a180f5e Gerrit-Change-Number: 14674 Gerrit-PatchSet: 6 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <axilirator at gmail.com> Gerrit-Reviewer: laforge <laforge at gnumonks.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-Reviewer: tnt <tnt at 246tNt.com> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190719/d382f792/attachment.htm>