def addElement(self, segment):
     self.Elements.append(segment)
     if segment.Type == 1:
         #key = "%s-%s" %(segment.StartDateTime.strftime('%Y%m%d'),segment.FlightNumber)
         key = self.findFlightByDateNumber(segment.StartDate,
                                           segment.FlightNumber)
         if key:
             flight = self.Flights[key]
         else:
             key = self.getNewKeyNumber()
             flight = Flight()
         flight.addSegment(segment)
         self.addFligth(flight, False, key)
Exemplo n.º 2
0
    def createFlights(self):
        allOptions = self.data['trips']['tripOption']
        flights = []
        for option in allOptions:
            price = option['saleTotal']
            for slice in option['slice']:
                for segment in slice['segment']:
                    airline = self.carriers.get(segment['flight']['carrier'],
                                                segment['flight']['carrier'])
                    leg = segment['leg'][0]
                    arrivalTime = leg['arrivalTime']
                    depTime = leg['departureTime']
                    dest = leg['destination']
                    origin = leg['origin']
                    meal = leg['meal']
                    f = Flight(depTime, arrivalTime, origin, dest, price,
                               airline, meal)
                    flights.append(f)
        return flights


#with open('C:\Users\Kunya\Desktop\jsonFlights.txt') as json_data:
#    d = json.load(json_data)
#    f = FlightParser(d)
#    print(d)
Exemplo n.º 3
0
    def __get_trip(self, trip):
        """
        Gets the trip information out of the json returned from ITA
        This should only be called if the caller understands the json returned by ITA
        """
        price = float(trip['ext']['price'][3:])
        ppm = float(trip['ext']['pricePerMile'][3:])
        ppm = round(ppm, 4)
        itin = trip['itinerary']
        distance = int(itin['distance']['value'])

        flights = []
        #get the flights out of the itinerary
        for flight in itin['slices']:
            stops = []
            layovers = flight.get('stops')
            if not layovers is None:
                for layover in layovers:
                    stops.append(layover['code'])

            fl = Flight(flight['origin']['code'],
                        flight['destination']['code'], flight['departure'],
                        flight['arrival'], flight['duration'], stops)
            flights.append(fl)

        return Trip(flights[0], flights[1], ppm, price, distance)
Exemplo n.º 4
0
    def procRow(self, values):
        for x in values:
            if len(x) == 0:
                return
        row = values
        pTok = row[0]
        fId = str(row[1])
        reward = float(row[2])
        fillRate = float(row[3])
        t_maxx = float(row[4])
        t_fail = float(row[5])
        t_succ = float(row[6])
        t_fail_std = float(row[7])
        t_succ_std = float(row[8].strip("\r\n"))

        self.rewList.append(float(reward)) if reward > 0.0 else None
        self.fillList.append(float(fillRate)) if fillRate > 0.0 else None
        self.tMaxList.append(float(t_maxx)) if t_maxx > 0.0 else None
        self.atFailList.append(float(t_fail)) if t_fail > 0.0 else None
        self.atSuccList.append(float(t_succ)) if t_succ > 0.0 else None
        self.stdtFailList.append(
            float(t_fail_std)) if t_fail_std > 0.0 else None
        self.stdtSuccList.append(
            float(t_succ_std)) if t_succ_std > 0.0 else None

        self.flights.append(
            Flight(pTok, fId, reward, fillRate, t_maxx, t_fail, t_succ,
                   t_fail_std, t_succ_std))
Exemplo n.º 5
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        f = Flight()

        # ----Home/Current Flight/Sign Out----
        home_button = ttk.Button(
            self,
            text="Home",
            command=lambda: controller.show_frame(ManagerPortal))
        home_button.grid(row=0, column=0, pady=5, columnspan=2)
        flight_string = "Flight #" + str(f.number)
        flight_label = ttk.Label(self, text=flight_string)
        flight_label.grid(row=0, column=2, pady=5, columnspan=2)
        sign_out_button = ttk.Button(
            self,
            text="Sign Out",
            command=lambda: controller.show_frame(ManagerSignIn))
        sign_out_button.grid(row=0, column=4, pady=5, columnspan=2)

        # ----Logo and Titles----
        load = Image.open("logo.png")
        load = load.resize((150, 85), Image.ANTIALIAS)
        render = ImageTk.PhotoImage(load)
        img = tk.Label(self, image=render)
        img.image = render
        img.grid(row=1, column=0, padx=100, columnspan=6)
        title1 = ttk.Label(self, text="Sunset Chaser Airlines")
        title1.grid(row=2, column=0, padx=20, pady=2, columnspan=6)
        title2 = ttk.Label(self, text="Manger Portal")
        title2.grid(row=3, column=0, padx=20, pady=5, columnspan=6)

        # ----Display Seat GUI----
        seats = f.get_seats()
        r = 4
        c = 0
        for i in range(len(seats)):
            if seats[i] == 'None':
                color = 'green'
            else:
                color = 'red'
            s = ttk.Label(self, text=f.get_seat_number(i), foreground=color)
            s.grid(row=r, column=c, padx=1, pady=1)
            c += 1
            if c == 6:
                c = 0
                r += 1
Exemplo n.º 6
0
 def get_data(self):
     """ Returns list of Employee instances from file """
     data_list = self.__read_data()
     flight_list = []
     for line in data_list:
         flight = Flight("Flight", "Flight", "Flight", "Flight")
         flight_list.append(flight)
     return flight_list
Exemplo n.º 7
0
def read_igc(fd):
	flight = Flight()

	day = 1
	month = 1
	year = 1970

	for line in fd.readlines():
		if line[0:5] == "HFDTE":
			day 	= int(line[5:7])
			month	= int(line[7:9])
			year 	= int(line[9:11]) + 2000
		elif line[0:1] == "B":
			#print line
			hour 	= int(line[1:3])
			minu 	= int(line[3:5])
			secs 	= int(line[5:7])
			dt	= datetime.datetime(year, month, day, hour, minu, secs)			

			tlat 	= line[7:14]
			ns	= line[14]
			lat_deg	= float(tlat[0:2])
			lat_min	= float(tlat[2:4])
			lat_dec	= float(tlat[6:8])
			lat	= lat_deg + (lat_min/60.0) + (lat_dec/60000.0)
			if ns == "S": 
				lat = -lat

			tlon	= line[15:23]
			ew	= line[23]
			lon_deg	= float(tlon[0:3])
			lon_min	= float(tlon[3:5])
			lon_dec	= float(tlon[5:8])
			lon	= lon_deg + (lon_min/60.0) + (lon_dec/60000.0)
			if ew == "W": 
				lon = -lon

			alt	= line[25:30]

			#print dt
			#print "%s, %s, %s" % (lat, lon, alt)
			pos	= Position(lat, lon, alt)
			flight.add_gps_position(dt, pos)

	return flight
