def addSatellite(self): """ Creates the add satellite popup """ # Read in satellite catalog data = [] self.catalog = [] file = open("satCat.txt", "r") lines = file.readlines() file.close() lineNum = 0 while (lineNum < len(lines)): name = lines[lineNum] line1 = lines[lineNum + 1] line2 = lines[lineNum + 2] lineNum = lineNum + 3 item = spacecraft(name, line1, line2) self.catalog.append(item) data.append(item.name) data.append(item.catalogNumber) data.append(item.intlDesignator) popup = tk.Toplevel() popup.title("Add satellites") self.listbox = MultiListbox( popup, ["Name", "Catalog Number", "Intl Designator"], height=30) self.listbox.add_data(data) self.listbox.selectmode = tk.EXTENDED self.listbox.pack(fill=tk.BOTH, expand=1) addButton = tk.Button(popup, text="Add", command=self.addSatelliteToTree) addButton.pack()
def test_plot3(self): """ Tests the plot function for a satellite """ name = "ASTRA 1G" line1 = "1 25071U 97076A 19341.46766885 .00000034 00000-0 00000+0 0 9998" line2 = "2 25071 4.2014 74.2996 0004010 178.3727 54.8839 1.00271202 80634" sat = spacecraft(name, line1, line2) self.app.canvas.plotter.plot(sat)
def test_plot2(self): """ Tests the plot function for a satellite """ name = "ORBCOMM FM27" line1 = "1 25481U 98053G 19340.54693811 -.00000035 00000-0 38449-4 0 9990" line2 = "2 25481 45.0083 64.2409 0001227 226.3801 133.6943 14.32857430107779" sat = spacecraft(name, line1, line2) self.app.canvas.plotter.plot(sat)
def test_plot1(self): """ Tests the plot function for a satellite """ name = "ISS (ZARYA)" line1 = "1 25544U 98067A 19341.76426397 .00000123 00000-0 10168-4 0 9998" line2 = "2 25544 51.6434 220.7574 0006991 10.3191 120.6360 15.50092039202187" sat = spacecraft(name, line1, line2) self.app.canvas.plotter.plot(sat)
def test_addSatellite3(self): """ Tests addSatellite function """ name = "ASTRA 1G" line1 = "1 25071U 97076A 19341.46766885 .00000034 00000-0 00000+0 0 9998" line2 = "2 25071 4.2014 74.2996 0004010 178.3727 54.8839 1.00271202 80634" sat = spacecraft(name, line1, line2) self.app.treeview.addSatellite(sat) self.assertEqual(self.app.treeview.satList[-1].name, name) self.assertEqual(self.app.treeview.masterList[-1].name, name)
def test_addSatellite2(self): """ Tests addSatellite function """ name = "ORBCOMM FM27" line1 = "1 25481U 98053G 19340.54693811 -.00000035 00000-0 38449-4 0 9990" line2 = "2 25481 45.0083 64.2409 0001227 226.3801 133.6943 14.32857430107779" sat = spacecraft(name, line1, line2) self.app.treeview.addSatellite(sat) self.assertEqual(self.app.treeview.satList[-1].name, name) self.assertEqual(self.app.treeview.masterList[-1].name, name)
def test_addSatellite1(self): """ Tests addSatellite function """ name = "ISS (ZARYA)" line1 = "1 25544U 98067A 19341.76426397 .00000123 00000-0 10168-4 0 9998" line2 = "2 25544 51.6434 220.7574 0006991 10.3191 120.6360 15.50092039202187" sat = spacecraft(name, line1, line2) self.app.treeview.addSatellite(sat) self.assertEqual(self.app.treeview.satList[-1].name, name) self.assertEqual(self.app.treeview.masterList[-1].name, name)
def testSpacecraft3(self): """ Tests that spacecraft class can be constructed correctly """ name = self.lines[6] line1 = self.lines[7] line2 = self.lines[8] sc = spacecraft(name, line1, line2) self.assertEqual(sc.name, "LCS 1") self.assertEqual(sc.catalogNumber.strip(), "01361U") self.assertEqual(sc.intlDesignator.strip(), "65034C")
def testSpacecraft2(self): """ Tests that spacecraft class can be constructed correctly """ name = self.lines[3] line1 = self.lines[4] line2 = self.lines[5] sc = spacecraft(name, line1, line2) self.assertEqual(sc.name, "CALSPHERE 2") self.assertEqual(sc.catalogNumber.strip(), "00902U") self.assertEqual(sc.intlDesignator.strip(), "64063E")
def test_search2(self): """ According to NASA, the ISS will be above Ann Arbor, MI on 12/11/19 at 5:49 PM EST (22:49 UTC). This test verifies that the search function can find this pass according to the TLE generated from celestrak on 12/7/19 around 9:00pm EST. """ name = "ISS (ZARYA)" line1 = "1 25544U 98067A 19341.76426397 .00000123 00000-0 10168-4 0 9998" line2 = "2 25544 51.6434 220.7574 0006991 10.3191 120.6360 15.50092039202187" sat = spacecraft(name, line1, line2) lat= 42.2808 lon = -83.7430 timeStart = datetime(2019, 12, 11, 22, 00, 00) timeEnd = datetime(2019, 12, 11, 23, 00, 00) tolerance = 200 timeResult = self.app.canvas.plotter.search(sat, lat, lon, timeStart, timeEnd, tolerance) self.assertTrue(timeResult is not None)
def test_calcOrientationVector3(self): """ Tests the calcOrientationVector function for a satellite approximately over Michigan """ name = "ISS (ZARYA)" line1 = "1 25544U 98067A 19341.76426397 .00000123 00000-0 10168-4 0 9998" line2 = "2 25544 51.6434 220.7574 0006991 10.3191 120.6360 15.50092039202187" sat = spacecraft(name, line1, line2) point = Point("test2", 42, -83) # Search for at time when ISS is over the point timeStart = datetime(2019, 12, 8, 0, 0, 0) timeEnd = datetime(2019, 12, 15, 0, 0, 0) tolerance = 200 time = self.app.canvas.plotter.search(sat, 42, -83, timeStart, timeEnd, tolerance) self.app.time = time self.app.canvas.plotter.updateAll() # Get orientation vector vector = self.app.canvas.plotter.calcOrientationVector(sat, point) self.assertTrue(sqrt(vector[0]**2 + vector[1]**2 + vector[2]**2) > 400 and sqrt(vector[0]**2 + vector[1]**2 + vector[2]**2) < 500)
def test_calcOrientationVector2(self): """ Tests the calcOrientationVector function for a satellite directly over (0, 90) """ name = "ISS (ZARYA)" line1 = "1 25544U 98067A 19341.76426397 .00000123 00000-0 10168-4 0 9998" line2 = "2 25544 51.6434 220.7574 0006991 10.3191 120.6360 15.50092039202187" sat = spacecraft(name, line1, line2) point = Point("test2", 0, 90) # Search for at time when ISS is over the point timeStart = datetime(2019, 12, 8, 0, 0, 0) timeEnd = datetime(2019, 12, 15, 0, 0, 0) tolerance = 200 time = self.app.canvas.plotter.search(sat, 0, 90, timeStart, timeEnd, tolerance) self.app.time = time self.app.canvas.plotter.updateAll() # Get orientation vector vector = self.app.canvas.plotter.calcOrientationVector(sat, point) self.assertTrue(abs(vector[0]) < tolerance) self.assertTrue(vector[1] < -400) # y-component should be greater than ISS altitude self.assertTrue(abs(vector[2]) < tolerance)