Beispiel #1
0
    def test_class_one(self):

        print '==================== Main start ==================== ' + time.strftime(
            "%c")

        t0 = time.clock()
        print "time start= {0}".format(t0)
        atmosphere = Atmosphere()

        t1 = time.clock()
        print "simulation time= {0} - simulation duration= {1:3.10f} seconds".format(
            t1, (t1 - t0))

        print '==================== load airports ==================== ' + time.strftime(
            "%c")
        airportsDB = AirportsDatabase()
        assert airportsDB.read()
        print '==================== air density at airports field elevation ==================== ' + time.strftime(
            "%c")

        for airport in airportsDB.getAirports():
            print '=======================' + airport.getName(
            ) + '===================='
            print 'field elevation= ' + str(
                airport.getFieldElevationAboveSeaLevelMeters()) + ' meters'
            altitudeMeters = airport.getFieldElevationAboveSeaLevelMeters()
            print 'air density= ' + str(
                atmosphere.getAirDensityKilogramsPerCubicMeters(
                    altitudeMeters)) + ' kg / meters ^^ 3'
Beispiel #2
0
    def test_class_two(self):

        print '==================== Main start ==================== ' + time.strftime(
            "%c")

        t0 = time.clock()
        print "time start= {0}".format(t0)
        atmosphere = Atmosphere()

        t1 = time.clock()
        print "simulation time= {0} - simulation duration= {1:3.10f} seconds".format(
            t1, (t1 - t0))

        altitudeMeters = 10.0
        print 'air density= ' + str(
            atmosphere.getAirDensityKilogramsPerCubicMeters(
                altitudeMeters)) + ' kg / meters ^^ 3'

        print '==================== air density at given altitudes ==================== ' + time.strftime(
            "%c")

        for altitudeMeters in ['10.0', '1000.0', '2000.0', '3000.0', '4000.0']:
            strMsg = 'altitude= ' + str(
                altitudeMeters) + ' meters ... air density= '
            strMsg += str(
                atmosphere.getAirDensityKilogramsPerCubicMeters(
                    float(altitudeMeters)))
            strMsg += ' kg / cubic meters'
            print strMsg
    def getAircraft(self, aircraftICAOcode):

        print(self.className +
              ': ================ get aircraft =================')
        atmosphere = Atmosphere()
        earth = Earth()
        acBd = BadaAircraftDatabase()
        assert acBd.read()

        if (acBd.aircraftExists(aircraftICAOcode)
                and acBd.aircraftPerformanceFileExists(aircraftICAOcode)):

            print(self.className + ': performance file= {0}'.format(
                acBd.getAircraftPerformanceFile(aircraftICAOcode)))
            self.aircraft = BadaAircraft(
                ICAOcode=aircraftICAOcode,
                aircraftFullName=acBd.getAircraftFullName(aircraftICAOcode),
                badaPerformanceFilePath=acBd.getAircraftPerformanceFile(
                    aircraftICAOcode),
                atmosphere=atmosphere,
                earth=earth,
                windSpeedMetersPerSecond=None,
                windDirectionDegrees=None)
            self.aircraft.dump()
        else:
            raise ValueError(self.className + ': aircraft not found= ' +
                             self.aircraftICAOcode)
Beispiel #4
0
 def test_Class_Two(self):
         
     print('================ test Two ====================')
     acBd = BadaAircraftDatabase()
     assert acBd.read()
     
     atmosphere = Atmosphere()
     earth = Earth()
     
     aircraftICAOcode = 'A320'
     if ( acBd.aircraftExists(aircraftICAOcode) and
          acBd.aircraftPerformanceFileExists(aircraftICAOcode)):
         
         print(acBd.getAircraftFullName(aircraftICAOcode))
         
         aircraftPerformance = AircraftPerformance(acBd.getAircraftPerformanceFile(aircraftICAOcode))
         aeroDynamics = AeroDynamics(aircraftPerformance, atmosphere, earth)
         
         print(aeroDynamics)
         phase = 'XX'
         try:
             print(aeroDynamics.getDragCoeff(phase))
         except Exception as e: 
             print('test two = {0}'.format(e))
             self.assertTrue(isinstance(e, AssertionError))
    def setUp(self) -> None:

        self.deltaTimeSeconds = 1.0
        atmosphere = Atmosphere()
        earth = Earth()

        print('==================== Aircraft ==================== ' +
              time.strftime("%c"))
        acBd = BadaAircraftDatabase()
        aircraftICAOcode = 'A320'
        if acBd.read():
            if (acBd.aircraftExists(aircraftICAOcode)
                    and acBd.aircraftPerformanceFileExists(aircraftICAOcode)):
                print(
                    '==================== aircraft found  ==================== '
                    + time.strftime("%c"))
                self.aircraft = BadaAircraft(
                    ICAOcode=aircraftICAOcode,
                    aircraftFullName=acBd.getAircraftFullName(
                        aircraftICAOcode),
                    badaPerformanceFilePath=acBd.getAircraftPerformanceFile(
                        aircraftICAOcode),
                    atmosphere=atmosphere,
                    earth=earth,
                    windSpeedMetersPerSecond=None,
                    windDirectionDegrees=None)
                print(self.aircraft)
                assert not (self.aircraft is None)