Exemplo n.º 8
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        f = Flight()

        # ----Home/Current Flight/Sign Out----
        home_button = ttk.Button(
            self,
            text="Home",
            command=lambda: controller.show_frame(CustomerPortal))
        home_button.grid(row=0, column=0, pady=5)
        flight_string = "Flight #" + str(f.number)
        flight_label = ttk.Label(self, text=flight_string)
        flight_label.grid(row=0, column=1, pady=5)
        sign_out_button = ttk.Button(
            self,
            text="Sign Out",
            command=lambda: controller.show_frame(HomePage))
        sign_out_button.grid(row=0, column=2, pady=5)

        # ----Logo and Titles----
        load = Image.open("logo.png")
        load = load.resize((150, 85), Image.ANTIALIAS)
        render = ImageTk.PhotoImage(load)
        img = tk.Label(self, image=render)
        img.image = render
        img.grid(row=1, column=0, padx=100, columnspan=3)
        title1 = ttk.Label(self, text="Sunset Chaser Airlines")
        title1.grid(row=2, column=0, padx=20, pady=2, columnspan=3)
        title2 = ttk.Label(self, text="Customer Portal")
        title2.grid(row=3, column=0, padx=20, pady=2, columnspan=3)

        def buy_tickets():
            customers = f.get_customers()
            # only allow customers to get another ticket if they have not yet gotten one
            # they will be able to get a new one when a new flight begins
            if controller.USER not in customers:
                controller.show_frame(BuyTickets)

        # ----Buttons----
        get_tickets_button = ttk.Button(self,
                                        text="Get Tickets",
                                        command=lambda: buy_tickets())
        get_tickets_button.grid(row=4,
                                column=0,
                                padx=20,
                                pady=12,
                                columnspan=3)
        view_ticket_button = ttk.Button(
            self,
            text="View Seats",
            command=lambda: controller.show_frame(ViewSeatsCustomer))
        view_ticket_button.grid(row=5,
                                column=0,
                                padx=20,
                                pady=12,
                                columnspan=3)
Exemplo n.º 9
0
def generate_flights(file_name):
    with open(file_name, 'w', encoding='utf-8') as file:
        for i in range(0, number_of_flights):
            flight_id = i + 1
            airline = random.choice(airlines).get_id()
            departure = random.choice(locations).get_id()
            destination = random.choice(locations).get_id()

            if destination == departure:
                destination = random.choice(locations).get_id()

            departure_date = random.choice(dates).get_id()
            departure_time = random.choice(times).get_id()

            flight = Flight(flight_id, airline, departure, destination,
                            departure_date, departure_time)
            flights.append(flight)

            file.write(flight.csv_format())
            if i != number_of_flights - 1:
                file.write('\n')
Exemplo n.º 10
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        conn = create_connection("airline.db")
        cursor = conn.cursor()
        f = Flight()

        # ----Home/Current Flight/Sign Out----
        home_button = ttk.Button(
            self,
            text="Home",
            command=lambda: controller.show_frame(ManagerPortal))
        home_button.grid(row=0, column=0, pady=5, columnspan=2)
        sign_out_button = ttk.Button(
            self,
            text="Sign Out",
            command=lambda: controller.show_frame(ManagerSignIn))
        sign_out_button.grid(row=0, column=4, pady=5, columnspan=2)

        # ----Logo and Titles----
        load = Image.open("logo.png")
        load = load.resize((150, 85), Image.ANTIALIAS)
        render = ImageTk.PhotoImage(load)
        img = tk.Label(self, image=render)
        img.image = render
        img.grid(row=1, column=0, padx=100, columnspan=6)
        title1 = ttk.Label(self, text="Sunset Chaser Airlines")
        title1.grid(row=2, column=0, padx=20, pady=2, columnspan=6)
        title2 = ttk.Label(self, text="Manger Portal")
        title2.grid(row=3, column=0, padx=20, pady=5, columnspan=6)

        # ----Display Score----
        info1 = ttk.Label(self, text="The Satisfaction Idex reflects")
        info2 = ttk.Label(self, text="a group of randomly chosen customers")
        info3 = ttk.Label(self, text="and their satisfaction with the flight.")
        info1.grid(row=4, column=0, padx=5, columnspan=6)
        info2.grid(row=5, column=0, padx=5, columnspan=6)
        info3.grid(row=6, column=0, padx=5, columnspan=6)

        # get previous flight score
        flight_num = f.number - 1

        with conn:
            cursor.execute("SELECT * FROM FLIGHT WHERE NUMBER=?",
                           (flight_num, ))

        rows = cursor.fetchall()
        score = rows[0][1]

        score_string = "Flight #" + str(flight_num) + ": " + str(score)
        score_label = tk.Label(self, text=score_string)
        score_label.grid(row=7, column=0, pady=15, columnspan=12)
Exemplo n.º 11
0
 def put_flights_into_objects(self, table: list):
     flights = []
     table = table[1:]
     for x in range(table.__len__()):
         curr_element = table[x]
         details = [
             curr_element[1], curr_element[3], curr_element[4],
             curr_element[5], curr_element[6], curr_element[7],
             curr_element[8], curr_element[9], curr_element[10],
             curr_element[15]
         ]
         flights.append(Flight(details))
     return flights
