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 =============== ')
aircraft = BadaAircraft(aircraftIcaoCode, acBd.getAircraftPerformanceFile(aircraftIcaoCode), atmosphere, earth) aircraft.dump() takeOffMassKilograms = 64000.0 aircraft.setAircraftMassKilograms(takeOffMassKilograms) RequestedFlightLevel = 310.0 fieldElevationAboveSeaLevelMeters = 150.0 aircraft.setTargetCruiseFlightLevel(RequestedFlightLevel, fieldElevationAboveSeaLevelMeters) tasMetersPerSecond = tasKnots * Knots2MetersPerSecond aircraft.initStateVector(elapsedTimeSeconds = 0.0, trueAirSpeedMetersSecond = tasMetersPerSecond, altitudeMeanSeaLevelMeters = 3000.0 * Meter2Feet, deltaDistanceFlownMeters = 0.0) aircraft.setCruiseConfiguration(elapsedTimeSeconds = 0.0) turnLeg = TurnLeg( initialWayPoint = departureAirport, finalWayPoint = arrivalAirport, initialHeadingDegrees = 215.0, finalHeadingDegrees = 180.0, aircraft = aircraft, reverse = False) distanceStillToFlyMeters = 700000.0 turnLeg.buildTurnLeg(elapsedTimeSeconds = 0.0, distanceStillToFlyMeters = distanceStillToFlyMeters) turnLeg.createKmlOutputFile() turnLeg.createXlsxOutputFile()