Beispiel #6
0
    def getAircraft(self):

        print(self.className +
              ': ================ get aircraft =================')
        atmosphere = Atmosphere()
        earth = Earth()
        acBd = BadaAircraftDatabase()
        assert acBd.read()

        if (acBd.aircraftExists(self.aircraftICAOcode)
                and acBd.aircraftPerformanceFileExists(self.aircraftICAOcode)):

            print(self.className + ': performance file= {0}'.format(
                acBd.getAircraftPerformanceFile(self.aircraftICAOcode)))
            self.aircraft = BadaAircraft(
                ICAOcode=self.aircraftICAOcode,
                aircraftFullName=acBd.getAircraftFullName(
                    self.aircraftICAOcode),
                badaPerformanceFilePath=acBd.getAircraftPerformanceFile(
                    self.aircraftICAOcode),
                atmosphere=atmosphere,
                earth=earth)
            self.aircraft.dump()
        else:
            raise ValueError(self.className + ': aircraft not found= ' +
                             self.aircraftICAOcode)
Beispiel #7
0
    def test_Class_One(self):
            
        print('================ test one ====================')
        acBd = BadaAircraftDatabase()
        assert acBd.read()
        
        atmosphere = Atmosphere()
        earth = Earth()
        
        aircraftICAOcode = 'A320'
        if ( acBd.aircraftExists(aircraftICAOcode) and
             acBd.aircraftPerformanceFileExists(aircraftICAOcode)):
            
            print(acBd.getAircraftFullName(aircraftICAOcode))
            
            aircraftPerformance = AircraftPerformance(acBd.getAircraftPerformanceFile(aircraftICAOcode))
            aeroDynamics = AeroDynamics(aircraftPerformance, atmosphere, earth)
            
            print(aeroDynamics)
            for phase in ['CR', 'IC', 'TO', 'AP', 'LD']:
                print('phase= {0} - Vstall CAS= {1} knots'.format(phase, aeroDynamics.getVstallKcas(phase)))
                
            for phase in ['CR', 'IC', 'TO', 'AP', 'LD']:
                print('phase= {0} - Drag Coeff= {1}'.format(phase, aeroDynamics.getDragCoeff(phase)))

            print('Wing Area Surface={0} Square-meters'.format(aeroDynamics.getWingAreaSurfaceSquareMeters()))
    def test_Vstall(self):

        t0 = time.clock()
        print("time start= ", t0)

        atmosphere = Atmosphere()
        earth = Earth()
        print(
            '==================== Stall Speed according to airport field elevation ==================== '
            + time.strftime("%c"))
        acBd = BadaAircraftDatabase()
        aircraftICAOcode = 'B743'
        if acBd.read():
            if (acBd.aircraftExists(aircraftICAOcode)
                    and acBd.aircraftPerformanceFileExists(
                        acBd.getAircraftPerformanceFile(aircraftICAOcode))):

                print(
                    '==================== aircraft found  ==================== '
                    + time.strftime("%c"))
                aircraft = BadaAircraft(
                    ICAOcode=aircraftICAOcode,
                    aircraftFullName=acBd.getAircraftFullName(
                        aircraftICAOcode),
                    badaPerformanceFilePath=acBd.getAircraftPerformanceFile(
                        aircraftICAOcode),
                    atmosphere=atmosphere,
                    earth=earth)
                aircraft.dump()

        print('==================== Airport database ==================== ' +
              time.strftime("%c"))
        airportsDB = AirportsDatabase()
        assert airportsDB.read()
        for airport in airportsDB.getAirports():
            print('============' + airport.getName() + ' ============')
            #print airport
            aircraft = BadaAircraft(
                ICAOcode=aircraftICAOcode,
                aircraftFullName=acBd.getAircraftFullName(aircraftICAOcode),
                badaPerformanceFilePath=acBd.getAircraftPerformanceFile(
                    aircraftICAOcode),
                atmosphere=atmosphere,
                earth=earth)
            print('airport field elevation= {0:.2f} meters'.format(
                airport.getFieldElevationAboveSeaLevelMeters()))
            CAS = aircraft.computeStallSpeedCasKnots()
            print('V stall Calibrated AirSpeed= {0:.2f} knots'.format(CAS))
            TAS = cas2tas(
                cas=CAS,
                altitude=airport.getFieldElevationAboveSeaLevelMeters(),
                temp='std',
                speed_units='kt',
                alt_units='m',
                temp_units=default_temp_units,
            )
            print('V stall True AirSpeed= {0:.2f} knots'.format(TAS))
    def test_class_one(self):

        print '==================== Main start ==================== '+ time.strftime("%c")

        t0 = time.clock()
        print "time start= {0}".format( t0)
        atmosphere = Atmosphere()
        
        t1 = time.clock()
        print "simulation time= {0} - simulation duration= {1:3.10f} seconds".format(t1 , (t1-t0))
    
        print '==================== load airports ==================== '+ time.strftime("%c")
        airportsDB = AirportsDatabase()
        assert airportsDB.read()
        print '==================== air density at airports field elevation ==================== '+ time.strftime("%c")
    
        for airport in airportsDB.getAirports():
            print '=======================' + airport.getName() + '===================='
            print 'field elevation= ' + str(airport.getFieldElevationAboveSeaLevelMeters()) + ' meters'
            altitudeMeters = airport.getFieldElevationAboveSeaLevelMeters()
            print 'air density= ' + str(atmosphere.getAirDensityKilogramsPerCubicMeters(altitudeMeters)) + ' kg / meters ^^ 3'
    def test_class_two(self):

        print '==================== Main start ==================== '+ time.strftime("%c")

        t0 = time.clock()
        print "time start= {0}".format( t0)
        atmosphere = Atmosphere()
        
        t1 = time.clock()
        print "simulation time= {0} - simulation duration= {1:3.10f} seconds".format(t1 , (t1-t0))
    
        altitudeMeters = 10.0
        print 'air density= ' + str(atmosphere.getAirDensityKilogramsPerCubicMeters(altitudeMeters)) + ' kg / meters ^^ 3'
        
        print '==================== air density at given altitudes ==================== '+ time.strftime("%c")
    
        for altitudeMeters in ['10.0', '1000.0', '2000.0', '3000.0', '4000.0']:
            strMsg = 'altitude= ' + str(altitudeMeters) + ' meters ... air density= '
            strMsg += str(atmosphere.getAirDensityKilogramsPerCubicMeters(float(altitudeMeters))) 
            strMsg += ' kg / cubic meters'
            print strMsg
    def setUp(self) -> None:
        self.atmosphere = Atmosphere()
        self.earth = Earth()
        self.acBd = BadaAircraftDatabase()
        self.aircraftICAOcode = 'A320'
        self.deltaTimeSeconds = 1.0

        assert self.acBd.read()
        assert self.acBd.aircraftExists(self.aircraftICAOcode)
        assert self.acBd.aircraftPerformanceFileExists(self.aircraftICAOcode)

        self.aircraft = BadaAircraft(
            ICAOcode=self.aircraftICAOcode,
            aircraftFullName=self.acBd.getAircraftFullName(
                self.aircraftICAOcode),
            badaPerformanceFilePath=self.acBd.getAircraftPerformanceFile(
                self.aircraftICAOcode),
            atmosphere=self.atmosphere,
            earth=self.earth,
            windSpeedMetersPerSecond=None,
            windDirectionDegrees=None)
    def test_Class_One(self):

        print('================ test one ====================')
        acBd = BadaAircraftDatabase()
        assert acBd.read()

        atmosphere = Atmosphere()
        earth = Earth()

        aircraftICAOcode = 'A320'
        if (acBd.aircraftExists(aircraftICAOcode)
                and acBd.aircraftPerformanceFileExists(aircraftICAOcode)):

            print(acBd.getAircraftFullName(aircraftICAOcode))

            aircraftPerformance = AircraftPerformance(
                acBd.getAircraftPerformanceFile(aircraftICAOcode))
            flightEnvelope = FlightEnvelope(
                aircraftPerformance=aircraftPerformance,
                ICAOcode=aircraftICAOcode,
                atmosphere=atmosphere,
                earth=earth)
            print(flightEnvelope)
