Example #1
0
 def create_groups(self):
     is_play1 = False
     is_play2 = False
     for air in gl.aircraft_group.sprites():
         if air.play.index == 0:
             is_play1 = True
         elif air.play.index == 1:
             is_play2 = True
     if self.aircraft_time == 0 or self.clock_ticks - self.aircraft_time > 4000:
         if is_play1 is False and self.play1.play > 0:
             self.aircraft_time = self.clock_ticks
             Aircraft((gl.all_group, gl.aircraft_group), self, self.play1)
             self.aircraft_start.play(0, 0, 0)
     if self.meteorite_time == 0 or self.clock_ticks - self.meteorite_time > 100:
         m_count = len(gl.meteorite_group.sprites())
         if m_count < self.meteorites_count:
             self.meteorite_time = self.clock_ticks
             Meteorite((gl.all_group, gl.meteorite_group), self)
     if self.reward_time == 0 or self.clock_ticks - self.reward_time > 100:
         r_count = len(gl.reward_group.sprites())
         if r_count < self.reward_count:
             self.reward_time = self.clock_ticks
             rtype = random.randint(0, 1)
             if rtype == 1:
                 Reward((gl.all_group, gl.reward_group, gl.s_reward_group),
                        self, random.randint(0, 5))
             else:
                 Reward((gl.all_group, gl.reward_group, gl.p_reward_group),
                        self, random.randint(6, 9))
Example #2
0
    def __init__(self):
        deque.__init__(self)

        self.currentTime = 0
        self.nextAvailable = 0
        self.lastPlane = Aircraft('nil', 0, 0, 0, 0)
        self.totalFuelBurned = 0
        self.totalDelayCost = 0
 def __init__(self):
     self.data = pd.read_excel('data/fleet.xlsx', index_col=0, usecols='A:D')
     self.amount = {}
     self.aircraftList = {}
     for i in self.data.columns:
         fl = self.data[i]
         self.amount[i] = fl['Fleet']
         self.aircraftList[i] = Aircraft(i, fl['Speed'], fl['Cargo capacity'], fl['Average TAT'], fl['Maximum Range'], fl['Runway Required'], fl['Lease Cost'], fl['Fixed Operating Cost'], fl['Cost per Hour'], fl['Fuel Cost Parameter'])
Example #4
0
 def loadData(self, csvFile):
     try:
         with open(csvFile) as csvFile:
             reader = csv.DictReader(csvFile)
             try:
                 for row in reader:
                     self._aircraftDict[row['code']] = Aircraft(
                         row['type'], row['units'], row['manufacturer'],
                         row['range'])
             except Exception:
                 pass
     except FileNotFoundError:
         return ('CSV file not found!')
         sys.exit(1)
Example #5
0
def setup():
    aircraftList = []
    os.chdir(
        r'C:/Users/zblue/Documents/Fall 2017/Algorithms for Nonlinear Optimization/'
    )
    unMergeExcelCell('AircraftInfo_final.xls')
    workbook = xlrd.open_workbook('AircraftInfo_temp2_unmerged.xls',
                                  formatting_info=True)
    sheet = workbook.sheet_by_index(0)
    row_idx = 1
    while row_idx < sheet.nrows:
        name = sheet.cell(row_idx, 0).value + ' '
        if type(sheet.cell(row_idx, 1).value) is str:
            name += sheet.cell(row_idx, 1).value
        else:
            name += str(int(sheet.cell(row_idx, 1).value))

        if not sheet.cell(row_idx, 2).value == '':
            if type(sheet.cell(row_idx, 2).value) is str:
                name += '-' + sheet.cell(row_idx, 2).value
            else:
                name += '-' + str(int(sheet.cell(row_idx, 2).value))

        myACDict = {
            'Light': AircraftType.TURBOPROP,
            'Medium': AircraftType.NARROW,
            'Heavy': AircraftType.HEAVY
        }
        acType = myACDict[sheet.cell(row_idx, 3).value]

        inService = sheet.cell(row_idx, 4).value
        if inService == '':
            inService = 0
        capacity = sheet.cell(row_idx, 5).value
        if capacity == '':
            capacity = 0
        fuelBurn = sheet.cell(row_idx, 6).value
        if fuelBurn == '':
            fuelBurn = 0
        aircraftList.append((Aircraft(name, acType, capacity, fuelBurn,
                                      3), inService))

        row_idx += 1
    return aircraftList
