added more radio metrics
This commit is contained in:
@@ -24,16 +24,25 @@ function [f, R] = plotRadioLogs(resultsPath)
|
||||
R{ii}(bad, :) = [];
|
||||
end
|
||||
|
||||
% Compute path loss from Power (post-processing)
|
||||
% Power = 20*log10(peak_mag) - rxGain; path loss = txGain - rxGain - Power
|
||||
txGain_dB = 76; % from startchannelsounderTXGRC.sh GAIN_TX
|
||||
rxGain_dB = 30; % from startchannelsounderRXGRC.sh GAIN_RX
|
||||
for ii = 1:numel(R)
|
||||
R{ii}.PathLoss = txGain_dB - rxGain_dB - R{ii}.Power;
|
||||
R{ii}.FreqOffset = R{ii}.FreqOffset / 1e6; % Hz to MHz
|
||||
end
|
||||
|
||||
% Build legend labels and color map for up to 4 UAVs
|
||||
nUAV = numel(R);
|
||||
colors = lines(nUAV * nUAV);
|
||||
styles = ["-o", "-s", "-^", "-d", "-v", "-p", "-h", "-<", "->", "-+", "-x", "-*"];
|
||||
|
||||
metricNames = ["SNR", "Power", "Quality"];
|
||||
yLabels = ["SNR (dB)", "Power (dB)", "Quality"];
|
||||
metricNames = ["SNR", "Power", "Quality", "PathLoss", "NoiseFloor", "FreqOffset"];
|
||||
yLabels = ["SNR (dB)", "Power (dB)", "Quality", "Path Loss (dB)", "Noise Floor (dB)", "Freq Offset (MHz)"];
|
||||
|
||||
f = figure;
|
||||
tl = tiledlayout(3, 1, 'TileSpacing', 'compact', 'Padding', 'compact');
|
||||
tl = tiledlayout(numel(metricNames), 1, 'TileSpacing', 'compact', 'Padding', 'compact');
|
||||
|
||||
for mi = 1:numel(metricNames)
|
||||
ax = nexttile(tl);
|
||||
|
||||
@@ -4,19 +4,19 @@ function R = readRadioLogs(logPath)
|
||||
end
|
||||
|
||||
arguments (Output)
|
||||
R (:, 6) table;
|
||||
R (:, 8) table;
|
||||
end
|
||||
|
||||
% Extract receiving UAV ID from directory name (e.g. "uav0_..." → 0)
|
||||
[~, dirName] = fileparts(logPath);
|
||||
rxID = int32(sscanf(dirName, 'uav%d'));
|
||||
|
||||
metrics = ["quality", "snr", "power"];
|
||||
metrics = ["quality", "snr", "power", "noisefloor", "freqoffset"];
|
||||
logs = dir(logPath);
|
||||
logs = logs(endsWith({logs(:).name}, metrics + "_log.txt"));
|
||||
|
||||
R = table(datetime.empty(0,1), zeros(0,1,'int32'), zeros(0,1,'int32'), zeros(0,1), zeros(0,1), zeros(0,1), ...
|
||||
'VariableNames', ["Timestamp", "TxUAVID", "RxUAVID", "SNR", "Power", "Quality"]);
|
||||
R = table(datetime.empty(0,1), zeros(0,1,'int32'), zeros(0,1,'int32'), zeros(0,1), zeros(0,1), zeros(0,1), zeros(0,1), zeros(0,1), ...
|
||||
'VariableNames', ["Timestamp", "TxUAVID", "RxUAVID", "SNR", "Power", "Quality", "NoiseFloor", "FreqOffset"]);
|
||||
|
||||
for ii = 1:numel(logs)
|
||||
filepath = fullfile(logs(ii).folder, logs(ii).name);
|
||||
@@ -43,13 +43,15 @@ function R = readRadioLogs(logPath)
|
||||
val = data{3};
|
||||
|
||||
n = numel(ts);
|
||||
t = table(ts, txId, repmat(rxID, n, 1), NaN(n,1), NaN(n,1), NaN(n,1), ...
|
||||
'VariableNames', ["Timestamp", "TxUAVID", "RxUAVID", "SNR", "Power", "Quality"]);
|
||||
t = table(ts, txId, repmat(rxID, n, 1), NaN(n,1), NaN(n,1), NaN(n,1), NaN(n,1), NaN(n,1), ...
|
||||
'VariableNames', ["Timestamp", "TxUAVID", "RxUAVID", "SNR", "Power", "Quality", "NoiseFloor", "FreqOffset"]);
|
||||
|
||||
switch metric
|
||||
case "snr", t.SNR = val;
|
||||
case "power", t.Power = val;
|
||||
case "quality", t.Quality = val;
|
||||
case "snr", t.SNR = val;
|
||||
case "power", t.Power = val;
|
||||
case "quality", t.Quality = val;
|
||||
case "noisefloor", t.NoiseFloor = val;
|
||||
case "freqoffset", t.FreqOffset = val;
|
||||
end
|
||||
|
||||
R = [R; t]; %#ok<AGROW>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%% Plot AERPAW logs (trajectory, radio)
|
||||
resultsPath = fullfile(matlab.project.rootProject().RootFolder, "sandbox", "t1"); % Define path to results copied from AERPAW platform
|
||||
resultsPath = fullfile(matlab.project.rootProject().RootFolder, "sandbox", "t2"); % Define path to results copied from AERPAW platform
|
||||
|
||||
% Plot GPS logged data and scenario information (domain, objective, obstacles)
|
||||
seaToGroundLevel = 110; % measured approximately from USGS national map viewer
|
||||
|
||||
Reference in New Issue
Block a user