Transceiver52M: Rename samples-per-symbol variable names
Because repeatedly typing mSamplesPerSymbol is giving me carpal tunnel syndrome. Replace with the much shorter, easier to type, and just as clear name of 'sps'. Signed-off-by: Thomas Tsou <tom@tsou.cc>
This commit is contained in:
parent
ddd6defb43
commit
d24cc2cd96
|
@ -50,7 +50,7 @@ using namespace GSM;
|
|||
|
||||
Transceiver::Transceiver(int wBasePort,
|
||||
const char *TRXAddress,
|
||||
int wSamplesPerSymbol,
|
||||
int wSPS,
|
||||
GSM::Time wTransmitLatency,
|
||||
RadioInterface *wRadioInterface)
|
||||
:mDataSocket(wBasePort+2,TRXAddress,wBasePort+102),
|
||||
|
@ -66,7 +66,7 @@ Transceiver::Transceiver(int wBasePort,
|
|||
mTransmitPriorityQueueServiceLoopThread = new Thread(32768);///< thread to process transmit bursts from GSM core
|
||||
|
||||
|
||||
mSamplesPerSymbol = wSamplesPerSymbol;
|
||||
mSPS = wSPS;
|
||||
mRadioInterface = wRadioInterface;
|
||||
mTransmitLatency = wTransmitLatency;
|
||||
mTransmitDeadlineClock = startTime;
|
||||
|
@ -76,9 +76,9 @@ Transceiver::Transceiver(int wBasePort,
|
|||
mMaxExpectedDelay = 0;
|
||||
|
||||
// generate pulse and setup up signal processing library
|
||||
gsmPulse = generateGSMPulse(2,mSamplesPerSymbol);
|
||||
gsmPulse = generateGSMPulse(2, mSPS);
|
||||
LOG(DEBUG) << "gsmPulse: " << *gsmPulse;
|
||||
sigProcLibSetup(mSamplesPerSymbol);
|
||||
sigProcLibSetup(mSPS);
|
||||
|
||||
txFullScale = mRadioInterface->fullScaleInputValue();
|
||||
rxFullScale = mRadioInterface->fullScaleOutputValue();
|
||||
|
@ -87,7 +87,7 @@ Transceiver::Transceiver(int wBasePort,
|
|||
for (int i = 0; i < 8; i++) {
|
||||
signalVector* modBurst = modulateBurst(gDummyBurst,*gsmPulse,
|
||||
8 + (i % 4 == 0),
|
||||
mSamplesPerSymbol);
|
||||
mSPS);
|
||||
scaleVector(*modBurst,txFullScale);
|
||||
fillerModulus[i]=26;
|
||||
for (int j = 0; j < 102; j++) {
|
||||
|
@ -124,7 +124,7 @@ void Transceiver::addRadioVector(BitVector &burst,
|
|||
// modulate and stick into queue
|
||||
signalVector* modBurst = modulateBurst(burst,*gsmPulse,
|
||||
8 + (wTime.TN() % 4 == 0),
|
||||
mSamplesPerSymbol);
|
||||
mSPS);
|
||||
scaleVector(*modBurst,txFullScale * pow(10,-RSSI/10));
|
||||
radioVector *newVec = new radioVector(*modBurst,wTime);
|
||||
mTransmitPriorityQueue.write(newVec);
|
||||
|
@ -137,7 +137,7 @@ void Transceiver::unModulateVector(signalVector wVector)
|
|||
{
|
||||
SoftVector *burst = demodulateBurst(wVector,
|
||||
*gsmPulse,
|
||||
mSamplesPerSymbol,
|
||||
mSPS,
|
||||
1.0,0.0);
|
||||
LOG(DEBUG) << "LOGGED BURST: " << *burst;
|
||||
|
||||
|
@ -322,7 +322,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime,
|
|||
complex amplitude = 0.0;
|
||||
float TOA = 0.0;
|
||||
float avgPwr = 0.0;
|
||||
if (!energyDetect(*vectorBurst,20*mSamplesPerSymbol,mEnergyThreshold,&avgPwr)) {
|
||||
if (!energyDetect(*vectorBurst, 20 * mSPS, mEnergyThreshold, &avgPwr)) {
|
||||
LOG(DEBUG) << "Estimated Energy: " << sqrt(avgPwr) << ", at time " << rxBurst->getTime();
|
||||
double framesElapsed = rxBurst->getTime()-prevFalseDetectionTime;
|
||||
if (framesElapsed > 50) { // if we haven't had any false detections for a while, lower threshold
|
||||
|
@ -358,7 +358,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime,
|
|||
success = analyzeTrafficBurst(*vectorBurst,
|
||||
mTSC,
|
||||
3.0,
|
||||
mSamplesPerSymbol,
|
||||
mSPS,
|
||||
&litude,
|
||||
&TOA,
|
||||
mMaxExpectedDelay,
|
||||
|
@ -393,7 +393,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime,
|
|||
// RACH burst
|
||||
success = detectRACHBurst(*vectorBurst,
|
||||
5.0, // detection threshold
|
||||
mSamplesPerSymbol,
|
||||
mSPS,
|
||||
&litude,
|
||||
&TOA);
|
||||
if (success) {
|
||||
|
@ -416,21 +416,21 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime,
|
|||
if ((corrType==RACH) || (!needDFE)) {
|
||||
burst = demodulateBurst(*vectorBurst,
|
||||
*gsmPulse,
|
||||
mSamplesPerSymbol,
|
||||
mSPS,
|
||||
amplitude,TOA);
|
||||
}
|
||||
else { // TSC
|
||||
scaleVector(*vectorBurst,complex(1.0,0.0)/amplitude);
|
||||
burst = equalizeBurst(*vectorBurst,
|
||||
TOA-chanRespOffset[timeslot],
|
||||
mSamplesPerSymbol,
|
||||
mSPS,
|
||||
*DFEForward[timeslot],
|
||||
*DFEFeedback[timeslot]);
|
||||
}
|
||||
wTime = rxBurst->getTime();
|
||||
RSSI = (int) floor(20.0*log10(rxFullScale/amplitude.abs()));
|
||||
LOG(DEBUG) << "RSSI: " << RSSI;
|
||||
timingOffset = (int) round(TOA*256.0/mSamplesPerSymbol);
|
||||
timingOffset = (int) round(TOA * 256.0 / mSPS);
|
||||
}
|
||||
|
||||
//if (burst) LOG(DEBUG) << "burst: " << *burst << '\n';
|
||||
|
@ -497,7 +497,7 @@ void Transceiver::driveControl()
|
|||
// Prepare for thread start
|
||||
mPower = -20;
|
||||
mRadioInterface->start();
|
||||
generateRACHSequence(*gsmPulse,mSamplesPerSymbol);
|
||||
generateRACHSequence(*gsmPulse, mSPS);
|
||||
|
||||
// Start radio interface threads.
|
||||
mFIFOServiceLoopThread->start((void * (*)(void*))FIFOServiceLoopAdapter,(void*) this);
|
||||
|
@ -589,7 +589,7 @@ void Transceiver::driveControl()
|
|||
sprintf(response,"RSP SETTSC 1 %d",TSC);
|
||||
else {
|
||||
mTSC = TSC;
|
||||
generateMidamble(*gsmPulse,mSamplesPerSymbol,TSC);
|
||||
generateMidamble(*gsmPulse, mSPS, TSC);
|
||||
sprintf(response,"RSP SETTSC 0 %d",TSC);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ private:
|
|||
|
||||
signalVector *gsmPulse; ///< the GSM shaping pulse for modulation
|
||||
|
||||
int mSamplesPerSymbol; ///< number of samples per GSM symbol
|
||||
int mSPS; ///< number of samples per GSM symbol
|
||||
|
||||
bool mOn; ///< flag to indicate that transceiver is powered on
|
||||
ChannelCombination mChanType[8]; ///< channel types for all timeslots
|
||||
|
@ -153,13 +153,13 @@ public:
|
|||
/** Transceiver constructor
|
||||
@param wBasePort base port number of UDP sockets
|
||||
@param TRXAddress IP address of the TRX manager, as a string
|
||||
@param wSamplesPerSymbol number of samples per GSM symbol
|
||||
@param wSPS number of samples per GSM symbol
|
||||
@param wTransmitLatency initial setting of transmit latency
|
||||
@param radioInterface associated radioInterface object
|
||||
*/
|
||||
Transceiver(int wBasePort,
|
||||
const char *TRXAddress,
|
||||
int wSamplesPerSymbol,
|
||||
int wSPS,
|
||||
GSM::Time wTransmitLatency,
|
||||
RadioInterface *wRadioInterface);
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ RadioInterface::RadioInterface(RadioDevice *wRadio,
|
|||
GSM::Time wStartTime)
|
||||
: underrun(false), sendCursor(0), rcvCursor(0), mOn(false),
|
||||
mRadio(wRadio), receiveOffset(wReceiveOffset),
|
||||
samplesPerSymbol(wSPS), powerScaling(1.0),
|
||||
sps(wSPS), powerScaling(1.0),
|
||||
loadTest(false)
|
||||
{
|
||||
mClock.set(wStartTime);
|
||||
|
@ -150,8 +150,8 @@ void RadioInterface::start()
|
|||
mRadio->updateAlignment(writeTimestamp-10000);
|
||||
mRadio->updateAlignment(writeTimestamp-10000);
|
||||
|
||||
sendBuffer = new float[2*2*INCHUNK*samplesPerSymbol];
|
||||
rcvBuffer = new float[2*2*OUTCHUNK*samplesPerSymbol];
|
||||
sendBuffer = new float[2*2*INCHUNK*sps];
|
||||
rcvBuffer = new float[2*2*OUTCHUNK*sps];
|
||||
|
||||
mOn = true;
|
||||
|
||||
|
@ -202,8 +202,8 @@ void RadioInterface::driveReceiveRadio() {
|
|||
// while there's enough data in receive buffer, form received
|
||||
// GSM bursts and pass up to Transceiver
|
||||
// Using the 157-156-156-156 symbols per timeslot format.
|
||||
while (rcvSz > (symbolsPerSlot + (tN % 4 == 0))*samplesPerSymbol) {
|
||||
signalVector rxVector((symbolsPerSlot + (tN % 4 == 0))*samplesPerSymbol);
|
||||
while (rcvSz > (symbolsPerSlot + (tN % 4 == 0)) * sps) {
|
||||
signalVector rxVector((symbolsPerSlot + (tN % 4 == 0)) * sps);
|
||||
unRadioifyVector(rcvBuffer+readSz*2,rxVector);
|
||||
GSM::Time tmpTime = rcvClock;
|
||||
if (rcvClock.FN() >= 0) {
|
||||
|
@ -223,8 +223,8 @@ void RadioInterface::driveReceiveRadio() {
|
|||
rcvClock.incTN();
|
||||
//if (mReceiveFIFO.size() >= 16) mReceiveFIFO.wait(8);
|
||||
//LOG(DEBUG) << "receiveFIFO: wrote radio vector at time: " << mClock.get() << ", new size: " << mReceiveFIFO.size() ;
|
||||
readSz += (symbolsPerSlot+(tN % 4 == 0))*samplesPerSymbol;
|
||||
rcvSz -= (symbolsPerSlot+(tN % 4 == 0))*samplesPerSymbol;
|
||||
readSz += (symbolsPerSlot+(tN % 4 == 0)) * sps;
|
||||
rcvSz -= (symbolsPerSlot+(tN % 4 == 0)) * sps;
|
||||
|
||||
tN = rcvClock.TN();
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ protected:
|
|||
|
||||
RadioClock mClock; ///< the basestation clock!
|
||||
|
||||
int samplesPerSymbol; ///< samples per GSM symbol
|
||||
int sps; ///< samples per GSM symbol
|
||||
int receiveOffset; ///< offset b/w transmit and receive GSM timestamps, in timeslots
|
||||
|
||||
bool mOn; ///< indicates radio is on
|
||||
|
@ -94,10 +94,6 @@ public:
|
|||
/** destructor */
|
||||
~RadioInterface();
|
||||
|
||||
void setSamplesPerSymbol(int wSamplesPerSymbol) {if (!mOn) samplesPerSymbol = wSamplesPerSymbol;}
|
||||
|
||||
int getSamplesPerSymbol() { return samplesPerSymbol;}
|
||||
|
||||
/** check for underrun, resets underrun value */
|
||||
bool isUnderrun();
|
||||
|
||||
|
|
|
@ -216,22 +216,24 @@ void initTrigTables() {
|
|||
}
|
||||
}
|
||||
|
||||
void initGMSKRotationTables(int samplesPerSymbol) {
|
||||
GMSKRotation = new signalVector(157*samplesPerSymbol);
|
||||
GMSKReverseRotation = new signalVector(157*samplesPerSymbol);
|
||||
void initGMSKRotationTables(int sps)
|
||||
{
|
||||
GMSKRotation = new signalVector(157 * sps);
|
||||
GMSKReverseRotation = new signalVector(157 * sps);
|
||||
signalVector::iterator rotPtr = GMSKRotation->begin();
|
||||
signalVector::iterator revPtr = GMSKReverseRotation->begin();
|
||||
float phase = 0.0;
|
||||
while (rotPtr != GMSKRotation->end()) {
|
||||
*rotPtr++ = expjLookup(phase);
|
||||
*revPtr++ = expjLookup(-phase);
|
||||
phase += M_PI_F/2.0F/(float) samplesPerSymbol;
|
||||
phase += M_PI_F / 2.0F / (float) sps;
|
||||
}
|
||||
}
|
||||
|
||||
void sigProcLibSetup(int samplesPerSymbol) {
|
||||
void sigProcLibSetup(int sps)
|
||||
{
|
||||
initTrigTables();
|
||||
initGMSKRotationTables(samplesPerSymbol);
|
||||
initGMSKRotationTables(sps);
|
||||
}
|
||||
|
||||
void GMSKRotate(signalVector &x) {
|
||||
|
@ -437,20 +439,19 @@ signalVector* convolve(const signalVector *a,
|
|||
}
|
||||
|
||||
|
||||
signalVector* generateGSMPulse(int symbolLength,
|
||||
int samplesPerSymbol)
|
||||
signalVector* generateGSMPulse(int sps, int symbolLength)
|
||||
{
|
||||
|
||||
int numSamples = samplesPerSymbol*symbolLength + 1;
|
||||
int numSamples = sps * symbolLength + 1;
|
||||
signalVector *x = new signalVector(numSamples);
|
||||
signalVector::iterator xP = x->begin();
|
||||
int centerPoint = (numSamples-1)/2;
|
||||
for (int i = 0; i < numSamples; i++) {
|
||||
float arg = (float) (i-centerPoint)/(float) samplesPerSymbol;
|
||||
float arg = (float) (i - centerPoint) / (float) sps;
|
||||
*xP++ = 0.96*exp(-1.1380*arg*arg-0.527*arg*arg*arg*arg); // GSM pulse approx.
|
||||
}
|
||||
|
||||
float avgAbsval = sqrtf(vectorNorm2(*x)/samplesPerSymbol);
|
||||
float avgAbsval = sqrtf(vectorNorm2(*x) / sps);
|
||||
xP = x->begin();
|
||||
for (int i = 0; i < numSamples; i++)
|
||||
*xP++ /= avgAbsval;
|
||||
|
@ -566,12 +567,12 @@ bool vectorSlicer(signalVector *x)
|
|||
signalVector *modulateBurst(const BitVector &wBurst,
|
||||
const signalVector &gsmPulse,
|
||||
int guardPeriodLength,
|
||||
int samplesPerSymbol)
|
||||
int sps)
|
||||
{
|
||||
|
||||
//static complex staticBurst[157];
|
||||
|
||||
int burstSize = samplesPerSymbol*(wBurst.size()+guardPeriodLength);
|
||||
int burstSize = sps * (wBurst.size() + guardPeriodLength);
|
||||
//signalVector modBurst((complex *) staticBurst,0,burstSize);
|
||||
signalVector modBurst(burstSize);// = new signalVector(burstSize);
|
||||
modBurst.isRealOnly(true);
|
||||
|
@ -584,7 +585,7 @@ signalVector *modulateBurst(const BitVector &wBurst,
|
|||
*modBurstItr = 2.0*(wBurst[0] & 0x01)-1.0;
|
||||
signalVector::iterator prevVal = modBurstItr;
|
||||
for (unsigned int i = 1; i < wBurst.size(); i++) {
|
||||
modBurstItr += samplesPerSymbol;
|
||||
modBurstItr += sps;
|
||||
if (wBurst[i] & 0x01)
|
||||
*modBurstItr = *prevVal * complex(0.0,1.0);
|
||||
else
|
||||
|
@ -595,7 +596,7 @@ signalVector *modulateBurst(const BitVector &wBurst,
|
|||
// if wBurst are the raw bits
|
||||
for (unsigned int i = 0; i < wBurst.size(); i++) {
|
||||
*modBurstItr = 2.0*(wBurst[i] & 0x01)-1.0;
|
||||
modBurstItr += samplesPerSymbol;
|
||||
modBurstItr += sps;
|
||||
}
|
||||
|
||||
// shift up pi/2
|
||||
|
@ -837,7 +838,7 @@ void offsetVector(signalVector &x,
|
|||
}
|
||||
|
||||
bool generateMidamble(signalVector &gsmPulse,
|
||||
int samplesPerSymbol,
|
||||
int sps,
|
||||
int TSC)
|
||||
{
|
||||
|
||||
|
@ -856,11 +857,11 @@ bool generateMidamble(signalVector &gsmPulse,
|
|||
signalVector *middleMidamble = modulateBurst(gTrainingSequence[TSC].segment(5,16),
|
||||
emptyPulse,
|
||||
0,
|
||||
samplesPerSymbol);
|
||||
sps);
|
||||
signalVector *midamble = modulateBurst(gTrainingSequence[TSC],
|
||||
gsmPulse,
|
||||
0,
|
||||
samplesPerSymbol);
|
||||
sps);
|
||||
|
||||
if (midamble == NULL) return false;
|
||||
if (middleMidamble == NULL) return false;
|
||||
|
@ -886,7 +887,7 @@ bool generateMidamble(signalVector &gsmPulse,
|
|||
|
||||
LOG(DEBUG) << "TOA: " << gMidambles[TSC]->TOA;
|
||||
|
||||
//gMidambles[TSC]->TOA -= 5*samplesPerSymbol;
|
||||
//gMidambles[TSC]->TOA -= 5*sps;
|
||||
|
||||
delete autocorr;
|
||||
delete midamble;
|
||||
|
@ -895,7 +896,7 @@ bool generateMidamble(signalVector &gsmPulse,
|
|||
}
|
||||
|
||||
bool generateRACHSequence(signalVector &gsmPulse,
|
||||
int samplesPerSymbol)
|
||||
int sps)
|
||||
{
|
||||
|
||||
if (gRACHSequence) {
|
||||
|
@ -906,7 +907,7 @@ bool generateRACHSequence(signalVector &gsmPulse,
|
|||
signalVector *RACHSeq = modulateBurst(gRACHSynchSequence,
|
||||
gsmPulse,
|
||||
0,
|
||||
samplesPerSymbol);
|
||||
sps);
|
||||
|
||||
assert(RACHSeq);
|
||||
|
||||
|
@ -928,7 +929,7 @@ bool generateRACHSequence(signalVector &gsmPulse,
|
|||
|
||||
bool detectRACHBurst(signalVector &rxBurst,
|
||||
float detectThreshold,
|
||||
int samplesPerSymbol,
|
||||
int sps,
|
||||
complex *amplitude,
|
||||
float* TOA)
|
||||
{
|
||||
|
@ -954,7 +955,7 @@ bool detectRACHBurst(signalVector &rxBurst,
|
|||
LOG(DEBUG) << "RACH corr: " << correlatedRACH;
|
||||
|
||||
float numSamples = 0.0;
|
||||
for (int i = 57*samplesPerSymbol; i <= 107*samplesPerSymbol;i++) {
|
||||
for (int i = 57 * sps; i <= 107 * sps; i++) {
|
||||
if (peakPtr+i >= correlatedRACH.end())
|
||||
break;
|
||||
valleyPower += (peakPtr+i)->norm2();
|
||||
|
@ -972,7 +973,7 @@ bool detectRACHBurst(signalVector &rxBurst,
|
|||
LOG(DEBUG) << "RACH peakAmpl=" << peakAmpl << " RMS=" << RMS << " peakToMean=" << peakToMean;
|
||||
*amplitude = peakAmpl/(gRACHSequence->gain);
|
||||
|
||||
*TOA = (*TOA) - gRACHSequence->TOA - 8*samplesPerSymbol;
|
||||
*TOA = (*TOA) - gRACHSequence->TOA - 8 * sps;
|
||||
|
||||
LOG(DEBUG) << "RACH thresh: " << peakToMean;
|
||||
|
||||
|
@ -1002,7 +1003,7 @@ bool energyDetect(signalVector &rxBurst,
|
|||
bool analyzeTrafficBurst(signalVector &rxBurst,
|
||||
unsigned TSC,
|
||||
float detectThreshold,
|
||||
int samplesPerSymbol,
|
||||
int sps,
|
||||
complex *amplitude,
|
||||
float *TOA,
|
||||
unsigned maxTOA,
|
||||
|
@ -1016,12 +1017,12 @@ bool analyzeTrafficBurst(signalVector &rxBurst,
|
|||
assert(TOA);
|
||||
assert(gMidambles[TSC]);
|
||||
|
||||
if (maxTOA < 3*samplesPerSymbol) maxTOA = 3*samplesPerSymbol;
|
||||
if (maxTOA < 3*sps) maxTOA = 3*sps;
|
||||
unsigned spanTOA = maxTOA;
|
||||
if (spanTOA < 5*samplesPerSymbol) spanTOA = 5*samplesPerSymbol;
|
||||
if (spanTOA < 5*sps) spanTOA = 5*sps;
|
||||
|
||||
unsigned startIx = 66*samplesPerSymbol-spanTOA;
|
||||
unsigned endIx = (66+16)*samplesPerSymbol+spanTOA;
|
||||
unsigned startIx = 66*sps-spanTOA;
|
||||
unsigned endIx = (66+16)*sps+spanTOA;
|
||||
unsigned windowLen = endIx - startIx;
|
||||
unsigned corrLen = 2*maxTOA+1;
|
||||
|
||||
|
@ -1048,7 +1049,7 @@ bool analyzeTrafficBurst(signalVector &rxBurst,
|
|||
}
|
||||
|
||||
int numRms = 0;
|
||||
for (int i = 2*samplesPerSymbol; i <= 5*samplesPerSymbol;i++) {
|
||||
for (int i = 2*sps; i <= 5*sps;i++) {
|
||||
if (peakPtr - i >= correlatedBurst.begin()) {
|
||||
valleyPower += (peakPtr-i)->norm2();
|
||||
numRms++;
|
||||
|
@ -1081,30 +1082,36 @@ bool analyzeTrafficBurst(signalVector &rxBurst,
|
|||
LOG(DEBUG) << "autocorr: " << correlatedBurst;
|
||||
|
||||
if (requestChannel && (peakToMean > detectThreshold)) {
|
||||
float TOAoffset = maxTOA; //gMidambles[TSC]->TOA+(66*samplesPerSymbol-startIx);
|
||||
float TOAoffset = maxTOA;
|
||||
delayVector(correlatedBurst,-(*TOA));
|
||||
// midamble only allows estimation of a 6-tap channel
|
||||
signalVector channelVector(6*samplesPerSymbol);
|
||||
signalVector chanVector(6 * sps);
|
||||
float maxEnergy = -1.0;
|
||||
int maxI = -1;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (TOAoffset+(i-5)*samplesPerSymbol + channelVector.size() > correlatedBurst.size()) continue;
|
||||
if (TOAoffset+(i-5)*samplesPerSymbol < 0) continue;
|
||||
correlatedBurst.segmentCopyTo(channelVector,(int) floor(TOAoffset+(i-5)*samplesPerSymbol),channelVector.size());
|
||||
float energy = vectorNorm2(channelVector);
|
||||
if (TOAoffset + (i-5) * sps + chanVector.size() > correlatedBurst.size())
|
||||
continue;
|
||||
if (TOAoffset + (i-5) * sps < 0)
|
||||
continue;
|
||||
correlatedBurst.segmentCopyTo(chanVector,
|
||||
(int) floor(TOAoffset + (i - 5) * sps),
|
||||
chanVector.size());
|
||||
float energy = vectorNorm2(chanVector);
|
||||
if (energy > 0.95*maxEnergy) {
|
||||
maxI = i;
|
||||
maxEnergy = energy;
|
||||
}
|
||||
}
|
||||
|
||||
*channelResponse = new signalVector(channelVector.size());
|
||||
correlatedBurst.segmentCopyTo(**channelResponse,(int) floor(TOAoffset+(maxI-5)*samplesPerSymbol),(*channelResponse)->size());
|
||||
scaleVector(**channelResponse,complex(1.0,0.0)/gMidambles[TSC]->gain);
|
||||
*channelResponse = new signalVector(chanVector.size());
|
||||
correlatedBurst.segmentCopyTo(**channelResponse,
|
||||
(int) floor(TOAoffset + (maxI - 5) * sps),
|
||||
(*channelResponse)->size());
|
||||
scaleVector(**channelResponse, complex(1.0, 0.0) / gMidambles[TSC]->gain);
|
||||
LOG(DEBUG) << "channelResponse: " << **channelResponse;
|
||||
|
||||
if (channelResponseOffset)
|
||||
*channelResponseOffset = 5*samplesPerSymbol-maxI;
|
||||
*channelResponseOffset = 5 * sps - maxI;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1131,7 +1138,7 @@ signalVector *decimateVector(signalVector &wVector,
|
|||
|
||||
SoftVector *demodulateBurst(signalVector &rxBurst,
|
||||
const signalVector &gsmPulse,
|
||||
int samplesPerSymbol,
|
||||
int sps,
|
||||
complex channel,
|
||||
float TOA)
|
||||
|
||||
|
@ -1146,8 +1153,8 @@ SoftVector *demodulateBurst(signalVector &rxBurst,
|
|||
GMSKReverseRotate(*shapedBurst);
|
||||
|
||||
// run through slicer
|
||||
if (samplesPerSymbol > 1) {
|
||||
signalVector *decShapedBurst = decimateVector(*shapedBurst,samplesPerSymbol);
|
||||
if (sps > 1) {
|
||||
signalVector *decShapedBurst = decimateVector(*shapedBurst, sps);
|
||||
shapedBurst = decShapedBurst;
|
||||
}
|
||||
|
||||
|
@ -1162,7 +1169,8 @@ SoftVector *demodulateBurst(signalVector &rxBurst,
|
|||
for (; shapedItr < shapedBurst->end(); shapedItr++)
|
||||
*burstItr++ = shapedItr->real();
|
||||
|
||||
if (samplesPerSymbol > 1) delete shapedBurst;
|
||||
if (sps > 1)
|
||||
delete shapedBurst;
|
||||
|
||||
return burstBits;
|
||||
|
||||
|
@ -1456,7 +1464,7 @@ bool designDFE(signalVector &channelResponse,
|
|||
// Assumes symbol-rate sampling!!!!
|
||||
SoftVector *equalizeBurst(signalVector &rxBurst,
|
||||
float TOA,
|
||||
int samplesPerSymbol,
|
||||
int sps,
|
||||
signalVector &w, // feedforward filter
|
||||
signalVector &b) // feedback filter
|
||||
{
|
||||
|
|
|
@ -100,7 +100,7 @@ float vectorNorm2(const signalVector &x);
|
|||
float vectorPower(const signalVector &x);
|
||||
|
||||
/** Setup the signal processing library */
|
||||
void sigProcLibSetup(int samplesPerSymbol);
|
||||
void sigProcLibSetup(int sps);
|
||||
|
||||
/** Destroy the signal processing library */
|
||||
void sigProcLibDestroy(void);
|
||||
|
@ -121,12 +121,11 @@ signalVector* convolve(const signalVector *a,
|
|||
|
||||
/**
|
||||
Generate the GSM pulse.
|
||||
@param samplesPerSymbol The number of samples per GSM symbol.
|
||||
@param sps The number of samples per GSM symbol.
|
||||
@param symbolLength The size of the pulse.
|
||||
@return The GSM pulse.
|
||||
*/
|
||||
signalVector* generateGSMPulse(int samplesPerSymbol,
|
||||
int symbolLength);
|
||||
signalVector* generateGSMPulse(int sps, int symbolLength);
|
||||
|
||||
/**
|
||||
Frequency shift a vector.
|
||||
|
@ -165,7 +164,7 @@ bool vectorSlicer(signalVector *x);
|
|||
signalVector *modulateBurst(const BitVector &wBurst,
|
||||
const signalVector &gsmPulse,
|
||||
int guardPeriodLength,
|
||||
int samplesPerSymbol);
|
||||
int sps);
|
||||
|
||||
/** Sinc function */
|
||||
float sinc(float x);
|
||||
|
@ -226,21 +225,19 @@ void offsetVector(signalVector &x,
|
|||
/**
|
||||
Generate a modulated GSM midamble, stored within the library.
|
||||
@param gsmPulse The GSM pulse used for modulation.
|
||||
@param samplesPerSymbol The number of samples per GSM symbol.
|
||||
@param sps The number of samples per GSM symbol.
|
||||
@param TSC The training sequence [0..7]
|
||||
@return Success.
|
||||
*/
|
||||
bool generateMidamble(signalVector &gsmPulse,
|
||||
int samplesPerSymbol,
|
||||
int TSC);
|
||||
bool generateMidamble(signalVector &gsmPulse, int sps, int tsc);
|
||||
/**
|
||||
Generate a modulated RACH sequence, stored within the library.
|
||||
@param gsmPulse The GSM pulse used for modulation.
|
||||
@param samplesPerSymbol The number of samples per GSM symbol.
|
||||
@param sps The number of samples per GSM symbol.
|
||||
@return Success.
|
||||
*/
|
||||
bool generateRACHSequence(signalVector &gsmPulse,
|
||||
int samplesPerSymbol);
|
||||
int sps);
|
||||
|
||||
/**
|
||||
Energy detector, checks to see if received burst energy is above a threshold.
|
||||
|
@ -259,14 +256,14 @@ bool energyDetect(signalVector &rxBurst,
|
|||
RACH correlator/detector.
|
||||
@param rxBurst The received GSM burst of interest.
|
||||
@param detectThreshold The threshold that the received burst's post-correlator SNR is compared against to determine validity.
|
||||
@param samplesPerSymbol The number of samples per GSM symbol.
|
||||
@param sps The number of samples per GSM symbol.
|
||||
@param amplitude The estimated amplitude of received RACH burst.
|
||||
@param TOA The estimate time-of-arrival of received RACH burst.
|
||||
@return True if burst SNR is larger that the detectThreshold value.
|
||||
*/
|
||||
bool detectRACHBurst(signalVector &rxBurst,
|
||||
float detectThreshold,
|
||||
int samplesPerSymbol,
|
||||
int sps,
|
||||
complex *amplitude,
|
||||
float* TOA);
|
||||
|
||||
|
@ -275,7 +272,7 @@ bool detectRACHBurst(signalVector &rxBurst,
|
|||
@param rxBurst The received GSM burst of interest.
|
||||
|
||||
@param detectThreshold The threshold that the received burst's post-correlator SNR is compared against to determine validity.
|
||||
@param samplesPerSymbol The number of samples per GSM symbol.
|
||||
@param sps The number of samples per GSM symbol.
|
||||
@param amplitude The estimated amplitude of received TSC burst.
|
||||
@param TOA The estimate time-of-arrival of received TSC burst.
|
||||
@param maxTOA The maximum expected time-of-arrival
|
||||
|
@ -287,7 +284,7 @@ bool detectRACHBurst(signalVector &rxBurst,
|
|||
bool analyzeTrafficBurst(signalVector &rxBurst,
|
||||
unsigned TSC,
|
||||
float detectThreshold,
|
||||
int samplesPerSymbol,
|
||||
int sps,
|
||||
complex *amplitude,
|
||||
float *TOA,
|
||||
unsigned maxTOA,
|
||||
|
@ -308,14 +305,14 @@ signalVector *decimateVector(signalVector &wVector,
|
|||
Demodulates a received burst using a soft-slicer.
|
||||
@param rxBurst The burst to be demodulated.
|
||||
@param gsmPulse The GSM pulse.
|
||||
@param samplesPerSymbol The number of samples per GSM symbol.
|
||||
@param sps The number of samples per GSM symbol.
|
||||
@param channel The amplitude estimate of the received burst.
|
||||
@param TOA The time-of-arrival of the received burst.
|
||||
@return The demodulated bit sequence.
|
||||
*/
|
||||
SoftVector *demodulateBurst(signalVector &rxBurst,
|
||||
const signalVector &gsmPulse,
|
||||
int samplesPerSymbol,
|
||||
int sps,
|
||||
complex channel,
|
||||
float TOA);
|
||||
|
||||
|
@ -372,14 +369,14 @@ bool designDFE(signalVector &channelResponse,
|
|||
Equalize/demodulate a received burst via a decision-feedback equalizer.
|
||||
@param rxBurst The received burst to be demodulated.
|
||||
@param TOA The time-of-arrival of the received burst.
|
||||
@param samplesPerSymbol The number of samples per GSM symbol.
|
||||
@param sps The number of samples per GSM symbol.
|
||||
@param w The feed forward filter of the DFE.
|
||||
@param b The feedback filter of the DFE.
|
||||
@return The demodulated bit sequence.
|
||||
*/
|
||||
SoftVector *equalizeBurst(signalVector &rxBurst,
|
||||
float TOA,
|
||||
int samplesPerSymbol,
|
||||
int sps,
|
||||
signalVector &w,
|
||||
signalVector &b);
|
||||
|
||||
|
|
Loading…
Reference in New Issue