...
 
Commits (2)
......@@ -5,13 +5,13 @@
"hub_id" : "files/powder-hub-serials.txt",
"frequency" : 2.5e9,
"channel" : "AB",
"rxgainA" : 20,
"rxgainA" : 50,
"txgainA" : 40,
"rxgainB" : 20,
"rxgainB" : 50,
"txgainB" : 40,
"rate" : 5e6,
"frame_schedule" : [
"BGPPPGGGGGGGGGGGGGGG"
"BGPGGGGGGGGGGGGGGGGG"
],
"max_frame" : 6000,
"subframe_size" : 640,
......@@ -34,13 +34,13 @@
"channel" : "AB",
"agc_en" : false,
"agc_gain_init": 70,
"rxgainA" : [20],
"rxgainA" : [50],
"txgainA" : [40],
"rxgainB" : [20],
"rxgainB" : [50],
"txgainB" : [40],
"rate" : 5e6,
"frame_schedule" : [
"GGPPGGGGGGGGGGGGGGGG"
"GGPGGGGGGGGGGGGGGGGG"
],
"frame_mode" : "continuous_resync",
"subframe_size" : 640,
......
......@@ -321,10 +321,9 @@ void Receiver::getPathLoss()
* estimate pathloss. To be used for TX power control
*/
// OBCH
int bsTxGain = config_->txgain[0]; // "DECODED" FROM DL FRAME - Chain A (0)
auto clRxGain = config_->clRxgain_vec[0];
//int bsTxGain = config_->txgain[0]; // "DECODED" FROM DL FRAME - Chain A (0)
//auto clRxGain = config_->clRxgain_vec[0];
//
// Given RX gain and rssi, find power at antenna
// Subtract power at RX antenna from TX power to get path loss
}
......@@ -2,6 +2,9 @@ function y = getRxVec(tx_data, n_bs, n_ue, chan_type, snr, bs_param, ue_param, h
%%% Returns Rx vector passed through the channel type given in the input
%%% list.
assert(length(bs_param) == n_bs);
assert(length(ue_param) == n_ue);
if chan_type == "awgn"
% AWGN
tx_var = mean(mean(abs(tx_data).^2 )) * (64/48);
......@@ -197,45 +200,27 @@ elseif chan_type == "iris"
else
node_bs = iris_py(bs_param,[]); % initialize BS
end
node_ue1 = iris_py(ue_param(1),[]); % initialize UE
if n_ue >1
node_ue2 = iris_py(ue_param(2));
end
node_ue = iris_py(ue_param,[]); % initialize UE
node_ue1.sdr_configgainctrl();
if n_ue >1
node_ue2.sdr_configgainctrl(); % gain control
end
node_ue.sdr_configgainctrl();
node_bs.sdrsync(); % synchronize delays only for BS
node_ue1.sdrrxsetup(); % set up reading stream
if n_ue >1
node_ue2.sdrrxsetup();
end
node_ue.sdrrxsetup(); % set up reading stream
node_bs.sdrrxsetup();
chained_mode = 0;
node_bs.set_tddconfig(chained_mode,1); % configure the BS: schedule etc.
node_ue1.set_tddconfig(chained_mode,0);
if n_ue >1
node_ue2.set_tddconfig(chained_mode,0);
end
tdd_sched_index = 1; % for uplink only one frame schedule is sufficient
node_bs.set_tddconfig(1, tdd_sched_index); % configure the BS: schedule etc.
node_ue.set_tddconfig(0, tdd_sched_index);
node_bs.sdr_setupbeacon(); % Burn beacon to the BS(1) RAM
node_ue1.sdrtx(tx_data(:,1)); % Burn data to the UE RAM
if n_ue >1
node_ue2.sdrtx(tx_data(:,2));
for i=1:n_ue
node_ue.sdrtx_single(tx_data(:,i), i); % Burn data to the UE RAM
end
node_bs.sdr_activate_rx(); % activate reading stream
node_ue1.sdr_setcorr() % activate correlator
if n_ue >1
node_ue2.sdr_setcorr()
end
node_ue.sdr_setcorr() % activate correlator
%node_bs.sdrtrigger(trig); % set trigger to start the frame
% Iris Rx
......@@ -244,10 +229,7 @@ elseif chan_type == "iris"
[y, data0_len] = node_bs.sdrrx(n_samp); % read data
node_bs.sdr_close(); % close streams and exit gracefully.
node_ue1.sdr_close();
if n_ue >1
node_ue2.sdr_close();
end
node_ue.sdr_close();
fprintf('Length of the received vector from HW: \tUE:%d\n', data0_len);
......
......@@ -23,7 +23,7 @@ classdef iris_py < handle
py_obj_hub;
% Parameters to feed python (pun very intended!)
serial_ids;
n_chain; % number of Iris boards in a chain
n_sdrs; % number of Iris boards in a chain
sample_rate;
tx_freq;q
rx_freq;
......@@ -42,7 +42,7 @@ classdef iris_py < handle
if nargin > 0
if ~isempty(hub_id)
disp('Using hub with ID:');
id_str = convertStringsToChars(hub_id)
id_str = convertStringsToChars(hub_id);
obj.py_obj_hub = py.hub_py.Hub_py( pyargs('serial_id',id_str));
obj.use_hub = 1;
end
......@@ -50,7 +50,7 @@ classdef iris_py < handle
obj.sdr_params = sdr_params;
obj.serial_ids = sdr_params.id;
obj.n_chain = sdr_params.n_chain;
obj.n_sdrs = sdr_params.n_sdrs;
obj.sample_rate = sdr_params.sample_rate;
obj.tx_freq = sdr_params.txfreq;
obj.rx_freq = sdr_params.rxfreq;
......@@ -61,13 +61,12 @@ classdef iris_py < handle
obj.tdd_sched = sdr_params.tdd_sched; % This is an array
obj.n_zpad_samp = sdr_params.n_zpad_samp;
for ipy=1:obj.n_chain
for ipy=1:obj.n_sdrs
id_str = convertStringsToChars( obj.serial_ids(ipy));
py_obj = py.iris_py.Iris_py( pyargs('serial_id',id_str,...
'tx_freq', obj.tx_freq, 'rx_freq', obj.rx_freq,...
'tx_gain',obj.tx_gain,'rx_gain',obj.rx_gain,...
'sample_rate',obj.sample_rate, 'n_samp',...
obj.n_samp,'n_zpad_samp',obj.n_zpad_samp) );%,...
'sample_rate',obj.sample_rate, 'n_samp', obj.n_samp) );%,...
%'max_frames',obj.n_frame) );
obj.py_obj_array(ipy,:) = {py_obj};
......@@ -94,11 +93,15 @@ classdef iris_py < handle
end
function sdr_setcorr(obj)
obj.py_obj_array{1}.set_corr();
for ipy = 1:obj.n_sdrs
obj.py_obj_array{ipy}.set_corr();
end
end
function sdr_configgainctrl(obj)
obj.py_obj_array{1}.config_gain_ctrl();
for ipy = 1:obj.n_sdrs
obj.py_obj_array{ipy}.config_gain_ctrl();
end
end
function sdr_setupbeacon(obj)
......@@ -107,33 +110,22 @@ classdef iris_py < handle
end
function set_tddconfig(obj, chained_tx_rx, is_bs)
if chained_tx_rx
sched = convertStringsToChars((obj.tdd_sched));
obj.py_obj_array{1}.config_sdr_tdd_chained(pyargs('tdd_sched', sched));
else
sched = convertStringsToChars(obj.tdd_sched(1));
obj.py_obj_array{1}.config_sdr_tdd( pyargs('tdd_sched', sched, ...
'is_bs', is_bs));
if (obj.n_chain > 1)
sched2 = convertStringsToChars(obj.tdd_sched(2));
for ipy = 2:obj.n_chain
obj.py_obj_array{ipy}.config_sdr_tdd( pyargs('tdd_sched',sched2, ...
'is_bs', is_bs));
end
end
function set_tddconfig(obj, is_bs, index)
sched = convertStringsToChars(obj.tdd_sched(index));
for ipy = 1:obj.n_sdrs
obj.py_obj_array{ipy}.config_sdr_tdd( pyargs('tdd_sched',sched, ...
'is_bs', is_bs, 'prefix_len', obj.n_zpad_samp));
end
end
function sdrrxsetup(obj)
for ipy = 1:obj.n_chain
for ipy = 1:obj.n_sdrs
obj.py_obj_array{ipy}.setup_stream_rx();
end
end
function sdr_activate_rx(obj)
for ipy=1:obj.n_chain
for ipy=1:obj.n_sdrs
obj.py_obj_array{ipy}.activate_stream_rx();
end
end
......@@ -142,14 +134,20 @@ classdef iris_py < handle
function sdrtx(obj, data)
re = real(data).';
im = imag(data).';
for ipy = 1:obj.n_chain
for ipy = 1:obj.n_sdrs
obj.py_obj_array{ipy}.burn_data( pyargs('data_r', re, 'data_i', im) );
end
end
function sdrtx_single(obj, data, index)
re = real(data).';
im = imag(data).';
obj.py_obj_array{index}.burn_data( pyargs('data_r', re, 'data_i', im) );
end
% Read n_frame x n_samp data
function [data, len] = sdrrx(obj, n_samp)
data_raw = zeros(obj.n_chain, obj.n_frame*n_samp); % Change this to max frame!
data_raw = zeros(obj.n_sdrs, obj.n_frame*n_samp); % Change this to max frame!
for jf=1:obj.n_frame
%trigger beacon TX
......@@ -161,7 +159,7 @@ classdef iris_py < handle
disp('trig hub!!!!')
end
for ipy = 1:obj.n_chain
for ipy = 1:obj.n_sdrs
rcv_data = obj.py_obj_array{ipy}.recv_stream_tdd();
data_raw(ipy, (jf-1)*n_samp + 1: jf*n_samp) = double( py.array.array( 'd',py.numpy.nditer( py.numpy.real(rcv_data) ) ) ) + ...
1i*double( py.array.array( 'd',py.numpy.nditer( py.numpy.imag(rcv_data) ) ) );
......@@ -173,7 +171,7 @@ classdef iris_py < handle
function sdr_close(obj)
for ipy = 1:obj.n_chain
for ipy = 1:obj.n_sdrs
obj.py_obj_array{ipy}.close();
delete(obj.py_obj_array{ipy});
end
......@@ -207,20 +205,20 @@ classdef iris_py < handle
% Assume peak in the first 500 samples
lts_corr_frm = reshape(lts_corr_sum, [], obj.n_frame);
if obj.n_chain == 1 && length(lts_corr_frm >= 300)
if obj.n_sdrs == 1 && length(lts_corr_frm >= 300)
lts_corr_frm = lts_corr_frm(1:300,:);
elseif (obj.n_chain > 1) && length(lts_corr_frm >= 420)
elseif (obj.n_sdrs > 1) && length(lts_corr_frm >= 420)
lts_corr_frm = lts_corr_frm(1:420,:);
end
save my_data.mat lts_corr_dr lts_corr_frm
% Avg corr value per frame
frm_avg_corr = sum(lts_corr_frm,1)./obj.n_chain
frm_avg_corr = sum(lts_corr_frm,1)./obj.n_sdrs
% Take index of maximum corr. value
[max_corr, m_idx] = max(frm_avg_corr);
% Reshape data frame to n_samp-by-n_antenna-by-n_frame
data_split = zeros(obj.n_samp, obj.n_chain,obj.n_frame);
data_split = zeros(obj.n_samp, obj.n_sdrs,obj.n_frame);
for nf = 1:obj.n_frame
strt_idx = (nf-1)*obj.n_samp +1;
end_idx = nf*obj.n_samp;
......
......@@ -88,8 +88,6 @@ class Iris_py:
bw=None,
sample_rate=None,
n_samp=None, # Total number of samples, including zero-pads
n_zpad_samp=150, # Total number of samples used for zero-padding in prefix and postfix
# Number of frames TXed: How many times the schedule will be repeated
max_frames=1,
both_channels=False,
agc_en=False,
......@@ -109,7 +107,6 @@ class Iris_py:
self.agc_en = agc_en
self.both_channels = both_channels
self.n_zpad_samp = int(n_zpad_samp)
self.max_frames = int(max_frames)
### Setup channel rates, ports, gains, and filters ###
......@@ -172,28 +169,9 @@ class Iris_py:
'''enable the correlator, with inputs from adc'''
self.sdr.writeSetting("CORR_START", "A")
# Write SDR configuration (chained mode):
def config_sdr_tdd_chained(self, tdd_sched=None):
'''Configure the TDD schedule and functionality when chained.'''
if tdd_sched is not None:
self.tdd_sched = tdd_sched
else:
self.tdd_sched = "G"
print(tdd_sched)
max_frames = self.max_frames
conf_str = {"tdd_enabled": True,
"frame_mode": "free_running",
"symbol_size": self.n_samp,
"max_frame": max_frames,
"frames": [self.tdd_sched]}
self.sdr.writeSetting("TDD_CONFIG", json.dumps(conf_str))
self.sdr.writeSetting("TDD_MODE", "true")
self.sdr.writeSetting("TX_SW_DELAY", str(30))
def config_sdr_tdd(self, tdd_sched=None, is_bs=True, prefix_len=0):
'''Configure the TDD schedule and functionality when unchained. Set up the correlator.'''
global corr_threshold, beacon
len_beacon_zpad = len(beacon) + self.n_zpad_samp
coe = cfloat2uint32(np.conj(beacon), order='QI')
if tdd_sched is not None:
self.tdd_sched = tdd_sched
......
......@@ -43,8 +43,7 @@ else
RX_GN = 23;
SMPL_RT = 5e6;
N_FRM = 50;
b_ids = string.empty();
b_scheds = string.empty();
bs_ids = string.empty();
ue_ids = string.empty();
ue_scheds = string.empty();
end
......@@ -153,7 +152,7 @@ else
% calibration on the BS. This functionality will be added later.
% For now, we use only the 4-node chains:
b_ids = ["RF3E000134", "RF3E000191", "RF3E000171", "RF3E000105",...
bs_ids = ["RF3E000134", "RF3E000191", "RF3E000171", "RF3E000105",...
"RF3E000053", "RF3E000177", "RF3E000192", "RF3E000117",...
"RF3E000183", "RF3E000152", "RF3E000123", "RF3E000178", "RF3E000113", "RF3E000176", "RF3E000132", "RF3E000108", ...
"RF3E000143", "RF3E000160", "RF3E000025", "RF3E000034",...
......@@ -163,34 +162,22 @@ else
hub_id = "FH4A000001";
else
b_ids = ["RF3E000189", "RF3E000024", "RF3E000139", "RF3E000032", "RF3E000154", "RF3E000182", "RF3E000038", "RF3E000137"];
bs_ids = ["RF3E000189", "RF3E000024", "RF3E000139", "RF3E000032", "RF3E000154", "RF3E000182", "RF3E000038", "RF3E000137"];
end
ue_ids= ["RF3E000060", "RF3E000145"];
b_prim_sched = "PGGGGGGGGGGRGGGG"; % BS primary node's schedule: Send Beacon only from one Iris board
b_sec_sched = "GGGGGGGGGGGRGGGG";
ue_sched = "GGGGGGGGGGGPGGGG"; % UE schedule
bs_sched = ["BGGGGGGGGGGRGGGG"]; % BS schedule
ue_sched = ["GGGGGGGGGGGPGGGG"]; % UE schedule
% schedule for the other boards
b_scheds = b_prim_sched;
if (N_BS_NODE > 1)
b_scheds = [b_scheds b_sec_sched];
end
% UE schedule
ue_scheds = string.empty();
for iu = 1:N_UE
ue_scheds(iu,:) = ue_sched;
end
%number of samples in a frame
n_samp = length(tx_vecs_iris);
% Iris nodes' parameters
sdr_params = struct(...
'id', b_ids, ...
'n_chain',N_BS_NODE, ... % number of nodes chained together
bs_sdr_params = struct(...
'id', bs_ids, ...
'n_sdrs',N_BS_NODE, ... % number of nodes chained together
'txfreq', TX_FRQ, ...
'rxfreq', RX_FRQ, ...
'txgain', TX_GN, ...
......@@ -198,27 +185,22 @@ else
'sample_rate', SMPL_RT, ...
'n_samp', n_samp, ... % number of samples per frame time.
'n_frame', N_FRM, ...
'tdd_sched', b_scheds, ... % number of zero-paddes samples
'n_zpad_samp', (N_ZPAD_PRE + N_ZPAD_POST) ...
'tdd_sched', bs_sched, ... % number of zero-paddes samples
'n_zpad_samp', N_ZPAD_PRE ...
);
sdr_params(2) = sdr_params(1);
sdr_params(2).id = ue_ids(1);
sdr_params(2).n_chain = 1;
sdr_params(2).rxfreq = RX_FRQ;
sdr_params(2).txfreq = TX_FRQ;
sdr_params(2).txgain = TX_GN_ue;
sdr_params(2).tdd_sched = ue_scheds(1);
ue_sdr_params = bs_sdr_params;
ue_sdr_params.id = ue_ids;
ue_sdr_params.n_sdrs = 2;
ue_sdr_params.txgain = TX_GN_ue;
sdr_params(3)= sdr_params(2);
sdr_params(3).id = ue_ids(2);
ue_sdr_params.tdd_sched = ue_sched;
if USE_HUB
rx_vec_iris = getRxVec(tx_vecs_iris,N_BS_NODE, N_UE, chan_type, [], sdr_params(1), sdr_params(2:3), hub_id);
rx_vec_iris = getRxVec(tx_vecs_iris, N_BS_NODE, N_UE, chan_type, [], bs_sdr_params, ue_sdr_params, hub_id);
else
rx_vec_iris = getRxVec(tx_vecs_iris,N_BS_NODE, N_UE, chan_type, [], sdr_params(1), sdr_params(2:3), []);
rx_vec_iris = getRxVec(tx_vecs_iris, N_BS_NODE, N_UE, chan_type, [], bs_sdr_params, ue_sdr_params, []);
end
end
......
......@@ -49,8 +49,8 @@ else
RX_GN = 20;
SMPL_RT = 5e6;
N_FRM = 10;
b_ids = string.empty();
b_scheds = string.empty();
bs_ids = string.empty();
bs_sched = string.empty();
ue_ids = string.empty();
ue_scheds = string.empty();
......@@ -152,7 +152,7 @@ else
% calibration on the BS. This functionality will be added later.
% For now, we use only the 4-node chains:
b_ids = ["RF3E000134", "RF3E000191", "RF3E000171", "RF3E000105",...
bs_ids = ["RF3E000134", "RF3E000191", "RF3E000171", "RF3E000105",...
"RF3E000053", "RF3E000177", "RF3E000192", "RF3E000117",...
"RF3E000183", "RF3E000152", "RF3E000123", "RF3E000178", "RF3E000113", "RF3E000176", "RF3E000132", "RF3E000108", ...
"RF3E000143", "RF3E000160", "RF3E000025", "RF3E000034",...
......@@ -162,32 +162,21 @@ else
hub_id = "FH4A000001";
else
b_ids = ["RF3E000189", "RF3E000024", "RF3E000139", "RF3E000032", "RF3E000154", "RF3E000182", "RF3E000038", "RF3E000137"];
bs_ids = ["RF3E000189", "RF3E000024", "RF3E000139", "RF3E000032", "RF3E000154", "RF3E000182", "RF3E000038", "RF3E000137"];
end
ue_ids= "RF3E000060";
ue_id= ["RF3E000060"];
b_prim_sched = "PGGGGGRG"; % BS primary noede's schedule: Send Beacon only from one Iris board
b_sec_sched = "GGGGGGRG";
ue_sched = "GGGGGGPG"; % UE schedule
b_scheds = b_prim_sched;
if (N_BS_NODE > 1)
b_scheds = [b_scheds b_sec_sched];
end
ue_scheds = string.empty();
for iu = 1:N_UE
ue_scheds(iu,:) = ue_sched;
end
bs_sched = ["BGGGGGRG"]; % BS schedule
ue_sched = ["GGGGGGPG"]; % UE schedule
n_samp = length(tx_vec_iris);
% Iris nodes' parameters
sdr_params = struct(...
'id', b_ids, ...
'n_chain',N_BS_NODE, ...
bs_sdr_params = struct(...
'id', bs_ids, ...
'n_sdrs',N_BS_NODE, ...
'txfreq', TX_FRQ, ...
'rxfreq', RX_FRQ, ...
'txgain', TX_GN, ...
......@@ -195,21 +184,19 @@ else
'sample_rate', SMPL_RT, ...
'n_samp', n_samp, ... % number of samples per frame time.
'n_frame', N_FRM, ...
'tdd_sched', b_scheds, ... % number of zero-paddes samples
'n_zpad_samp', (N_ZPAD_PRE + N_ZPAD_POST) ...
'tdd_sched', bs_sched, ... % number of zero-paddes samples
'n_zpad_samp', N_ZPAD_PRE ...
);
sdr_params(2) = sdr_params(1);
sdr_params(2).id = ue_ids(1);
sdr_params(2).n_chain = 1;
sdr_params(2).txfreq = TX_FRQ;
sdr_params(2).rxfreq = RX_FRQ;
sdr_params(2).tdd_sched = ue_scheds(1);
ue_sdr_params = bs_sdr_params;
ue_sdr_params.id = ue_ids;
ue_sdr_params.n_sdrs = 1;
ue_sdr_params.tdd_sched = ue_sched;
if USE_HUB
rx_vec_iris = getRxVec(tx_vec_iris, N_BS_NODE, N_UE, chan_type, [], sdr_params(1), sdr_params(2), hub_id);
rx_vec_iris = getRxVec(tx_vec_iris, N_BS_NODE, N_UE, chan_type, [], bs_sdr_params, ue_sdr_params, hub_id);
else
rx_vec_iris = getRxVec(tx_vec_iris, N_BS_NODE, N_UE, chan_type, [], sdr_params(1), sdr_params(2), []);
rx_vec_iris = getRxVec(tx_vec_iris, N_BS_NODE, N_UE, chan_type, [], bs_sdr_params, ue_sdr_params, []);
end
end
rx_vec_iris = rx_vec_iris.';
......
......@@ -29,7 +29,7 @@ sim_H_var = 4;
%Iris params:
N_BS_NODE = 2;
N_UE = 1;
b_ids = string.empty();
bs_ids = string.empty();
b_scheds = string.empty();
ue_ids = string.empty();
ue_scheds = string.empty();
......@@ -162,49 +162,40 @@ else
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create a two Iris node objects:
b_ids = ["RF3E000189", "RF3E000024"];
ue_ids= "RF3E000060";
bs_ids = ["RF3E000189", "RF3E000024"];
ue_ids= ["RF3E000060"];
b_prim_sched = "PGGGGGRG"; % BS primary noede's schedule: Send Beacon only from one Iris board
b_sec_sched = "GGGGGGRG";
ue_sched = "GGGGGGPG"; % UE schedule
b_scheds = b_prim_sched;
if (N_BS_NODE > 1)
b_scheds = [b_scheds b_sec_sched];
end
ue_scheds = string.empty();
for iu = 1:N_UE
ue_scheds(iu,:) = ue_sched;
end
bs_sched = ["BGGGGGRG"]; % BS schedule
ue_sched = ["GGGGGGPG"]; % UE schedule
rxfreq = 2.5e9;
txfreq = 2.5e9;
n_samp = length(tx_vec_iris);
% Iris nodes' parameters
sdr_params = struct(...
'id', b_ids, ...
'n_chain',N_BS_NODE, ...
'txfreq', 2.5e9, ...
'rxfreq', 2.5e9, ...
bs_sdr_params = struct(...
'id', bs_ids, ...
'n_sdrs', N_BS_NODE, ...
'txfreq', txfreq, ...
'rxfreq', rxfreq, ...
'txgain', 42, ...
'rxgain', 23, ...
'sample_rate', 5e6, ...
'n_samp', n_samp, ... % number of samples per frame time.
'tdd_sched', b_scheds, ... % number of zero-paddes samples
'tdd_sched', bs_sched, ... % number of zero-paddes samples
'n_zpad_samp', (N_ZPAD_PRE + N_ZPAD_POST) ...
);
sdr_params(2) = sdr_params(1);
sdr_params(2).id = ue_ids(1);
sdr_params(2).n_chain = 1;
sdr_params(2).rxfreq = 2.5e9;
sdr_params(2).txfreq = 2.5e9;
sdr_params(2).tdd_sched = ue_scheds(1);
ue_sdr_params = bs_sdr_params;
ue_sdr_params.id = ue_ids;
ue_sdr_params.n_sdrs = 1;
ue_sdr_params.tdd_sched = ue_sched;
% Iris nodes objects
node_bs = iris_py(sdr_params(1));
node_ue = iris_py(sdr_params(2));
node_bs = iris_py(bs_sdr_params);
node_ue = iris_py(ue_sdr_params);
SAMP_FREQ = sdr_params(1).sample_rate;
SAMP_FREQ = bs_sdr_params.sample_rate;
%% Iris Tx UL
% Need to be done once for burst! Just burn the data onto the FPGAs RAM
......
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Author(s): C. Nicolas Barati nicobarati@rice.edu
% Rahman Doost-Mohamamdy: doost@rice.edu
%
%---------------------------------------------------------------------
% Original code copyright Mango Communications, Inc.
% Distributed under the WARP License http://warpproject.org/license
% Copyright (c) 2018-2019, Rice University
% RENEW OPEN SOURCE LICENSE: http://renew-wireless.org/license
% ---------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear
close all;
[version, executable, isloaded] = pyversion;
if ~isloaded
pyversion /usr/bin/python
py.print() %weird bug where py isn't loaded in an external script
end
% Params:
% Waveform params
N_OFDM_SYM = 0; % Number of OFDM symbols for burst, it needs to be less than 47
TX_SCALE = .5; % Scale for Tx waveform ([0:1])
CP_LEN = 16; % Cyclic prefix length
N_LTS_SYM = 20; % Number of
N_STS_SYM = 0; % Number of STS Symbols (taken as N_SC + CP_LEN units)
N_ZPAD_PRE = 70; % Zero-padding prefix for Iris
N_ZPAD_POST = N_ZPAD_PRE -14; % Zero-padding postfix for Iris
%% Define the pilot
% LTS for fine CFO and channel estimation
lts_f = [0 1 -1 -1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 -1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 ...
1 1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 1 1 -1 1 -1 1 1 1 1];
lts_t = ifft(lts_f, 64); %time domain
preamble =repmat(lts_t,1,10);
%% Iris Tx
% Need to be done once for burst! Just burn the data onto the FPGAs RAM
% Scale the Tx vector to +/- 1
% Construct the full time-domain OFDM waveform, no CP
tx_vec = [zeros(1,N_ZPAD_PRE) preamble zeros(1,N_ZPAD_POST)];
tx_vec_iris = tx_vec.';
tx_vec_iris = TX_SCALE .* tx_vec_iris ./ max(abs(tx_vec_iris));
%% Init Iris nodes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set up the Iris nodes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create a two Iris node objects:
b_sched = "PGGGGGRG"; % BS schedule
u_sched = "GGGGGGPG"; % UE schedule
n_samp = length(tx_vec_iris);
% Create a vector of node objects
sdr_params = struct(...
'id', "RF3E000189", ...
'n_chain',1, ...
'txfreq', 2.5e9, ...
'rxfreq', 2.5e9, ...
'txgain', 40, ...
'rxgain', 20, ...
'sample_rate', 5e6, ...
'n_samp', n_samp, ... % number of samples per frame time.
'tdd_sched', b_sched, ... % number of zero-paddes samples
'n_zpad_samp', (N_ZPAD_PRE + N_ZPAD_POST) ...
);
sdr_params(2) = sdr_params(1);
sdr_params(2).id = "RF3E000145";
sdr_params(2).rxfreq = 2.5e9;
sdr_params(2).txfreq = 2.5e9;
sdr_params(2).tdd_sched = u_sched;
node_bs = iris_py(sdr_params(1));
node_ue = iris_py(sdr_params(2));
trig = 1;
node_ue.sdrsync(0); %is_bs = 0
node_ue.sdrrxsetup();
node_bs.sdrrxsetup();
chained_mode = 0;
node_bs.set_config(chained_mode,1); % chained_tx_rx =0 is_bs = 1
node_ue.set_config(chained_mode,0); % chained_tx_rx =0 is_bs = 0
node_bs.sdr_txbeacon(N_ZPAD_PRE);
node_ue.sdrtx(tx_vec_iris);
node_bs.sdr_activate_rx();
node_ue.sdr_setcorr()
node_bs.sdrtrigger(trig);
%% Iris Rx
% Only UL data:
[rx_vec_iris, data0_len] = node_bs.sdrrx(n_samp);
node_bs.sdr_close();
node_ue.sdr_close();
fprintf('Matlab script: Length of the received vector: \tUE:%d\n', data0_len);
rx_vec_iris = rx_vec_iris.';
raw_rx_dec = rx_vec_iris(:,1).';
rx_vec_air = raw_rx_dec;
%% Rx signal plot
figure; clf;
subplot(2,1,1);
plot(real(rx_vec_air), 'b');
axis([0 length(rx_vec_air) -TX_SCALE TX_SCALE])
grid on;
title('Rx Waveform (I)');
subplot(2,1,2);
plot(imag(rx_vec_air), 'r');
axis([0 length(rx_vec_air) -TX_SCALE TX_SCALE])
grid on;
title('Rx Waveform (Q)');
......@@ -54,10 +54,10 @@ RX_GN = 20;
SMPL_RT = 5e6;
N_FRM = 10;
b_ids = string.empty();
b_scheds = string.empty();
bs_ids = string.empty();
bs_sched = string.empty();
ue_ids = string.empty();
ue_scheds = string.empty();
ue_sched = string.empty();
% Waveform params
......@@ -146,25 +146,18 @@ else
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create two Iris node objects:
b_ids(end+1) = "RF3E000189";
ue_ids(end+1) = "RF3E000060";
bs_ids = ["RF3E000189"];
ue_ids = ["RF3E000060"];
b_prim_sched = "BGGGGGRG"; % BS primary noede's schedule: Send Beacon only from one Iris board
ue_sched = "GGGGGGPG"; % UE schedule
b_scheds = b_prim_sched;
ue_scheds = string.empty();
for iu = 1:N_UE
ue_scheds(iu,:) = ue_sched;
end
bs_sched = ["BGGGGGRG"]; % BS schedule
ue_sched = ["GGGGGGPG"]; % UE schedule
n_samp = length(tx_vec_iris);
% Iris nodes' parameters
sdr_params = struct(...
'id', b_ids, ...
'n_chain',N_BS_NODE, ...
bs_sdr_params = struct(...
'id', bs_ids, ...
'n_sdrs',N_BS_NODE, ...
'txfreq', TX_FRQ, ...
'rxfreq', RX_FRQ, ...
'txgain', TX_GN, ...
......@@ -172,18 +165,16 @@ else
'sample_rate', SMPL_RT, ...
'n_samp', n_samp, ... % number of samples per frame time.
'n_frame', N_FRM, ...
'tdd_sched', b_scheds, ... % number of zero-paddes samples
'n_zpad_samp', (N_ZPAD_PRE + N_ZPAD_POST) ...
'tdd_sched', bs_sched, ... % number of zero-paddes samples
'n_zpad_samp', N_ZPAD_PRE ...
);
sdr_params(2) = sdr_params(1);
sdr_params(2).id = ue_ids(1);
sdr_params(2).n_chain = 1;
sdr_params(2).txfreq = TX_FRQ;
sdr_params(2).rxfreq = RX_FRQ;
sdr_params(2).tdd_sched = ue_scheds(1);
ue_sdr_params = bs_sdr_params;
ue_sdr_params.id = ue_ids;
ue_sdr_params.n_sdrs = 1;
ue_sdr_params.tdd_sched = ue_sched;
rx_vec_iris = getRxVec(tx_vec_iris, N_BS_NODE, N_UE, chan_type, [], sdr_params(1), sdr_params(2), []);
rx_vec_iris = getRxVec(tx_vec_iris, N_BS_NODE, N_UE, chan_type, [], bs_sdr_params, ue_sdr_params, []);
end
rx_vec_iris = rx_vec_iris.';
......
This diff is collapsed.
......@@ -28,7 +28,7 @@
---------------------------------------------------------------------
"""
import matplotlib
matplotlib.use('GTK3Agg')
#matplotlib.use('GTK3Agg')
import sys
sys.path.append('../IrisUtils/')
......@@ -43,7 +43,7 @@ import pickle
import scipy.signal
import matplotlib.pyplot as plt
from matplotlib import animation
from SoapySDR import * # SOAPY_SDR constants
#from SoapySDR import * # SOAPY_SDR constants
from optparse import OptionParser
from digital_rssi import *
from fft_power import *
......@@ -53,6 +53,7 @@ from file_rdwr import *
from bandpower import *
from generate_sequence import *
matplotlib.rcParams.update({'font.size': 10})
from MyFuncAnimation import *
#########################################
......@@ -321,8 +322,11 @@ def rxsamples_app(args, srl, freq, bw, rxgain, clockRate, out):
# Start AGC thread
threadT.start()
anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=100, interval=100, blit=True)
#anim = animation.FuncAnimation(fig, animate, init_func=init,
# frames=100, interval=100, blit=True)
anim = MyFuncAnimation(fig, animate, init_func=init,
frames=100, interval=100, blit=True)
plt.show()
if out is not None:
fig.savefig(out)
......
......@@ -49,7 +49,7 @@ import pickle
from macros import *
from SoapySDR import * # SOAPY_SDR_ constants
from optparse import OptionParser
from matplotlib import animation
#from matplotlib import animation
from data_recorder import *
from find_lts import *
from digital_rssi import *
......@@ -59,6 +59,7 @@ from type_conv import *
from print_sensor import *
from ofdmtxrx import *
from init_fncs import *
from MyFuncAnimation import *
plt.style.use('ggplot')
......@@ -507,9 +508,10 @@ def txrx_app(args, rate, ampl, ant, txgain, rxgain, freq, bbfreq, serialTx, seri
else:
# Simulation Mode
rxStream = []
sdrTx = []
# Start animation
anim = animation.FuncAnimation(fig, animate,
anim = MyFuncAnimation(fig, animate,
init_func=init,
fargs=(num_samps_rd, rxStream, sdrRx, sdrTx, ofdm_params, tx_struct, ota, ofdm_obj, agc_en),
frames=100,
......
......@@ -56,7 +56,7 @@ import logging
import pdb
from SoapySDR import * # SOAPY_SDR_ constants
from optparse import OptionParser
from matplotlib import animation
#from matplotlib import animation
from data_recorder import *
from find_lts import *
from digital_rssi import *
......@@ -65,6 +65,7 @@ from file_rdwr import *
from fft_power import *
from macros import *
from init_fncs import *
from MyFuncAnimation import *
#########################################
# Global Parameters #
......@@ -242,8 +243,11 @@ def rxsamples_app(srl, freq, gain, num_samps, recorder, agc_en, wait_trigger):
# RSSI read setup
setUpDigitalRssiMode(sdr)
anim = animation.FuncAnimation(fig, animate, init_func=init, fargs=(num_samps, recorder, agc_en, wait_trigger), frames=100,
interval=100, blit=True)
#anim = animation.FuncAnimation(fig, animate, init_func=init, fargs=(num_samps, recorder, agc_en, wait_trigger), frames=100,
# interval=100, blit=True)
anim = MyFuncAnimation(fig, animate, init_func=init, fargs=(num_samps, recorder, agc_en, wait_trigger), frames=100,
interval=100, blit=True)
plt.show()
......@@ -408,7 +412,7 @@ def main():
parser.add_option("--elevation", type="float", dest="elevation", help="Elevation", default=0.0)
parser.add_option("--freq", type="float", dest="freq", help="Optional Rx freq (Hz)", default=3.6e9)
parser.add_option("--numSamps", type="int", dest="numSamps", help="Num samples to receive", default=16384)
parser.add_option("--serial", type="string", dest="serial", help="Serial number of the device", default="RF3E000392") # "RF3E000375" "RF3E000392"
parser.add_option("--serial", type="string", dest="serial", help="Serial number of the device", default="")
parser.add_option("--rxMode", type="string", dest="rxMode", help="RX Mode, Options:BASIC/REC/REPLAY", default="BASIC")
parser.add_option("--AGCen", type="int", dest="AGCen", help="Enable AGC Flag. Options:0/1", default=0)
parser.add_option("--wait-trigger", action="store_true", dest="wait_trigger", help="wait for a trigger to start a frame",default=False)
......
0339
0268
0282
0344
0233
0334
0402
RF3E000103
RF3E000180
RF3E000181
RF3E000188
RF3E000183
RF3E000152
RF3E000123
RF3E000178
RF3E000113
RF3E000176
RF3E000132
RF3E000108
RF3E000189
RF3E000024
RF3E000139
RF3E000032
RF3E000154
RF3E000182
RF3E000038
RF3E000137
RF3E000053
RF3E000177
RF3E000192
RF3E000117
RF3E000134
RF3E000191
RF3E000171
RF3E000105
RF3E000143
RF3E000160
RF3E000025
RF3E000034