Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
07d18bb4
Commit
07d18bb4
authored
Oct 07, 2013
by
Florian Kaltenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git-svn-id:
http://svn.eurecom.fr/openair4G/trunk@4181
818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent
047913d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
26 deletions
+60
-26
targets/PROJECTS/TDDREC/beamforming.m
targets/PROJECTS/TDDREC/beamforming.m
+31
-18
targets/PROJECTS/TDDREC/calibration.m
targets/PROJECTS/TDDREC/calibration.m
+9
-1
targets/PROJECTS/TDDREC/genrandpskseq.m
targets/PROJECTS/TDDREC/genrandpskseq.m
+7
-7
targets/PROJECTS/TDDREC/ofdm_mod.m
targets/PROJECTS/TDDREC/ofdm_mod.m
+13
-0
No files found.
targets/PROJECTS/TDDREC/beamforming.m
View file @
07d18bb4
...
...
@@ -2,6 +2,7 @@
signalA2B
=
zeros
(
N
,
4
);
signalB2A
=
zeros
(
N
,
4
);
signalB2A_prec
=
zeros
(
N
,
4
);
signalB2A_diag
=
zeros
(
N
,
4
);
%%----------Node A to B transmission---------%%
for
i
=
1
:
4
...
...
@@ -37,7 +38,9 @@ chanestsA2B=reshape(diag(repmat(Da2b_T,1,Nantb)'*Da2b_R)/size(Da2b_T,1),301,Nant
for
i
=
1
:
301
YA
=
chanestsA2B
(
i
,:)
.'
;
F
=
Fs
(:,:,
i
);
Bd
(:,
i
)
=
conj
(
F
*
YA
)
.
/
norm
(
F
*
YA
);
Fd
=
Fds
(:,:,
i
);
BFs
(:,
i
)
=
conj
(
F
*
YA
)
.
/
norm
(
F
*
YA
);
BDs
(:,
i
)
=
conj
(
Fd
*
YA
)
.
/
norm
(
Fd
*
YA
);
end
%% generate normal and beamformed signals
...
...
@@ -45,24 +48,24 @@ end
for
i
=
1
:
size
(
seqf
,
1
)
% precoding
for
j
=
1
:
size
(
seqf
,
2
)
symbol_prec
(:,
j
)
=
Bd
(:,
j
)
*
seqf
(
i
,
j
);
seqf_prec_full
(:,
i
,
j
)
=
BFs
(:,
j
)
*
seqf
(
i
,
j
);
seqf_prec_diag
(:,
i
,
j
)
=
BDs
(:,
j
)
*
seqf
(
i
,
j
);
end
% insert zero subcarriers
symbol_prec
=
cat
(
2
,
zeros
(
3
,
1
),
symbol_prec
(:,
1
:
150
),
zeros
(
3
,
210
),
symbol_prec
(:,
151
:
301
));
% ofdm modulation
symbol_prec_t
=
ifft
(
symbol_prec
,
512
,
2
);
% Adding cycl. prefix making the block of 640 elements
symbol_prec_cp
=
cat
(
2
,
symbol_prec_t
(:,
end
-
127
:
end
),
symbol_prec_t
);
tmps_prec
(:,[
1
:
640
]
+
(
i
-
1
)
*
640
)
=
floor
(
amp
*
symbol_prec_cp
);
end
tmps_prec_diag
=
ofdm_mod
(
seqf_prec_full
,
amp
);
tmps_prec_full
=
ofdm_mod
(
seqf_prec_diag
,
amp
);
%%
for
i
=
1
:
4
if
(
active_rfB
(
i
))
signalB2A
(:,
i
)
=
floor
(
tmps
/
sqrt
(
3
))
*
2
;
%make sure LSB is 0 (switch=tx)
signalB2A_prec
(:,
i
)
=
tmps_prec
(
i
-
1
,:)
*
2
;
%make sure LSB is 0 (switch=tx)
signalB2A_prec_full
(:,
i
)
=
tmps_prec_full
(
i
-
1
,:)
*
2
;
%make sure LSB is 0 (switch=tx)
signalB2A_prec_diag
(:,
i
)
=
tmps_prec_diag
(
i
-
1
,:)
*
2
;
%make sure LSB is 0 (switch=tx)
else
signalB2A
(:,
i
)
=
repmat
(
1
+
1
j
,
76800
,
1
);
%make sure LSB is 1 (switch=rx)
signalB2A_prec
(:,
i
)
=
repmat
(
1
+
1
j
,
76800
,
1
);
%make sure LSB is 1 (switch=rx)
signalB2A
(:,
i
)
=
repmat
(
1
+
1
j
,
76800
,
1
);
%make sure LSB is 1 (switch=rx)
signalB2A_prec_full
(:,
i
)
=
repmat
(
1
+
1
j
,
76800
,
1
);
%make sure LSB is 1 (switch=rx)
signalB2A_prec_diag
(:,
i
)
=
repmat
(
1
+
1
j
,
76800
,
1
);
%make sure LSB is 1 (switch=rx)
end
end
...
...
@@ -77,17 +80,27 @@ sleep(0.01);
P_rx
=
10
*
log10
(
mean
(
abs
(
receivedB2A
(:,
1
))
.^
2
))
%% send beamformed DL signal
P_tx_prec
=
10
*
log10
(
sum
(
mean
(
abs
(
signalB2A_prec
(:,
2
:
4
))
.^
2
)))
oarf_send_frame
(
card
,
signalB2A_prec
,
n_bit
);
P_tx_prec_diag
=
10
*
log10
(
sum
(
mean
(
abs
(
signalB2A_prec_diag
(:,
2
:
4
))
.^
2
)))
oarf_send_frame
(
card
,
signalB2A_prec_diag
,
n_bit
);
%keyboard
sleep
(
0.01
);
receivedB2A_prec_diag
=
oarf_get_frame
(
card
);
sleep
(
0.01
);
% measure SNR
P_rx_prec_diag
=
10
*
log10
(
mean
(
abs
(
receivedB2A_prec_diag
(:,
1
))
.^
2
))
%% send beamformed DL signal
P_tx_prec_full
=
10
*
log10
(
sum
(
mean
(
abs
(
signalB2A_prec_full
(:,
2
:
4
))
.^
2
)))
oarf_send_frame
(
card
,
signalB2A_prec_full
,
n_bit
);
%keyboard
sleep
(
0.01
);
receivedB2A_prec
=
oarf_get_frame
(
card
);
receivedB2A_prec
_full
=
oarf_get_frame
(
card
);
sleep
(
0.01
);
% measure SNR
P_rx_prec
=
10
*
log10
(
mean
(
abs
(
receivedB2A_prec
(:,
1
))
.^
2
))
P_rx_prec
_full
=
10
*
log10
(
mean
(
abs
(
receivedB2A_prec_full
(:,
1
))
.^
2
))
figure
(
10
)
bar
([
P_tx
P_tx_prec
;
P_rx
P_rx_prec
]);
legend
(
'normal'
,
'beamformed'
)
bar
([
P_tx
P_tx_prec
_diag
P_tx_prec_full
;
P_rx
P_rx_prec_diag
P_rx_prec_full
]);
legend
(
'normal'
,
'beamformed
F diag'
,
'beamformed F full
'
)
ylim
([
0
60
])
drawnow
targets/PROJECTS/TDDREC/calibration.m
View file @
07d18bb4
...
...
@@ -19,10 +19,18 @@ end
Fs
=
zeros
(
Nantb
,
Nantb
,
301
);
for
s
=
1
:
301
[
F
,
HA
]
=
alterproj
(
CHB2A
,
CHA2B
,
s
,
Nantb
,
N_loc
,
Nmeas
);
Fs
(:,:,
s
)
=
F
;
Fs
(:,:,
s
)
=
F
;
%HAs{s}=HA;
end
%% calculate the diag F matrix based on last position
Fds
=
zeros
(
Nantb
,
Nantb
,
301
);
for
s
=
1
:
301
CHA
=
squeeze
(
chanestsA2B
(
s
,:,:));
CHB
=
aqueeze
(
chanestsB2A
(
s
,:,:));
Fds
(:,:,
s
)
=
diag
(
diag
(
CHB
*
CHA
')./diag(CHA*CHA'
));
end
%% plot F
figure
(
1
)
clf
...
...
targets/PROJECTS/TDDREC/genrandpskseq.m
View file @
07d18bb4
#
% Author: Mirsad Cirkic
#
% Organisation: Eurecom (and Linkoping University)
#
% E-mail: mirsad.cirkic@liu.se
% Author: Mirsad Cirkic
% Organisation: Eurecom (and Linkoping University)
% E-mail: mirsad.cirkic@liu.se
function
[
carrierdata
,
s
]
=
genrandpskseq
(
N
,
M
,
amp
)
if
(
mod
(
N
,
640
)
~=
0
)
error
(
'The sequence length must be divisible with 640.'
);
end
if
end
s
=
zeros
(
N
,
1
);
MPSK
=
exp
(
sqrt
(
-
1
)
*
([
1
:
M
]
*
2
*
pi
/
M
+
pi
/
M
));
...
...
@@ -18,12 +18,12 @@ for i=0:(N/640-1)
datablock
=
MPSK
(
ceil
(
rand
(
301
,
1
)
*
M
));
for
j
=
1
:
301
carrierdata
(
i
+
1
,
j
)
=
datablock
(
j
);
end
for
end
fblock
=
[
0
datablock
(
1
:
150
)
zeros
(
1
,
210
)
datablock
(
151
:
301
)];
ifblock
=
ifft
(
fblock
,
512
);
% Adding cycl. prefix making the block of 640 elements
block
=
[
ifblock
(
end
-
127
:
end
)
ifblock
];
s
([
1
:
640
]
+
i
*
640
)
=
floor
(
amp
*
block
);
end
for
end
endfunction
\ No newline at end of file
end
\ No newline at end of file
targets/PROJECTS/TDDREC/ofdm_mod.m
0 → 100644
View file @
07d18bb4
function
sigt
=
ofdm_mod
(
sigf
,
amp
)
[
Nant
,
Nsymb
,
Nsub
]
=
size
(
sigf
);
sigt
=
zeros
(
Nant
,
Nsymb
*
640
);
for
i
=
1
:
Nsymb
symbol
=
squeeze
(
sigf
(:,
i
,:));
% insert zero subcarriers
symbol
=
cat
(
2
,
zeros
(
Nant
,
1
),
symbol
(:,
1
:
150
),
zeros
(
Nant
,
210
),
symbol
(:,
151
:
301
));
% ofdm modulation
symbol_t
=
ifft
(
symbol
,
512
,
2
);
% Adding cycl. prefix making the block of 640 elements
symbol_cp
=
cat
(
2
,
symbol_t
(:,
end
-
127
:
end
),
symbol_t
);
sigt
(:,(
1
:
640
)
+
(
i
-
1
)
*
640
)
=
floor
(
amp
*
symbol_cp
);
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment