(self, duration, orbit_number, sat_number, path,
GS_lat_long)
| 143 | return bound_distance |
| 144 | |
| 145 | def matrix_to_change(self, duration, orbit_number, sat_number, path, |
| 146 | GS_lat_long): |
| 147 | no_fac = len(GS_lat_long) |
| 148 | no_geo = 0 |
| 149 | duration = duration - 1 |
| 150 | no_leo = orbit_number * sat_number |
| 151 | |
| 152 | topo_duration = [[[0 for i in range(no_leo + no_geo + no_fac)] |
| 153 | for i in range(no_leo + no_geo + no_fac)] |
| 154 | for k in range(duration)] |
| 155 | for time in range(1, duration + 1): |
| 156 | topo_path = path + '/delay/' + str(time) + ".txt" |
| 157 | adjacency_matrix = sn_get_param(topo_path) |
| 158 | for i in range(len(adjacency_matrix)): |
| 159 | for j in range(len(adjacency_matrix[i])): |
| 160 | if float(adjacency_matrix[i][j]) > 0: |
| 161 | adjacency_matrix[i][j] = 1 |
| 162 | else: |
| 163 | adjacency_matrix[i][j] = 0 |
| 164 | topo_duration[time - 1] = adjacency_matrix |
| 165 | |
| 166 | changetime = [] |
| 167 | Duration = [] |
| 168 | for i in range(duration - 1): |
| 169 | l1 = topo_duration[i] |
| 170 | l2 = topo_duration[i + 1] |
| 171 | if l1 == l2: |
| 172 | continue |
| 173 | else: |
| 174 | changetime.append(i) |
| 175 | pretime = 0 |
| 176 | for item in changetime: |
| 177 | Duration.append(item - pretime) |
| 178 | pretime = item |
| 179 | Duration.append(60) |
| 180 | |
| 181 | topo_leo_change_path = path + "/Topo_leo_change.txt" |
| 182 | f = open(topo_leo_change_path, "w") |
| 183 | cnt = 1 |
| 184 | for i in range(duration - 1): |
| 185 | pre_lines = topo_duration[i] |
| 186 | now_lines = topo_duration[i + 1] |
| 187 | if pre_lines == now_lines: |
| 188 | continue |
| 189 | else: |
| 190 | f.write("time " + str(i + 2) + ":\n") # time started from 1 |
| 191 | f.write('duration ' + str(Duration[cnt]) + ":\n") |
| 192 | cnt += 1 |
| 193 | f.write("add:\n") |
| 194 | for j in range(no_fac): |
| 195 | prelines = pre_lines[no_geo + no_leo + j] |
| 196 | nowlines = now_lines[no_geo + no_leo + j] |
| 197 | for k in range(no_geo + no_leo + no_fac): |
| 198 | if prelines[k] == 0 and nowlines[k] == 1: |
| 199 | f.write( |
| 200 | str(k + 1) + "-" + str(no_leo + j + 1) + |
| 201 | "\n") # index |
| 202 | f.write("del:\n") |
no test coverage detected