-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTopo.py
More file actions
39 lines (31 loc) · 1.35 KB
/
Topo.py
File metadata and controls
39 lines (31 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from Constellation_model import *
from utils import *
import json
# Heaven and earth fusion network, a time of constellations + all stations
class IntegratedNetwork:
def __init__(self, constellation, gw_file_path, t):
self.t = t
self.constellation = Constellation(constellation, self.t)
self.gw_file_path = gw_file_path
self.num_gw = 0
self.cpd, self.c_matrix, self.sat_lst = self.constellation.constellation_topo()
self.num_sat = len(self.c_matrix)
self.in_matrix = self.in_topo()
def in_topo(self):
gw_dict = self.read_gw_file()
self.num_gw = len(gw_dict)
in_topology = matrix_expand(self.c_matrix, gw_dict, self.cpd, self.t)
return in_topology
def fin_topo(self, src, dst, cp_pos_dict):
cp_dict = dict()
cp_dict[src] = cp_pos_dict[src]
cp_dict[dst] = cp_pos_dict[dst] # Get latitude and longitude
fin_topology, k_max = matrix_expand(self.in_matrix, cp_dict, self.cpd, self.t)
return fin_topology, k_max
def read_gw_file(self):
gw_dict = dict()
with open('./gw_amazon.json', 'r') as json_file:
locations_data = json.load(json_file)
for gw, location in locations_data.items():
gw_dict[gw] = (float(location['longitude']), float(location['latitude']))
return gw_dict