...
 
Commits (2)
......@@ -116,7 +116,7 @@ Config::Config(const std::string& jsonfile)
dlSymsPerFrame = DLSymbols[0].size();
// read commons from Client json config
if (!clPresent) {
nClSdrs = std::count(frames.at(0).begin(), frames.at(0).end(), 'P');
nClSdrs = nClAntennas = std::count(frames.at(0).begin(), frames.at(0).end(), 'P');
clDataMod = tddConf.value("modulation", "QPSK");
}
}
......@@ -130,6 +130,7 @@ Config::Config(const std::string& jsonfile)
if (clChannel != "A" && clChannel != "B" && clChannel != "AB")
throw std::invalid_argument("error channel config: not any of A/B/AB!\n");
clSdrCh = (clChannel == "AB") ? 2 : 1;
nClAntennas = nClSdrs * clSdrCh;
clAgcEn = tddConfCl.value("agc_en", false);
clAgcGainInit = tddConfCl.value("agc_gain_init", 70); // 0 to 108
clDataMod = tddConfCl.value("modulation", "QPSK");
......@@ -267,7 +268,7 @@ Config::Config(const std::string& jsonfile)
int syms = nSamps / ofdmSize;
std::vector<std::complex<float>> pre1(prefix, 0);
std::vector<std::complex<float>> post1(nSamps % ofdmSize + postfix, 0);
for (unsigned int i = 0; i < nClSdrs; i++) {
for (unsigned int i = 0; i < nClAntennas; i++) {
std::vector<std::complex<float>> data_cf;
std::vector<std::complex<float>> data_freq_dom;
data_cf.insert(data_cf.begin(), pre1.begin(), pre1.end());
......@@ -332,8 +333,7 @@ Config::Config(const std::string& jsonfile)
tm* ltm = localtime(&now);
int cell_num = nCells;
int ant_num = getNumAntennas();
int ue_num = nClSdrs;
std::string filename = "logs/Argos-" + std::to_string(1900 + ltm->tm_year) + "-" + std::to_string(1 + ltm->tm_mon) + "-" + std::to_string(ltm->tm_mday) + "-" + std::to_string(ltm->tm_hour) + "-" + std::to_string(ltm->tm_min) + "-" + std::to_string(ltm->tm_sec) + "_" + std::to_string(cell_num) + "x" + std::to_string(ant_num) + "x" + std::to_string(ue_num) + ".hdf5";
std::string filename = "logs/Argos-" + std::to_string(1900 + ltm->tm_year) + "-" + std::to_string(1 + ltm->tm_mon) + "-" + std::to_string(ltm->tm_mday) + "-" + std::to_string(ltm->tm_hour) + "-" + std::to_string(ltm->tm_min) + "-" + std::to_string(ltm->tm_sec) + "_" + std::to_string(cell_num) + "x" + std::to_string(ant_num) + "x" + std::to_string(pilotSymsPerFrame) + ".hdf5";
trace_file = tddConf.value("trace_file", filename);
}
......@@ -358,7 +358,7 @@ Config::Config(const std::string& jsonfile)
}
if (clPresent && core_alloc)
printf("allocating %d cores to client threads ... \n", nClSdrs);
printf("allocating %zu cores to client threads ... \n", nClSdrs);
running = true;
......
......@@ -74,9 +74,10 @@ public:
std::string trace_file;
// Clients features
unsigned int nClSdrs;
std::vector<std::string> cl_sdr_ids;
int clSdrCh;
size_t nClSdrs;
size_t clSdrCh;
size_t nClAntennas;
std::string clChannel;
bool clAgcEn;
int clAgcGainInit;
......
......@@ -260,8 +260,10 @@ void Receiver::clientTxRx(int tid)
std::vector<void*> txbuff(2);
if (txSyms > 0) {
txbuff[0] = config_->txdata[tid].data();
txbuff[1] = config_->txdata[tid].data();
size_t txIndex = tid * config_->clSdrCh;
txbuff[0] = config_->txdata[txIndex].data();
if (config_->clSdrCh == 2)
txbuff[1] = config_->txdata[txIndex+1].data();
std::cout << txSyms << " uplink symbols will be sent per frame..." << std::endl;
}
......
......@@ -310,15 +310,15 @@ herr_t Recorder::initHDF5(const std::string& hdf5)
}
write_attribute(mainGroup, "OFDM_PILOT", split_vec_pilot);
// Number of Clients
// Number of Pilots
write_attribute(mainGroup, "PILOT_NUM", (int)cfg->pilotSymsPerFrame);
// Number of Clients
write_attribute(mainGroup, "CL_NUM", (int)cfg->nClSdrs);
// Number of Client Antennas
write_attribute(mainGroup, "CL_NUM", (int)cfg->nClAntennas);
if (cfg->clPresent) {
// Client antenna polarization
write_attribute(mainGroup, "CL_CH_PER_RADIO", cfg->clSdrCh);
write_attribute(mainGroup, "CL_CH_PER_RADIO", (int)cfg->clSdrCh);
// Client AGC enable flag
write_attribute(mainGroup, "CL_AGC_EN", cfg->clAgcEn ? 1 : 0);
......
......@@ -263,6 +263,7 @@ def analyze_hdf5(hdf5, frame=10, cell=0, zoom=0, pl=0):
symbol_num = int(metadata['BS_FRAME_LEN'])
timestep = symbol_length*symbol_num/rate
num_cl = int(metadata['CL_NUM'])-1
num_pilots = int(metadata['PILOT_NUM'])
cp = int(metadata['CP_LEN'])
prefix_len = int(metadata['PREFIX_LEN'])
postfix_len = int(metadata['POSTFIX_LEN'])
......@@ -271,7 +272,7 @@ def analyze_hdf5(hdf5, frame=10, cell=0, zoom=0, pl=0):
# compute CSI for each user and get a nice numpy array
# Returns csi with Frame, User, LTS (there are 2), BS ant, Subcarrier
#also, iq samples nicely chunked out, same dims, but subcarrier is sample.
csi, _ = hdf5_lib.samps2csi(pilot_samples, num_cl+1, symbol_length, offset=offset)
csi, _ = hdf5_lib.samps2csi(pilot_samples, num_pilots, symbol_length, offset=offset)
csi = csi[:, cell, :, :, :, :]
# zoom in too look at behavior around peak (and reduce processing time)
if zoom > 0:
......