Exemplo n.º 12
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        f = Flight()

        # ----Home/Current Flight/Sign Out----
        home_button = ttk.Button(
            self,
            text="Home",
            command=lambda: controller.show_frame(ManagerPortal))
        home_button.grid(row=0, column=0, pady=5, columnspan=2)
        flight_string = "Flight #" + str(f.number)
        flight_label = ttk.Label(self, text=flight_string)
        flight_label.grid(row=0, column=2, pady=5, columnspan=2)
        sign_out_button = ttk.Button(
            self,
            text="Sign Out",
            command=lambda: controller.show_frame(ManagerSignIn))
        sign_out_button.grid(row=0, column=4, pady=5, columnspan=2)

        # ----Logo and Titles----
        load = Image.open("logo.png")
        load = load.resize((150, 85), Image.ANTIALIAS)
        render = ImageTk.PhotoImage(load)
        img = tk.Label(self, image=render)
        img.image = render
        img.grid(row=1, column=0, padx=100, columnspan=6)
        title1 = ttk.Label(self, text="Sunset Chaser Airlines")
        title1.grid(row=2, column=0, padx=20, pady=2, columnspan=6)
        title2 = ttk.Label(self, text="Manger Portal")
        title2.grid(row=3, column=0, padx=20, pady=5, columnspan=6)

        # ----Buttons----
        report_button = ttk.Button(
            self,
            text="Satisfactory Report",
            command=lambda: controller.show_frame(SatisfactoryScore))
        report_button.grid(row=4, column=0, padx=20, pady=12, columnspan=6)
        end_flight_button = ttk.Button(
            self,
            text="End Flight",
            command=lambda: controller.show_frame(EndFlight))
        end_flight_button.grid(row=5, column=0, padx=20, pady=12, columnspan=6)
        view_seats_button = ttk.Button(
            self,
            text="View Seats",
            command=lambda: controller.show_frame(ViewSeatsManager))
        view_seats_button.grid(row=6, column=0, padx=20, pady=12, columnspan=6)
Exemplo n.º 13
0
    def read(self):
        flights = dict()
        arrs = dict()
        deps = dict()
        sinks = dict()

        self.f.readline()
        line = self.f.readline()
        while line is not '':
            args = line.split(',')
            start = StartNode(args[2], int(args[5]))
            end = EndNode(args[3], int(args[7]))

            #Map from airport to list of arrivals
            a = arrs.get(args[3], [])
            a.append(end)
            arrs[args[3]] = a

            #Map from airport to list of departures
            d = deps.get(args[2], [])
            d.append(start)
            deps[args[2]] = d

            #Map from airport to list of sink nodes
            s = sinks.get(args[3], None)
            if s == None:
                sinks[args[3]] = SinkNode(args[3])

            #Construct flight arcs
            flight = Flight(
                int(args[0]),  #ID \
                start,
                end,
                bool(int(args[8])),  #canceled \
                int(args[9])  #seats \
            )
            #Append to the node-arc adjacency lists
            start.outgoing.append(flight)
            end.incoming.append(flight)

            flights[int(args[0])] = flight
            line = self.f.readline()
        self.f.close()

        self.mapArcs(arrs, deps, sinks)

        return flights, deps, sinks, arrs
Exemplo n.º 14
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        f = Flight()

        # ----Home/Current Flight/Sign Out----
        home_button = ttk.Button(
            self,
            text="Home",
            command=lambda: controller.show_frame(ManagerPortal))
        home_button.grid(row=0, column=0, pady=5, columnspan=2)
        sign_out_button = ttk.Button(
            self,
            text="Sign Out",
            command=lambda: controller.show_frame(ManagerSignIn))
        sign_out_button.grid(row=0, column=4, pady=5, columnspan=2)

        # ----Logo and Titles----
        load = Image.open("logo.png")
        load = load.resize((150, 85), Image.ANTIALIAS)
        render = ImageTk.PhotoImage(load)
        img = tk.Label(self, image=render)
        img.image = render
        img.grid(row=1, column=0, padx=100, columnspan=6)
        title1 = ttk.Label(self, text="Sunset Chaser Airlines")
        title1.grid(row=2, column=0, padx=20, pady=2, columnspan=6)
        title2 = ttk.Label(self, text="Manager Portal")
        title2.grid(row=3, column=0, padx=20, pady=5, columnspan=6)

        def endFlight():
            f.end_flight()
            f.create_new_flight()
            controller.refresh_user(controller.USER, controller.USERTYPE)
            controller.show_frame(ManagerPortal)

        # ----End The Flight----
        confirm_string = "Are you sure you would like to end Flight #" + str(
            f.number) + "?"
        confirm_text = ttk.Label(self, text=confirm_string)
        confirm_text.grid(row=4, column=0, padx=20, pady=10, columnspan=12)
        confirm_button = ttk.Button(self,
                                    text="Confirm",
                                    command=lambda: endFlight())
        confirm_button.grid(row=5, column=0, padx=20, pady=2, columnspan=12)
def CreateFlight(flightlist, locationlist, dronelist):
    flightname = input("\nEnter Flight Name:")
    dronename = input("\nEnter Drone Name:")

    for i in range(len(dronelist)):
        if dronelist[i].drone_id == dronename:
            drone = dronelist[i].drone_id
            startlatitude = dronelist[i].gethomelatitude()
            startlongitude = dronelist[i].gethomelongitude()

    destlocation = input("\nEnter Destination Location:")

    for i in range(len(locationlist)):
        if locationlist[i].getlocationname() == destlocation:
            destlatitude = locationlist[i].getlocationlatitude()
            destlongitude = locationlist[i].getlocationlongitude()

    flightlist.append(
        Flight(flightname, startlatitude, startlongitude, destlatitude,
               destlongitude, drone, False))
Exemplo n.º 16
0
def Unpack_Flight(obj):
    current = 1

    id = Unpack_int(obj[current:obj[current] + current])
    current += obj[current]

    source = Unpack_string(obj[current:obj[current] + current])
    current += obj[current]

    destination = Unpack_string(obj[current:obj[current] + current])
    current += obj[current]

    departure_time = Unpack_datetime(obj[current:obj[current] + current])
    current += obj[current]

    airfare = Unpack_floating_point(obj[current:obj[current] + current])
    current += obj[current]

    number_of_seats_available = Unpack_int(obj[current:obj[current] + current])
    current += obj[current]

    return Flight(id, source, destination, departure_time, airfare,
                  number_of_seats_available)
Exemplo n.º 17
0
def main():
    # Populates airport list with data from text file
    airport_list = populate_airport_list("AirportData.txt")
    print(len(airport_list), "airports imported.")

    # --- All code below this line is highly temporary and is only used to test ---

    # Create temporary plane
    dh8 = AirplaneType("DeHavilland Canada DHC-8-400", "DH4", "DH4D", 1289,
                       345, 79, 30)

    fnr_counter = 100

    flight_list = []
    for origin in airport_list:
        for destination in airport_list:
            if origin != destination \
                    and origin.distance_to(destination) < 800\
                    and (origin.get_daily_passengers() > 250 or destination.get_daily_passengers() > 250) \
                    and ((origin.get_daily_passengers() > 250 and destination.get_daily_passengers() > 250 and origin.distance_to(destination) > 150) or origin.distance_to(destination) < 250)\
                    and dh8.can_use(origin) and dh8.can_use(destination):

                fnr = "WF" + str(fnr_counter)
                fnr_counter += 1
                flight_list.append(Flight(fnr, origin, destination, dh8))

    f = open("output.txt", "w")
    f.truncate(0)
    test_list = set()
    for flight in flight_list:
        print(flight)
        f.write(str(flight) + "\n")
        if flight.get_origin() not in test_list:
            test_list.add(flight.get_origin())
    print(len(flight_list), "flights created.")
    print(len(test_list), "airports covered.")
    f.close()
