Example #1
0
    def buildDeparturePhase(self):
        ''' 
        this function manages the departure phases with a ground run and a climb ramp 
        '''

        print(self.className +
              ' ============== build the departure ground run =========== ')
        self.finalRoute = GroundRunLeg(runway=self.departureRunway,
                                       aircraft=self.aircraft,
                                       airport=self.departureAirport)

        distanceToLastFixMeters = self.computeDistanceToLastFixMeters(
            currentPosition=self.departureAirport, fixListIndex=0)
        distanceStillToFlyMeters = self.flightLengthMeters - self.finalRoute.getLengthMeters(
        )

        elapsedTimeSeconds = 0.0
        self.finalRoute.buildDepartureGroundRun(
            deltaTimeSeconds=self.deltaTimeSeconds,
            elapsedTimeSeconds=elapsedTimeSeconds,
            distanceStillToFlyMeters=distanceStillToFlyMeters,
            distanceToLastFixMeters=distanceToLastFixMeters)
        distanceStillToFlyMeters = self.flightLengthMeters - self.finalRoute.getLengthMeters(
        )

        #print '==================== end of ground run ==================== '
        initialWayPoint = self.finalRoute.getLastVertex().getWeight()
        distanceToFirstFixNautics = initialWayPoint.getDistanceMetersTo(
            self.getFirstWayPoint()) * Meter2NauticalMiles
        #print '==================== Initial Climb Ramp ==================== '

        climbRamp = ClimbRamp(initialWayPoint=initialWayPoint,
                              runway=self.departureRunway,
                              aircraft=self.aircraft,
                              departureAirport=self.departureAirport)
        ''' climb ramp of 5.0 nautics is not possible if first fix placed in between '''
        climbRampLengthNautics = min(distanceToFirstFixNautics / 2.0, 5.0)
        climbRamp.buildClimbRamp(
            deltaTimeSeconds=self.deltaTimeSeconds,
            elapsedTimeSeconds=initialWayPoint.getElapsedTimeSeconds(),
            distanceStillToFlyMeters=distanceStillToFlyMeters,
            distanceToLastFixMeters=distanceToLastFixMeters,
            climbRampLengthNautics=climbRampLengthNautics)
        self.finalRoute.addGraph(climbRamp)

        #print '============= initial condition for the route ================='

        initialWayPoint = self.finalRoute.getLastVertex().getWeight()
        lastLeg = self.finalRoute.getLastEdge()
        initialHeadingDegrees = lastLeg.getBearingTailHeadDegrees()
        print(self.className +
              ': last leg orientation= {0:.2f} degrees'.format(
                  initialHeadingDegrees))

        #'''============= add way point in the fix list =============== '''
        self.insert(position='begin', wayPoint=initialWayPoint)
        #print self.className + ': fix list= {0}'.format(self.fixList)

        return initialHeadingDegrees, initialWayPoint
    def buildDeparturePhase(self):
        """ 
        this function manages the departure phases with a ground run and a climb ramp 
        """

        print self.className + " ============== build the departure ground run =========== "
        self.finalRoute = GroundRunLeg(
            runway=self.departureRunway, aircraft=self.aircraft, airport=self.departureAirport
        )

        distanceToLastFixMeters = self.computeDistanceToLastFixMeters(
            currentPosition=self.departureAirport, fixListIndex=0
        )
        distanceStillToFlyMeters = self.flightLengthMeters - self.finalRoute.getLengthMeters()

        elapsedTimeSeconds = 0.0
        self.finalRoute.buildDepartureGroundRun(
            deltaTimeSeconds=self.deltaTimeSeconds,
            elapsedTimeSeconds=elapsedTimeSeconds,
            distanceStillToFlyMeters=distanceStillToFlyMeters,
            distanceToLastFixMeters=distanceToLastFixMeters,
        )
        distanceStillToFlyMeters = self.flightLengthMeters - self.finalRoute.getLengthMeters()

        # print '==================== end of ground run ==================== '
        initialWayPoint = self.finalRoute.getLastVertex().getWeight()
        distanceToFirstFixNautics = initialWayPoint.getDistanceMetersTo(self.getFirstWayPoint()) * Meter2NauticalMiles
        # print '==================== Initial Climb Ramp ==================== '

        climbRamp = ClimbRamp(
            initialWayPoint=initialWayPoint,
            runway=self.departureRunway,
            aircraft=self.aircraft,
            departureAirport=self.departureAirport,
        )
        """ climb ramp of 5.0 nautics is not possible is first fix in between """
        climbRampLengthNautics = min(distanceToFirstFixNautics / 2.0, 5.0)
        climbRamp.buildClimbRamp(
            deltaTimeSeconds=self.deltaTimeSeconds,
            elapsedTimeSeconds=initialWayPoint.getElapsedTimeSeconds(),
            distanceStillToFlyMeters=distanceStillToFlyMeters,
            distanceToLastFixMeters=distanceToLastFixMeters,
            climbRampLengthNautics=climbRampLengthNautics,
        )
        self.finalRoute.addGraph(climbRamp)

        # print '============= initial condition for the route ================='

        initialWayPoint = self.finalRoute.getLastVertex().getWeight()
        lastLeg = self.finalRoute.getLastEdge()
        initialHeadingDegrees = lastLeg.getBearingTailHeadDegrees()
        print self.className + ": last leg orientation= {0:.2f} degrees".format(initialHeadingDegrees)

        #'''============= add way point in the fix list =============== '''
        self.insert(position="begin", wayPoint=initialWayPoint)
        # print self.className + ': fix list= {0}'.format(self.fixList)

        return initialHeadingDegrees, initialWayPoint
