added sensor tilting and rf sensor sim test cases

This commit is contained in:
2026-05-03 14:32:53 -07:00
parent e950d43fc8
commit 0e39e0037d
13 changed files with 154 additions and 29 deletions
+23
View File
@@ -0,0 +1,23 @@
function value = halfAngle(obj)
arguments (Input)
obj (1, 1) {mustBeA(obj, "rfSensor")};
end
arguments (Output)
value (1, 1) double;
end
% Sweep angular offset from boresight by evaluating transmitterGain at
% (obj.tilt + dtheta, obj.azimuth). The cosine difference identity guarantees
% the resulting angular offset from boresight equals dtheta exactly,
% independent of the actual pointing direction.
dtheta = (0:0.1:179.9)';
gain = obj.transmitterGain(obj.tilt + dtheta, obj.azimuth * ones(size(dtheta)));
target = gain(1) - 3;
idx = find(gain <= target, 1);
if isempty(idx) || idx == 1
value = dtheta(end);
return;
end
% Linear interpolation between bracketing samples
value = dtheta(idx-1) + (target - gain(idx-1)) * ...
(dtheta(idx) - dtheta(idx-1)) / (gain(idx) - gain(idx-1));
end
+1
View File
@@ -22,6 +22,7 @@ classdef rfSensor
[obj] = initialize(obj, txPower, bandwidth, centerFreq, rxGain); % initialize sensor, define parameters
[SINR, SNR, obj, otherSensors] = sensorPerformance(obj, agentPos, targetPos, otherSensorsPos, otherSensors); % determine sensor performance for a given single sensor and target geometry
[d, t, a] = computePointToPoints(obj, agentPos, targetPos);
[value] = halfAngle(obj); % tilt angle (deg) at which sensor performance is halved
[f] = plotParameters(obj); % debug, plot sensor response as a function of distance and tilt angle
[f] = plotPerformance(obj, altitude, otherSensorsPos, otherSensors); % debug, plot SNR or SINR ground heatmap for a given geometry
obj = clearRssCache(obj);
+2 -2
View File
@@ -17,7 +17,7 @@ function [SINR, SNR, obj, otherSensors] = sensorPerformance(obj, agentPos, targe
[d, t, a] = obj.computePointToPoints(agentPos, targetPos);
if isempty(obj.rssCache)
obj.rssCache = 10 .^ (0.1 .* obj.RSS(d, t, a));
obj.rssCache = 1e-3 .* 10 .^ (0.1 .* obj.RSS(d, t, a)); % dBm W
end
S = obj.rssCache;
@@ -25,7 +25,7 @@ function [SINR, SNR, obj, otherSensors] = sensorPerformance(obj, agentPos, targe
for ii = 1:size(otherSensors, 1)
if isempty(otherSensors{ii}.rssCache)
[d_other, t_other, a_other] = otherSensors{ii}.computePointToPoints(otherSensorsPos(ii, 1:3), targetPos);
otherSensors{ii}.rssCache = 10 .^ (0.1 .* otherSensors{ii}.RSS(d_other, t_other, a_other));
otherSensors{ii}.rssCache = 1e-3 .* 10 .^ (0.1 .* otherSensors{ii}.RSS(d_other, t_other, a_other)); % dBm W
end
I = I + otherSensors{ii}.rssCache;
end
+1 -1
View File
@@ -11,7 +11,7 @@ function value = transmitterGain(obj, t, a)
error("t and a must be the same size");
end
n = 4; % beamwidth exponent (higher = narrower beam)
n = 6; % beamwidth exponent (higher = narrower beam)
% Angular offset from boresight via spherical law of cosines
% Convention: t=0° nadir, t=90° horizon; a=0° +y, a=90° +x