full simulation with RF sensors
This commit is contained in:
+18
-9
@@ -1,15 +1,24 @@
|
||||
function value = RSS(obj, d, t, a)
|
||||
function value = RSS(obj, d, dx, dy, dz)
|
||||
arguments (Input)
|
||||
obj (1, 1) {mustBeA(obj, "rfSensor")};
|
||||
d (:, 1) double; % distance from agent to target
|
||||
t (:, 1) double; % LOS tilt angle
|
||||
a (:, 1) double; % LOS azimuth angle
|
||||
d (:, 1) double;
|
||||
dx (:, 1) double;
|
||||
dy (:, 1) double;
|
||||
dz (:, 1) double;
|
||||
end
|
||||
arguments (Output)
|
||||
value (:, 1) double
|
||||
end
|
||||
assert(size(d, 1) == size(t, 1), "Mismatch in number of distances (%d) and tilts (%d) provided", size(d, 1), size(t, 1));
|
||||
|
||||
% RSS (dBm) = TX Power (dBm) + TX Antenna Gain (dBi) + RX Antenna Gain (dBi) - Path Loss (dB)
|
||||
value = obj.P_TX_dBm + obj.transmitterGain(t, a) + obj.G_RX_dBi - obj.pathLoss(d);
|
||||
end
|
||||
% Boresight unit vector: [st*sa, st*ca, -ct]
|
||||
% Target direction unit vector: [dx, dy, dz] / d
|
||||
% cos_theta = dot product of the two, computed without per-point trig.
|
||||
st = sind(obj.tilt);
|
||||
ct = cosd(obj.tilt);
|
||||
sa = sind(obj.azimuth);
|
||||
ca = cosd(obj.azimuth);
|
||||
cos_theta = (st .* (dx .* sa + dy .* ca) - ct .* dz) ./ max(d, eps);
|
||||
cos_theta = max(-1, min(1, cos_theta));
|
||||
theta = acosd(cos_theta);
|
||||
gain = 10 .* obj.beamwidthExponent .* log10((1 + cosd(theta)) ./ 2);
|
||||
value = obj.P_TX_dBm + gain + obj.G_RX_dBi - obj.pathLoss(d);
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user