def __init__(self, ac, eng=None): """Intitialize the generator. Args: ac (string): Aircraft type. eng (string): Engine type. Leave empty for default engine type in OpenAP. Returns: dict: flight trajectory """ super(Generator, self).__init__() self.ac = ac self.acdict = prop.aircraft(self.ac) if eng is None: self.eng = self.acdict['engine']['default'] else: self.eng = eng self.engdict = prop.engine(self.eng) self.wrap = WRAP(self.ac) # self.thrust = Thrust(self.ac, self.eng) # self.drag = Drag(self.ac) # self.fuelflow = Thrust(self.ac, self.eng) # for noise generation self.sigma_v = 0 self.sigma_vs = 0 self.sigma_h = 0 self.sigma_s = 0
def __init__(self, ac, eng=None): """Initialize FuelFlow object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). Leave empty to use the default engine specified by in the aircraft database. """ self.aircraft = prop.aircraft(ac) if eng is None: eng = self.aircraft["engine"]["default"] self.engine = prop.engine(eng) self.thrust = Thrust(ac, eng) self.drag = Drag(ac) c3, c2, c1 = ( self.engine["fuel_c3"], self.engine["fuel_c2"], self.engine["fuel_c1"], ) # print(c3,c2,c1) self.fuel_flow_model = lambda x: c3 * x**3 + c2 * x**2 + c1 * x
def __init__(self, ac, eng=None, **kwargs): """Initialize FuelFlow object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). Leave empty to use the default engine specified by in the aircraft database. """ if not hasattr(self, "np"): self.np = importlib.import_module("numpy") if not hasattr(self, "Thrust"): self.Thrust = importlib.import_module("openap.thrust").Thrust if not hasattr(self, "Drag"): self.Drag = importlib.import_module("openap.drag").Drag if not hasattr(self, "WRAP"): self.WRAP = importlib.import_module("openap.kinematic").WRAP self.aircraft = prop.aircraft(ac, **kwargs) if eng is None: eng = self.aircraft["engine"]["default"] self.engine = prop.engine(eng) self.thrust = self.Thrust(ac, eng, **kwargs) self.drag = self.Drag(ac, **kwargs) self.wrap = self.WRAP(ac, **kwargs) polydeg = kwargs.get("polydeg", 3) if polydeg == 2: a, b = self.engine["fuel_a"], self.engine["fuel_b"] self.polyfuel = func_fuel2(a, b) elif polydeg == 3: c3, c2, c1 = ( self.engine["fuel_c3"], self.engine["fuel_c2"], self.engine["fuel_c1"], ) self.polyfuel = func_fuel3(c3, c2, c1) else: raise RuntimeError(f"polydeg must be 2 or 3")
def __init__(self, ac, eng=None): """Initialize FuelFlow object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). Leave empty to use the default engine specified by in the aircraft database. """ self.ac = prop.aircraft(ac) self.n_eng = self.ac["engine"]["number"] if eng is None: eng = self.ac["engine"]["default"] self.engine = prop.engine(eng)
def __init__(self, ac, eng=None, **kwargs): """Initialize Thrust object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). """ if not hasattr(self, "np"): self.np = importlib.import_module("numpy") if not hasattr(self, "aero"): self.aero = importlib.import_module("openap").aero aircraft = prop.aircraft(ac, **kwargs) if eng is None: eng = aircraft["engine"]["default"] engine = prop.engine(eng) if type(aircraft["engine"]["options"]) == dict: eng_options = list(aircraft["engine"]["options"].values()) elif type(aircraft["engine"]["options"]) == list: eng_options = list(aircraft["engine"]["options"]) if engine["name"] not in eng_options: raise RuntimeError( f"Engine {eng} and aircraft {ac} mismatch. Available engines for {ac} are {eng_options}" ) self.cruise_alt = aircraft["cruise"]["height"] / self.aero.ft # self.cruise_alt = 30000 self.eng_bpr = engine["bpr"] self.eng_max_thrust = engine["max_thrust"] self.eng_number = aircraft["engine"]["number"] if engine["cruise_mach"] > 0: self.cruise_mach = engine["cruise_mach"] self.eng_cruise_thrust = engine["cruise_thrust"] else: self.cruise_mach = aircraft["cruise"]["mach"] self.eng_cruise_thrust = 0.2 * self.eng_max_thrust + 890
def __init__(self, ac, eng=None, **kwargs): """Initialize FuelFlow object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). Leave empty to use the default engine specified by in the aircraft database. """ if not hasattr(self, "np"): self.np = importlib.import_module("numpy") if not hasattr(self, "Thrust"): self.Thrust = importlib.import_module("openap.thrust").Thrust if not hasattr(self, "Drag"): self.Drag = importlib.import_module("openap.drag").Drag if not hasattr(self, "WRAP"): self.WRAP = importlib.import_module("openap.kinematic").WRAP self.aircraft = prop.aircraft(ac, **kwargs) if eng is None: eng = self.aircraft["engine"]["default"] self.engine = prop.engine(eng) self.thrust = self.Thrust(ac, eng, **kwargs) self.drag = self.Drag(ac, **kwargs) self.wrap = self.WRAP(ac, **kwargs) c3, c2, c1 = ( self.engine["fuel_c3"], self.engine["fuel_c2"], self.engine["fuel_c1"], ) # print(c3,c2,c1) self.func_fuel = prop.func_fuel(c3, c2, c1)
def __init__(self, ac, eng=None): """Initialize Thrust object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). """ super(Thrust, self).__init__() aircraft = prop.aircraft(ac) if eng is None: eng = aircraft['engine']['default'] engine = prop.engine(eng) if type(aircraft['engine']['options']) == dict: eng_options = list(aircraft['engine']['options'].values()) elif type(aircraft['engine']['options']) == list: eng_options = list(aircraft['engine']['options']) if engine['name'] not in eng_options: raise RuntimeError( 'Engine {eng} and aircraft {ac} mismatch. Available engines for {ac} are {eng_options}' ) self.cruise_alt = aircraft['cruise']['height'] / aero.ft # self.cruise_alt = 30000 self.eng_bpr = engine['bpr'] self.eng_max_thrust = engine['max_thrust'] self.eng_number = aircraft['engine']['number'] if engine['cruise_mach'] > 0: self.cruise_mach = engine['cruise_mach'] self.eng_cruise_thrust = engine['cruise_thrust'] else: self.cruise_mach = aircraft['cruise']['mach'] self.eng_cruise_thrust = 0.2 * self.eng_max_thrust + 890
def __init__(self, ac, eng=None, **kwargs): """Initialize Emission object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). Leave empty to use the default engine specified by in the aircraft database. """ if not hasattr(self, "np"): self.np = importlib.import_module("numpy") if not hasattr(self, "aero"): self.aero = importlib.import_module("openap").aero self.ac = prop.aircraft(ac, **kwargs) self.n_eng = self.ac["engine"]["number"] if eng is None: eng = self.ac["engine"]["default"] self.engine = prop.engine(eng)
import numpy as np from openap import prop from pprint import pprint as print import matplotlib.pyplot as plt acs = prop.available_aircraft() for ac in acs: engs = prop.aircraft_engine_options(ac) for eng in engs: try: e = prop.engine(eng) print(e) except: print(f"{eng} from {ac} cannot be found.") continue c3, c2, c1 = ( e["fuel_c3"], e["fuel_c2"], e["fuel_c1"], ) x = np.array([0.07, 0.3, 0.85, 1.0]) xx = np.linspace(0.07, 1, 100) plt.suptitle(f"{ac} / {eng}") plt.subplot(221) plt.scatter(x, [e["ff_idl"], e["ff_app"], e["ff_co"], e["ff_to"]])
from pprint import pprint from openap import prop ac = prop.aircraft("A320") pprint(ac) eng = prop.engine("CFM56-5B4") pprint(eng)