Skip to content

Commit f1ac3bc

Browse files
committed
add a few more READMEs
1 parent 08cc837 commit f1ac3bc

17 files changed

+838
-0
lines changed

StarPerf_MATLAB_stage/Create_Fac.m

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
function Create_Fac(conid)
2+
disp('settings of Fac');
3+
global No_fac Lat Long;
4+
% San Diego, New York, London, Santiago, sydney, ground station 1, ground station 2,...
5+
Lat = [32.88 40.74 51.51 -33.45, -33.89];
6+
Long = [-117.23 -74.10 -0.11 -70.65, 151.20];
7+
8+
% add Starlink ground stations
9+
ground_stations = readtable('../../Starlink_ground_stations.xlsx');
10+
num_ground_stations = height(ground_stations)
11+
12+
for j=1:num_ground_stations
13+
Lat = [Lat ground_stations{j, 1}];
14+
Long = [Long ground_stations{j, 2}];
15+
end
16+
17+
No_fac=length(Long)
18+
for i=7:No_fac
19+
info_facility=strcat('Fac',num2str(i));
20+
stkNewObj('*/','Facility',info_facility);
21+
lat=Lat(i);
22+
long=Long(i);
23+
info_facility=strcat('Scenario/Matlab_Basic/Facility/',info_facility);
24+
stkSetFacPosLLA(info_facility, [lat*pi/180; long*pi/180; 0]);
25+
stkConnect(conid,'SetConstraint',info_facility,'ElevationAngle Min 20');
26+
num_fac(i)=i;
27+
28+
end
29+
save('Num_fac.mat','num_fac');
30+
end

StarPerf_MATLAB_stage/Create_LEO.m

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
function [parameter] = Create_LEO(conid,path)
2+
% Create LEOs in STK
3+
% input:
4+
% conid: used to connect to STK
5+
% path: configuration file path of mega-constellations
6+
7+
global No_leo cycle No_snap tStop constellation dT;
8+
parameter = readtable(path);
9+
parameter = parameter.Value;
10+
constellation = parameter{1,1};
11+
Altitude = str2num(parameter{2,1});
12+
cycle = str2num(parameter{3,1});
13+
No_snap = floor(cycle/dT)+1;
14+
tStop = cycle;
15+
dtr = pi/180;
16+
% orbit inclination
17+
inc = str2num(parameter{4,1})*dtr;
18+
% phase shift
19+
F = str2num(parameter{5,1});
20+
% number of orbits
21+
leo_plane = str2num(parameter{6,1});
22+
% number of satellites per orbit
23+
no = str2num(parameter{7,1});
24+
if (str2num(parameter{4,1}) > 80) && (str2num(parameter{4,1}) < 100)
25+
raan=[0:180/leo_plane:180/leo_plane*(leo_plane-1)];
26+
else
27+
raan=[0:360/leo_plane:360/leo_plane*(leo_plane-1)];
28+
end
29+
meanAnomaly1 = [0:360/no:360/no*(no-1)];
30+
raan = raan.*dtr;
31+
No_leo = leo_plane*no;
32+
disp('LEO:');
33+
disp(No_leo);
34+
for i =1:leo_plane
35+
for j=1:no
36+
ra = raan(i);
37+
ma = (mod(meanAnomaly1(j) + 360*F/(leo_plane*no)*(i-1),360))*dtr;
38+
num = j+no*(i-1);%%index of satellite-ID
39+
sat_no = strcat('Sat',num2str(num));
40+
stkNewObj('*/','Satellite',sat_no);
41+
sat_no = strcat('*/Satellite/',sat_no);
42+
stkSetPropClassical(sat_no,'J4Perturbation','J2000',0.0,tStop,dT,0,6371000 + Altitude * 10^3,0.0,inc,0.0,ra,ma);
43+
num_leo(num) = num;
44+
end
45+
end
46+
save('Num_leo.mat','num_leo','leo_plane');
47+
mkdir(strcat(constellation,'\\delay'))
48+
end
49+
50+

