def path_correction(self, origin, points, apex = 30000, pressure = None, temp = None): ''' Given a list of real time GPS points, calculate the projected descent path. Initial implementation: Take the given list of points, create a vector out of it, reverse the Z coordinate, and add it to itself. Desired implementation: Create a vector from the list of points, and plot the descent using the descent rate calculation. This is desirable because the descent rate greatly differs from the ascent. 1) Get a unit vector from points. 2) Starting at the apex, create a time step (t = 0), and calculate how long it takes to travel to the ground. 3) For however many seconds it takes, add up the results. ''' corrections = [] n = apex # Set Height peak = points[len(points) - 1] if pressure is None: pressure = eq.pressure(n) if temp is None: temp = 1 for p in reversed(points): if n > 1300: #1300m = SLC avg height. d = eq.descent_rate(n, pressure, temp) #Increment by Descent Rate n += d pnot = (peak[0] + (peak[0] - p[0]),peak[1] + (peak[1] - p[1]),n) print pnot corrections.append(pnot) return corrections
def __descent(self, Vpos, Vpeak): """ Piecewise Descent prediction. Takes the result from @_ascent and the initial position, performs the same calculation as ascent, but in reverse order. """ Vpath = eq.geodetic(Vpeak, Vpos) n = float(Vpeak[2]) Vavg = array([0,0,0]) for prev, current, next in self._layers(reversed(self.data)): floor = float(current[0]) wind_dir = float(current[1]) wind_spd = float(current[2]) if(current[3]): pressure = float(current[3]) else: pressure = None if(current[4]): temp = float(current[4]) else: temp = None if(next is None): floor = float(self.origin[2]) elif current[0] > n: continue while (n > floor): d = eq.descent_rate(n, pressure, temp) #Increment by Descent Rate n += d Vavg[2] = Vavg[2] + d Vavg = Vavg + self.__wind_component(wind_spd, wind_dir) self.tick = self.tick + 1 point = eq.geodetic(Vavg, Vpos) self.AscentPoints.append((point[0],point[1],Vpeak[2]+point[2])) descent = eq.geodetic(Vavg, Vpos) #self.DescentPoints.append((descent[1],descent[0],descent[2])) return descent