Skip to content

Commit

Permalink
Merge pull request #101 from renew-wireless/pr-release-101
Browse files Browse the repository at this point in the history
Pr release 101
  • Loading branch information
obejarano authored Jul 7, 2021
2 parents 0df6b40 + 30bf80e commit 6f3045d
Show file tree
Hide file tree
Showing 44 changed files with 3,199 additions and 1,573 deletions.
26 changes: 13 additions & 13 deletions CC/Sounder/BaseRadioSet-calibrate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ static void dciqMinimize(SoapySDR::Device* targetDev, SoapySDR::Device* refDev,
//try I or Q arm based on iteration
const auto dcCorr = ((iter % 2) == 0)
? std::complex<double>(
bestDcCorr.real(), double(i) / fixedScale)
bestDcCorr.real(), double(i) / fixedScale)
: std::complex<double>(
double(i) / fixedScale, bestDcCorr.imag());
double(i) / fixedScale, bestDcCorr.imag());
targetDev->setDCOffset(direction, channel, dcCorr);

//measure the efficacy
Expand Down Expand Up @@ -534,7 +534,7 @@ void BaseRadioSet::collectCSI(bool& adjust)
// Prepend/Append vectors with prefix/postfix number of null samples
std::vector<std::complex<int16_t>> prefix_vec(_cfg->prefix(), 0);
std::vector<std::complex<int16_t>> postfix_vec(
_cfg->samps_per_symbol() - _cfg->prefix() - seqLen, 0);
_cfg->samps_per_slot() - _cfg->prefix() - seqLen, 0);
pilot_cint16.insert(
pilot_cint16.begin(), prefix_vec.begin(), prefix_vec.end());
pilot_cint16.insert(
Expand All @@ -559,18 +559,18 @@ void BaseRadioSet::collectCSI(bool& adjust)
buff.resize(R * R);
for (int i = 0; i < R; i++) {
for (int j = 0; j < R; j++) {
buff[i * R + j].resize(_cfg->samps_per_symbol());
buff[i * R + j].resize(_cfg->samps_per_slot());
}
}

std::vector<std::complex<int16_t>> dummyBuff0(_cfg->samps_per_symbol());
std::vector<std::complex<int16_t>> dummyBuff1(_cfg->samps_per_symbol());
std::vector<std::complex<int16_t>> dummyBuff0(_cfg->samps_per_slot());
std::vector<std::complex<int16_t>> dummyBuff1(_cfg->samps_per_slot());
std::vector<void*> dummybuffs(2);
dummybuffs[0] = dummyBuff0.data();
dummybuffs[1] = dummyBuff1.data();

for (int i = 0; i < R; i++)
bsRadios[0][i]->drain_buffers(dummybuffs, _cfg->samps_per_symbol());
bsRadios[0][i]->drain_buffers(dummybuffs, _cfg->samps_per_slot());

for (int i = 0; i < R; i++) {
Radio* bsRadio = bsRadios[0][i];
Expand All @@ -588,12 +588,12 @@ void BaseRadioSet::collectCSI(bool& adjust)
for (int j = 0; j < R; j++) {
if (j == i) {
int ret = bsRadios[0][j]->xmit(
txbuff.data(), _cfg->samps_per_symbol(), 3, txTime);
txbuff.data(), _cfg->samps_per_slot(), 3, txTime);
if (ret < 0)
std::cout << "bad write" << std::endl;
} else {
int ret = bsRadios[0][j]->activateRecv(
rxTime, _cfg->samps_per_symbol(), 3);
rxTime, _cfg->samps_per_slot(), 3);
if (ret < 0)
std::cout << "bad activate at node " << j << std::endl;
}
Expand All @@ -610,7 +610,7 @@ void BaseRadioSet::collectCSI(bool& adjust)
//rxbuff[1] = ant == 2 ? buff[(i*M+j)*ant+1].data() : dummyBuff.data();
rxbuff[1] = dummyBuff0.data();
int ret = bsRadios[0][j]->recv(
rxbuff.data(), _cfg->samps_per_symbol(), rxTime);
rxbuff.data(), _cfg->samps_per_slot(), rxTime);
if (ret < 0)
std::cout << "bad read at node " << j << std::endl;
}
Expand All @@ -631,12 +631,12 @@ void BaseRadioSet::collectCSI(bool& adjust)
good_csi = false;

#if DEBUG_PLOT
std::vector<double> rx_I(_cfg->samps_per_symbol());
std::vector<double> rx_I(_cfg->samps_per_slot());
std::transform(rx.begin(), rx.end(), rx_I.begin(),
[](std::complex<double> cf) { return cf.real(); });
plt::figure_size(1200, 780);
plt::plot(rx_I);
plt::xlim(0, _cfg->samps_per_symbol());
plt::xlim(0, _cfg->samps_per_slot());
plt::ylim(-1, 1);
plt::title("Sample figure");
plt::legend();
Expand Down Expand Up @@ -671,6 +671,6 @@ void BaseRadioSet::collectCSI(bool& adjust)
bsRadio->deactivateRecv();
bsRadio->deactivateXmit();
dev->setGain(SOAPY_SDR_TX, ch, "PAD", _cfg->tx_gain().at(ch)); //[0,30]
bsRadio->drain_buffers(dummybuffs, _cfg->samps_per_symbol());
bsRadio->drain_buffers(dummybuffs, _cfg->samps_per_slot());
}
}
13 changes: 6 additions & 7 deletions CC/Sounder/BaseRadioSet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ BaseRadioSet::BaseRadioSet(Config* cfg)
tddConf["tdd_enabled"] = true;
tddConf["frame_mode"] = "free_running";
tddConf["max_frame"] = _cfg->max_frame();
tddConf["symbol_size"] = _cfg->samps_per_symbol();
tddConf["symbol_size"] = _cfg->samps_per_slot();

