Skip to content

Commit

Permalink
working failure pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
skapoor68 committed Feb 24, 2024
1 parent 9b97585 commit f1714c1
Show file tree
Hide file tree
Showing 21 changed files with 1,858 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Steps to run on ARM Mac running Ubuntu

1. Generate forwarding state:
1. Generate dynamic state:
- `cd hypatia/paper/satellite_networks_state`
- Run main_starlink_500.py and see file for how to run in command line

Expand Down
2 changes: 1 addition & 1 deletion ns3-sat-sim/simulator/contrib/basic-sim
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
0,Ikire,7.3781,4.1864,0
1,Lekki,6.4412,3.4711,0
2,Akita,39.7200,140.1025,0
3,Hitachinaka,36.3964,140.5331,0
4,Otaru,43.1900,140.9947,0
5,Yamaguchi,34.1833,131.4667,0
6,Angeles,15.1449,120.5887,0
7,Marathon-Ontario,48.7500,-86.3667,0
8,Saguenay-Quebec,48.4284,-71.0689,0
9,Sambro-Creek-Nova-Scotia,44.5500,-63.8000,0
10,St-Johns-Newfoundland,47.5615,-52.7126,0
11,Caleta,27.9642,-114.0403,0
12,Santiago-de-los-Caballeros,19.4511,-70.6970,0
13,Cabo-San-Lucas,22.8905,-109.9167,0
14,Charcas,23.7075,-101.4608,0
15,El-Marques,20.6170,-100.2350,0
16,Llano-Grande,25.9000,-97.5000,0
17,Mazahua,19.0000,-100.0000,0
18,Merida,20.9670,-89.6235,0
19,Monterey,36.6002,-121.8947,0
20,Peñuelas,18.0510,-66.7210,0
21,Tapachula,14.9061,-92.2613,0
22,Villahermosa,17.9869,-92.9303,0
23,Ponce,18.0111,-66.6141,0
24,Toa-Baja,18.4464,-66.2264,0
25,Adelanto-California,34.5828,-117.4092,0
26,Anchorage-Arkansas,35.7935,-94.3586,0
27,Anderson-South-Carolina,34.5034,-82.6501,0
28,Angola-Indiana,41.6340,-85.0000,0
29,Arbuckle-California,39.0150,-122.0586,0
30,Arlington-Oregon,45.7200,-120.2000,0
31,Arvin-California,35.2018,-118.8331,0
32,Atlanta-Georgia,33.7490,-84.3880,0
33,Baxley-Georgia,31.7714,-82.3506,0
34,Beekmantown-New-York,44.6994,-73.4669,0
35,Bellingham-Washington,48.7519,-122.4787,0
36,Benkelman-Nebraska,40.0500,-101.5400,0
37,Blountsville-Alabama,34.0811,-86.5917,0
38,Boca-Chica-Texas,25.9080,-97.2200,0
39,Boydton-Virginia,36.6667,-78.3833,0
40,Brewster-Washington,48.0989,-119.7864,0
41,Broadview-Illinois,41.8589,-87.8536,0
42,Brunswick-Maine,43.9145,-69.9653,0
43,Butte-Montana,45.9969,-112.5348,0
44,Cass-County-North-Dakota,46.8400,-97.2400,0
45,Charleston-Oregon,43.3614,-124.2179,0
46,Charleston-South-Carolina,32.7765,-79.9311,0
47,Cheyenne-Wyoming,41.1399,-104.8202,0
48,Clinton-Illinois,40.1526,-88.9645,0
49,Colburn-Idaho,48.6000,-116.4000,0
50,Columbus-Ohio,39.9612,-82.9988,0
51,Conrad-Montana,48.1769,-111.9400,0
52,Des-Moines-Iowa,41.5868,-93.6250,0
53,Dumas-Texas,35.8623,-101.9664,0
54,Elbert-Colorado,39.2200,-104.5500,0
55,Elkton-Maryland,39.6068,-75.8330,0
56,Evanston-Wyoming,41.2683,-110.9633,0
57,Fairbanks-Alaska,64.8378,-147.7164,0
58,Fort-Lauderdale-Florida,26.1224,-80.1373,0
59,Frederick-Maryland,39.4142,-77.4105,0
60,Gaffney-South-Carolina,35.0718,-81.6498,0
61,Greenville-Pennsylvania,41.4090,-80.3860,0
62,Hamshire-Texas,29.9300,-94.3600,0
63,Hawthorne-California,33.9164,-118.3526,0
64,Hillman-Michigan,45.0986,-83.7636,0
65,Hillsboro-Texas,32.0000,-97.1300,0
66,Hitterdal-Minnesota,47.0000,-96.4000,0
67,Inman-Kansas,38.2294,-97.7890,0
68,Kalama-Washington,46.0100,-122.8400,0
69,Kenansville-Florida,28.1667,-81.8261,0
70,Ketchikan-Alaska,55.3422,-131.6461,0
71,Kuparuk-Alaska,70.3167,-149.6000,0
72,Lawrence-Kansas,38.9717,-95.2353,0
73,Litchfield-Connecticut,41.7449,-73.1894,0
74,Lockport-New-York,43.1706,-78.6906,0
75,Loring-Maine,46.9700,-67.8500,0
76,Lunenberg-Vermont,44.4397,-71.7236,0
77,Mandale-North-Carolina,35.0000,-78.0000,0
78,Manistique-Michigan,45.9556,-86.2483,0
79,Marcell-Minnesota,47.6011,-93.3161,0
80,Marshall-Texas,32.5449,-94.3674,0
81,McGregor-Texas,31.4200,-97.4300,0
82,Merrillan-Wisconsin,44.4094,-90.8456,0
83,Molokai-Hawaii,21.1500,-157.1000,0
84,Mt-Ayr-Indiana,39.0000,-87.0000,0
85,Murrieta-California,33.5539,-117.2139,0
86,Nemaha-Nebraska,40.4000,-95.8500,0
87,New-Braunfels-Texas,29.7030,-98.1245,0
88,Nome-Alaska,64.5011,-165.4064,0
89,Norcross-Georgia,33.9412,-84.2135,0
90,North-Bend-Washington,47.4957,-121.7860,0
91,Olympia-Washington,47.0379,-122.9007,0
92,Panaca-Nevada,37.8194,-114.3861,0
93,Port-Matilda-Pennsylvania,40.8000,-78.0500,0
94,Prosser-Washington,46.2067,-119.7642,0
95,Punta-Gorda-Florida,26.9298,-82.0454,0
96,Quincy-Washington,47.2342,-119.8526,0
97,Redmond-Washington,47.6730,-122.1180,0
98,Richardson-Texas,32.9483,-96.7299,0
99,Roberts-Wisconsin,44.9861,-92.4475,0
100,Robbins-California,38.2350,-121.7750,0
101,Robertsdale-Alabama,30.5562,-87.7050,0
102,Rolette-North-Dakota,48.7719,-99.8400,0
103,Roll-Arizona,35.2167,-113.6667,0
104,Romulus-New-York,42.9117,-76.8011,0
105,San-Antonio-Texas,29.4241,-98.4936,0
106,Sanderson-Texas,30.1389,-102.3997,0
107,Savanna-Oklahoma,34.8400,-95.8397,0
108,Savannah-Tennessee,35.2269,-88.2494,0
109,Sheffield-Illinois,41.3589,-89.6289,0
110,Slope-County-North-Dakota,46.4000,-103.5000,0
111,Springer-Oklahoma,34.5000,-97.1000,0
112,Sullivan-Maine,44.5433,-68.2097,0
113,The-Dalles-Oregon,45.5946,-121.1787,0
114,Tionesta-California,40.9500,-124.1000,0
115,Tracy-City-Tennessee,35.2522,-85.7256,0
116,Unalaska-Alaska,53.8800,-166.5300,0
117,Vernon-Utah,40.3494,-112.4694,0
118,Warren-Missouri,38.7628,-91.1403,0
119,Wichita-Falls-Texas,33.9137,-98.4934,0
120,Wise-North-Carolina,36.9742,-82.5750,0
121,York-Pennsylvania,39.9626,-76.7277,0
122,Villenave-d'Ornon,44.7900,-0.5700,0
123,Aerzen,52.0000,9.0000,0
124,Usingen,50.3500,8.6000,0
125,Ballinspittle,51.7000,-8.6500,0
126,Elfordstown,51.8000,-8.3000,0
127,Foggia,41.4623,15.5440,0
128,Marsala,37.8000,12.4500,0
129,Milano,45.4642,9.1900,0
130,Kaunas,54.8985,23.9036,0
131,Tromso,69.6496,18.9560,0
132,Wola-Krobowska,52.0000,20.0000,0
133,Alfouvar-de-Cima,40.0000,-8.0000,0
134,Coviha,40.0000,-8.0000,0
135,Ibi,38.6250,-0.5700,0
136,Lepe,37.2500,-7.2000,0
137,Villarejo-de-Salvanes,40.2000,-3.3000,0
138,Chalfont-Grove,51.6000,-0.6000,0
139,Fawley,50.8000,-1.3500,0
140,Goonhilly,50.0000,-5.2000,0
141,Hoo,51.4000,0.5000,0
142,Isle-of-Man,54.2361,-4.5481,0
143,Morn-Hill,51.0833,-1.3167,0
144,Wherstead,52.0000,1.1000,0
145,Woodwalton,52.4000,-0.1000,0
146,Murayjat,24.0000,45.0000,0
147,Muallim,24.0000,45.0000,0
148,Bogantungan,-23.0000,147.0000,0
149,Boorowa,-34.4333,148.7000,0
150,Broken-Hill,-31.9500,141.4333,0
151,Bulla-Bulling,-31.0000,121.0000,0
152,Calrossie,-20.0000,148.0000,0
153,Canyonleigh,-34.5000,150.0000,0
154,Cataby,-30.0000,115.0000,0
155,Cobargo,-36.3000,149.8000,0
156,Ki-Ki,-36.0000,140.0000,0
157,Merredin,-31.5000,118.2667,0
158,Pimba,-31.0000,136.0000,0
159,Springbrook-Creek,-28.0000,153.0000,0
160,Tea-Gardens,-32.6667,152.1667,0
161,Toonpan,-19.3333,146.7500,0
162,Torrumbarry,-35.8000,144.0000,0
163,Wagin,-33.3000,117.3500,0
164,Warra,-27.0000,150.0000,0
165,Willows,-19.0000,146.0000,0
166,Suva,-18.1416,178.4419,0
167,Awarua,-46.6000,168.3333,0
168,Cleavdon,51.0000,-2.8000,0
169,Cromwell,45.0000,-81.0000,0
170,Hinds,-43.9000,171.8000,0
171,Puwera,-41.0000,174.0000,0
172,Te-Hana,-36.0000,174.0000,0
173,Falda-del-Carmen,-31.0000,-64.0000,0
174,Camaçari,-12.7000,-38.3200,0
175,Guarapari,-20.6500,-40.5000,0
176,Itaboraí,-22.7500,-42.8600,0
177,João-Câmara,-5.5400,-35.8000,0
178,Luz,-19.8000,-43.9500,0
179,Manaus,-3.1190,-60.0217,0
180,Montes-Carlos,-20.0000,-45.0000,0
181,Mossoró,-5.1875,-37.3442,0
182,Passa-Quatro,-22.4000,-44.9700,0
183,Porto-Alegre,-30.0346,-51.2177,0
184,Presidente-Prudente,-22.1200,-51.3900,0
185,Rio-Negro,-26.1000,-49.8000,0
186,Santana-de-Parnaíba,-23.4447,-46.9178,0
187,São-Gonçalo-do-Amarante,-5.7900,-35.3200,0
188,Surubim,-7.8400,-35.7600,0
189,Uruguaiana,-29.7500,-57.0900,0
190,Caldera,-27.0667,-70.8333,0
191,Noviciado,-33.5000,-70.7000,0
192,Puerto-Montt,-41.4719,-72.9361,0
193,Puerto-Saavedra,-38.7833,-73.4000,0
194,Punta-Arenas,-53.1500,-70.9167,0
195,San-Clemente,-35.6000,-71.3500,0
196,Santa-Elena,-2.2267,-80.8583,0
197,Willemstad,12.1000,-68.9167,0
130 changes: 124 additions & 6 deletions paper/satellite_networks_state/main_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ def calculate(
# Ground stations
print("Generating ground stations...")
if gs_selection == "ground_stations_top_100":
# write the GS file to the gen_data directory
satgen.extend_ground_stations(
"input_data/ground_stations_cities_sorted_by_estimated_2025_pop_top_100.basic.txt",
output_generated_data_dir + "/" + name + "/ground_stations.txt"
"input_data/ground_stations_cities_sorted_by_estimated_2025_pop_top_100.basic.txt", # input GS file
output_generated_data_dir + "/" + name + "/ground_stations.txt" # gen_data output GS file
)
elif gs_selection == "ground_stations_paris_moscow_grid":
satgen.extend_ground_stations(
Expand All @@ -94,7 +95,7 @@ def calculate(
# TLEs
print("Generating TLEs...")
satgen.generate_tles_from_scratch_manual(
output_generated_data_dir + "/" + name + "/tles.txt",
output_generated_data_dir + "/" + name + "/tles.txt", # gen_data/"constellation_name"/tles.txt
self.NICE_NAME,
self.NUM_ORBS,
self.NUM_SATS_PER_ORB,
Expand All @@ -107,8 +108,8 @@ def calculate(

# ISLs
print("Generating ISLs...")
if isl_selection == "isls_plus_grid":
satgen.generate_plus_grid_isls(
if isl_selection == "isls_plus_grid": # create the ISL file in the gen_data directory
satgen.generate_plus_grid_isls( # each line in the ISL file is a link between two satellite indices
output_generated_data_dir + "/" + name + "/isls.txt",
self.NUM_ORBS,
self.NUM_SATS_PER_ORB,
Expand Down Expand Up @@ -143,7 +144,7 @@ def calculate(
raise ValueError("Unknown dynamic state algorithm: " + dynamic_state_algorithm)

print("Generating GSL interfaces info..")
satgen.generate_simple_gsl_interfaces_info(
satgen.generate_simple_gsl_interfaces_info( # generates the GSL info file; each node (satellite and ground station) has a id, # of GSL interfaces, and max bandwidth
output_generated_data_dir + "/" + name + "/gsl_interfaces_info.txt",
self.NUM_ORBS * self.NUM_SATS_PER_ORB,
len(ground_stations),
Expand All @@ -166,3 +167,120 @@ def calculate(
dynamic_state_algorithm,
True
)

def calculate_failure(
self,
output_generated_data_dir, # Final directory in which the result will be placed
duration_s,
time_step_ms,
isl_selection, # isls_{none, plus_grid}
gs_selection, # ground_stations_{top_100, paris_moscow_grid}
dynamic_state_algorithm, # algorithm_{free_one_only_{gs_relays,_over_isls}, paired_many_only_over_isls}
num_threads
):

# Add base name to setting
name = self.BASE_NAME + "_" + isl_selection + "_" + gs_selection + "_" + dynamic_state_algorithm

# Create output directories
if not os.path.isdir(output_generated_data_dir):
os.makedirs(output_generated_data_dir, exist_ok=True)
if not os.path.isdir(output_generated_data_dir + "/" + name):
os.makedirs(output_generated_data_dir + "/" + name, exist_ok=True)

# Ground stations
print("Generating ground stations...")
if gs_selection == "ground_stations_top_100":
# write the GS file to the gen_data directory
satgen.extend_ground_stations(
"input_data/ground_stations_cities_sorted_by_estimated_2025_pop_top_100.basic.txt", # input GS file
output_generated_data_dir + "/" + name + "/ground_stations.txt" # gen_data output GS file
)
elif gs_selection == "ground_stations_paris_moscow_grid":
satgen.extend_ground_stations(
"input_data/ground_stations_paris_moscow_grid.basic.txt",
output_generated_data_dir + "/" + name + "/ground_stations.txt"
)
else:
raise ValueError("Unknown ground station selection: " + gs_selection)

# TLEs
print("Generating TLEs...")
satgen.generate_tles_from_scratch_manual(
output_generated_data_dir + "/" + name + "/tles.txt", # gen_data/"constellation_name"/tles.txt
self.NICE_NAME,
self.NUM_ORBS,
self.NUM_SATS_PER_ORB,
self.PHASE_DIFF,
self.INCLINATION_DEGREE,
self.ECCENTRICITY,
self.ARG_OF_PERIGEE_DEGREE,
self.MEAN_MOTION_REV_PER_DAY
)

# ISLs
print("Generating ISLs...")
if isl_selection == "isls_plus_grid": # create the ISL file in the gen_data directory
satgen.generate_plus_grid_isls( # each line in the ISL file is a link between two satellite indices
output_generated_data_dir + "/" + name + "/isls.txt",
self.NUM_ORBS,
self.NUM_SATS_PER_ORB,
isl_shift=0,
idx_offset=0
)
elif isl_selection == "isls_none":
satgen.generate_empty_isls(
output_generated_data_dir + "/" + name + "/isls.txt"
)
else:
raise ValueError("Unknown ISL selection: " + isl_selection)

# Description
print("Generating description...")
satgen.generate_description(
output_generated_data_dir + "/" + name + "/description.txt",
self.MAX_GSL_LENGTH_M,
self.MAX_ISL_LENGTH_M
)

# GSL interfaces
ground_stations = satgen.read_ground_stations_extended(
output_generated_data_dir + "/" + name + "/ground_stations.txt"
)
if dynamic_state_algorithm == "algorithm_free_one_only_gs_relays" \
or dynamic_state_algorithm == "algorithm_free_one_only_over_isls":
gsl_interfaces_per_satellite = 1
elif dynamic_state_algorithm == "algorithm_paired_many_only_over_isls":
gsl_interfaces_per_satellite = len(ground_stations)
else:
raise ValueError("Unknown dynamic state algorithm: " + dynamic_state_algorithm)

print("Generating GSL interfaces info..")
satgen.generate_simple_gsl_interfaces_info( # generates the GSL info file; each node (satellite and ground station) has a id, # of GSL interfaces, and max bandwidth
output_generated_data_dir + "/" + name + "/gsl_interfaces_info.txt",
self.NUM_ORBS * self.NUM_SATS_PER_ORB,
len(ground_stations),
gsl_interfaces_per_satellite, # GSL interfaces per satellite
1, # (GSL) Interfaces per ground station
1, # Aggregate max. bandwidth satellite (unit unspecified)
1 # Aggregate max. bandwidth ground station (same unspecified unit)
)

# Failure file
print("Parsing failure file...")
failure_table = satgen.parse_failure_file("input_data/failure_config_1.txt")

# Forwarding state
print("Generating forwarding state...")
satgen.help_dynamic_state_failure(
output_generated_data_dir,
num_threads, # Number of threads
name,
time_step_ms,
duration_s,
self.MAX_GSL_LENGTH_M,
self.MAX_ISL_LENGTH_M,
dynamic_state_algorithm,
failure_table,
True
)
Loading

0 comments on commit f1714c1

Please sign in to comment.