| 279 | |
| 280 | # A thread designed for initializing constellation links. |
| 281 | class sn_Link_Init_Thread(threading.Thread): |
| 282 | |
| 283 | def __init__(self, remote_ssh, remote_ftp, orbit_num, sat_num, |
| 284 | constellation_size, fac_num, file_path, |
| 285 | configuration_file_path, sat_bandwidth, sat_ground_bandwidth, |
| 286 | sat_loss, sat_ground_loss): |
| 287 | threading.Thread.__init__(self) |
| 288 | self.remote_ssh = remote_ssh |
| 289 | self.constellation_size = constellation_size |
| 290 | self.fac_num = fac_num |
| 291 | self.orbit_num = orbit_num |
| 292 | self.sat_num = sat_num |
| 293 | self.file_path = file_path |
| 294 | self.configuration_file_path = configuration_file_path |
| 295 | self.sat_bandwidth = sat_bandwidth |
| 296 | self.sat_ground_bandwidth = sat_ground_bandwidth |
| 297 | self.sat_loss = sat_loss |
| 298 | self.sat_ground_loss = sat_ground_loss |
| 299 | self.remote_ftp = remote_ftp |
| 300 | |
| 301 | def run(self): |
| 302 | print('Run in link init thread.') |
| 303 | self.remote_ftp.put( |
| 304 | os.path.join(os.getcwd(), "starrynet/sn_orchestrater.py"), |
| 305 | self.file_path + "/sn_orchestrater.py") |
| 306 | self.remote_ftp.put( |
| 307 | self.configuration_file_path + "/" + self.file_path + |
| 308 | '/delay/1.txt', self.file_path + "/1.txt") |
| 309 | print('Initializing links ...') |
| 310 | sn_remote_cmd( |
| 311 | self.remote_ssh, "python3 " + self.file_path + |
| 312 | "/sn_orchestrater.py" + " " + str(self.orbit_num) + " " + |
| 313 | str(self.sat_num) + " " + str(self.constellation_size) + " " + |
| 314 | str(self.fac_num) + " " + str(self.sat_bandwidth) + " " + |
| 315 | str(self.sat_loss) + " " + str(self.sat_ground_bandwidth) + " " + |
| 316 | str(self.sat_ground_loss) + " " + self.file_path + "/1.txt") |
| 317 | |
| 318 | |
| 319 | # A thread designed for initializing bird routing. |