Exemplo n.º 1
0
    def setUp(self):
        # init maindll
        self.maindll_handle = maindll.DllMainInit()

        # init timefunc and tle
        def init_subdll(initer):
            retcode = initer(self.maindll_handle)
            if retcode != 0:
                raise Exception("Failed to init %s with error code %i" %
                                ('initer.__name__', retcode))

        init_subdll(timedll.TimeFuncInit)
        init_subdll(tledll.TleInit)
        init_subdll(envdll.EnvInit)

        # Open a log file
        maindll.OpenLogFile('tle.log')

        # Make a test satKey available for many functions
        line1 = '1 25544U 98067A   19311.39056523  .00000757  00000-0  21099-4 0  9992'
        line2 = '2 25544  51.6451  11.2360 0005828 238.9618 210.3569 15.50258526197470'
        generic_satKey = tledll.TleAddSatFrLines(line1, line2)
        if generic_satKey.value <= 0:
            raise Exception("Failed to init generic_satKey with code %i" %
                            generic_satKey.value)
        else:
            self.generic_satKey = generic_satKey
Exemplo n.º 2
0
	def setUp(self):
		#init maindll
		self.maindll_handle = maindll.DllMainInit()
		
		# init other dlls
		def init_subdll(initer):
			retcode = initer(self.maindll_handle)
			if retcode != 0:
				raise Exception("Failed to init %s with error code %i" % ('initer.__name__', retcode))
		
		init_subdll(timedll.TimeFuncInit)
		init_subdll(tledll.TleInit)
		init_subdll(envdll.EnvInit)
		init_subdll(astrodll.AstroFuncInit)
		sgp4dll.Sgp4SetLicFilePath('./dshsaa/libdll/') #get the license before initing sgp4
		init_subdll(sgp4dll.Sgp4Init)
		
		# open a log file
		maindll.OpenLogFile('sgp4.log')
		
		# Initialize a TLE
		line1 = '1 25544U 98067A   19311.39056523  .00000757  00000-0  21099-4 0  9992'
		line2 = '2 25544  51.6451  11.2360 0005828 238.9618 210.3569 15.50258526197470'
		generic_satKey = tledll.TleAddSatFrLines(line1, line2)
		if generic_satKey.value <= 0:
			raise Exception("Failed to init generic_satKey with code %i" % generic_satKey.value)
		else:
			self.generic_satKey = generic_satKey
		
		# Initialize that satellite in the SGP4 context
		retcode = sgp4dll.Sgp4InitSat(generic_satKey)
		if retcode != 0:
			raise Exception("Failed to init tle with code %i" % (retcode))
Exemplo n.º 3
0
 def test_TleRemoveAllSats(self):
     tledll.TleRemoveAllSats()
     self.assertEqual(0, tledll.TleGetCount())
     line1 = '1 23455U 94089A   97320.90946019  .00000140  00000-0  10191-3 0  2621'
     line2 = '2 23455  99.0090 272.6745 0008546 223.1686 136.8816 14.11711747148495'
     satKey = tledll.TleAddSatFrLines(line1, line2)
     self.assertTrue(satKey.value > 0)
     self.assertEqual(1, tledll.TleGetCount())
     tledll.TleRemoveAllSats()
     self.assertEqual(0, tledll.TleGetCount())
Exemplo n.º 4
0
 def test_TleGetLoaded(self):
     tledll.TleRemoveAllSats()
     inserted_satKeys = []
     for num in range(0, 10):
         line1 = '1 2345%iU 94089A   97320.90946019  .00000140  00000-0  10191-3 0  2621' % (
             num)
         line2 = '2 2345%i  99.0090 272.6745 0008546 223.1686 136.8816 14.11711747148495' % (
             num)
         inserted_satKeys.append(tledll.TleAddSatFrLines(line1, line2))
     retrieved_satKeys = tledll.TleGetLoaded(9)
Exemplo n.º 5
0
retcode = astrodll.AstroFuncInit(maindll_handle)
if retcode != 0:
    raise Exception("Failed to init %s with error code %i" %
                    ('astrodll', retcode))

sgp4dll.Sgp4SetLicFilePath(
    './dshsaa/libdll/')  #get the license before initing sgp4
retcode = sgp4dll.Sgp4Init(maindll_handle)
if retcode != 0:
    raise Exception("Failed to init %s with error code %i" %
                    ('sgp4dll', retcode))

# Initialize a TLE
line1 = '1 90001U SGP4-VAL 93 51.47568104  .00000184      0 0  00000-4   814'
line2 = '2 90001   0.0221 182.4922 0000720  45.6036 131.8822  1.00271328 1199'
satKey = tledll.TleAddSatFrLines(line1, line2)
if satKey.value <= 0:
    raise Exception("Failed to init satKey with code %i" % satKey.value)

# Initialize that satellite in the SGP4 context
retcode = sgp4dll.Sgp4InitSat(satKey)
if retcode != 0:
    raise Exception("Failed to init tle with code %i" % (retcode))

# Propogate the orbit 3600 seconds
(retcode, ds50UTC, pos, vel, llh) = sgp4dll.Sgp4PropMse(satKey, 2700)

print("retcode:  %i" % (retcode))
print("ds50UTC:  {:13.7f}".format(ds50UTC))
print("position: < {:13.7f}, {:14.7f}, {:14.7f} >".format(
    pos[0], pos[1], pos[2]))
Exemplo n.º 6
0
 def test_TleGetLines(self):
     line1 = '1 23455U 94089A   97320.90946019  .00000140  00000-0  10191-3 0  2621'
     line2 = '2 23455  99.0090 272.6745 0008546 223.1686 136.8816 14.11711747148495'
     satKey = tledll.TleAddSatFrLines(line1, line2)
     (retcode, line1_r, line2_r) = tledll.TleGetLines(satKey)
Exemplo n.º 7
0
 def test_TleAddSatFrLines(self):
     line1 = '1 23455U 94089A   97320.90946019  .00000140  00000-0  10191-3 0  2621'
     line2 = '2 23455  99.0090 272.6745 0008546 223.1686 136.8816 14.11711747148495'
     satKey = tledll.TleAddSatFrLines(line1, line2)
     self.assertTrue(satKey.value > 0)