コード例 #1
0
    def buildSimulatedArrivalPhase(self):

        print self.className + "=========== add final turn, descent and ground run ==================="
        arrivalGroundRun = GroundRunLeg(runway=self.arrivalRunway, aircraft=self.aircraft, airport=self.arrivalAirport)
        self.touchDownWayPoint = arrivalGroundRun.computeTouchDownWayPoint()
        print self.touchDownWayPoint
        """ distance from last fix to touch down """
        distanceToLastFixNautics = (
            self.touchDownWayPoint.getDistanceMetersTo(self.getLastWayPoint()) * Meter2NauticalMiles
        )

        print self.className + "===================== final 3 degrees descending glide slope ================"
        descentGlideSlope = DescentGlideSlope(
            runway=self.arrivalRunway,
            aircraft=self.aircraft,
            arrivalAirport=self.arrivalAirport,
            descentGlideSlopeDegrees=3.0,
        )
        """ if there is a fix nearer to 5 nautics of the touch-down then limit size of simulated glide slope """
        descentGlideSlopeSizeNautics = min(distanceToLastFixNautics / 2.0, 5.0)
        """ build simulated glide slope """
        descentGlideSlope.buildSimulatedGlideSlope(descentGlideSlopeSizeNautics)
        self.firstGlideSlopeWayPoint = descentGlideSlope.getVertex(v=0).getWeight()
        print self.className + ": top of arrival glide slope= {0}".format(self.firstGlideSlopeWayPoint)

        print self.className + " ================= need a turn leg to find the junction point the last way-point in the fix list to the top of the final glide slope"
        """
        initial heading is the orientation of the run-way
        """
        lastFixListWayPoint = self.wayPointsDict[self.fixList[-1]]
        initialHeadingDegrees = self.arrivalRunway.getTrueHeadingDegrees()

        lastTurnLeg = TurnLeg(
            initialWayPoint=self.firstGlideSlopeWayPoint,
            finalWayPoint=lastFixListWayPoint,
            initialHeadingDegrees=initialHeadingDegrees,
            aircraft=self.aircraft,
            reverse=True,
        )
        lastTurnLeg.buildNewSimulatedArrivalTurnLeg(
            deltaTimeSeconds=self.deltaTimeSeconds,
            elapsedTimeSeconds=0.0,
            distanceStillToFlyMeters=0.0,
            simulatedAltitudeSeaLevelMeters=self.firstGlideSlopeWayPoint.getAltitudeMeanSeaLevelMeters(),
            flightPathAngleDegrees=3.0,
            bankAngleDegrees=5.0,
        )
        descentGlideSlope.addGraph(lastTurnLeg)
        # print self.className + ': compute arrival phase length= {0:.2f} meters'.format(descentGlideSlope.getLengthMeters())
        # descentGlideSlope.createXlsxOutputFile()
        # descentGlideSlope.createKmlOutputFile()
        """ prepare next step """
        beginOfLastTurnLeg = lastTurnLeg.getVertex(v=0).getWeight()
        print self.className + ": begin of last turn= {0}".format(beginOfLastTurnLeg)

        """ add the three last way-points in the fix list """
        self.insert(position="end", wayPoint=beginOfLastTurnLeg)
        """ update the length of the flight path """
        self.distanceFromApproachToTouchDownMeters = descentGlideSlope.getLengthMeters()
        self.flightLengthMeters = self.computeLengthMeters() + descentGlideSlope.getLengthMeters()
        print self.className + ": updated flight path length= {0:.2f} nautics".format(
            self.flightLengthMeters * Meter2NauticalMiles
        )
        """ target approach fix is equal to the begin of the SIMULATED last turn leg """
        self.aircraft.setTargetApproachWayPoint(beginOfLastTurnLeg)
        self.aircraft.setArrivalRunwayTouchDownWayPoint(self.touchDownWayPoint)
        print self.className + ": fix list= {0}".format(self.fixList)
