rfsensor parameterization
This commit is contained in:
+1
-1
@@ -10,6 +10,6 @@ function value = RSS(obj, d, t, a)
|
||||
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 (dB) + RX Antenna Gain (dBi) - Path Loss (dB)
|
||||
% 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
|
||||
@@ -1,26 +1,32 @@
|
||||
function obj = initialize(obj, txPower, bandwidth, centerFreq, rxGain_dBi, tilt, azimuth)
|
||||
function obj = initialize(obj, txPower, bandwidth, centerFreq, rxGain_dBi, beamwidthExponent, tilt, azimuth, lossExponent)
|
||||
arguments (Input)
|
||||
obj (1, 1) {mustBeA(obj, "rfSensor")}
|
||||
txPower (1, 1) double;
|
||||
bandwidth (1, 1) double;
|
||||
centerFreq (1, 1) double;
|
||||
rxGain_dBi (1, 1) double;
|
||||
beamwidthExponent (1, 1) double;
|
||||
tilt (1, 1) double = 0;
|
||||
azimuth (1, 1) double = 0;
|
||||
lossExponent (1, 1) double = NaN;
|
||||
end
|
||||
arguments (Output)
|
||||
obj (1, 1) {mustBeA(obj, "rfSensor")}
|
||||
end
|
||||
|
||||
% Provided values
|
||||
%% Provided values
|
||||
obj.P_TX = txPower; % Transmit power (W)
|
||||
obj.BW = bandwidth; % Bandwidth (Hz)
|
||||
obj.f_c = centerFreq; % Center frequency (Hz)
|
||||
obj.G_RX_dBi = rxGain_dBi; % Receiving Antenna Gain (dBi)
|
||||
obj.beamwidthExponent = beamwidthExponent; % Defines how focused the antenna beam is
|
||||
obj.lossExponent = lossExponent;
|
||||
|
||||
% Define initial antenna pointing
|
||||
obj.tilt = tilt;
|
||||
obj.azimuth = azimuth;
|
||||
|
||||
% Computed values
|
||||
%% Computed values
|
||||
obj.P_TX_dBm = 10*log10(obj.P_TX/1e-3); % Transmit power in dBm
|
||||
obj.N = obj.k_B * obj.T_0 * obj.BW; % Thermal noise
|
||||
end
|
||||
@@ -8,6 +8,6 @@ function L_FSPL_dB = pathLoss(obj, d)
|
||||
end
|
||||
|
||||
% Free Space Path Loss (dB); d clamped away from zero (log undefined at d=0)
|
||||
L_FSPL_dB = 20*log10(max(d, eps)) + 20*log10(obj.f_c) + 20*log10((4*pi)/obj.c);
|
||||
L_FSPL_dB = obj.lossExponent * 10 * log10(max(d, eps)) + 20 * log10(obj.f_c) + 20 * log10((4*pi)/obj.c);
|
||||
|
||||
end
|
||||
|
||||
@@ -40,7 +40,7 @@ function f = plotParameters(obj)
|
||||
end
|
||||
|
||||
colormap(turbo);
|
||||
colorbar;
|
||||
c = colorbar; c.Label.String = "Received Signal Strength (dB)";
|
||||
daspect([1 1 0.2]);
|
||||
xlabel('X (log_{10} units)'); ylabel('Y (log_{10} units)'); zlabel('log_{10} Altitude (m)');
|
||||
set(gca, 'ZDir', 'reverse');
|
||||
|
||||
@@ -52,7 +52,7 @@ function f = plotPerformance(obj, altitude, otherSensorsPos, otherSensors)
|
||||
colorbar; xlabel("X (m)"); ylabel("Y (m)");
|
||||
title("Linearly Normalized SNR (dB)");
|
||||
subtitle("No interfering sources");
|
||||
addSensorOverlay(gca, sensorXY, sensorTilts, sensorAzimuths, tailScale);
|
||||
addSensorOverlay(gca, sensorXY(1, 1:2), sensorTilts(1, 1), sensorAzimuths(1, 1), tailScale);
|
||||
|
||||
nexttile;
|
||||
imagesc(distances, distances, SINR);
|
||||
|
||||
@@ -4,6 +4,7 @@ classdef rfSensor
|
||||
c = 3e8; % Speed of light (m/s)
|
||||
k_B = 1.38e-23 % Boltzmann constant (W/Hz/K) for thermal noise model
|
||||
T_0 = 300; % Ambient temperature (Kelvin) for thermal noise model
|
||||
lossExponent = NaN; % Path loss exponent (2 for free space, up to 6 for the lossiest environments)
|
||||
% Sensor parameters
|
||||
P_TX = NaN; % Transmit power (Watts)
|
||||
BW = NaN; % Bandwidth (Hz)
|
||||
@@ -11,6 +12,7 @@ classdef rfSensor
|
||||
G_RX_dBi = NaN; % Receiver antenna gain
|
||||
tilt = NaN; % Antenna boresight tilt (deg): 0=nadir, 90=horizon
|
||||
azimuth = NaN; % Antenna boresight azimuth (deg): 0=+y, 90=+x, 180=-y, 270=-x
|
||||
beamwidthExponent = NaN; % Antenna beamwidth exponent for cosine radiation pattern, larger exponent -> narrower beam
|
||||
% Values computed at initialization
|
||||
P_TX_dBm = NaN; % Transmit power (dBm)
|
||||
N = NaN; % Thermal noise
|
||||
@@ -19,7 +21,7 @@ classdef rfSensor
|
||||
end
|
||||
|
||||
methods (Access = public)
|
||||
[obj] = initialize(obj, txPower, bandwidth, centerFreq, rxGain, tilt, azimuth); % initialize sensor, define parameters
|
||||
[obj] = initialize(obj, txPower, bandwidth, centerFreq, rxGain, beamwidthExponent, tilt, azimuth); % 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
|
||||
|
||||
@@ -11,8 +11,6 @@ function value = transmitterGain(obj, t, a)
|
||||
error("t and a must be the same size");
|
||||
end
|
||||
|
||||
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
|
||||
cos_theta = sind(obj.tilt) .* sind(t) .* cosd(a - obj.azimuth) + ...
|
||||
@@ -21,5 +19,5 @@ function value = transmitterGain(obj, t, a)
|
||||
theta = acosd(cos_theta);
|
||||
|
||||
% Cardioid family: peak at boresight (theta=0), null opposite (theta=180°)
|
||||
value = 10 .* n .* log10((1 + cosd(theta)) ./ 2);
|
||||
value = 10 .* obj.beamwidthExponent .* log10((1 + cosd(theta)) ./ 2);
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user