Exemplo n.º 18
0
#!/usr/bin/env python3

from Passenger import Passenger
from Flight import Flight

flights = []
#
#	read flight info
#
print("*** Listing flight information ***")
ffile = open("flights", "r")
for i in ffile:
    (ffrom, to, number) = i.split(",")
    number = number.strip()
    flights.append(Flight(ffrom, to, number))

print("There are %s flight records in all \n" % len(flights))
print("*** Now listing flights ***")
for i in flights:
    print(i)

print("\n*** opening passenger file ***")
pfile = open("passengers", "r")
print("*** processing passengers  ***")
for i in pfile:
    (fname, lname, flight, seat) = i.split(",")
    seat = seat.strip()
    print("processing", fname, lname)
    for f in flights:
        if (f.flightno() == flight):
            f.add(Passenger(fname, lname, flight, seat))
Exemplo n.º 19
0
airport_list = [
    airport_trd, airport_trf, airport_bgo, airport_svg, airport_osl
]

# print(airport_trd)
# print(airport_trf)
# print(airport_bgo)
# print(airport_svg)

dh8 = AirplaneType("DeHavilland Canada DHC-8-400", "DH4", "DH4D", 1289, 345,
                   79, 30)

# flight_1 = Flight("WF487", airport_trf, airport_trd, dh8)
# print(flight_1)

flight_list = []
flight_numbers_taken = []  # TODO: Rewrite flight number generation system

for origin in airport_list:
    for destination in airport_list:
        if origin != destination:
            while True:
                flight_number = "WF" + str(randint(100, 999))
                if flight_number not in flight_numbers_taken:
                    break
            flight_list.append(Flight(flight_number, origin, destination, dh8))

for flight in flight_list:
    print(flight)
print("In total " + str(len(flight_list)) + " flights")
Exemplo n.º 20
0
class MyTest(unittest.TestCase):
    def setUp(self):
        self.flight = Flight()
        self.angle = 0
        self.flag = 'n'
        self.flag1 = 'y'

    def test_to_string_method_should_return_empty_string(self):
        self.assertEqual(str(self.flight), '')
        print self.flight

    def test_should_print_welcome_message(self):
        with captured_output() as (out, err):
            Flight()

        output = out.getvalue().strip()
        self.assertEqual(output, "Start!")

    def test_should_print_given_arguments(self):
        argument1 = 1
        argument2 = ['z', 2]
        with captured_output() as (out, err):
            Travel.simulator_reply(argument1, argument2)

        output = out.getvalue().strip()
        self.assertEqual(output, str(argument1) + '\n' + str(argument2))

    def test_should_have_proper_field_values_set(self):
        self.assertEqual(Travel.angle, self.angle)
        self.assertEqual(Travel.flag, self.flag)
        self.assertEqual(Travel.flag1, self.flag1)

    def test_should_not_print_info_when_flag_is_yes_and_flag1_is_yes(self):
        self.flight.flag = 'y'
        self.flight.flag1 = 'y'
        self.verify_flight_go_empty_output()

    def test_should_not_print_info_when_flag_is_no_flag1_is_no(self):
        self.flight.flag = 'n'
        self.flight.flag1 = 'n'
        self.verify_flight_go_empty_output()

    def test_should_not_print_info_when_flag_is_no_flag1_is_yes(self):
        self.flight.flag = 'n'
        self.flight.flag1 = 'yes'
        self.verify_flight_go_empty_output()

    def verify_flight_go_empty_output(self):
        with captured_output() as (out, err):
            self.flight.go()

        output = out.getvalue().strip()
        self.assertEqual(output, '')

    @mock.patch.object(__builtin__, 'raw_input')
    def test_should_return_users_input(self, mock_raw_input):
        mock_raw_input.return_value = 'n'
        self.assertEqual(self.flight.user_action(''), 'n')

    @mock.patch.object(__builtin__, 'raw_input')
    def test_should_print_init_angle(self, mock_raw_input):
        mock_raw_input.return_value = 'n'
        with captured_output() as (out, err):
            self.flight.go()

        output = out.getvalue().strip()
        self.assertTrue(output.startswith('The angle is:'))
        self.assertTrue(output.endswith('We crashed!'))
Exemplo n.º 21
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        # ----Home/Current Flight/Sign Out----
        home_button = ttk.Button(
            self,
            text="Home",
            command=lambda: controller.show_frame(CustomerPortal))
        home_button.grid(row=0, column=0, pady=5, columnspan=2)
        sign_out_button = ttk.Button(
            self,
            text="Sign Out",
            command=lambda: controller.show_frame(HomePage))
        sign_out_button.grid(row=0, column=5, pady=5, columnspan=2)

        # ----Logo and Titles----
        load = Image.open("logo.png")
        load = load.resize((150, 85), Image.ANTIALIAS)
        render = ImageTk.PhotoImage(load)
        img = tk.Label(self, image=render)
        img.image = render
        img.grid(row=1, column=0, padx=100, columnspan=7)
        title1 = ttk.Label(self, text="Sunset Chaser Airlines")
        title1.grid(row=2, column=0, padx=20, pady=2, columnspan=7)
        title2 = ttk.Label(self, text="Customer Portal")
        title2.grid(row=3, column=0, padx=20, pady=5, columnspan=7)

        if controller.USER != '' and controller.USERTYPE == "customer":
            # ----Seat View----
            f = Flight()
            seats = f.get_seats()
            r = 4
            c = 0
            for i in range(len(seats)):
                if seats[i] == controller.USER:
                    color = 'green'
                else:
                    color = 'black'
                s = ttk.Label(self,
                              text=f.get_seat_number(i),
                              foreground=color)
                s.grid(row=r, column=c, padx=1, pady=1)
                c += 1
                if c == 6:
                    c = 0
                    r += 1
            # ----Ticket Info----
            c = Customer(controller.USER)

            num, tType, seat_list = c.get_ticket_info()

            f_string = "Flight #" + num
            flight_label = ttk.Label(self, text=f_string)
            flight_label.grid(row=4, column=6, pady=1)

            type_string = "Traveler: " + tType
            type_label = ttk.Label(self, text=type_string)
            type_label.grid(row=5, column=6, pady=1)

            seat_string = "Seats: "
            for seat in seat_list:
                seat_string += f.get_seat_number(seat) + ", "
            seat_label = ttk.Label(self, text=seat_string)
            seat_label.grid(row=6, column=6, pady=1)
