new SINR threshold comms CBF constraint

This commit is contained in:
kdee committed 2026-06-26 22:13:51 -07:00
1 parent b53f62391b
commit efa251d747
18 files changed
+534 -66

No files matched your search

+31 -9
View File
@@ -6,16 +6,38 @@ function obj = updateAdjacency(obj)
obj (1, 1) {mustBeA(obj, "miSim")};
end
% Initialize assuming only self-connections
A = true(size(obj.agents, 1));
nAgents = size(obj.agents, 1);
% Check lower triangle off-diagonal connections
for ii = 2:size(A, 1)
for jj = 1:(ii - 1)
% Check that agents are not out of range
if norm(obj.agents{ii}.pos - obj.agents{jj}.pos) > min([obj.agents{ii}.commsGeometry.radius, obj.agents{jj}.commsGeometry.radius])
A(ii, jj) = false; % comm range violation
continue;
% Initialize assuming all agents are connected
A = true(nAgents);
if ~obj.useSinrComms
% Fixed-radius model: pair connected iff separation is within the
% smaller of the two comms radii.
for ii = 2:nAgents
for jj = 1:(ii - 1)
if norm(obj.agents{ii}.pos - obj.agents{jj}.pos) > min([obj.agents{ii}.commsGeometry.radius, obj.agents{jj}.commsGeometry.radius])
A(ii, jj) = false; % comm range violation
continue;
end
end
end
else
% SINR model: pair (ii, jj) connected iff the lower-index agent (jj)
% receives the higher-index agent's (ii) signal above the SINR
% threshold, with interference from all other agents at the receiver.
gammaLin = 10^(obj.sinrThreshold / 10); % dB threshold -> linear
positions = zeros(nAgents, 3);
for kk = 1:nAgents
positions(kk, :) = obj.agents{kk}.pos;
end
for ii = 2:nAgents
for jj = 1:(ii - 1)
sinr = obj.sinrLink(positions, jj, ii); % receiver jj, transmitter ii
if sinr < gammaLin
A(ii, jj) = false; % SINR below threshold
continue;
end
end
end
end