aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2017-03-15 23:23:36 +0300
committerAlexander Chemeris <Alexander.Chemeris@gmail.com>2017-03-22 18:09:00 +0000
commit1dd05cf35a8c5e3c2acfbc4e23e26d41ea4a9aa9 (patch)
tree9efd28ce2955b6cd045b3156d573d2c6c6784c66 /Transceiver52M
parent14d13b67dcd4fa35b03cbbef0c5ddd2622b89155 (diff)
sigProcLib: make energyDetect() simpler by returning actual energy.
Diffstat (limited to 'Transceiver52M')
-rw-r--r--Transceiver52M/Transceiver.cpp4
-rw-r--r--Transceiver52M/sigProcLib.cpp8
-rw-r--r--Transceiver52M/sigProcLib.h14
3 files changed, 9 insertions, 17 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index f156ad4..3df482f 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -606,7 +606,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, double &RSSI, bool &i
{
int rc;
complex amp;
- float toa, pow, max = -1.0, avg = 0.0;
+ float toa, max = -1.0, avg = 0.0;
int max_i = -1;
signalVector *burst;
SoftVector *bits = NULL;
@@ -641,7 +641,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, double &RSSI, bool &i
/* Select the diversity channel with highest energy */
for (size_t i = 0; i < radio_burst->chans(); i++) {
- energyDetect(*radio_burst->getVector(i), 20 * mSPSRx, 0.0, &pow);
+ float pow = energyDetect(*radio_burst->getVector(i), 20 * mSPSRx);
if (pow > max) {
max = pow;
max_i = i;
diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index c1cf12e..41b18cf 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -1721,10 +1721,7 @@ static float computePeakRatio(signalVector *corr,
return (amp.abs()) / rms;
}
-bool energyDetect(signalVector &rxBurst,
- unsigned windowLength,
- float detectThreshold,
- float *avgPwr)
+float energyDetect(signalVector &rxBurst, unsigned windowLength)
{
signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2;
@@ -1735,8 +1732,7 @@ bool energyDetect(signalVector &rxBurst,
energy += windowItr->norm2();
windowItr+=4;
}
- if (avgPwr) *avgPwr = energy/windowLength;
- return (energy/windowLength > detectThreshold*detectThreshold);
+ return energy/windowLength;
}
/*
diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h
index 1b646cd..87c0229 100644
--- a/Transceiver52M/sigProcLib.h
+++ b/Transceiver52M/sigProcLib.h
@@ -176,17 +176,13 @@ void scaleVector(signalVector &x,
complex scale);
/**
- Energy detector, checks to see if received burst energy is above a threshold.
- @param rxBurst The received GSM burst of interest.
+ Rough energy estimator.
+ @param rxBurst A GSM burst.
@param windowLength The number of burst samples used to compute burst energy
- @param detectThreshold The detection threshold, a linear value.
- @param avgPwr The average power of the received burst.
- @return True if burst energy is above threshold.
+ @return The average power of the received burst.
*/
-bool energyDetect(signalVector &rxBurst,
- unsigned windowLength,
- float detectThreshold,
- float *avgPwr = NULL);
+float energyDetect(signalVector &rxBurst,
+ unsigned windowLength);
/**
RACH aka Access Burst correlator/detector.