from Home.Guidance.GroundRunLegFile import GroundRunLeg
from Home.Guidance.DescentGlideSlopeFile import DescentGlideSlope

from Home.BadaAircraftPerformance.BadaAircraftDatabaseFile import BadaAircraftDatabase
from Home.BadaAircraftPerformance.BadaAircraftFile import BadaAircraft

Knots2MetersPerSecond = 0.514444444

if __name__ == '__main__':

    t0 = time.clock()
    print("time start= ", t0)

    print('================ get aircraft =================')
    aircraftIcaoCode = 'A320'
    atmosphere = Atmosphere()
    earth = Earth()

    acBd = BadaAircraftDatabase()
    assert acBd.read()

    if (acBd.aircraftExists(aircraftIcaoCode)
            and acBd.aircraftPerformanceFileExists(
                acBd.getAircraftPerformanceFile(aircraftIcaoCode))):

        aircraft = BadaAircraft(
            aircraftIcaoCode,
            acBd.getAircraftPerformanceFile(aircraftIcaoCode), atmosphere,
            earth)
        aircraft.dump()
    else:
Beispiel #14
0
    def test_DescentGlideSlope(self):

        atmosphere = Atmosphere()
        earth = Earth()
        print '==================== three degrees Descent Slope Start  ==================== ' + time.strftime(
            "%c")

        acBd = BadaAircraftDatabase()
        aircraftICAOcode = 'A320'
        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)
                aircraft.dump()

        assert not (aircraft is None)
        print '==================== runways database ==================== ' + time.strftime(
            "%c")
        runWaysDatabase = RunWayDataBase()
        assert runWaysDatabase.read()

        runway = runWaysDatabase.getFilteredRunWays(airportICAOcode='LFML',
                                                    runwayName='')
        print runway

        print "=========== arrival airport  =========== " + time.strftime("%c")
        airportsDB = AirportsDatabase()
        assert (airportsDB.read())

        MarseilleMarignane = airportsDB.getAirportFromICAOCode('LFML')
        print MarseilleMarignane

        print "=========== descent glide slope  =========== " + time.strftime(
            "%c")
        threeDegreesGlideSlope = DescentGlideSlope(
            runway=runway,
            aircraft=aircraft,
            arrivalAirport=MarseilleMarignane)

        initialWayPoint = WayPoint(Name='startOfDescentGlideSlope', )
        print "=========== DescentGlideSlope build the glide slope  =========== " + time.strftime(
            "%c")
        #     threeDegreesGlideSlope.buildGlideSlope(deltaTimeSeconds = 0.1,
        #                         elapsedTimeSeconds = 0.0,
        #                         initialWayPoint = None,
        #                         flownDistanceMeters = 0.0,
        #                         distanceStillToFlyMeters = 100000.0,
        #                         distanceToLastFixMeters = 100000.0)

        threeDegreesGlideSlope.buildSimulatedGlideSlope(
            descentGlideSlopeSizeNautics=5.0)

        print "=========== DescentGlideSlope  =========== " + time.strftime(
            "%c")
        for node in threeDegreesGlideSlope.getVertices():
            print node

        print "=========== DescentGlideSlope length =========== " + time.strftime(
            "%c")
        print "get number of vertices= {0}".format(
            threeDegreesGlideSlope.getNumberOfVertices())
        print "get number of edges= {0}".format(
            threeDegreesGlideSlope.getNumberOfEdges())
        print 'Glide Slope overall length= {0} meters'.format(
            threeDegreesGlideSlope.computeLengthMeters())

        threeDegreesGlideSlope.createKmlOutputFile()
        threeDegreesGlideSlope.createXlsxOutputFile()
        print '==================== three degrees Descent Slope End  ==================== ' + time.strftime(
            "%c")
    def test_One(self):

        print('=========== main start ==================')
        aircraftICAOcode = 'A320'

        atmosphere = Atmosphere()
        assert (not (atmosphere is None))

        earth = Earth()
        assert (not (earth is None))

        acBd = BadaAircraftDatabase()
        assert acBd.read()

        if (acBd.aircraftExists(aircraftICAOcode)
                and acBd.aircraftPerformanceFileExists(aircraftICAOcode)):

            aircraft = BadaAircraft(
                ICAOcode=aircraftICAOcode,
                aircraftFullName=acBd.getAircraftFullName(aircraftICAOcode),
                badaPerformanceFilePath=acBd.getAircraftPerformanceFile(
                    aircraftICAOcode),
                atmosphere=atmosphere,
                earth=earth)
            aircraft.dump()
        else:
            raise ValueError(': aircraft not found= ' + aircraftICAOcode)

        assert not (aircraft is None)

        print('================ load airports =================')
        airportsDB = AirportsDatabase()
        assert (airportsDB.read())

        adepIcaoCode = 'LFML'

        departureAirport = airportsDB.getAirportFromICAOCode(adepIcaoCode)
        print(': departure airport= ' + str(departureAirport))
        assert not (departureAirport is None)

        print('================ load runways =================')

        runWaysDatabase = RunWayDataBase()
        assert (runWaysDatabase.read())

        print('====================  take off run-way ==================== ')
        departureRunway = runWaysDatabase.getFilteredRunWays(adepIcaoCode)
        print(
            '=========== minimum and maximum aircraft mass ==================')

        minMassKg = aircraft.getMinimumMassKilograms()
        print('aircraft minimum mass: ' + str(minMassKg) + ' kilograms')

        maxMassKg = aircraft.getMaximumMassKilograms()
        print('aircraft maximum mass: ' + str(maxMassKg) + ' kilograms')

        deltaMass = maxMassKg - minMassKg
        massKg = 39000.0
        while (massKg < maxMassKg):

            massKg += 1000.0
            print(
                '==================== set aircraft reference mass ==================== '
            )
            aircraft = BadaAircraft(
                ICAOcode=aircraftICAOcode,
                aircraftFullName=acBd.getAircraftFullName(aircraftICAOcode),
                badaPerformanceFilePath=acBd.getAircraftPerformanceFile(
                    aircraftICAOcode),
                atmosphere=atmosphere,
                earth=earth)

            aircraft.setTargetCruiseFlightLevel(
                310, departureAirport.getFieldElevationAboveSeaLevelMeters())

            print(
                '==================== aircraft reference mass ==================== '
            )
            print('aircraft reference mass= ' + str(massKg) + ' Kilograms')

            aircraft.setAircraftMassKilograms(massKg)
            print(
                '==================== begin of ground run ==================== '
            )
            groundRunLeg = GroundRunLeg(runway=departureRunway,
                                        aircraft=aircraft,
                                        airport=departureAirport)

            groundRunLeg.buildDepartureGroundRun(
                deltaTimeSeconds=0.1,
                elapsedTimeSeconds=0.0,
                distanceStillToFlyMeters=500000.0,
                distanceToLastFixMeters=500000.0)

            groundRunLeg.computeLengthMeters()
            #groundRunLeg.createXlsxOutputFile()

            print(
                '==================== end of ground run ==================== ')
            initialWayPoint = groundRunLeg.getLastVertex().getWeight()

            print(
                '==================== dump aircraft speed profile ==================== '
            )
            aircraft.createStateVectorOutputFile(aircraftICAOcode + "-Mass-" +
                                                 str(massKg))
            print('=========== main end ==================')
Beispiel #16
0
    def test_TurnLeg(self):

        print '==================== Turn Leg ==================== ' + time.strftime(
            "%c")
        atmosphere = Atmosphere()
        earth = Earth()

        acBd = BadaAircraftDatabase()
        aircraftICAOcode = 'A320'
        assert acBd.read()
        assert acBd.aircraftExists(aircraftICAOcode)
        assert 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)
        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=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=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 end =============== '
        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=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 =============== '
Beispiel #17
0
@author: rjdverbeek <*****@*****.**>
'''



from Home.aerocalc.airspeed import tas2cas, cas2tas

from Home.Environment.Atmosphere import Atmosphere
from Home.Environment.Earth import Earth

from Home.BadaAircraftPerformance.BadaAircraftDatabaseFile import BadaAircraftDatabase
from Home.BadaAircraftPerformance.BadaAircraftFile import BadaAircraft

if __name__ == '__main__':
    
    atmosphere = Atmosphere()

    print ( '=========== main start ==================' )
    for tas in range(0,100,1):
        cas1 = tas2cas(tas = tas , altitude = 100.0, temp='std', speed_units = 'm/s', alt_units='m')
        cas2 = atmosphere.tas2cas(tas, altitude = 100.0, speed_units = 'm/s', alt_units = 'm')
        print ( tas, cas1, cas2 )
    
    print ( '=========== main start ==================' )

    for altitude in range(0, 10000, 100):
        cas = 100.0 # 100 m/s
        tas1 = cas2tas(cas = cas, altitude = altitude, temp='std', speed_units = 'm/s', alt_units='m')
        tas2 = atmosphere.cas2tas(cas = cas, altitudeMeters = altitude, speed_units = 'm/s', altitude_units = 'm')
        print ( 'altitude= {0} meters ... cas= {1} m/s constant ... tas1= {2} m/s ... tas2= {3} m/s'.format(altitude, cas, tas1, tas2) )
    
Beispiel #18
0
from Home.Environment.Earth import Earth

from Home.OutputFiles.XlsxOutputFile import XlsxOutput

Meter2Feet = 3.2808
Knots2MetersPerSecond = 0.514444444

#============================================
if __name__ == '__main__':

    FileName = "FlightEnvelope.xlsx"
    print("=================== Flight Envelope start======================")

    aircraftIcaoCode = 'A320'

    atmosphere = Atmosphere()
    assert not (atmosphere is None)

    earth = Earth()
    assert not (earth is None)

    acBd = BadaAircraftDatabase()
    assert acBd.read()

    assert acBd.aircraftExists(aircraftIcaoCode)
    assert acBd.aircraftPerformanceFileExists(aircraftIcaoCode)

    aircraft = BadaAircraft(aircraftIcaoCode,
                            acBd.getAircraftFullName(aircraftIcaoCode),
                            acBd.getAircraftPerformanceFile(aircraftIcaoCode),
                            atmosphere, earth)
Beispiel #19
0
    def test_DescentGlideSlope_Two(self):

        atmosphere = Atmosphere()
        earth = Earth()
        print(
            '==================== three degrees Descent Slope Start  ==================== '
            + 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)
                aircraft.dump()

        assert not (aircraft is None)
        print('==================== runways database ==================== ' +
              time.strftime("%c"))
        runWaysDatabase = RunWayDataBase()
        assert runWaysDatabase.read()

        runway = runWaysDatabase.getFilteredRunWays(airportICAOcode='LFPG',
                                                    runwayName='08L')
        print(runway)

        print("=========== airports  =========== " + time.strftime("%c"))
        airportsDB = AirportsDatabase()
        assert (airportsDB.read())

        CharlesDeGaulle = airportsDB.getAirportFromICAOCode('LFPG')
        print(CharlesDeGaulle)

        print("=========== descent glide slope  =========== " +
              time.strftime("%c"))
        threeDegreesGlideSlope = DescentGlideSlope(
            runway=runway, aircraft=aircraft, arrivalAirport=CharlesDeGaulle)

        threeDegreesGlideSlope.buildSimulatedGlideSlope(
            descentGlideSlopeSizeNautics=5.0)

        print("=========== DescentGlideSlope  =========== " +
              time.strftime("%c"))
        for node in threeDegreesGlideSlope.getVertices():
            print(node)

        print("=========== DescentGlideSlope length =========== " +
              time.strftime("%c"))
        print("get number of vertices= {0}".format(
            threeDegreesGlideSlope.getNumberOfVertices()))
        print("get number of edges= {0}".format(
            threeDegreesGlideSlope.getNumberOfEdges()))
        print('Glide Slope overall length= {0} meters'.format(
            threeDegreesGlideSlope.computeLengthMeters()))

        threeDegreesGlideSlope.createKmlOutputFile()
        threeDegreesGlideSlope.createXlsxOutputFile()
        print(
            '==================== three degrees Descent Slope End  ==================== '
            + time.strftime("%c"))
Beispiel #20
0
    def test_ClimbRamp(self):

        atmosphere = Atmosphere()
        earth = Earth()

        print '==================== Three Degrees climb slope ==================== ' + time.strftime(
            "%c")
        acBd = BadaAircraftDatabase()
        aircraftICAOcode = 'A320'
        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)
                aircraft.dump()

        assert not (aircraft is None)

        print '==================== get Charles Gaulle airport ==================== ' + time.strftime(
            "%c")
        airportsDB = AirportsDatabase()
        assert (airportsDB.read())
        CharlesDeGaulle = airportsDB.getAirportFromICAOCode('LFPG')
        print CharlesDeGaulle
        assert not (aircraft is None)

        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

        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")
 def test_Two(self):  
 
     t0 = time.clock()
     print ( " ========== Great Circle ======= time start= ", t0 )
     atmosphere = Atmosphere()
     earth = Earth()
     
     print ( '==================== Great Circle ==================== '+ time.strftime("%c") )
     acBd = BadaAircraftDatabase()
     aircraftICAOcode = 'A320'
     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)
             print ( aircraft )
     
     else:
         
         print ( '====================  airport database ==================== '+ time.strftime("%c") )
         airportsDB = AirportsDatabase()
         assert not(airportsDB is None)
         
         wayPointsDb = WayPointsDatabase()
         assert (wayPointsDb.read())
     
         initialWayPoint = wayPointsDb.getWayPoint('TOU')
         finalWayPoint = wayPointsDb.getWayPoint('ALIVA') 
         print ( initialWayPoint.getBearingDegreesTo(finalWayPoint) )
         print ( finalWayPoint.getBearingDegreesTo(initialWayPoint) )
         
         ''' departure ground run => initial speed is null '''
         trueAirSpeedMetersSecond = 70.0
         elapsedTimeSeconds = 0.0
 
         aircraft.setCurrentAltitudeSeaLevelMeters( 
                                          elapsedTimeSeconds = 0.0 , 
                                          altitudeMeanSeaLevelMeters = 0.0,
                                          lastAltitudeMeanSeaLevelMeters = 0.0,
                                          targetCruiseAltitudeMslMeters = 10000.0)
                
         aircraft.initStateVector( 
                         elapsedTimeSeconds = 0.0,
                         trueAirSpeedMetersSecond = 70.0,
                         airportFieldElevationAboveSeaLevelMeters = 152.0)
         
         aircraft.setTargetCruiseFlightLevel(RequestedFlightLevel = 310, 
                                    departureAirportAltitudeMSLmeters = 152.0)
         
         print ( "=========== simulated descent glide slope  =========== " + time.strftime("%c") )
         MarseilleMarignane = airportsDB.getAirportFromICAOCode('LFML')
         
         
         print ( '==================== runways database ==================== '+ time.strftime("%c") )
         runWaysDatabase = RunWayDataBase()
         assert runWaysDatabase.read()
         runway = runWaysDatabase.getFilteredRunWays(airportICAOcode = 'LFML', runwayName = '')
 
         arrivalGroundRun = GroundRunLeg( runway   = runway,
                                          aircraft = aircraft,
                                          airport  = MarseilleMarignane )
         
         touchDownWayPoint = arrivalGroundRun.computeTouchDownWayPoint()
         aircraft.setArrivalRunwayTouchDownWayPoint(touchDownWayPoint)
 
         threeDegreesGlideSlope = DescentGlideSlope(runway = runway, 
                                                    aircraft = aircraft, 
                                                    arrivalAirport = MarseilleMarignane )
         threeDegreesGlideSlope.buildSimulatedGlideSlope(descentGlideSlopeSizeNautics = 5.0)
         approachWayPoint = threeDegreesGlideSlope.getLastVertex().getWeight()
         
         aircraft.setTargetApproachWayPoint(approachWayPoint)
         
         ''' =================================='''
         greatCircle = GreatCircleRoute(initialWayPoint = initialWayPoint, 
                                         finalWayPoint = finalWayPoint,
                                         aircraft = aircraft)
         
         distanceStillToFlyMeters = initialWayPoint.getDistanceMetersTo(approachWayPoint)
 
         greatCircle.computeGreatCircle( 
                            deltaTimeSeconds = 0.1,
                            elapsedTimeSeconds = 0.0,
                            distanceStillToFlyMeters = distanceStillToFlyMeters,
                            distanceToLastFixMeters = distanceStillToFlyMeters)
         
         print ( 'main great circle length= ' + str(greatCircle.computeLengthMeters()) + ' meters' )
 
         greatCircle.createKmlOutputFile()
         greatCircle.createXlsxOutputFile()