// write TDD schedule and beacons to FPFA buffers only for Iris
for (size_t c = 0; c < _cfg->num_cells(); c++) {
Expand Down Expand Up @@ -514,7 +514,7 @@ void BaseRadioSet::radioTx(const void* const* buffs)
for (size_t c = 0; c < _cfg->num_cells(); c++) {
for (size_t i = 0; i < bsRadios.at(c).size(); i++) {
bsRadios.at(c).at(i)->xmit(
buffs, _cfg->samps_per_symbol(), 0, frameTime);
buffs, _cfg->samps_per_slot(), 0, frameTime);
}
}
}
Expand All @@ -526,12 +526,12 @@ int BaseRadioSet::radioTx(size_t radio_id, size_t cell_id,
// for UHD device xmit from host using frameTimeNs
if (!kUseUHD) {
w = bsRadios.at(cell_id).at(radio_id)->xmit(
buffs, _cfg->samps_per_symbol(), flags, frameTime);
buffs, _cfg->samps_per_slot(), flags, frameTime);
} else {
long long frameTimeNs
= SoapySDR::ticksToTimeNs(frameTime, _cfg->rate());
w = bsRadios.at(cell_id).at(radio_id)->xmit(
buffs, _cfg->samps_per_symbol(), flags, frameTimeNs);
buffs, _cfg->samps_per_slot(), flags, frameTimeNs);
}
#if DEBUG_RADIO
size_t chanMask;
Expand All @@ -551,8 +551,7 @@ void BaseRadioSet::radioRx(void* const* buffs)
for (size_t c = 0; c < _cfg->num_cells(); c++) {
for (size_t i = 0; i < bsRadios.at(c).size(); i++) {
void* const* buff = buffs + (i * 2);
bsRadios.at(c).at(i)->recv(
buff, _cfg->samps_per_symbol(), frameTime);
bsRadios.at(c).at(i)->recv(buff, _cfg->samps_per_slot(), frameTime);
}
}
}
Expand All @@ -561,7 +560,7 @@ int BaseRadioSet::radioRx(
size_t radio_id, size_t cell_id, void* const* buffs, long long& frameTime)
{
return this->radioRx(
radio_id, cell_id, buffs, _cfg->samps_per_symbol(), frameTime);
radio_id, cell_id, buffs, _cfg->samps_per_slot(), frameTime);
}

int BaseRadioSet::radioRx(size_t radio_id, size_t cell_id, void* const* buffs,
Expand Down
6 changes: 5 additions & 1 deletion CC/Sounder/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
cmake_minimum_required(VERSION 3.10)
project(Sounder)
#Allow project version
cmake_policy(SET CMP0048 NEW)
project(Sounder VERSION 1.0.1)

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set(GCC_COVERAGE_COMPILE_FLAGS "-faligned-new")
endif()

configure_file(${CMAKE_SOURCE_DIR}/include/version_config.h.in ${CMAKE_SOURCE_DIR}/include/version_config.h)

option(FORCE_BUILD_PATH "Hardcode the build directory path to be 'build/'" ON)
if(FORCE_BUILD_PATH)
message(STATUS "Setting the build directory to build folder")
Expand Down
10 changes: 5 additions & 5 deletions CC/Sounder/ClientRadioSet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ ClientRadioSet::ClientRadioSet(Config* cfg)
} else {
//beaconSize + 82 (BS FE delay) + 68 (path delay) + 17 (correlator delay) + 82 (Client FE Delay)
int clTrigOffset = _cfg->beacon_size() + _cfg->tx_advance();
int sf_start = clTrigOffset / _cfg->samps_per_symbol();
int sp_start = clTrigOffset % _cfg->samps_per_symbol();
int sf_start = clTrigOffset / _cfg->samps_per_slot();
int sp_start = clTrigOffset % _cfg->samps_per_slot();

for (size_t i = 0; i < radios.size(); i++) {
auto dev = radios.at(i)->dev;
Expand Down Expand Up @@ -186,16 +186,16 @@ ClientRadioSet::ClientRadioSet(Config* cfg)
tddConf["tdd_enabled"] = true;
tddConf["frame_mode"] = _cfg->frame_mode();
int max_frame_ = (int)(2.0
/ ((_cfg->samps_per_symbol() * _cfg->symbols_per_frame())
/ _cfg->rate()));
/ ((_cfg->samps_per_slot() * _cfg->slot_per_frame())
/ _cfg->rate()));
tddConf["max_frame"]
= _cfg->frame_mode() == "free_running" ? 0 : max_frame_;
//std::cout << "max_frames for client " << i << " is " << max_frame_ << std::endl;
if (_cfg->cl_sdr_ch() == 2)
tddConf["dual_pilot"] = true;
tddConf["frames"] = json::array();
tddConf["frames"].push_back(tddSched);
tddConf["symbol_size"] = _cfg->samps_per_symbol();
tddConf["symbol_size"] = _cfg->samps_per_slot();
std::string tddConfStr = tddConf.dump();

dev->writeSetting("TDD_CONFIG", tddConfStr);
Expand Down
Loading

0 comments on commit 6f3045d

Please sign in to comment.