예제 #1
0
def test_winds_aloft():
    pre = predict(2) # 1 for GFS data, 2 for Winds Aloft
    origin = array([40.7500,-111.8833,1377])
    V = pre.flight_prediction(origin)
    Fpos= eq.geodetic(V, origin)
    print "Initial Position: \t", origin
    print "Final Position:   \t", Fpos
    print "Vector:           \t", eq.to_vector(V), V 
예제 #2
0
    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   
예제 #3
0
    def prediction(self, Vnot):
        """
        Base Piecewise handler function. Calls Ascent and Descent and returns a path vector to the caller.
        """
#        print "Starting prediction..."
        predict.AscentPoints.append((Vnot[0],Vnot[1],Vnot[2])) 
        ascent = self.__ascent(Vnot)
        point = eq.geodetic(ascent, Vnot)
        predict.AscentPoints.append((point[0],point[1],point[2])) 
        descent = self.__descent(point, ascent)
        finalPoint = predict.AscentPoints[len(predict.AscentPoints) - 1 ]#eq.geodetic(final, point)
        #predict.AscentPoints.append((finalPoint[0],finalPoint[1],finalPoint[2])) 
        print "Total flight time:", float(self.tick) / 3600, "hours."
        self.current_to_kml(finalPoint)
        return finalPoint
예제 #4
0
 def __ascent(self, Vpos):
     """
     Piecewise Ascent prediction. 
     Takes the initial position and calculates the effect of wind as the balloon rises through the atmosphere.
     """
     Vavg = array([0,0,0])
     self.origin = Vpos
     for prev, current, next in self._layers(self.data):               
         floor = float(current[0])
         wind_dir = float(current[1])
         wind_spd = float(current[2])
         if(next is None):
             ceiling = self.peak 
         else:
             ceiling = float(next[0])
         if Vpos[2] is None:
             Vpos[2] = floor
         if Vpos[2] > ceiling:     # If Vpos altitude isn't in the current lyr, go to next iteration. 
             continue
         
         if(current[3]):
             pressure = float(current[3])
         else:
             pressure = None
         
         if(current[4]):
             temp = float(current[4])
         else:
             temp = None
         
         while (Vavg[2] < ceiling):
             Vavg[2] = Vavg[2] + eq.ascent_rate(Vavg[2], pressure, temp)      #Increment by Ascent Rate
             Vavg = Vavg + self.__wind_component(wind_spd, wind_dir)
             self.tick += 1
         point = eq.geodetic(Vavg, Vpos)
         predict.AscentPoints.append((point[0],point[1],point[2]))    
 
     return Vavg