Example #3
0
        print ( '==================== aircraft found  ==================== '+ time.strftime("%c") )
        aircraft = BadaAircraft(aircraftICAOcode, 
                                  acBd.getAircraftPerformanceFile(aircraftICAOcode),
                                  atmosphere,
                                  earth)
        
        print ( '==========================' )
        print ( runway )
        airportIcaoCode = runway.getAirportICAOcode()
        airport = airportsDB.getAirportFromICAOCode(airportIcaoCode)
        
        print ( '==========================' )
        print ( airport )
        
        print ( '====================  ground run ==================== '+ time.strftime("%c") )

        groundRun = GroundRunLeg(runway=runway, 
                             aircraft=aircraft,
                             airport=airport)
        groundRun.buildDepartureGroundRun()
        initialWayPoint = groundRun.getLastVertex().getWeight()
        
        climbRamp = ClimbRamp(initialWayPoint=initialWayPoint,
                              runway=runway, 
                              aircraft=aircraft, 
                              departureAirport=airport)
        climbRamp.buildClimbRamp()
        groundRun.addGraph(climbRamp)
        groundRun.createKmlOutputFile()
 
        
Example #4
0
    print('====================  find the run-ways ==================== ')
    runWaysDB = RunWayDataBase()
    if runWaysDB.read():
        print('runways DB correctly read')
    else:
        raise ValueError('runways not read correctly')

    print('====================  find the run-ways ==================== ')
    for arrivalRunway in runWaysDB.getRunWays():

        print('====================  run-way ==================== ')
        print(arrivalRunway)

        airportIcaoCode = arrivalRunway.getAirportICAOcode()
        airport = airportsDb.getAirportFromICAOCode(airportIcaoCode)
        print('====================  airport ==================== ')

        print(airport)

        climbRamp = ClimbRamp(runway=arrivalRunway,
                              aircraft=acA320,
                              departureAirport=airport)
        climbRamp.buildClimbRamp()
        climbRamp.createXlsxOutputFile()

        descentSlope = DescentGlideSlope(runway=arrivalRunway,
                                         aircraft=acA320,
                                         arrivalAirport=airport)
        descentSlope.buildGlideSlope()
        descentSlope.createXlsxOutputFile()
    for runway in runWaysDB.getRunWays():

        print('========== ' + str(runway) + ' =================')
        airportIcaoCode = runway.getAirportICAOcode()
        departureAirport = airportsDB.getAirportFromICAOCode(airportIcaoCode)
        if departureAirport is None:
            raise ValueError('departure airport not found')

        print('====================  departure airport ==================== ' +
              time.strftime("%c"))
        print(departureAirport)

        print('====================  Climb Ramp ==================== ' +
              time.strftime("%c"))
        climbRamp = ClimbRamp(runway=runway,
                              aircraft=aircraft,
                              departureAirport=departureAirport)
        climbRamp.buildClimbRamp()

        print(
            '==================== Initial WayPoint - end of Climb Ramp ==================== '
            + time.strftime("%c"))
        initialVertex = climbRamp.getVertex(climbRamp.getNumberOfVertices() -
                                            1)
        endOfClimbRampWayPoint = initialVertex.getWeight()
        print(endOfClimbRampWayPoint)

        print(
            '==================== Initial Heading = end of Climb Ramp ==================== '
            + time.strftime("%c"))
        lastClimbRampEdge = climbRamp.getEdge(climbRamp.getNumberOfEdges() - 1)