コード例 #2
0
    def buildSimulatedArrivalPhase(self):

        print(
            self.className +
            '=========== add final turn, descent and ground run ==================='
        )
        arrivalGroundRun = GroundRunLeg(runway=self.arrivalRunway,
                                        aircraft=self.aircraft,
                                        airport=self.arrivalAirport)
        self.touchDownWayPoint = arrivalGroundRun.computeTouchDownWayPoint()
        # add touch down to constraint list
        self.constraintsList.append(
            ArrivalRunWayTouchDownConstraint(self.touchDownWayPoint))

        print(self.touchDownWayPoint)
        ''' distance from last fix to touch down '''
        distanceToLastFixNautics = self.touchDownWayPoint.getDistanceMetersTo(
            self.getLastWayPoint()) * Meter2NauticalMiles

        print(
            self.className +
            '===================== final 3 degrees descending glide slope ================'
        )
        descentGlideSlope = DescentGlideSlope(
            runway=self.arrivalRunway,
            aircraft=self.aircraft,
            arrivalAirport=self.arrivalAirport,
            descentGlideSlopeDegrees=3.0)
        ''' if there is a fix nearer to 5 nautics of the touch-down then limit size of simulated glide slope '''
        descentGlideSlopeSizeNautics = min(distanceToLastFixNautics / 2.0, 5.0)
        ''' build simulated glide slope '''
        descentGlideSlope.buildSimulatedGlideSlope(
            descentGlideSlopeSizeNautics)
        self.firstGlideSlopeWayPoint = descentGlideSlope.getVertex(
            v=0).getWeight()
        print(self.className + ': top of arrival glide slope= {0}'.format(
            self.firstGlideSlopeWayPoint))

        print(
            self.className +
            ' ================= need a turn leg to find the junction point the last way-point in the fix list to the top of the final glide slope'
        )
        '''
        initial heading is the orientation of the run-way
        '''
        lastFixListWayPoint = self.wayPointsDict[self.fixList[-1]]
        initialHeadingDegrees = self.arrivalRunway.getTrueHeadingDegrees()

        print("=====> arrival runway - true heading degrees = {0}".format(
            initialHeadingDegrees))

        lastTurnLeg = TurnLeg(initialWayPoint=self.firstGlideSlopeWayPoint,
                              finalWayPoint=lastFixListWayPoint,
                              initialHeadingDegrees=initialHeadingDegrees,
                              aircraft=self.aircraft,
                              reverse=True)
        lastTurnLeg.buildNewSimulatedArrivalTurnLeg(
            deltaTimeSeconds=self.deltaTimeSeconds,
            elapsedTimeSeconds=0.0,
            distanceStillToFlyMeters=0.0,
            simulatedAltitudeSeaLevelMeters=self.firstGlideSlopeWayPoint.
            getAltitudeMeanSeaLevelMeters(),
            flightPathAngleDegrees=3.0,
            bankAngleDegrees=5.0)
        descentGlideSlope.addGraph(lastTurnLeg)
        #print self.className + ': compute arrival phase length= {0:.2f} meters'.format(descentGlideSlope.getLengthMeters())
        #descentGlideSlope.createXlsxOutputFile()
        #descentGlideSlope.createKmlOutputFile()
        ''' prepare next step '''
        beginOfLastTurnLeg = lastTurnLeg.getVertex(v=0).getWeight()
        print(self.className +
              ': begin of last turn= {0}'.format(beginOfLastTurnLeg))
        ''' add to constraint list '''
        self.constraintsList.append(
            TargetApproachConstraint(beginOfLastTurnLeg))
        ''' add the three last way-points in the fix list '''
        self.insert(position='end', wayPoint=beginOfLastTurnLeg)
        ''' update the length of the flight path '''
        self.distanceFromApproachToTouchDownMeters = descentGlideSlope.getLengthMeters(
        )
        self.flightLengthMeters = self.computeLengthMeters(
        ) + descentGlideSlope.getLengthMeters()

        print(self.className +
              ': updated flight path length= {0:.2f} nautics'.format(
                  self.flightLengthMeters * Meter2NauticalMiles))
        ''' target approach fix is equal to the begin of the SIMULATED last turn leg '''
        self.aircraft.setTargetApproachWayPoint(beginOfLastTurnLeg)
        self.aircraft.setArrivalRunwayTouchDownWayPoint(self.touchDownWayPoint)
        print(self.className + ': fix list= {0}'.format(self.fixList))
