Skip to content

Commit

Permalink
Merge pull request #17 from edwardoughton/finish_linking_to_maps
Browse files Browse the repository at this point in the history
Finish linking to maps
  • Loading branch information
edwardoughton committed Mar 15, 2021
2 parents ebc80d9 + 5cc9eef commit fff3bd5
Show file tree
Hide file tree
Showing 7 changed files with 343 additions and 165 deletions.
4 changes: 0 additions & 4 deletions README.md
Expand Up @@ -65,10 +65,6 @@ If you want to create the map try:

Followed by:

python scripts/results.py

And then:

python vis/vis.py


Expand Down
19 changes: 8 additions & 11 deletions scripts/inputs.py
Expand Up @@ -9,13 +9,12 @@

parameters = {
'starlink': {
'number_of_satellites': 6000,
'iterations': 10,
'number_of_satellites': 5040,
'iterations': 100,
'seed_value': 42,
'mu': 1, #Mean of distribution
'sigma': 7.8, #Standard deviation of distribution
'total_area_earth_km_sq': 510000000, #Area of Earth in km^2
'portion_of_earth_covered': 0.8, #We assume the poles aren't covered
'altitude_km': 550, #Altitude of starlink satellites in km
'dl_frequency': 13.5*10**9, #Downlink frequency in Hertz
'dl_bandwidth': 0.25*10**9, #Downlink bandwidth in Hertz
Expand All @@ -29,18 +28,17 @@
'all_other_losses': 0.53, #All other losses
},
'oneweb': {
'number_of_satellites': 600,
'iterations': 10,
'number_of_satellites': 720,
'iterations': 100,
'seed_value': 42,
'mu': 1, #Mean of distribution
'sigma': 7.8, #Standard deviation of distribution
'total_area_earth_km_sq': 510000000, #Area of Earth in km^2
'portion_of_earth_covered': 0.8, #We assume the poles aren't covered
'altitude_km': 1200, #Altitude of starlink satellites in km
'dl_frequency': 13.5*10**9, #Downlink frequency in Hertz
'dl_bandwidth': 0.25*10**9,
'speed_of_light': 3.0*10**8, #Speed of light in vacuum
'antenna_diameter': 0.7, #Metres
'antenna_diameter': 0.75, #Metres
'antenna_efficiency': 0.6,
'power': 30, #dBw
'losses': 4, #dB
Expand All @@ -50,20 +48,19 @@
},
'kuiper': {
'number_of_satellites': 3236,
'iterations': 10,
'iterations': 100,
'seed_value': 42,
'mu': 1, #Mean of distribution
'sigma': 7.8, #Standard deviation of distribution
'total_area_earth_km_sq': 510000000, #Area of Earth in km^2
'portion_of_earth_covered': 0.8, #We assume the poles aren't covered
'altitude_km': 610, #Altitude of starlink satellites in km
'dl_frequency': 17.7*10**9, #Downlink frequency in Hertz
'dl_bandwidth': 0.25*10**9,
'speed_of_light': 3.0*10**8, #Speed of light in vacuum
'antenna_diameter': 0.7, #Metres
'antenna_diameter': 1, #Metres
'antenna_efficiency': 0.6,
'power': 30, #dBw
'receiver_gain': 38,
'receiver_gain': 39,
'rain_attenuation': 10, #Rain Attenuation
'all_other_losses': 0.53, #All other losses
},
Expand Down
105 changes: 0 additions & 105 deletions scripts/results.py

This file was deleted.

118 changes: 117 additions & 1 deletion scripts/run.py
Expand Up @@ -17,15 +17,108 @@
CONFIG.read(os.path.join(os.path.dirname(__file__), 'script_config.ini'))
BASE_PATH = CONFIG['file_locations']['base_path']

INTERMEDIATE = os.path.join(BASE_PATH, 'intermediate')
RESULTS = os.path.join(BASE_PATH, '..', 'results')


def process_capacity_data(data, constellations):
"""
Process capacity data.
"""
output = {}

for constellation in constellations:

max_satellites_set = set() #get the maximum network density
coverage_area_set = set() #and therefore minimum coverage area

for idx, item in data.iterrows():
if constellation.lower() == item['constellation'].lower():
max_satellites_set.add(item['number_of_satellites'])
coverage_area_set.add(item['satellite_coverage_area'])

max_satellites = max(list(max_satellites_set)) #max density
coverage_area = min(list(coverage_area_set)) #minimum coverage area

capacity_results = []

for idx, item in data.iterrows():
if constellation.lower() == item['constellation'].lower():
if item['number_of_satellites'] == max_satellites:
capacity_results.append(item['capacity']) #append to list

mean_capacity = sum(capacity_results) / len(capacity_results)

output[constellation] = {
'number_of_satellites': max_satellites,
'satellite_coverage_area': coverage_area,
'capacity': mean_capacity,
'capacity_kmsq': mean_capacity / coverage_area,
}


return output


def process_results(data, capacity, constellation, scenario):
"""
Process results.
"""
output = []

adoption_rate = scenario[1]
# overbooking_factor = parameters['overbooking_factor']
constellation_capacity = capacity[constellation]
max_capacity = constellation_capacity['capacity_kmsq']

for idx, item in data.iterrows():

users_per_km2 = item['pop_density_km2'] * (adoption_rate / 100)

active_users_km2 = users_per_km2 #/ overbooking_factor

if active_users_km2 > 0:
per_user_capacity = max_capacity / active_users_km2
else:
per_user_capacity = 0

output.append({
'scenario': scenario[0],
'constellation': constellation,
'iso3': item['iso3'],
'GID_id': item['regions'],
'population': item['population'],
'area_m': item['area_m'],
'pop_density_km2': item['pop_density_km2'],
'adoption_rate': adoption_rate,
'users_per_km2': users_per_km2,
'active_users_km2': active_users_km2,
'per_user_capacity': per_user_capacity,
})

return output


if __name__ == '__main__':

CONSTELLATIONS = [
'Starlink',
'OneWeb',
'Kuiper',
# 'Telesat'
]

SCENARIO = [
('low', 0.05),
('baseline', 0.1),
('high', 0.2),
]

results = []

for constellation, params in parameters.items():

for number_of_satellites in range(60, params['number_of_satellites'] + 60, 60):

data = system_capacity(constellation, number_of_satellites, params, lut)
Expand All @@ -36,3 +129,26 @@

path = os.path.join(RESULTS, 'sim_results.csv')
results.to_csv(path, index=False)

CAPACITY = process_capacity_data(results, CONSTELLATIONS)

path = os.path.join(INTERMEDIATE, 'global_regional_population_lookup.csv')
global_data = pd.read_csv(path)

all_results = []

for constellation in CONSTELLATIONS:

for scenario in SCENARIO:

results = process_results(global_data, CAPACITY, constellation, scenario)

all_results = all_results + results

all_results = pd.DataFrame(all_results)

if not os.path.exists(RESULTS):
os.makedirs(RESULTS)

path = os.path.join(RESULTS, 'global_results.csv')
all_results.to_csv(path, index=False)
17 changes: 7 additions & 10 deletions src/globalsat/sim.py
Expand Up @@ -35,7 +35,7 @@ def system_capacity(constellation, number_of_satellites, params, lut):
"""
results = []

distance, satelite_coverage_area_km = calc_geographic_metrics(
distance, satellite_coverage_area_km = calc_geographic_metrics(
number_of_satellites, params
)

Expand Down Expand Up @@ -78,7 +78,7 @@ def system_capacity(constellation, number_of_satellites, params, lut):
'constellation': constellation,
'number_of_satellites': number_of_satellites,
'distance': distance,
'satelite_coverage_area': satelite_coverage_area_km,
'satellite_coverage_area': satellite_coverage_area_km,
'iteration': i,
'path_loss': path_loss,
'random_variation': random_variation,
Expand All @@ -89,7 +89,7 @@ def system_capacity(constellation, number_of_satellites, params, lut):
'cnr': cnr,
'spectral_efficiency': spectral_efficiency,
'capacity': capacity,
'capacity_kmsq': capacity / satelite_coverage_area_km,
'capacity_kmsq': capacity / satellite_coverage_area_km,
})

return results
Expand All @@ -111,24 +111,21 @@ def calc_geographic_metrics(number_of_satellites, params):
-------
distance : float
The distance between the transmitter and reciever in km.
satelite_coverage_area_km : float
satellite_coverage_area_km : float
The area which each satellite covers on Earth's surface in km.
"""
area_of_earth_covered = (
params['total_area_earth_km_sq'] *
params['portion_of_earth_covered']
)
area_of_earth_covered = params['total_area_earth_km_sq']

network_density = number_of_satellites / area_of_earth_covered

satelite_coverage_area_km = (area_of_earth_covered / number_of_satellites)
satellite_coverage_area_km = (area_of_earth_covered / number_of_satellites) #/ 1000

mean_distance_between_assets = math.sqrt((1 / network_density)) / 2

distance = math.sqrt(((mean_distance_between_assets)**2) + ((params['altitude_km'])**2))

return distance, satelite_coverage_area_km
return distance, satellite_coverage_area_km


def calc_free_space_path_loss(distance, params, i, random_variations):
Expand Down

0 comments on commit fff3bd5

Please sign in to comment.