File size: 2,551 Bytes
7c5589a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
function [H, PG] = genChannelDrop(par, v, samples_per_sec)

    % Distance
    dist_tot = v * par.sequenceLength / samples_per_sec;
    samples_per_meter = 1 / (dist_tot / par.sequenceLength);
    
%     par.l.simpar.samples_per_meter = samples_per_meter; not necessary

    % Create tracks
    for i = 1:par.l.no_rx
        name = par.l.track(1, i).name;
        par.l.track(1, i) = qd_track('linear', 1/samples_per_meter*(par.sequenceLength - 1));
        par.l.track(1, i).name = name;
        par.l.track(1, i).scenario = 'BERLIN_UMa_NLOS';
    end

    % Add random positions
    distances = sqrt(rand(1, par.l.no_rx)*(par.maxDistance^2 - par.minDistance^2)+par.minDistance^2);
    angles = (2 * rand(1, par.l.no_rx) - 1) * par.sectorAngleRad;
    par.l.rx_position = [cos(angles) .* distances; sin(angles) .* distances; 1.5 .* ones(1, par.l.no_rx)];

    for i = 1:par.l.no_rx
        par.l.track(1, i).movement_profile = ...
            [0, 1 / samples_per_meter * (par.sequenceLength - 1) / v; ...
            0, 1 / samples_per_meter * (par.sequenceLength - 1)];

        par.l.track(1, i).interpolate('time', 1/samples_per_sec);
    end

    %     for i=1:par.l.no_rx
    %         a = par.l.track(1,i).initial_position+par.l.track(1,i).positions;
    %         if sum(abs(atan(a(2,:)./a(1,:))) > par.sectorAngleRad)
    %             disp('Out of sector angle')
    %             i
    %         end
    %         if sum(sqrt(a(1,:).^2+a(2,:).^2) > par.maxDistance)
    %             disp('Out of range r')
    %             i
    %         end
    %     end

    % Get channel impulse reponses
    H_raw = par.l.get_channels();

    % Get channels in frequency domain: only consider single carrier
    H = zeros(1, par.l.no_rx, par.l.tx_array.no_elements, par.sequenceLength);

    PG = zeros(1, par.l.no_rx);

    for k = 1:par.l.no_rx
        h = squeeze(H_raw(k).fr(par.bandwidth, 1, 1:par.sequenceLength));

        pg = sqrt(10.^(0.1 * H_raw(k).par.pg_parset));
        h = h / pg;

%         Visualize channels
%         figure
%         surf(real(h), 'EdgeColor', 'None');
%         view(2)
%         title('Real part CSI sample sequence')
%         xlabel('shapshots')
%         ylabel('BS antennas')

        %         figure
        %         surf(imag(h));
        %         view(2)
        %         title('Imag part CSI sample sequence')
        %         xlabel('n shapshots')
        %         ylabel('BS antennas')


        H(1, k, :, :) = single(h);
        PG(1, k) = single(pg);
    end
    H = {H};
    PG = {PG};
end