コード例 #3
0
    def test_turn_leg(self):
        print('==================== Turn Leg ==================== ' +
              time.strftime("%c"))

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

        self.aircraft.dump()

        print('==================== Get Airport ==================== ' +
              time.strftime("%c"))
        airportsDB = AirportsDatabase()
        assert airportsDB.read()

        print(
            '==================== Get Arrival Airport ==================== ' +
            time.strftime("%c"))
        Lisbonne = airportsDB.getAirportFromICAOCode('LPPT')
        print(Lisbonne)

        print('====================  find the run-ways ==================== ' +
              time.strftime("%c"))
        runWaysDatabase = RunWayDataBase()
        if runWaysDatabase.read():
            print('runways DB correctly read')

        print('====================  take off run-way ==================== ' +
              time.strftime("%c"))
        arrivalRunway = runWaysDatabase.getFilteredRunWays(
            airportICAOcode='LPPT', runwayName='')
        print(arrivalRunway)

        print('==================== Ground run ==================== ' +
              time.strftime("%c"))
        groundRun = GroundRunLeg(runway=arrivalRunway,
                                 aircraft=self.aircraft,
                                 airport=Lisbonne)

        touchDownWayPoint = groundRun.computeTouchDownWayPoint()
        print(touchDownWayPoint)
        groundRun.buildDepartureGroundRun(deltaTimeSeconds=1.0,
                                          elapsedTimeSeconds=0.0,
                                          distanceStillToFlyMeters=0.0,
                                          distanceToLastFixMeters=0.0)
        print('==================== Climb Ramp ==================== ' +
              time.strftime("%c"))

        initialWayPoint = groundRun.getLastVertex().getWeight()

        descentGlideSlope = DescentGlideSlope(runway=arrivalRunway,
                                              aircraft=self.aircraft,
                                              arrivalAirport=Lisbonne,
                                              descentGlideSlopeDegrees=3.0)
        ''' if there is a fix nearer to 5 nautics of the touch-down then limit size of simulated glide slope '''

        descentGlideSlope.buildSimulatedGlideSlope(
            descentGlideSlopeSizeNautics=5.0)
        descentGlideSlope.createKmlOutputFile()

        firstGlideSlopeWayPoint = descentGlideSlope.getVertex(v=0).getWeight()

        print('==================== Climb Ramp ==================== ' +
              time.strftime("%c"))
        initialWayPoint = groundRun.getLastVertex().getWeight()

        print(' ================== turn leg start =============== ')
        wayPointsDb = WayPointsDatabase()
        assert (wayPointsDb.read())
        Exona = wayPointsDb.getWayPoint('EXONA')
        Rosal = wayPointsDb.getWayPoint('ROSAL')

        print(Rosal.getBearingDegreesTo(Exona))
        initialHeadingDegrees = arrivalRunway.getTrueHeadingDegrees()

        lastTurnLeg = TurnLeg(initialWayPoint=firstGlideSlopeWayPoint,
                              finalWayPoint=Exona,
                              initialHeadingDegrees=initialHeadingDegrees,
                              aircraft=self.aircraft,
                              reverse=True)
        deltaTimeSeconds = 1.0
        lastTurnLeg.buildNewSimulatedArrivalTurnLeg(
            deltaTimeSeconds=deltaTimeSeconds,
            elapsedTimeSeconds=0.0,
            distanceStillToFlyMeters=0.0,
            simulatedAltitudeSeaLevelMeters=firstGlideSlopeWayPoint.
            getAltitudeMeanSeaLevelMeters(),
            flightPathAngleDegrees=3.0)
        lastTurnLeg.createKmlOutputFile()
        descentGlideSlope.addGraph(lastTurnLeg)
        descentGlideSlope.createXlsxOutputFile()
        descentGlideSlope.createKmlOutputFile()

        print(' ================== turn leg end =============== ')