task 5 done
This commit is contained in:
+101
@@ -0,0 +1,101 @@
|
||||
markers = 'ox*sd^v><ph+ox*sd^v><ph+';
|
||||
|
||||
if do_task5_1
|
||||
progressTitle = "Task 5.1";
|
||||
progressStartText = "Starting channel profile sweep";
|
||||
f = waitbar(0, progressStartText, "Name", progressTitle);
|
||||
|
||||
progressTotal = numel(ntn_tdl_delay_profiles) * numel(snrs);
|
||||
progressQueue = parallel.pool.DataQueue;
|
||||
|
||||
parfor_waitbar(f, progressTotal, progressStartText, true);
|
||||
progressListener = afterEach(progressQueue, @(info) parfor_waitbar(f, progressTotal, info, false));
|
||||
|
||||
errorRates = zeros(numel(ntn_tdl_delay_profiles), numel(snrs));
|
||||
|
||||
for profile_idx = 1 : numel(ntn_tdl_delay_profiles)
|
||||
currentProfile = ntn_tdl_delay_profiles(profile_idx);
|
||||
[cfgEHT, simParameters, channel, chInfo, maxChDelay, satelliteDopplerShift, chanBW] = create_baseline_configuration(currentProfile, bandwidth, false, "None", carrier_frequency, 0, 0, leo_altitude, random_stream, seed, tx_antenna_count, rx_antenna_count, apep);
|
||||
|
||||
cfgEHT.User{1}.MCS = mcs_t1;
|
||||
errorRatesForProfile = zeros(1, numel(snrs));
|
||||
|
||||
parfor snr_idx = 1 : numel(snrs)
|
||||
local_channel = clone(channel);
|
||||
[errorCount, packetCount, ~] = simulateTransmission(cfgEHT, local_channel, maxChDelay, snrs(snr_idx), packets_per_snr, maxNumErrors, simParameters, chanBW, snr_idx, elevationAngles);
|
||||
errorRatesForProfile(snr_idx) = errorCount / packetCount;
|
||||
send(progressQueue, sprintf("Channel Profile %s | SNR %.1f dB", currentProfile, snrs(snr_idx)));
|
||||
end
|
||||
|
||||
errorRates(profile_idx, :) = errorRatesForProfile;
|
||||
end
|
||||
|
||||
delete(progressListener);
|
||||
if ishandle(f)
|
||||
close(f);
|
||||
end
|
||||
|
||||
figure;
|
||||
for profile_idx = 1 : numel(ntn_tdl_delay_profiles)
|
||||
semilogy(snrs, errorRates(profile_idx, :).', ['-' markers(profile_idx)]);
|
||||
hold on;
|
||||
end
|
||||
grid on;
|
||||
xlabel('SNR (dB)');
|
||||
ylabel('PER');
|
||||
dataStr = "Profile " + ntn_tdl_delay_profiles;
|
||||
legend(dataStr, 'Location', 'NorthEastOutside');
|
||||
title('PER over SNR, Channel Profile Sweep');
|
||||
end
|
||||
|
||||
if do_task5_2
|
||||
cfrBandwidth = 320;
|
||||
representativeSnr = 30;
|
||||
representativeCfrByProfile = cell(1, numel(ntn_tdl_delay_profiles));
|
||||
|
||||
progressTitle = "Task 5.2";
|
||||
progressStartText = "Starting CFR profile comparison";
|
||||
f = waitbar(0, progressStartText, "Name", progressTitle);
|
||||
|
||||
progressTotal = numel(ntn_tdl_delay_profiles);
|
||||
progressQueue = parallel.pool.DataQueue;
|
||||
|
||||
parfor_waitbar(f, progressTotal, progressStartText, true);
|
||||
progressListener = afterEach(progressQueue, @(info) parfor_waitbar(f, progressTotal, info, false));
|
||||
|
||||
parfor profile_idx = 1 : numel(ntn_tdl_delay_profiles)
|
||||
currentProfile = ntn_tdl_delay_profiles(profile_idx);
|
||||
[cfgEHT, simParameters, channel, chInfo, maxChDelay, satelliteDopplerShift, chanBW] = create_baseline_configuration(currentProfile, cfrBandwidth, false, "None", carrier_frequency, 0, 0, leo_altitude, random_stream, seed, tx_antenna_count, rx_antenna_count, apep);
|
||||
|
||||
cfgEHT.User{1}.MCS = mcs_t1;
|
||||
local_channel = clone(channel);
|
||||
[~, ~, cfrMagnitudes] = simulateTransmission(cfgEHT, local_channel, maxChDelay, representativeSnr, 1, 1, simParameters, chanBW, profile_idx, elevationAngles);
|
||||
|
||||
if ~isempty(cfrMagnitudes)
|
||||
representativeCfrByProfile{profile_idx} = cfrMagnitudes(:, 1);
|
||||
end
|
||||
|
||||
send(progressQueue, sprintf("Channel Profile %s | SNR %.1f dB", currentProfile, representativeSnr));
|
||||
end
|
||||
|
||||
delete(progressListener);
|
||||
if ishandle(f)
|
||||
close(f);
|
||||
end
|
||||
|
||||
figure;
|
||||
for profile_idx = 1 : numel(ntn_tdl_delay_profiles)
|
||||
if isempty(representativeCfrByProfile{profile_idx})
|
||||
warning("No CFR collected for profile %s at %.1f dB SNR.", ntn_tdl_delay_profiles(profile_idx), representativeSnr);
|
||||
continue;
|
||||
end
|
||||
plot(representativeCfrByProfile{profile_idx}, ['-' markers(profile_idx)]);
|
||||
hold on;
|
||||
end
|
||||
|
||||
grid on;
|
||||
xlabel("Subcarrier index");
|
||||
ylabel("|H[k]|");
|
||||
legend("Profile " + ntn_tdl_delay_profiles, 'Location', 'NorthEastOutside');
|
||||
title(sprintf("CFR magnitude for representative packet at %.1f dB SNR", representativeSnr));
|
||||
end
|
||||
Reference in New Issue
Block a user