mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-trx.git
synced 2025-11-03 21:53:18 +00:00
Compare commits
1 Commits
osmith/wip
...
tnt/ci
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d40f11962a |
@@ -1455,6 +1455,28 @@ static signalVector *downsampleBurst(const signalVector &burst)
|
|||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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
|
* Detect a burst based on correlation and peak-to-average ratio
|
||||||
*
|
*
|
||||||
@@ -1470,6 +1492,7 @@ static int detectBurst(const signalVector &burst,
|
|||||||
{
|
{
|
||||||
const signalVector *corr_in;
|
const signalVector *corr_in;
|
||||||
signalVector *dec = NULL;
|
signalVector *dec = NULL;
|
||||||
|
complex xcorr;
|
||||||
|
|
||||||
if (sps == 4) {
|
if (sps == 4) {
|
||||||
dec = downsampleBurst(burst);
|
dec = downsampleBurst(burst);
|
||||||
@@ -1501,11 +1524,14 @@ static int detectBurst(const signalVector &burst,
|
|||||||
if (computePeakRatio(&corr, sps, *toa, *amp) < thresh)
|
if (computePeakRatio(&corr, sps, *toa, *amp) < thresh)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Compute peak-to-average ratio. Reject if we don't have enough values */
|
/* Refine TOA and correlation value */
|
||||||
*amp = peakDetect(corr, toa, NULL);
|
xcorr = peakDetect(corr, toa, NULL);
|
||||||
|
|
||||||
|
/* Compute C/I */
|
||||||
|
float CI = computeCI(corr_in, sync, *toa, start, xcorr);
|
||||||
|
|
||||||
/* Normalize our channel gain */
|
/* Normalize our channel gain */
|
||||||
*amp = *amp / sync->gain;
|
*amp = xcorr / sync->gain;
|
||||||
|
|
||||||
/* Compensate for residuate time lag */
|
/* Compensate for residuate time lag */
|
||||||
*toa = *toa - sync->toa;
|
*toa = *toa - sync->toa;
|
||||||
|
|||||||
Reference in New Issue
Block a user