diff --git a/public-trunk/Transceiver/Transceiver.cpp b/public-trunk/Transceiver/Transceiver.cpp index bb2649e..77f9a3a 100644 --- a/public-trunk/Transceiver/Transceiver.cpp +++ b/public-trunk/Transceiver/Transceiver.cpp @@ -397,8 +397,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, *DFEFeedback[timeslot]); } wTime = rxBurst->time(); - // FIXME: what is full scale for the USRP? we get more that 12 bits of resolution... - RSSI = (int) floor(20.0*log10(9450.0/amplitude.abs())); + RSSI = (int) floor(20.0*log10(rxFullScale/amplitude.abs())); LOG(DEBUG) << "RSSI: " << RSSI; timingOffset = (int) round(TOA*256.0/mSamplesPerSymbol); } diff --git a/public-trunk/Transceiver/UHDDevice.cpp b/public-trunk/Transceiver/UHDDevice.cpp index 75f2374..7746730 100644 --- a/public-trunk/Transceiver/UHDDevice.cpp +++ b/public-trunk/Transceiver/UHDDevice.cpp @@ -38,12 +38,15 @@ on the RF side of the timestamping point of the device. This value is generally empirically measured. - smpl_buf_sz - The receive sample buffer size in bytes. + smpl_buf_sz - The receive sample buffer size in bytes. + + tx_ampl - Transmit amplitude must be between 0 and 1.0 */ const bool use_ext_ref = false; const double master_clk_rt = 100e6; const double rx_smpl_offset = .00005; const size_t smpl_buf_sz = (1 << 20); +const float tx_ampl = .3; /** Timestamp conversion @param timestamp a UHD or OpenBTS timestamp @@ -158,8 +161,8 @@ public: inline TIMESTAMP initialWriteTimestamp() { return 0; } inline TIMESTAMP initialReadTimestamp() { return 0; } - inline double fullScaleInputValue() { return 13500.0; } - inline double fullScaleOutputValue() { return 9450.0; } + inline double fullScaleInputValue() { return 32000 * tx_ampl; } + inline double fullScaleOutputValue() { return 32000; } double setRxGain(double db); double getRxGain(void) { return rx_gain; } diff --git a/public-trunk/Transceiver/radioInterface.cpp b/public-trunk/Transceiver/radioInterface.cpp index 327f2b7..d38fb30 100644 --- a/public-trunk/Transceiver/radioInterface.cpp +++ b/public-trunk/Transceiver/radioInterface.cpp @@ -58,7 +58,6 @@ RadioInterface::RadioInterface(RadioDevice *wUsrp, receiveOffset = wReceiveOffset; samplesPerSymbol = wSamplesPerSymbol; mClock.set(wStartTime); - powerScaling = 1.0; } RadioInterface::~RadioInterface(void) { @@ -82,12 +81,7 @@ double RadioInterface::fullScaleOutputValue(void) { void RadioInterface::setPowerAttenuation(double atten) { - double HWatten = usrp->setTxGain(usrp->maxTxGain() - atten); - atten -= HWatten; - if (atten < 1.0) - powerScaling = 1.0; - else - powerScaling = 1.0 / sqrt(pow(10, (atten / 10.0))); + usrp->setTxGain(usrp->maxTxGain() - atten); } short *RadioInterface::USRPifyVector(signalVector &wVector) @@ -155,7 +149,7 @@ void RadioInterface::pushBuffer(void) { delete inputVector; // Set transmit gain and power here. - scaleVector(*resampledVector, powerScaling * usrp->fullScaleInputValue()); + scaleVector(*resampledVector, usrp->fullScaleInputValue()); short *resampledVectorShort = USRPifyVector(*resampledVector); diff --git a/public-trunk/Transceiver/radioInterface.h b/public-trunk/Transceiver/radioInterface.h index 4d3fb21..94d0166 100644 --- a/public-trunk/Transceiver/radioInterface.h +++ b/public-trunk/Transceiver/radioInterface.h @@ -142,8 +142,6 @@ private: bool mOn; ///< indicates radio is on - double powerScaling; - /** format samples to USRP */ short *USRPifyVector(signalVector &wVector); diff --git a/public-trunk/Transceiver52M/Transceiver.cpp b/public-trunk/Transceiver52M/Transceiver.cpp index 036a4d8..a80832a 100644 --- a/public-trunk/Transceiver52M/Transceiver.cpp +++ b/public-trunk/Transceiver52M/Transceiver.cpp @@ -401,7 +401,6 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, *DFEFeedback[timeslot]); } wTime = rxBurst->time(); - // FIXME: what is full scale for the USRP? we get more that 12 bits of resolution... RSSI = (int) floor(20.0*log10(rxFullScale/amplitude.abs())); LOG(DEBUG) << "RSSI: " << RSSI; timingOffset = (int) round(TOA*256.0/mSamplesPerSymbol); diff --git a/public-trunk/Transceiver52M/UHDDevice.cpp b/public-trunk/Transceiver52M/UHDDevice.cpp index be07a9e..6c55260 100644 --- a/public-trunk/Transceiver52M/UHDDevice.cpp +++ b/public-trunk/Transceiver52M/UHDDevice.cpp @@ -38,12 +38,15 @@ on the RF side of the timestamping point of the device. This value is generally empirically measured. - smpl_buf_sz - The receive sample buffer size in bytes. + smpl_buf_sz - The receive sample buffer size in bytes. + + tx_ampl - Transmit amplitude must be between 0 and 1.0 */ const bool use_ext_ref = false; const double master_clk_rt = 52e6; const double rx_smpl_offset = .0000869; const size_t smpl_buf_sz = (1 << 20); +const float tx_ampl = .3; /** Timestamp conversion @param timestamp a UHD or OpenBTS timestamp @@ -158,8 +161,8 @@ public: inline TIMESTAMP initialWriteTimestamp() { return 0; } inline TIMESTAMP initialReadTimestamp() { return 0; } - inline double fullScaleInputValue() { return 13500.0; } - inline double fullScaleOutputValue() { return 9450.0; } + inline double fullScaleInputValue() { return 32000 * tx_ampl; } + inline double fullScaleOutputValue() { return 32000; } double setRxGain(double db); double getRxGain(void) { return rx_gain; } diff --git a/public-trunk/Transceiver52M/radioInterface.cpp b/public-trunk/Transceiver52M/radioInterface.cpp index 69f563c..add4c3c 100644 --- a/public-trunk/Transceiver52M/radioInterface.cpp +++ b/public-trunk/Transceiver52M/radioInterface.cpp @@ -91,7 +91,6 @@ RadioInterface::RadioInterface(RadioDevice *wRadio, receiveOffset = wReceiveOffset; samplesPerSymbol = wRadioOversampling; mClock.set(wStartTime); - powerScaling = 1.0; } RadioInterface::~RadioInterface(void) { @@ -109,18 +108,11 @@ double RadioInterface::fullScaleOutputValue(void) { void RadioInterface::setPowerAttenuation(double atten) { - double HWatten = mRadio->setTxGain(mRadio->maxTxGain() - atten); - atten -= HWatten; - if (atten < 1.0) - powerScaling = 1.0; - else - powerScaling = 1.0 / sqrt(pow(10, (atten / 10.0))); + mRadio->setTxGain(mRadio->maxTxGain() - atten); } -short *RadioInterface::radioifyVector(signalVector &wVector, short *retVector, double scale, bool zeroOut) +short *RadioInterface::radioifyVector(signalVector &wVector, short *retVector, bool zeroOut) { - - signalVector::iterator itr = wVector.begin(); short *shortItr = retVector; if (zeroOut) { @@ -130,13 +122,6 @@ short *RadioInterface::radioifyVector(signalVector &wVector, short *retVector, d itr++; } } - else if (scale != 1.0) { - while (itr < wVector.end()) { - *shortItr++ = (short) (itr->real()*scale); - *shortItr++ = (short) (itr->imag()*scale); - itr++; - } - } else { while (itr < wVector.end()) { *shortItr++ = (short) (itr->real()); @@ -146,7 +131,6 @@ short *RadioInterface::radioifyVector(signalVector &wVector, short *retVector, d } return retVector; - } void RadioInterface::unRadioifyVector(short *shortVector, signalVector& newVector) @@ -254,7 +238,7 @@ void RadioInterface::driveTransmitRadio(signalVector &radioBurst, bool zeroBurst if (!mOn) return; - radioifyVector(radioBurst, sendBuffer+sendCursor, powerScaling, zeroBurst); + radioifyVector(radioBurst, sendBuffer+sendCursor, zeroBurst); sendCursor += (radioBurst.size()*2); diff --git a/public-trunk/Transceiver52M/radioInterface.h b/public-trunk/Transceiver52M/radioInterface.h index 824bf7e..b9ae608 100644 --- a/public-trunk/Transceiver52M/radioInterface.h +++ b/public-trunk/Transceiver52M/radioInterface.h @@ -161,7 +161,7 @@ private: double powerScaling; /** format samples to USRP */ - short *radioifyVector(signalVector &wVector, short *shortVector, double scale, bool zeroOut); + short *radioifyVector(signalVector &wVector, short *shortVector, bool zeroOut); /** format samples from USRP */ void unRadioifyVector(short *shortVector, signalVector &wVector);