Exemplo n.º 22
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        f = Flight()

        # ----Home/Current Flight/Sign Out----
        home_button = ttk.Button(
            self,
            text="Home",
            command=lambda: controller.show_frame(CustomerPortal))
        home_button.grid(row=0, column=0, pady=5)
        flight_string = "Flight #" + str(f.number)
        flight_label = ttk.Label(self, text=flight_string)
        flight_label.grid(row=0, column=1, pady=5)
        sign_out_button = ttk.Button(
            self,
            text="Sign Out",
            command=lambda: controller.show_frame(HomePage))
        sign_out_button.grid(row=0, column=2, pady=5)

        # ----Logo and Titles----
        load = Image.open("logo.png")
        load = load.resize((150, 85), Image.ANTIALIAS)
        render = ImageTk.PhotoImage(load)
        img = tk.Label(self, image=render)
        img.image = render
        img.grid(row=1, column=0, padx=100, columnspan=3)
        title1 = ttk.Label(self, text="Sunset Chaser Airlines")
        title1.grid(row=2, column=0, padx=20, pady=2, columnspan=3)
        title2 = ttk.Label(self, text="Customer Portal")
        title2.grid(row=3, column=0, padx=20, pady=2, columnspan=3)

        # ----Display Ticket Info----
        title3 = ttk.Label(self, text="Ticket(s) Confirmed!")
        title3.grid(row=4, column=0, padx=30, pady=2, columnspan=3)

        if controller.USER != '' and controller.USERTYPE == "customer":
            user = Customer(controller.USER)

            name_string = "Name: " + user.username
            name_label = ttk.Label(self, text=name_string)
            name_label.grid(row=5, column=0, pady=10, columnspan=3)

            num, t, seat_list = user.get_ticket_info()

            flight_string = "Flight #" + num
            flight_label = ttk.Label(self, text=flight_string)
            flight_label.grid(row=6, column=0, pady=10, columnspan=3)

            type_string = "Traveler Type: " + t
            type_label = ttk.Label(self, text=type_string)
            type_label.grid(row=7, column=0, pady=10, columnspan=3)

            seat_string = "Seats: "
            for seat in seat_list:
                seat_string += f.get_seat_number(seat)
                if seat != seat_list[len(seat_list) - 1]:
                    seat_string += ", "

            seats = ttk.Label(self, text=seat_string)
            seats.grid(row=8, column=0, columnspan=3)
Exemplo n.º 23
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        f = Flight()

        # ----Home/Current Flight/Sign Out----
        home_button = ttk.Button(
            self,
            text="Home",
            command=lambda: controller.show_frame(CustomerPortal))
        home_button.grid(row=0, column=0, pady=5, columnspan=2)
        flight_string = "Flight #" + str(f.number)
        flight_label = ttk.Label(self, text=flight_string)
        flight_label.grid(row=0, column=2, pady=5, columnspan=3)
        sign_out_button = ttk.Button(
            self,
            text="Sign Out",
            command=lambda: controller.show_frame(HomePage))
        sign_out_button.grid(row=0, column=5, pady=5, columnspan=2)

        # ----Logo and Titles----
        load = Image.open("logo.png")
        load = load.resize((150, 85), Image.ANTIALIAS)
        render = ImageTk.PhotoImage(load)
        img = tk.Label(self, image=render)
        img.image = render
        img.grid(row=1, column=0, padx=100, columnspan=7)
        title1 = ttk.Label(self, text="Sunset Chaser Airlines")
        title1.grid(row=2, column=0, padx=20, pady=2, columnspan=7)
        title2 = ttk.Label(self, text="Customer Portal")
        title2.grid(row=3, column=0, padx=20, pady=5, columnspan=7)

        def display_business(pos):
            r = 4
            c = 0
            for i in range(len(seats)):
                if i == options[pos]:
                    color = 'green'
                elif seats[i] != 'None':
                    color = 'red'
                else:
                    color = 'black'

                s = ttk.Label(self,
                              text=f.get_seat_number(i),
                              foreground=color)
                s.grid(row=r, column=c, padx=1, pady=1)

                c += 1
                if c == 6:
                    c = 0
                    r += 1

        def display_group(pos):
            r = 4
            c = 0
            for i in range(len(seats)):
                for j in options[pos]:
                    if i == j:
                        color = 'green'
                        break

                if seats[i] != 'None':
                    color = 'red'
                elif seats[i] == 'None':
                    if i not in options[pos]:
                        color = 'black'

                s = ttk.Label(self,
                              text=f.get_seat_number(i),
                              foreground=color)
                s.grid(row=r, column=c, padx=1, pady=1)

                c += 1
                if c == 6:
                    c = 0
                    r += 1

        # ----Show Seat Options & New/Confirm Button----
        global index
        index = 0

        if controller.USER != '' and controller.USERTYPE == "customer":
            seats = f.get_seats()
            user = Customer(controller.USER)
            if user.type != "None":
                options = []

                if user.type == "BT-BS":
                    options = f.add_business(True)
                    # display seats
                    display_business(index)
                elif user.type == "BT-N":
                    options = f.add_business(False)
                    display_business(index)

                elif user.type == "TT":
                    options = f.add_tourist()
                    display_group(index)

                elif user.type == "FT-1":
                    options = f.add_family(1)
                    display_group(index)

                elif user.type == "FT-2":
                    options = f.add_family(2)
                    display_group(index)

                elif user.type == "FT-3":
                    options = f.add_family(3)
                    display_group(index)

            def confirm():
                if user.type == "BT-BS" or user.type == "BT-N":
                    f.confirm([options[index]], controller.USER)
                else:
                    f.confirm(options[index], controller.USER)

                controller.refresh_user(controller.USER, "customer")
                controller.show_frame(TicketGenerated)

            def next():
                global index
                index += 1
                if index == len(options):
                    index = 0
                # display seats
                if user.type == "BT-BS" or user.type == "BT-N":
                    display_business(index)
                else:
                    display_group(index)

            new_button = ttk.Button(self, text="New", command=lambda: next())
            new_button.grid(row=4, column=6, padx=2, rowspan=4)
            confirm_button = ttk.Button(self,
                                        text="Confirm",
                                        command=lambda: confirm())
            confirm_button.grid(row=8, column=6, padx=2, rowspan=4)