Example #6
0
    def loadData(self, filename):
        """
        gets the filename and loads all the information
        about the Aircraft

        **Parameters**\n
        ----------\n
        filename: Aircraft data filename
        """

        with open(filename, encoding="utf8") as file:

            reader = csv.reader(file)

            try:
                for row in reader:
                    self.aircraftdict[row[0]] = Aircraft(
                        row[0], row[1], row[2], row[3], row[4])

            except FileNotFoundError:
                print("File not found")
Example #7
0
def test():

    print(
        "-------------------------------------Testing AC----------------------------------"
    )

    x0 = [0.0, 0.0, 0.0]
    vel0 = [1.0, 2.0, 3.0]
    euler0 = [0.1, 0.2, 0.3]
    ang_vel0 = [0.1, 0.2, 0.3]

    initial_parameters = [x0, vel0, euler0, ang_vel0]
    ac = Aircraft(initial_parameters, Tsc=0.01, RK4=False)
    forces = [1, 1, 1]
    forces = [0, 0, 0]
    moments = [0, 0, 0]
    print(ac.RK4)
    print(ac.vel, ac.ang_vel)
    print(ac.DotAngVel_get())
    ac.update_onestep(forces, moments)
    print(ac.vel, ac.ang_vel)
        self.store_of_ammo = store_of_ammo
        self.health_point = health_point

    def addAircraft(self, aircraft):
        self.list_of_aircraft.append(aircraft)

    def fill(self):
        for item in self.list_of_aircraft:
            if item.getType() == "F35":
                self.store_of_ammo = item.refill(self.store_of_ammo)
                print(str(self.store_of_ammo))

    def fight(self, Carrier):
        carrier_max_dmg = 0
        for item in self.list_of_aircraft:
            carrier_max_dmg += 

carrier = Carrier(1000, 2000)

aircraft1 = Aircraft("F35")
carrier.addAircraft(aircraft1)
aircraft2 = Aircraft("F16")
carrier.addAircraft(aircraft2)
aircraft3 = Aircraft("F35")
carrier.addAircraft(aircraft3)
aircraft4 = Aircraft("F16")
carrier.addAircraft(aircraft4)
aircraft5 = Aircraft("F35")
carrier.addAircraft(aircraft5)
aircraft6 = Aircraft("F16")
carrier.addAircraft(aircraft6)
Example #9
0
 def create(self, capacity, registrationNo, types, name):
     a = Aircraft(capacity, registrationNo, types, name)
     self.aircrafts.append(a)
     self.file.write(f"{str(a)}\n")
     self.file.flush()
from Aircraft import Aircraft  # this runs without an error but doesn't give me the output I expected

jumbo = Aircraft("747")
print("About to start preparing a ", jumbo.planeType, " for takeoff")
jumbo.addFuel(30)
jumbo.printStatus()
jumbo.fuelCheck()
jumbo.fly(500)

airbus = Aircraft("A330")
print("About to start preparing a ", airbus.planeType, " for takeoff")
airbus.addFuel(2000)
airbus.printStatus()
airbus.fuelCheck()
airbus.fly(1000)

boeing = Aircraft("737")
print("About to start preparing a ", boeing.planeType, " for takeoff")
fuelInTruck = 50000
fuelInTruck = boeing.addFuel(fuelInTruck)
boeing.printStatus()
boeing.fuelCheck()
boeing.fly(5000)
print("Fuel Truck still has: ", fuelInTruck)
Example #11
0
 def create(self, capacity, registrationNo, types, name):
     info = Aircraft(capacity, registrationNo, types, name)
     self.aircraft.append(info)
     self.file.write(f"{str(info)}\n")
     self.file.flush()
from Airport import Airport
from Route import Route
from Aircraft import Aircraft

plane = Aircraft("737", 5600, "LHR", "imperial")

madrid = Airport("Madrid", 3.7038, 40.4168, 0.84)
london = Airport("London", 0.1278, 51.5074, 1.17)
moscow = Airport("Moscow", 37.618423, 55.7558, 0.5)
shanghai = Airport("Shanghai", 121.4737, 31.2304, 0.4)
paris = Airport("Paris", 2.3522, 48.864716, 1)
hk = Airport("Hong Kong", 114.149139, 22.286394, 0.3)
athens = Airport("Athens", 23.727539, 37.983810, 1)
la = Airport("Los Angeles", -118.243683, 34.052235, 1.5)
hawaii = Airport("Honolulu", -157.917480, 21.289373, 1.5)
NYC = Airport("New York", -73.935242, 40.730610, 1.5)
dublin = Airport("Dublin", -6.266155, 53.350140, 1)
# dublin = Airport("Dublin", )