StarPerf_MATLAB_stage/Create_delay.m

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
function [ delay ] = Create_delay(position_cbf,time, inc)
2+
% Calculate delay between LEOs and facilities
3+
% input:
4+
% position_cbf: used to connect to STK
5+
% delay: two-dimensional matrix, delay(i,j) denotes
6+
global No_fac No_leo constellation;
7+
load('Num_leo.mat')
8+
load('Num_fac.mat');
9+
distance = zeros(No_fac+No_leo,No_fac+No_leo);
10+
delay = zeros(No_fac+No_leo,No_fac+No_leo);
11+
%calculate the distance and delay between leo and others(include leo)
12+
no = No_leo/leo_plane;
13+
for i=1:leo_plane
14+
for j=1:no
15+
cur_leo = (i-1)*no+j;
16+
% if the current satellite is already the last one in the orbit
17+
%, its up one is the first one
18+
if j ~= no
19+
up_leo = (i-1)*no+j+1;
20+
else
21+
up_leo = (i-1)*no+1;
22+
end
23+
distance(cur_leo,up_leo) = sqrt((position_cbf{cur_leo,1}(1,time) - position_cbf{up_leo,1}(1,time))^2 + (position_cbf{cur_leo,1}(2,time) - position_cbf{up_leo,1}(2,time))^2 + (position_cbf{cur_leo,1}(3,time) - position_cbf{up_leo,1}(3,time))^2);
24+
distance(up_leo,cur_leo) = distance(cur_leo,up_leo);
25+
% use light speed
26+
delay(cur_leo,up_leo) = distance(cur_leo,up_leo) / (3 * 10^5);
27+
delay(up_leo,cur_leo) = delay(cur_leo,up_leo);
28+
if i ~= leo_plane
29+
right_leo = i*no+j;
30+
31+
else
32+
if inc > 80 && inc < 100
33+
continue;
34+
else
35+
right_leo = j;
36+
end
37+
end
38+
distance(cur_leo,right_leo) = sqrt((position_cbf{cur_leo,1}(1,time) - position_cbf{right_leo,1}(1,time))^2 + (position_cbf{cur_leo,1}(2,time) - position_cbf{right_leo,1}(2,time))^2 + (position_cbf{cur_leo,1}(3,time) - position_cbf{right_leo,1}(3,time))^2);
39+
distance(right_leo,cur_leo) = distance(cur_leo,right_leo);
40+
delay(cur_leo,right_leo) = distance(cur_leo,right_leo) / (3 * 10^5);
41+
delay(right_leo,cur_leo) = delay(cur_leo,right_leo);
42+
end
43+
end
44+
% each satellite will always be able to talk with the ground station
45+
for i = 1:No_leo
46+
for j = No_leo + 1:No_fac+No_leo
47+
distance(i,j) = sqrt((position_cbf{i,1}(1,time) - position_cbf{j,1}(1,time))^2 + (position_cbf{i,1}(2,time) - position_cbf{j,1}(2,time))^2 + (position_cbf{i,1}(3,time) - position_cbf{j,1}(3,time))^2);
48+
distance(j,i) = distance(i,j);
49+
delay(i,j) = distance(i,j) / (3 * 10^5);
50+
delay(j,i) = delay(i,j);
51+
end
52+
end
53+
filename = [constellation '\delay\'];
54+
filename = strcat(filename,num2str(time));
55+
filename = strcat(filename,'.mat');
56+
save(filename,'delay')
57+
end
58+
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
function [position, position_cbf]=Create_location(dT)
2+
global No_leo No_fac tStart tStop No_snap Lat Long;
3+
load('Num_leo.mat');
4+
load('Num_fac.mat');
5+
index=1;
6+
position = cell(No_leo + No_fac,1);
7+
position_cbf = cell(No_leo + No_fac,1);
8+
for i=1:No_leo
9+
leo_info=strcat('*/Satellite/Sat',num2str(num_leo(i)));
10+
[secData, secName] = stkReport(leo_info,'LLA Position',tStart, tStop, dT);
11+
lat = stkFindData(secData{1}, 'Lat');
12+
long = stkFindData(secData{1}, 'Lon');
13+
alt = stkFindData(secData{1}, 'Alt');
14+
llapos = zeros(3,No_snap);%%[lat long high]'
15+
for j = 1:No_snap
16+
llapos(1,j) = llapos(1,j)+ lat(j)*180/pi;%%lat
17+
llapos(2,j) = llapos(2,j)+ long(j)*180/pi;%%long
18+
llapos(3,j) = llapos(3,j) + alt(j);
19+
end
20+
position{index} = llapos;
21+
position_cbf{index} = Lla2Cbf(position{index,1});
22+
index=index+1;
23+
24+
end
25+
for i=1:No_fac
26+
llapos = zeros(3,No_snap);
27+
llapos(1,:) = llapos(1,:)+Lat(i);
28+
llapos(2,:) = llapos(2,:)+Long(i);
29+
position{index} = llapos;
30+
position_cbf{index} = Lla2Cbf(position{index,1});
31+
index=index+1;
32+
end
33+
end

StarPerf_MATLAB_stage/Lla2Cbf.m

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
function position_cbf=Lla2Cbf(position)
2+
%load('satData.mat');
3+
R=6371*10^3;
4+
% No=length(position);
5+
% position_cbf=cell(No,1);
6+
% for s=1:No
7+
% tmp_pos=position{s};
8+
% r=R+ tmp_pos(3,:);% Altitude in m above the earth
9+
% Theta=pi/2-tmp_pos(1,:);
10+
% Phi=2*pi+tmp_pos(2,:);
11+
% X=(r.*sin(Theta)).*cos(Phi);
12+
% Y=(r.*sin(Theta)).*sin(Phi);
13+
% Z=r.*cos(Theta);
14+
% position_cbf{s}=[X; Y; Z];
15+
% end
16+
% position_cbf{1}(:,1:100);
17+
% position_cbf{2}(:,1:100);
18+
19+
r=R+ position(3,:);% Altitude in m above the earth
20+
Theta=pi/2-position(1,:)*pi/180;
21+
Phi=2*pi+position(2,:)*pi/180;
22+
X=(r.*sin(Theta)).*cos(Phi);
23+
Y=(r.*sin(Theta)).*sin(Phi);
24+
Z=r.*cos(Theta);
25+
position_cbf=[X; Y; Z];
26+
end

StarPerf_MATLAB_stage/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## LEO Constellation Construction
2+
3+
**We adopt [StarPerf](https://github.com/SpaceNetLab/StarPerf_Simulator)'s solution for this stage**. You could go through StarPerf's README to understand the details.
4+
5+
### Prerequisites
6+
7+
As mentioned in StarPerf, the solution relies on
8+
9+
1. [MATLAB](https://www.mathworks.com/products/matlab.html)
10+
2. [Ansys STK with evaluation license](https://www.ansys.com/products/missions/ansys-stk)
11+
12+
With prerequisites installed, run the MATLAB entry-point script `build_constellation.m`, and the constellation spatial data will be generated at `constellation_outputs\`.
13+
14+
You could also directly use those public spatial data available at [StarPerf](https://www.dropbox.com/sh/ncxf84a1m9uznm2/AABwrzHdKX6ZXsEb6FV6L3foa?dl=0) and skip this stage.
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
clear all; close all; clc;
2+
global cycle No_snap No_fac No_leo tStart tStop dT constellation
3+
dT = 1.0;
4+
tStart = 0;
5+
dtr = pi/180;
6+
rtd = 180/pi;
7+
remMachine = stkDefaultHost;
8+
delete(get(0,'children'));
9+
conid=stkOpen(remMachine);
10+
11+
scen_open = stkValidScen;
12+
if scen_open == 1
13+
rtn = questdlg('Close the current scenario?');
14+
if ~strcmp(rtn,'Yes')
15+
stkClose(conid)
16+
else
17+
stkUnload('/*')
18+
end
19+
end
20+
21+
disp('Create a new scenario');
22+
stkNewObj('/','Scenario','Matlab_Basic');
23+
disp('Set scenario time period');
24+
stkSetTimePeriod('1 Dec 2019 0:00:00.0','1 Dec 2019 10:00:00.0','GREGUTC');
25+
stkSetEpoch('1 Dec 2019 0:00:00.0','GREGUTC');
26+
cmd1 = ['SetValues "1 Dec 2019 0:00:00.0" ' mat2str(dT)];
27+
cmd1 = [cmd1 ' 0.1'];
28+
rtn = stkConnect(conid,'Animate','Scenario/Matlab_Basic',cmd1);
29+
rtn = stkConnect(conid,'Animate','Scenario/Matlab_Basic','Reset');
30+
disp('Set up the propagator and nodes for the satellites');
31+
% spanning satellites
32+
[parameter] = Create_LEO(conid,'../constellation_params/parameter.xlsx');
33+
% spanning ground stations
34+
Create_Fac(conid);
35+
inc = str2num(parameter{4,1})*dtr;
36+
37+
disp('save position info');
38+
[position, position_cbf]=Create_location(dT);
39+
filename = ['..\constellation_outputs\' constellation '\position.mat'];
40+
save(filename,'position','position_cbf');
41+
disp('save delay info');
42+
% for each cycle, caculate the delay matrix
43+
for t = 1:cycle
44+
[delay] = Create_delay(position_cbf,t,inc);
45+
end
46+
stkExec( conid, 'Animate Scenario/Matlab_Basic Reset' );
47+
stkExec( conid, 'Animate Scenario/Matlab_Basic Start' );
48+
49+
stkClose(conid)
50+
stkClose

constellation_params/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## LEO Constellation Parameter Specification
2+
3+
(Adopting StarPerf's Framework)
4+
5+
Please specify the following key parameters in `parameter.xlsx`, following the self-explanatory format:
6+
7+
* Name: just a unique identifier of the constellation.
8+
* Altitude: the altitude of satellites. See the visualization.
9+
* Cycle: the orbital period (in seconds). I.e., the time it takes for a satellite to go back to the original spatial point.
10+
* Inclination: the angle between orbits and the equator. See the visualization.
11+
* Phase shift: the amount of shift of same-index satellites on two adjacent orbits. Usually it is 0.
12+
* Number of orbits: as name suggests. See the visualization.
13+
* Number of satellites: the number of satellites on each orbit. Therefore, number of orbits × number of satellites = total satellite number in the constellation.
14+
15+
Visualization of Starlink Shell 1 constellation:
16+
17+
![Image: starlink_visualization.jpg](https://github.com/XuyangCaoUCSD/LeoEM/blob/main/constellation_params/starlink_visualization.jpg)
18+
19+
Then we can move to the stage 1: `StarPerf_MATLAB_stage/`.
20+
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"constellation": [{"id": "0", "name": "starlink", "inclination": 53, "altitude": 550, "num_satellite": 1584, "phase_shift": 1, "orbit_num": 24, "satellite_num": 66, "link_band": "Ka"}, {"id": "1", "name": "starlink", "inclination": 89.7, "altitude": 1200, "num_satellite": 720, "phase_shift": 0, "orbit_num": 18, "satellite_num": 40, "link_band": "Ka"}, {"id": "2", "name": "telasat(polar)", "inclination": 99.5, "altitude": 1000, "num_satellite": 72, "phase_shift": 0, "orbit_num": 6, "satellite_num": 12, "link_band": "Ka"}, {"id": "3", "name": "telasat(inclined)", "inclination": 37.4, "altitude": 1200, "num_satellite": 50, "phase_shift": 0, "orbit_num": 5, "satellite_num": 10, "link_band": "Ka"}]}

constellation_params/parameter.xlsx

9.38 KB
Binary file not shown.
Loading

route_stage/README.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## Route Computation
2+
3+
We pre-compute the time-varying route between two endpoints using the time-varying spatial data calculated from the previous stage.
4+
5+
### Usage:
6+
7+
```bash
8+
route_stage % python3 precompute_path_15s_isl.py|precompute_path_15s_bp.py constellation output_filename sat_num cycle latitude_1 longitude_1 latitude_2 longitude_2 depression_angle elevation_angle
9+
```
10+
11+
* To use inter-satellite laser link, choose `precompute_path_15s_isl.py`. To use bent-pipe radio link, choose `precompute_path_15s_bp.py`.
12+
* `constellation`: the LEO constellation name. The program will seek spatial data in `../constellation_outputs/$constellation/`.
13+
* `output_filename`: the output filename. The file will be generated in `../precomputed_paths/`.
14+
* `sat_num`: total satellite number in the constellation. You should know it in stage 1.
15+
* `cycle`: the orbital period length (in seconds). You should know it in stage 1.
16+
* `latitude_1`: the latitude of the first endpoint you choose. In degree.
17+
* `longitude_1`: the longitude of the first endpoint you choose. In degree.
18+
* `latitude_2`: the latitude of the second endpoint you choose. In degree.
19+
* `longitude_2`: the longitude of the second endpoint you choose. In degree.
20+
* `depression_angle`: please refer to the figure in Principle subsection. In degree.
21+
* `elevation_angle`: please refer to the figure in Principle subsection. In degree.
22+
23+
Also specify all the rely ground stations' locations in `../ground_stations.xlsx`, if you use bent-pipe links. The given one has Starlink's *discovered* ground stations from [here](https://satellitemap.space/).
24+
25+
For example, to compute the dynamic ISL routes between San Diego and New York City using Starlink Shell 1 (whose spatial data has been computed in stage 1):
26+
27+
```bash
28+
route_stage % python3 precompute_path_15s_isl.py Starlink Starlink_SD_NY_15_ISL_path.log 1584 5731 32.881 -117.237 40.845 -73.932 44.85 40
29+
```
30+
31+
To compute the dynamic bent-pipe routes between San Diego and Seattle using Starlink Shell 1:
32+
33+
```bash
34+
route_stage % python3 precompute_path_15s_bp.py Starlink Starlink_SD_SEA_15_BP_path.log 1584 5731 32.881 -117.237 47.608 -122.335 44.85 40
35+
```
36+
37+
### Principle
38+
39+
Explanation of mathematical function `getCoverageLimitL` in `utility.py`:
40+
41+
![Image: cover.jpg](https://github.com/XuyangCaoUCSD/LeoEM/blob/main/route_stage/cover.jpg)
42+
43+
44+
![Image: elevation.jpg](https://github.com/XuyangCaoUCSD/LeoEM/blob/main/route_stage/elevation.jpg)
45+
46+
47+

route_stage/cover.jpg

207 KB
Loading

route_stage/elevation.jpg

160 KB
Loading

0 commit comments

Comments
 (0)