Exemplo n.º 24
0
    def test_should_print_welcome_message(self):
        with captured_output() as (out, err):
            Flight()

        output = out.getvalue().strip()
        self.assertEqual(output, "Start!")
Exemplo n.º 25
0
 def setUp(self):
     self.flight = Flight()
     self.angle = 0
     self.flag = 'n'
     self.flag1 = 'y'
Exemplo n.º 26
0
def main():
    a = AirbusA319("G-EUPT")
    print(a.seating_plan())
    f = Flight("BA758", a)
    f.allocate_seat('12A', 'Guido van Rossum')
    f.allocate_seat('15F', 'Bjarne S')
    f.allocate_seat('15E', 'Andreas H')
    f.allocate_seat('1C', 'John M')
    f.allocate_seat('1D', 'Richard H')
    f.relocate_passenger('12A', '15D')
    f.make_boarding_cards(console_card_printer)
Exemplo n.º 27
0
def checkFlights(outBoundDate, outBoundLocation, inBoundDate, inBoundLocation):
    usedItineraryMap = set()
    return_list: List[Flight] = []
    url = "https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/pricing/v1.0"
    payload = "inboundDate=" + inBoundDate + "&cabinClass=economy&children=0&infants=0&country=US&currency=USD&locale=en-US&originPlace=" + outBoundLocation + "&destinationPlace=" + inBoundLocation + "&outboundDate=" + outBoundDate + "&adults=1"
    headers = {
        'x-rapidapi-host': "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com",
        'x-rapidapi-key': SensitiveInformation.API_PASSWORD,
        'content-type': "application/x-www-form-urlencoded"
    }
    response = requests.request("POST", url, data=payload, headers=headers)

    lowFLightsList: list
    if response:

        fullKey = response.headers["Location"]


        key = fullKey[-36:]
        url = "https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/pricing/uk2/v1.0/" + key;
        querystring = {"sortType": "price", "sortOrder": "asc", "pageIndex": "0", "pageSize": "10"}
        headers = {
            'x-rapidapi-host': "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com",
            'x-rapidapi-key': SensitiveInformation.API_PASSWORD
        }
        response = requests.request("GET", url, headers=headers, params=querystring)
        # converting to a dictionary

        if response:
                    responseDict = json.loads(response.text)
        if "Itineraries" in responseDict:
            itineraryList = responseDict["Itineraries"]
            index = -1
            for itineraryDict in itineraryList:
                index += 1
                priceList = itineraryDict["PricingOptions"]
                for priceOptionDict in priceList:
                    price = priceOptionDict["Price"]
                    # print(price)
                    if int(price) < Params.MinPrice:
                        if not (index in usedItineraryMap):
                            usedItineraryMap.add(index)
                            # Found a DEAL
                            flight = Flight()
                            # time to set:
                            # price
                            flight.price = price
                            # link
                            flight.link = priceOptionDict["DeeplinkUrl"]
                            # Going into the legs to toAP, fromAP, startDate, endDate
                            legsList = responseDict["Legs"]
                            for leg in legsList:
                                if leg["Id"] == itineraryDict["OutboundLegId"]:
                                    flight.startDate = leg["Departure"]
                                    flight.startDateArrival = leg["Arrival"]

                                if leg["Id"] == itineraryDict["InboundLegId"]:
                                    flight.endDate = leg["Departure"]
                                    flight.endDateArrival = leg["Arrival"]
                            queryDict = responseDict["Query"]
                            originID = queryDict["OriginPlace"]
                            destID = queryDict["DestinationPlace"]
                            placesList = responseDict["Places"]
                            for place in placesList:
                                if place["Id"] == int(originID):
                                    flight.fromAP = place["Name"]
                                if place["Id"] == int(destID):
                                    flight.toAP = place["Name"]

                            return_list.append(flight)
                    else:
                        return return_list
        else:
            raise OtherError(response.status_code, response.text)
        return return_list

    else:
        if str(response.status_code) == "429":
            raise TooManyAcessTrys
        else:
            raise OtherError(response.status_code, response.text)
Exemplo n.º 28
0
passengers.append(passengers_class.name)
passengers.append(passengers_class.passport)

passengers_class = Passengers('Jack5', 'B10000005')
passengers.append(passengers_class.name)
passengers.append(passengers_class.passport)

passengers_class = Passengers('Jack6', 'B10000006')
passengers.append(passengers_class.name)
passengers.append(passengers_class.passport)



# As a checking-assistant, i want to be able to list all flights.

flight_class = Flight('1111','London', 'Jamacia', '17/02/2020')
flights.append(flight_class.flight_list())

flight_class = Flight('1112','Jamaica', 'Brazil', '17/02/2020')
flights.append(flight_class.flight_list())

flight_class = Flight('1113','Brazil', 'Uganda', '17/02/2020')
flights.append(flight_class.flight_list())

# for flight in flights:
#     print(flight)

# As a check-in assistant, i want to be able to add a passenger to a flight.