print("plane range is ", plane.getRange())
print(Route.calculate_distance(hk, la))

# stops = {
#     "Madrid": [london, dublin, madrid],
#     "Dublin": [london, madrid, dublin],
#     "London": [madrid, dublin, london]
# }
'''
Step 1: 
Produce a dictionary with possibilities. 
Example #13
0
import numpy as np
np.errstate(divide='ignore')
import matplotlib.pyplot as plt
from math import sin
from math import cos

time_end = 350
dt = 0.05

t = 0
wingspan = 10
weight = 5
#State tuning: bxd, bx, bhd, bh, bVa
b_i = np.array([.9, .2, .6, .2, .1])

myAircraft1 = Aircraft(wingspan, weight, b_i)
myFlightPlan = FlightPlan()

#State variables: pn, pe, Xid, Xi, hd, h, Va
x = np.array([[0], [0], [0], [0], [0], [0], [0]])
#wind inputs : wn, we
w = np.array([0, 0])
#State inputs: CourseDerivative, Course (rads), Altitude Derivative, Altitude, Airspeed
u = np.array([0, .1, 0, 100, 12])

steps = int(time_end / dt)
psi_array = np.zeros(steps)
pn_array = np.zeros(steps)
pe_array = np.zeros(steps)
h_array = np.zeros(steps)
u_h_array = np.zeros(steps)
# s1 = int(input('Enter y coordinate for the source: '))
# source_1 = [s0, s1]
# dest_1 = [d0, d1]
#
# d0_2 = int(input('Enter x coordinate for destination: '))
# d1_2 = int(input('Enter y coordinate for the destination: '))
# s0_2 = int(input('Enter x coordinate for the source: '))
# s1_2 = int(input('Enter y coordinate for the source: '))
# source_2 = [s0_2, s1_2]
# dest_2 = [d0_2, d1_2]
#
# A1 = Aircraft(dest_1, 0, source_1)
# A2 = Aircraft(dest_2, 0, source_2)

# Creating the instance of Aircrafts
A1 = Aircraft([1, 8], 0, [1, 2])
A2 = Aircraft([1, 2], 0, [1, 7])
# A1 = Aircraft([1, 5], 0, [1, 1])
# A2 = Aircraft([1, 5], 0, [1, 7])

# A1 = Aircraft([2,7], 0, [5, 4])
# A2 = Aircraft([5,6], 0, [8, 9])

#Creating the instance of controller
C1 = AircraftController()
C2 = AircraftController()

t1 = A1.isDestination()
t2 = A2.isDestination()
m1 = A1.Message()
m2 = A2.Message()
Example #15
0
 def add_aircraft(self, mode_s):
     self.dict[mode_s] = Aircraft("", "", [], [], [], [], [], [], [], [])
Example #16
0
from Transport import Engine
from PassengerCar import PassengerCar
from Aircraft import Aircraft
from Ship import Ship

if __name__ == "__main__":
    rb25 = Engine(3.0, 220, 6)
    nissan = PassengerCar(1000, 500, 300, rb25)
    airbus = Aircraft(10000, 2000, 4000)
    ship = Ship(20000, 6000, 2000)

    nissan.start()
    nissan.tank_up(120)
    nissan.start()
    nissan.make_sound()
    nissan.open_doors()
    airbus.make_sound()
    ship.make_sound()
Example #17
0
@author: ozmatron
'''
from Costs import Costs
from Aircraft import Aircraft
from Shortest_path import Shortest_path
import csv

try:
    with open('test.csv', newline='') as file:
        reader = csv.reader(file)
        for line in reader:
            list = line
            aircraft = list[5]
            list = list[0:5]
            range = Aircraft(aircraft).find_range()
            costs_dict = Costs(list, range).find_costs()

            the_path = Shortest_path(costs_dict, list).path_finder()
            print(the_path)
            if the_path != "Cannot make the distance, get a bigger plane":
                output = []
                x = 0
                y = 3
                while x < 34:
                    output.append(the_path[x:y])
                    x += 6
                    y += 6
                output.append(the_path[x - 1:])

                with open("bestroutes.csv", "a") as writing_file: