cleanup before refactoring
This commit is contained in:
@@ -8,5 +8,6 @@ function value = antennaGain(obj, t)
|
|||||||
end
|
end
|
||||||
|
|
||||||
% TODO
|
% TODO
|
||||||
value = 10*log10(1);
|
% Temporary logic to make nadir-pointing most effective
|
||||||
|
value = 10*log10(cosd(t));
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
function obj = initialize(obj)
|
function obj = initialize(obj, txPower, bandwidth, centerFreq)
|
||||||
arguments (Input)
|
arguments (Input)
|
||||||
obj (1, 1) {mustBeA(obj, "rfSensor")}
|
obj (1, 1) {mustBeA(obj, "rfSensor")}
|
||||||
|
txPower (1, 1) double;
|
||||||
|
bandwidth (1, 1) double;
|
||||||
|
centerFreq (1, 1) double;
|
||||||
end
|
end
|
||||||
arguments (Output)
|
arguments (Output)
|
||||||
obj (1, 1) {mustBeA(obj, "rfSensor")}
|
obj (1, 1) {mustBeA(obj, "rfSensor")}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
obj.P_TX = txPower;
|
||||||
|
obj.BW = bandwidth;
|
||||||
|
obj.f_c = centerFreq;
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -9,6 +9,7 @@ function f = plotParameters(obj)
|
|||||||
% Distance and tilt sample points
|
% Distance and tilt sample points
|
||||||
d = [0.01, 0.1, 0.25, 0.5, 0.75, 1:1:100];
|
d = [0.01, 0.1, 0.25, 0.5, 0.75, 1:1:100];
|
||||||
t = zeros(size(d));
|
t = zeros(size(d));
|
||||||
|
t = -90:1:90;
|
||||||
|
|
||||||
% Sample RSS function by distances, tilts
|
% Sample RSS function by distances, tilts
|
||||||
r_x = obj.RSS(d', t');
|
r_x = obj.RSS(d', t');
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ classdef rfSensor
|
|||||||
k_B = 1.38e-23 % Boltzmann constant (W/Hz/K) for thermal noise model
|
k_B = 1.38e-23 % Boltzmann constant (W/Hz/K) for thermal noise model
|
||||||
T_0 = 300; % Ambient temperature (Kelvin) for thermal noise model
|
T_0 = 300; % Ambient temperature (Kelvin) for thermal noise model
|
||||||
% Sensor parameters
|
% Sensor parameters
|
||||||
P_TX = 10e-3; % Transmit power (Watts)
|
P_TX = NaN; % Transmit power (Watts)
|
||||||
BW = 1e6; % Bandwidth (Hz)
|
BW = NaN; % Bandwidth (Hz)
|
||||||
f_c = 2e9; % Center frequency (Hz)
|
f_c = NaN; % Center frequency (Hz)
|
||||||
end
|
end
|
||||||
|
|
||||||
methods (Access = public)
|
methods (Access = public)
|
||||||
[obj] = initialize(obj, alphaDist, betaDist, alphaTilt, betaTilt); % TODO initialize sensor, define parameters
|
[obj] = initialize(obj, txPower, bandwidth, centerFreq); % TODO initialize sensor, define parameters
|
||||||
[SINR] = sensorPerformance(obj, agentPos, agentPan, agentTilt, targetPos); % determine sensor performance for a given single sensor and target geometry
|
[SINR] = sensorPerformance(obj, agentPos, agentPan, agentTilt, targetPos); % determine sensor performance for a given single sensor and target geometry
|
||||||
[f] = plotParameters(obj); % debug, plot sensor response as a function of distance and tilt angle
|
[f] = plotParameters(obj); % debug, plot sensor response as a function of distance and tilt angle
|
||||||
end
|
end
|
||||||
|
|||||||
+16
-6
@@ -8,18 +8,28 @@ classdef test_rfSensor < matlab.unittest.TestCase
|
|||||||
function tc = setup(tc)
|
function tc = setup(tc)
|
||||||
% Reinitialize sensor with random parameters
|
% Reinitialize sensor with random parameters
|
||||||
tc.testClass = rfSensor;
|
tc.testClass = rfSensor;
|
||||||
% TODO
|
|
||||||
tc.testClass = tc.testClass.initialize();
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
methods (Test)
|
methods (Test)
|
||||||
% Test methods
|
function plot_SNR(tc)
|
||||||
|
% Plot sensor performance with no sources of interference
|
||||||
|
P_TX = 1e-3; % Transmit power (Watts)
|
||||||
|
BW = 20e6; % Bandwidth (Hz)
|
||||||
|
f_c = 2e9; % Center frequency (Hz)
|
||||||
|
|
||||||
|
tc.testClass = tc.testClass.initialize(P_TX, BW, f_c);
|
||||||
|
|
||||||
function test_SINR(tc)
|
|
||||||
tc.testClass.plotParameters();
|
tc.testClass.plotParameters();
|
||||||
% [SINR] = tc.testClass.sensorPerformance(obj, agentPos, agentPan, agentTilt, targetPos);
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
function plot_SINR(tc)
|
||||||
|
% Plot sensor performance with a single source of interference
|
||||||
|
P_TX = 1e-3; % Transmit power (Watts)
|
||||||
|
BW = 20e6; % Bandwidth (Hz)
|
||||||
|
f_c = 2e9; % Center frequency (Hz)
|
||||||
|
|
||||||
|
tc.testClass = tc.testClass.initialize(P_TX, BW, f_c);
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user