How to finding GAPS in satellite access times.

3 Ansichten (letzte 30 Tage)
Michael Hurley
Michael Hurley am 22 Nov. 2023
Bearbeitet: Michael Hurley am 29 Nov. 2023
Hello,
Appreciate any help on how to find gaps in satellite access. The attached picture shows Iridium satellite accesses to a radio near Dulles during 1 day. You can see there are many overlapping accesses. I am trying to find any periods of time that do not have access (any time gaps in coverage). I do have Aerospace Toolbox which quickly calculates all the access intervals.
My question is a may be a more complex verion of this Q&A:
I have tried several plotting approaches but not luck yet. The plot function needed seems like a combination of "stairs" and many, superimposed "fplot" intervals; however fplot intervals do not seem to accept datetime input (the attached shows an attempt to fplot just one access interval).
Thanks in advance.
-Mike

Akzeptierte Antwort

sai charan sampara
sai charan sampara am 27 Nov. 2023
Hello Michael,
I understand that you are trying to find intervals in which the variable “AccessTrue” is zero when the data contains overlapping intervals.
You can achieve this by using the plot function which works on the “datetime” data type. This can be done by creating a table that contains two columns. One column has set of timestamps that range from “00:00:00” to the last available end time, here it is “00:28:00”. The step duration can be anything of your choice. I have taken 1 minute in this case. The second value can be a logical variable that marks if there is access at that time. This column is initially populated with all zeros and individual row values can be set to one based on the durations where the “AccessTrue” variable is true. It can be done as follows:
%Example data with random values
StartTime=[datetime(2023,11,22,00,00,00);datetime(2023,11,22,00,00,00);datetime(2023,11,22,00,02,00);
datetime(2023,11,22,00,05,00);datetime(2023,11,22,00,10,00);datetime(2023,11,22,00,12,00);
datetime(2023,11,22,00,14,00);datetime(2023,11,22,00,17,00);datetime(2023,11,22,00,21,00)];
EndTime=[datetime(2023,11,22,00,07,00);datetime(2023,11,22,00,02,00);datetime(2023,11,22,00,07,00);
datetime(2023,11,22,00,16,00);datetime(2023,11,22,00,21,00);datetime(2023,11,22,00,20,00);
datetime(2023,11,22,00,25,00);datetime(2023,11,22,00,24,00);datetime(2023,11,22,00,28,00)];
AccessTrue=[1;0;1;0;1;0;0;1;0];
tab=table(StartTime,EndTime,AccessTrue,VariableNames=["StartTime","EndTime","AccessTrue"])
tab = 9×3 table
StartTime EndTime AccessTrue ____________________ ____________________ __________ 22-Nov-2023 00:00:00 22-Nov-2023 00:07:00 1 22-Nov-2023 00:00:00 22-Nov-2023 00:02:00 0 22-Nov-2023 00:02:00 22-Nov-2023 00:07:00 1 22-Nov-2023 00:05:00 22-Nov-2023 00:16:00 0 22-Nov-2023 00:10:00 22-Nov-2023 00:21:00 1 22-Nov-2023 00:12:00 22-Nov-2023 00:20:00 0 22-Nov-2023 00:14:00 22-Nov-2023 00:25:00 0 22-Nov-2023 00:17:00 22-Nov-2023 00:24:00 1 22-Nov-2023 00:21:00 22-Nov-2023 00:28:00 0
xInterval=[tab.StartTime,tab.EndTime];
access=xInterval(tab.AccessTrue==1,:);
st=[];
for i=0:28
st=[st;datetime(2023,11,22,00,i,00)];
end
access_available=zeros(size(st));
for i=1:length(access)
idx1=find(st==access(i,1),1);
idx2=find(st==access(i,2),1);
access_available(idx1:idx2)=1;
end
stem(st,access_available,"o");
You can refer to the below documentation to learn more about “datetime” data type:
  1 Kommentar