flight_class.add_a_passenger('Jack1', '1111')
airplane.append(flight_class.list_of_passengers)
Exemplo n.º 29
0
def userInput():
    if request.method == 'GET':
        return render_template('UserInput.html')
    elif request.method == 'POST':
        
        testid= 'testid_01'
        flight = Flight(testid, request.form['flight_datetime'], request.form['flight'] )  # request.form['flight_datetime']
        hotel = Hotel(testid, request.form['hotel_datetime'], request.form['hotel'] )  # request.form['hotel_datetime']
        place  = Place(testid, request.form['place_datetime'], request.form['place'] )  # request.form['place_datetime']

        # return incorrect flight info page when result is not available
        # return incorrect flight info page when result is not available
        # retrieve live flight information from website (no free api I found so far..)
        url = 'https://flightaware.com/live/flight/' + str(flight.info)
        req = requests.get(url)
        soup = BeautifulSoup(req.text, "html.parser")
        flight_state = []  # from website https://flightware.com/live/flight/
        for each in soup.findAll("td", {"class": "smallrow1"}):
            flight_state.append(each.text)

        output = """
                <tr>
                    <th>Event</th>
                    <th>Detail</th>
                    <th>Date/Time</th>
                    <th>Status</th>
                </tr>
        """

        if(len(flight_state) == 0):
            flight.status="NOT AVAILABLE"
            tl = [flight, hotel, place]
            tl.sort(key= lambda obj: obj.datetime)            

            for obj in tl:            
                add =  """
                            <tr>
                                <td>""" + obj.title + """</td>
                                <td>""" + obj.info + """</td>
                                <td>""" + obj.datetime + """</td>
                                <td style='color:#f00'>""" + obj.status + """</td>
                            </tr>
                        """
                output += add
            
            output = Markup(output)
            return render_template('IncorrectFlightInfo.html', 
                            travel_id = testid, sorted_result= output
                            )
        else:
            print(flight_state)  # keep going  & show live flight info
            flight.status = str(re.sub(r'\([^)]*\)', '', flight_state[0]))


        repo.add_travel_info(flight, hotel, place)

        # return result information when flight info is availalble 
        # dt = datetime.datetime.strptime(flight.datetime, "%Y-%m-%dT%H:%M")  # conversion
        
        tl = [flight, hotel, place]
        tl.sort(key= lambda obj: obj.datetime)
                
        for obj in tl:
            
            add =  """
                        <tr>
                            <td>""" + obj.title + """</td>
                            <td>""" + obj.info + """</td>
                            <td>""" + obj.datetime + """</td>
                            <td style='color:#00bde4'>""" + obj.status + """</td>
                        </tr>
                    """
            output += add
            
        output = Markup(output)
        return render_template('ShowTravelInfo.html', 
                               travel_id = testid, sorted_result= output)

    return   # end of userInput()
Exemplo n.º 30
0
    def create_flight_popup(self):
        """
        Popup used to add flights to the system
        """
        mapview = self.parent
        global flights
        global locations
        global drones
        new_flight = Flight("F", 0, 0, 0, 0, "D", False, False)
        
        def buttonPressAddFlightName(newflight, name):
            newflight.setflightid(name)
        
        def buttonPressAddDrone(newflight, drones, selection):
            for drone in drones:
                if drone.drone_id == drones[int(selection)-1].drone_id:
                    newflight.setdrone(drone.drone_id)
                    newflight.setstartlatitude(drone.gethomelatitude())
                    newflight.setstartlongitude(drone.gethomelongitude())
        
        def buttonPressAddDestination(newflight, locations, selection):
            for location in locations:
                if location.getlocationname() == locations[int(selection)-1].getlocationname():
                    newflight.setdestinationlatitude(location.getlocationlatitude())
                    newflight.setdestinationlongitude(location.getlocationlongitude())
        #Adds Flight to system Flight list   
        def buttonPressAddFlight(newflight, flights):
            flights.append(newflight)
            SaveFlightList(flights)
            self.popup.dismiss()

        
        self.root = BoxLayout(orientation='vertical', spacing =5)
        
        flightname = TextInput(hint_text="Flight Name", multiline=False,size_hint=(.9, .8),pos_hint ={'center_x': .5,'center_y': 1})
        self.root.add_widget(flightname)
        
        #Scrollable Drone list
        dronelistview = Label(text= drone_list(),size_hint=(1.01, None))
        dronelistviewscroll = ScrollView(size_hint=(1, None), size=(Window.width, Window.height/8), do_scroll_x=False, scroll_type=['bars','content'], bar_width = 10, pos_hint ={'center_x': .5,'center_y': 1})
        dronelistviewscroll.add_widget(dronelistview) 
        dronelistviewscroll.effect_cls.spring_constant=0
        self.root.add_widget(dronelistviewscroll)
        
        drone = FloatInput(hint_text="Drone choice", multiline=False,size_hint=(.9, .8),pos_hint ={'center_x': .5,'center_y': 1})
        self.root.add_widget(drone)
        
        locationlistview = Label(text= location_list(),size_hint=(1.01, None))
        locationlistviewscroll = ScrollView(size_hint=(1, None), size=(Window.width, Window.height/8), do_scroll_x=False,scroll_y=1, scroll_type=['bars','content'], bar_width = 10, pos_hint ={'center_x': .5,'center_y': 1})
        locationlistviewscroll.add_widget(locationlistview)
        locationlistviewscroll.effect_cls.spring_constant=0
        self.root.add_widget(locationlistviewscroll)
        
        location = FloatInput(hint_text="Destination Choice", multiline=False,size_hint=(.9, .8),pos_hint ={'center_x': .5,'center_y': 1})
        self.root.add_widget(location)
        
        self.root.add_widget(Button(text="AddFlightName",size_hint=(.9, .8),pos_hint ={'center_x': .5,'center_y': 1},on_press=lambda a: buttonPressAddFlightName(new_flight, flightname.text)))
        self.root.add_widget(Button(text="AddDrone",size_hint=(.9, .8),pos_hint ={'center_x': .5,'center_y': 1},on_press=lambda a: buttonPressAddDrone(new_flight, drones, drone.text)))
        self.root.add_widget(Button(text="AddDestination",size_hint=(.9, .8),pos_hint ={'center_x': .5,'center_y': 1},on_press=lambda a: buttonPressAddDestination(new_flight, locations, location.text)))
        self.root.add_widget(Button(text="AddFlight",size_hint=(.9, .8),pos_hint ={'center_x': .5,'center_y': 1},on_press=lambda a: buttonPressAddFlight(new_flight, flights)))
        
        self.root.add_widget(Button(text="Close window", background_color = [1,0,0,1],size_hint=(.9, .8),pos_hint ={'center_x': .5,'center_y': 1},on_press=lambda a: self.popup.dismiss()))
        self.popup = Popup(title="Add Flight", auto_dismiss=True, size_hint=(.9,.8))
        self.popup.add_widget(self.root)
        self.popup.open()  
