def createFacility(): # StateVector global svcount, t0, dt svcount += 1 sv = StateVector() sv.configure() sv.setPosition(list(np.random.randint(10, size=(3, )))) sv.setVelocity(list(np.random.randint(10, size=(3, )))) t = t0 + (svcount - 1) * dt #Force microseconds=0 on some statevectors if svcount % 2 == 0: t = datetime.datetime(t.year, t.month, t.day, t.hour, t.minute, t.second) sv.setTime(t) return sv
def createStateVectors(self, positions): """Calculate the satellite velocity from the position data and create StateVector objects""" for i in range(len(positions)): t0 = positions[i]['time'] x0 = positions[i]['x'] y0 = positions[i]['y'] z0 = positions[i]['z'] sv = StateVector() sv.configure() sv.setTime(t0) sv.setPosition([x0, y0, z0]) sv.setVelocity([0.0, 0.0, 0.0]) self._ephemeris.addStateVector(sv) self._calculateVelocities()
def __parseStateVectorLine(self, line): date = line[0:11] time = line[12:27] x = float(line[44:56]) y = float(line[57:69]) z = float(line[70:82]) vx = float(line[83:95]) vy = float(line[96:108]) vz = float(line[109:121]) dt = self.__parseDateTimeString(date, time) sv = StateVector() sv.configure() sv.setTime(dt) sv.setPosition([x, y, z]) sv.setVelocity([vx, vy, vz]) self.orbit.addStateVector(sv)
def getOrbitFromXML(self): ''' Populate orbit. ''' orb = Orbit() orb.configure() for node in self._xml_root.find('platform/orbit'): if node.tag == 'stateVec': sv = StateVector() sv.configure() for z in node: if z.tag == 'timeUTC': timeStamp = self.convertToDateTime2(z.text) elif z.tag == 'posX': xPosition = float(z.text) elif z.tag == 'posY': yPosition = float(z.text) elif z.tag == 'posZ': zPosition = float(z.text) elif z.tag == 'velX': xVelocity = float(z.text) elif z.tag == 'velY': yVelocity = float(z.text) elif z.tag == 'velZ': zVelocity = float(z.text) sv.setTime(timeStamp) sv.setPosition([xPosition, yPosition, zPosition]) sv.setVelocity([xVelocity, yVelocity, zVelocity]) orb.addStateVector(sv) print('sv=',sv) orbExt = OrbitExtender(planet=Planet(pname='Earth')) orbExt.configure() newOrb = orbExt.extendOrbit(orb) return newOrb self.product.orbit.setOrbitSource('Header') for sv in newOrb: self.product.orbit.addStateVector(sv)
def getOrbitFromXML(self): ''' Populate orbit. ''' orb = Orbit() orb.configure() for node in self._xml_root.find( 'sourceAttributes/orbitAndAttitude/orbitInformation'): if node.tag == 'stateVector': sv = StateVector() sv.configure() for z in node.getchildren(): if z.tag == 'timeStamp': timeStamp = self.convertToDateTime(z.text) elif z.tag == 'xPosition': xPosition = float(z.text) elif z.tag == 'yPosition': yPosition = float(z.text) elif z.tag == 'zPosition': zPosition = float(z.text) elif z.tag == 'xVelocity': xVelocity = float(z.text) elif z.tag == 'yVelocity': yVelocity = float(z.text) elif z.tag == 'zVelocity': zVelocity = float(z.text) sv.setTime(timeStamp) sv.setPosition([xPosition, yPosition, zPosition]) sv.setVelocity([xVelocity, yVelocity, zVelocity]) orb.addStateVector(sv) orbExt = OrbitExtender(planet=Planet(pname='Earth')) orbExt.configure() newOrb = orbExt.extendOrbit(orb) return newOrb self.product.orbit.setOrbitSource('Header') for sv in newOrb: self.product.orbit.addStateVector(sv)
def __parseTerrestrialLine(self, line): j2000Day = float(line[14:20]) / 10.0 + 0.5 tdt = float(line[20:31]) / 1e6 x = float(line[31:43]) / 1e3 y = float(line[43:55]) / 1e3 z = float(line[55:67]) / 1e3 vx = float(line[67:78]) / 1e6 vy = float(line[78:89]) / 1e6 vz = float(line[89:100]) / 1e6 quality = line[127] tdt = tdt - self.tdtOffset dt = self.__j2000ToDatetime(j2000Day, tdt) sv = StateVector() sv.configure() sv.setTime(dt) sv.setPosition([x, y, z]) sv.setVelocity([vx, vy, vz]) self.orbit.addStateVector(sv)