Michael Hurley
Michael Hurley am 29 Nov. 2023
Good approach; this gets me most of the way there! Appreciate you identifying that STEM plot that accepts "datetime" data. This plot type will be helpful here as well as in other models.
Hope you had a good Thanksgiving. Thanks much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Peter Perkins
Peter Perkins am 27 Nov. 2023
There are ways to do this without loops, but the most straight-forward way (assuming the data are sorted by start time) is brute force, something like this:
StartTime = datetime(2023,11,22,0,[0,1,4,5,10,12,14,17,21]',0);
StopTime = datetime(2023,11,22,0,[1,2,11,16,21,20,25,24,28]',0);
Dur = StopTime - StartTime;
t = table(StartTime,StopTime,Dur)
t = 9×3 table
StartTime StopTime Dur ____________________ ____________________ ________ 22-Nov-2023 00:00:00 22-Nov-2023 00:01:00 00:01:00 22-Nov-2023 00:01:00 22-Nov-2023 00:02:00 00:01:00 22-Nov-2023 00:04:00 22-Nov-2023 00:11:00 00:07:00 22-Nov-2023 00:05:00 22-Nov-2023 00:16:00 00:11:00 22-Nov-2023 00:10:00 22-Nov-2023 00:21:00 00:11:00 22-Nov-2023 00:12:00 22-Nov-2023 00:20:00 00:08:00 22-Nov-2023 00:14:00 22-Nov-2023 00:25:00 00:11:00 22-Nov-2023 00:17:00 22-Nov-2023 00:24:00 00:07:00 22-Nov-2023 00:21:00 22-Nov-2023 00:28:00 00:07:00
for i = height(t):-1:2
upper = max(t.StopTime(1:i-1));
if t.StartTime(i) <= upper
t.StopTime(i-1) = max(t.StopTime(i),upper);
t(i,:) = [];
t.Dur(i-1) = t.StopTime(i-1) - t.StartTime(i-1);
end
t
end
t = 8×3 table
StartTime StopTime Dur ____________________ ____________________ ________ 22-Nov-2023 00:00:00 22-Nov-2023 00:01:00 00:01:00 22-Nov-2023 00:01:00 22-Nov-2023 00:02:00 00:01:00 22-Nov-2023 00:04:00 22-Nov-2023 00:11:00 00:07:00 22-Nov-2023 00:05:00 22-Nov-2023 00:16:00 00:11:00 22-Nov-2023 00:10:00 22-Nov-2023 00:21:00 00:11:00 22-Nov-2023 00:12:00 22-Nov-2023 00:20:00 00:08:00 22-Nov-2023 00:14:00 22-Nov-2023 00:25:00 00:11:00 22-Nov-2023 00:17:00 22-Nov-2023 00:28:00 00:11:00
t = 7×3 table
StartTime StopTime Dur ____________________ ____________________ ________ 22-Nov-2023 00:00:00 22-Nov-2023 00:01:00 00:01:00 22-Nov-2023 00:01:00 22-Nov-2023 00:02:00 00:01:00 22-Nov-2023 00:04:00 22-Nov-2023 00:11:00 00:07:00 22-Nov-2023 00:05:00 22-Nov-2023 00:16:00 00:11:00 22-Nov-2023 00:10:00 22-Nov-2023 00:21:00 00:11:00 22-Nov-2023 00:12:00 22-Nov-2023 00:20:00 00:08:00 22-Nov-2023 00:14:00 22-Nov-2023 00:28:00 00:14:00
t = 6×3 table
StartTime StopTime Dur ____________________ ____________________ ________ 22-Nov-2023 00:00:00 22-Nov-2023 00:01:00 00:01:00 22-Nov-2023 00:01:00 22-Nov-2023 00:02:00 00:01:00 22-Nov-2023 00:04:00 22-Nov-2023 00:11:00 00:07:00 22-Nov-2023 00:05:00 22-Nov-2023 00:16:00 00:11:00 22-Nov-2023 00:10:00 22-Nov-2023 00:21:00 00:11:00 22-Nov-2023 00:12:00 22-Nov-2023 00:28:00 00:16:00
t = 5×3 table
StartTime StopTime Dur ____________________ ____________________ ________ 22-Nov-2023 00:00:00 22-Nov-2023 00:01:00 00:01:00 22-Nov-2023 00:01:00 22-Nov-2023 00:02:00 00:01:00 22-Nov-2023 00:04:00 22-Nov-2023 00:11:00 00:07:00 22-Nov-2023 00:05:00 22-Nov-2023 00:16:00 00:11:00 22-Nov-2023 00:10:00 22-Nov-2023 00:28:00 00:18:00
t = 4×3 table
StartTime StopTime Dur ____________________ ____________________ ________ 22-Nov-2023 00:00:00 22-Nov-2023 00:01:00 00:01:00 22-Nov-2023 00:01:00 22-Nov-2023 00:02:00 00:01:00 22-Nov-2023 00:04:00 22-Nov-2023 00:11:00 00:07:00 22-Nov-2023 00:05:00 22-Nov-2023 00:28:00 00:23:00
t = 3×3 table
StartTime StopTime Dur ____________________ ____________________ ________ 22-Nov-2023 00:00:00 22-Nov-2023 00:01:00 00:01:00 22-Nov-2023 00:01:00 22-Nov-2023 00:02:00 00:01:00 22-Nov-2023 00:04:00 22-Nov-2023 00:28:00 00:24:00
t = 3×3 table
StartTime StopTime Dur ____________________ ____________________ ________ 22-Nov-2023 00:00:00 22-Nov-2023 00:01:00 00:01:00 22-Nov-2023 00:01:00 22-Nov-2023 00:02:00 00:01:00 22-Nov-2023 00:04:00 22-Nov-2023 00:28:00 00:24:00
t = 2×3 table
StartTime StopTime Dur ____________________ ____________________ ________ 22-Nov-2023 00:00:00 22-Nov-2023 00:02:00 00:02:00 22-Nov-2023 00:04:00 22-Nov-2023 00:28:00 00:24:00
In your data, IIUC, you had no gaps, so I changed them a bit. now you just need
gaps = table(t.StopTime(1:end-1),t.StartTime(2:end),t.StartTime(2:end)-t.StopTime(1:end-1),VariableNames=["GapStart" "GapStop" "GapDur"])
gaps = 1×3 table
GapStart GapStop GapDur ____________________ ____________________ ________ 22-Nov-2023 00:02:00 22-Nov-2023 00:04:00 00:02:00
  1 Kommentar
Michael Hurley
Michael Hurley am 29 Nov. 2023
Bearbeitet: Michael Hurley am 29 Nov. 2023
Thanks Peter. I expect to combine some aspects of you answer and Sai's answer above. Hope you had a good Thanksgiving.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Reference Applications finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by