Exemplo n.º 31
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        conn = create_connection("airline.db")
        cursor = conn.cursor()
        f = Flight()

        # ----Home/Current Flight/Sign Out----
        home_button = ttk.Button(
            self,
            text="Home",
            command=lambda: controller.show_frame(CustomerPortal))
        home_button.grid(row=0, column=0, pady=5)
        flight_string = "Flight #" + str(f.number)
        flight_label = ttk.Label(self, text=flight_string)
        flight_label.grid(row=0, column=1, pady=5)
        sign_out_button = ttk.Button(
            self,
            text="Sign Out",
            command=lambda: controller.show_frame(HomePage))
        sign_out_button.grid(row=0, column=2, pady=5)

        # ----Logo and Titles----
        load = Image.open("logo.png")
        load = load.resize((150, 85), Image.ANTIALIAS)
        render = ImageTk.PhotoImage(load)
        img = tk.Label(self, image=render)
        img.image = render
        img.grid(row=1, column=0, padx=100, columnspan=3)
        title1 = ttk.Label(self, text="Sunset Chaser Airlines")
        title1.grid(row=2, column=0, padx=20, pady=2, columnspan=3)
        title2 = ttk.Label(self, text="Customer Portal")
        title2.grid(row=3, column=0, padx=20, pady=2, columnspan=3)
        title3 = ttk.Label(self, text="What type of seat(s) do you need?")
        title3.grid(row=4, column=0, padx=20, pady=2, columnspan=3)

        # ----Ticket Options----
        def travelerType(selection):
            if selection == 'Business Traveler (1) - Business Select':
                return "BT-BS"
            elif selection == 'Business Traveler (1) - Normal Seating':
                return "BT-N"
            elif selection == 'Tourist Travelers (2)':
                return "TT"
            elif selection == 'Family Travelers (2 adults + 1 child)':
                return "FT-1"
            elif selection == 'Family Travelers (2 adults + 2 child)':
                return "FT-2"
            elif selection == 'Family Travelers (2 adults + 3 child)':
                return "FT-3"

        def updateTraveler():
            if ticket_options.get() != '':
                type = travelerType(ticket_options.get())
                with conn:
                    cursor.execute(
                        "UPDATE CUSTOMER SET TRAVEL_TYPE=? WHERE USER=?",
                        (type, controller.USER))
                controller.refresh_user(controller.USER, "customer")
                controller.show_frame(ConfirmSeats)

        s = tk.StringVar()
        ticket_options = ttk.Combobox(self,
                                      state="readonly",
                                      width=27,
                                      textvariable=s)
        ticket_options['values'] = ('Business Traveler (1) - Business Select',
                                    'Business Traveler (1) - Normal Seating',
                                    'Tourist Travelers (2)',
                                    'Family Travelers (2 adults + 1 child)',
                                    'Family Travelers (2 adults + 2 child)',
                                    'Family Travelers (2 adults + 3 child)')

        ticket_options.grid(row=5, column=0, pady=20, columnspan=3)
        ticket_options.current(0)
        submit = ttk.Button(self,
                            text="Submit",
                            command=lambda: updateTraveler())
        submit.grid(row=6, column=0, columnspan=3, padx=10)
Exemplo n.º 32
0
    def fly(self):
        t0 = time.time()
        
        startWeight = self.p.calcActWeight()
        
        # in flight werden alle wichtigen Parameter über dem Flugverlauf gespeichert
        flight = Flight(self.stepWidth, startWeight, self.p.config)
        flight.mass = self.p.propulsion.mass
        flight.distance = self.m.calcDistance()
        
        # prüft ob das MTOM + Toleranz eingehalten wird
        if(startWeight > c.MTOM * (1 + c.MTOM_TOLERANCE)):
            flight.fail("[Pilot] MTOM ueberschritten")
            if(self.verbose):
                print(flight.fail)
            return flight
        
        # prüft ob das maximale Tankvolumen eingehlaten wird
        if(self.p.config["fuel"] > (1 + c.FUELTANK_TOLERANCE) * self.p.propulsion.V_tank):
            flight.fail("[Pilot] Tankvolumen reicht nicht aus.")
            if(self.verbose):
                print(flight.getErrorMessage())
            return flight
        
        missionState = 0;
        timeRange = range(0, max(self.m.sec) + 1, self.stepWidth)
        
        # Berechnung des Starts
        flight = self.takeOff(flight)

        # Berechnung des Fluges in einer Schleife, der Zietschritt ist in der config.ini der Mission definiert
        for t in timeRange:
            while(t >= self.m.sec[min(missionState + 1, len(self.m.sec) - 1)] and missionState < len(self.m.sec) - 1):
                missionState += 1
            
            if(self.verbose):
                print ('---TIME: ' + str(t) + '------------------')

            if(t == -1):
                print("break")
                
            if(t == -1):
                print("break")
                
            if(t == -1):
                print("break")

            mLast = flight.getLastMass()
            SoCLast = float(self.p.propulsion.bat.SoC)
            SoFLast = float(self.p.propulsion.SoF)
            H = float(self.m.getHeight(t))
            r = float(self.m.getRadius(t))
            w_g = float(self.m.getW_g(t))

            if(self.m.vSpecial[missionState] == ''):
                tas = float(self.m.getTas(t))
            else:
                tas = self.findSpeedSetting(mLast, H, w_g, r, self.m.vSpecial[missionState])

            u_g = math.sqrt(abs(tas**2 - w_g**2))

            F = self.p.calcNeededThrust(flight.getLastMass(), H, u_g, w_g, r)

            Pshaft, Nprop, m_f, We, Pice, Nice, Pemot, Wcharge = self.p.calcConsumption(H, tas, F, self.stepWidth)
            
            m = mLast - m_f
                
            SoC = float(self.p.propulsion.bat.SoC)
            SoF = float(self.p.propulsion.SoF)
                
            if(t == 0):
                m = mLast
                SoC = SoCLast
                SoF = SoFLast
                
            if(self.verbose):
                print('[Pilot] Mass [kg]: ' + str(m))
                print('[Pilot] Consumption [l/h]: ' + str(self.p.propulsion.ice.calcConsumtionToL_h(m_f, self.stepWidth)))
            
            flight.addStep(t, m, H, tas, r, F, Pshaft, Nprop, Pice, Nice, Pemot, SoC, SoF, We, Wcharge)

        t1 = time.time()
        flight.runTime = t1-t0

        # Konsolen-Ausgabe
        if(self.verbose):
            self.printReport(flight)
        
        # Speichern der Plots
        if(self.savePlot or self.verbose):
            self.plotFlight(flight)
            sfcMapPath = None
            propMapPath = None
            if(self.savePlot):
                fileName = self.m.NAME + "_" + self.propulsionType
                if(self.propulsionType == c.SERI or self.propulsionType == c.PARA):
                    fileName = fileName + "_Pice_" + str(int(flight.config["pice"]))
                sfcMapPath = self.m.getResultsPath() + "sfcMap_" + fileName
                propMapPath = self.m.getResultsPath() + "propMap_" + fileName
            self.p.propulsion.ice.plotEfficiencyMap(flight, fileName=sfcMapPath, showPlot=self.verbose, propType=self.propulsionType)
            self.p.propulsion.prop.plotEfficiencyMap(flight, fileName=propMapPath , showPlot=self.verbose)
  
        return flight