Example #6
0
    print("=========== initial Arrival Descent Slope Way Point  =========== " +
          time.strftime("%c"))
    print('altitude of initial arrival Descent Slope Way Point= ' + str(
        initialArrivalDescentSlopeWayPoint.getAltitudeMeanSeaLevelMeters()) +
          ' meters')

    print("=========== initial Arrival Descent Slope Way Point  =========== " +
          time.strftime("%c"))
    print(initialArrivalDescentSlopeWayPoint)

    print(
        '==================== Three Degrees climb slope==================== ' +
        time.strftime("%c"))
    climbSlope = ClimbRamp(runway=departureRunway,
                           aircraft=aircraft,
                           departureAirport=departureAirport)
    climbSlope.buildClimbRamp()

    print(
        '==================== Initial WayPoint - end of Climb Ramp ==================== '
        + time.strftime("%c"))
    initialVertex = climbSlope.getVertex(climbSlope.getNumberOfVertices() - 1)
    endOfClimbRampWayPoint = initialVertex.getWeight()
    print(endOfClimbRampWayPoint)

    print(
        '==================== Initial Heading = end of Climb Ramp ==================== '
        + time.strftime("%c"))
    lastClimbSlopeEdge = climbSlope.getEdge(climbSlope.getNumberOfEdges() - 1)
    lastClimbSlopeLeg = lastClimbSlopeEdge.getWeight()
Example #7
0
    def test_ClimbRamp(self):

        atmosphere = Atmosphere()
        earth = Earth()

        print(
            '==================== Three Degrees climb slope ==================== '
            + time.strftime("%c"))
        acBd = BadaAircraftDatabase()
        aircraftICAOcode = 'A320'
        aircraft = None
        if acBd.read():
            if (acBd.aircraftExists(aircraftICAOcode)
                    and acBd.aircraftPerformanceFileExists(aircraftICAOcode)):

                print(
                    '==================== aircraft found  ==================== '
                    + time.strftime("%c"))

                aircraft = BadaAircraft(
                    ICAOcode=aircraftICAOcode,
                    aircraftFullName=acBd.getAircraftFullName(
                        aircraftICAOcode),
                    badaPerformanceFilePath=acBd.getAircraftPerformanceFile(
                        aircraftICAOcode),
                    atmosphere=atmosphere,
                    earth=earth)
                assert (isinstance(aircraft, BadaAircraft))
                aircraft.dump()

        assert not (aircraft is None)

        print(
            '==================== get Charles de Gaulle airport ==================== '
            + time.strftime("%c"))
        airportsDB = AirportsDatabase()
        assert (airportsDB.read())

        CharlesDeGaulle = airportsDB.getAirportFromICAOCode('LFPG')
        assert (isinstance(CharlesDeGaulle, Airport))

        print(CharlesDeGaulle)

        aircraft.setTargetCruiseFlightLevel(
            RequestedFlightLevel=390,
            departureAirportAltitudeMSLmeters=CharlesDeGaulle.
            getAltitudeMeanSeaLevelMeters())

        print(
            '==================== Three Degrees climb slope==================== '
            + time.strftime("%c"))
        runWaysDatabase = RunWayDataBase()
        if runWaysDatabase.read():
            print('runways DB correctly read')

        runway = runWaysDatabase.getFilteredRunWays('LFPG')
        print(runway)
        assert (isinstance(runway, RunWay))

        print('==================== Ground Run ==================== ' +
              time.strftime("%c"))
        groundRun = GroundRunLeg(runway=runway,
                                 aircraft=aircraft,
                                 airport=CharlesDeGaulle)

        groundRun.buildDepartureGroundRun(deltaTimeSeconds=0.1,
                                          elapsedTimeSeconds=0.0,
                                          distanceStillToFlyMeters=100000.0,
                                          distanceToLastFixMeters=100000.0)
        print(
            '==================== Three Degrees climb slope==================== '
            + time.strftime("%c"))

        initialVertex = groundRun.getVertex(groundRun.getNumberOfVertices() -
                                            1)
        initialWayPoint = initialVertex.getWeight()

        climbRamp = ClimbRamp(initialWayPoint=initialWayPoint,
                              runway=runway,
                              aircraft=aircraft,
                              departureAirport=CharlesDeGaulle)

        climbRamp.buildClimbRamp(deltaTimeSeconds=0.1,
                                 elapsedTimeSeconds=0.0,
                                 distanceStillToFlyMeters=100000.0,
                                 distanceToLastFixMeters=100000.0,
                                 climbRampLengthNautics=5.0)

        groundRun.addGraph(climbRamp)

        groundRun.createKmlOutputFile()
        print("=========== ThreeDegreesGlideSlope end =========== " +
              time.strftime("%c"))