Example #1
0
    def __init__(self):
        TrafficArrays.__init__(self)
        # [m] Horizontal separation minimum for detection
        self.rpz = bs.settings.asas_pzr * nm
        # [m] Vertical separation minimum for detection
        self.hpz = bs.settings.asas_pzh * ft
        # [s] lookahead time
        self.dtlookahead = bs.settings.asas_dtlookahead
        self.dtnolook = 0.0

        # Conflicts and LoS detected in the current timestep (used for resolving)
        self.confpairs = list()
        self.lospairs = list()
        self.qdr = np.array([])
        self.dist = np.array([])
        self.dcpa = np.array([])
        self.tcpa = np.array([])
        self.tLOS = np.array([])
        # Unique conflicts and LoS in the current timestep (a, b) = (b, a)
        self.confpairs_unique = set()
        self.lospairs_unique = set()

        # All conflicts and LoS since simt=0
        self.confpairs_all = list()
        self.lospairs_all = list()

        # Per-aircraft conflict data
        with RegisterElementParameters(self):
            self.inconf = np.array([], dtype=bool)  # In-conflict flag
            self.tcpamax = np.array([]) # Maximum time to CPA for aircraft in conflict
Example #2
0
    def __init__(self, min_update_dt=1):
        super(OpenAP, self).__init__()

        self.min_update_dt = min_update_dt  # second, minimum update dt
        self.current_sim_time = 0  # last update simulation time
        self.ac_warning = False  # aircraft mdl to default warning
        self.eng_warning = False  # aircraft engine to default warning

        self.coeff = coeff.Coefficient()

        with RegisterElementParameters(self):
            self.actypes = np.array([], dtype=str)
            self.phase = np.array([])
            self.lifttype = np.array([])  # lift type, fixwing [1] or rotor [2]
            self.engnum = np.array([], dtype=int)  # number of engines
            self.engthrust = np.array([])  # static engine thrust
            self.engbpr = np.array([])  # engine bypass ratio
            self.thrustratio = np.array([])  # thrust ratio at current alt spd
            self.ff_coeff_a = np.array([])  # icao fuel flows coefficient a
            self.ff_coeff_b = np.array([])  # icao fuel flows coefficient b
            self.ff_coeff_c = np.array([])  # icao fuel flows coefficient c
            self.engpower = np.array([])  # engine power, rotor ac
            self.cd0 = np.array([])  # zero drag coefficient
            self.cd0_clean = np.array([])  # Cd0, clean configuration
            self.cd0_gd = np.array([])  # Cd0, ground mode
            self.cd0_to = np.array([])  # Cd0, taking-off
            self.cd0_ic = np.array([])  # Cd0, initial climb
            self.cd0_ap = np.array([])  # Cd0, landing
            self.cd0_ld = np.array([])  # Cd0, landing
            self.k = np.array([])  # induced drag coeff
Example #3
0
 def __init__(self):
     super(ActiveWaypoint, self).__init__()
     with RegisterElementParameters(self):
         self.lat = np.array([])  # [deg] Active WP latitude
         self.lon = np.array([])  # [deg] Active WP longitude
         self.nextaltco = np.array(
             [])  # [m] Altitude to arrive at after distance xtoalt
         self.xtoalt = np.array(
             [])  # [m] Distance to next altitude constraint
         self.nextspd = np.array(
             [])  # [CAS[m/s]/Mach] save speed from next wp for next leg
         self.spd = np.array(
             []
         )  # [CAS[m/s]/Mach]Active WP speed (constraint or calculated)
         self.spdcon = np.array(
             [])  # [CAS[m/s]/Mach]Active WP speed constraint
         self.vs = np.array([])  # [m/s] Active vertical speed to use
         self.turndist = np.array(
             [])  # [m] Distance when to turn to next waypoint
         self.flyby = np.array(
             [])  # Flyby switch, when False, flyover (turndist=0.0)
         self.torta = np.array(
             [])  # [s] NExt req Time of Arrival (RTA) (-999. = None)
         self.xtorta = np.array([])  # [m] distance ot next RTA
         self.next_qdr = np.array([])  # [deg] track angle of next leg
Example #4
0
    def __init__(self):
        super(Autopilot, self).__init__()
        # Scheduling of FMS and ASAS
        self.t0 = -999.  # last time fms was called
        self.dt = 1.01  # interval for fms

        # Standard self.steepness for descent
        self.steepness = 3000. * ft / (10. * nm)

        # From here, define object arrays
        with RegisterElementParameters(self):

            # FMS directions
            self.trk = np.array([])
            self.spd = np.array([])
            self.tas = np.array([])
            self.alt = np.array([])
            self.vs = np.array([])

            # VNAV variables
            self.dist2vs = np.array([])  # distance from coming waypoint to TOD
            self.swvnavvs = np.array([])  # whether to use given VS or not
            self.vnavvs = np.array([])  # vertical speed in VNAV

            # Traffic navigation information
            self.orig = []  # Four letter code of origin airport
            self.dest = []  # Four letter code of destination airport

        # Route objects
        self.route = []
Example #5
0
    def __init__(self):
        TrafficArrays.__init__(self)

        # Standard self.steepness for descent
        self.steepness = 3000. * ft / (10. * nm)

        # From here, define object arrays
        with RegisterElementParameters(self):

            # FMS directions
            self.trk = np.array([])
            self.spd = np.array([])
            self.tas = np.array([])
            self.alt = np.array([])
            self.vs = np.array([])

            # VNAV variables
            self.dist2vs = np.array([])  # distance from coming waypoint to TOD
            self.swvnavvs = np.array([])  # whether to use given VS or not
            self.vnavvs = np.array([])  # vertical speed in VNAV

            # LNAV variables
            self.qdr2wp = np.array(
                []
            )  # Direction to waypoint from the last time passing was checked
            # to avoid 180 turns due to updated qdr shortly before passing wp

            # Traffic navigation information
            self.orig = []  # Four letter code of origin airport
            self.dest = []  # Four letter code of destination airport

            # Route objects
            self.route = []
Example #6
0
    def __init__(self):
        TrafficArrays.__init__(self)

        # Standard self.steepness for descent
        self.steepness = 3000. * ft / (10. * nm)

        # From here, define object arrays
        with RegisterElementParameters(self):

            # FMS directions
            self.trk = np.array([])
            self.spd = np.array([])
            self.tas = np.array([])
            self.alt = np.array([])
            self.vs  = np.array([])

            # VNAV variables
            self.dist2vs  = np.array([])  # distance from coming waypoint to TOD
            self.swvnavvs = np.array([])  # whether to use given VS or not
            self.vnavvs   = np.array([])  # vertical speed in VNAV

            # Traffic navigation information
            self.orig = []  # Four letter code of origin airport
            self.dest = []  # Four letter code of destination airport

            # Route objects
            self.route = []
Example #7
0
 def __init__(self):
     # Initialize the groups structure
     super(TrafficGroups, self).__init__()
     self.groups = dict()
     self.allmasks = 0
     with RegisterElementParameters(self):
         self.ingroup = np.array([], dtype=np.int64)
Example #8
0
 def __init__(self):
     super(Pilot, self).__init__()
     with RegisterElementParameters(self):
         # Desired aircraft states
         self.alt = np.array([])  # desired altitude [m]
         self.hdg = np.array([])  # desired heading [deg]
         self.trk = np.array([])  # desired track angle [deg]
         self.vs  = np.array([])  # desired vertical speed [m/s]
         self.tas = np.array([])  # desired speed [m/s]
Example #9
0
 def __init__(self):
     super(ActiveWaypoint, self).__init__()
     with RegisterElementParameters(self):
         self.lat       = np.array([])  # [deg] Active WP latitude
         self.lon       = np.array([])  # [deg] Active WP longitude
         self.nextaltco = np.array([])  # [m] Altitude to arrive at after distance xtoalt
         self.xtoalt    = np.array([])  # [m] Distance to next altitude constraint
         self.spd       = np.array([])  # [CAS[m/s]/Mach]Active WP speed
         self.vs        = np.array([])  # [m/s] Active vertical speed to use
         self.turndist  = np.array([])  # [m] Distance when to turn to next waypoint
         self.flyby     = np.array([])  # Flyby switch, when False, flyover (turndist=0.0)
         self.next_qdr  = np.array([])  # [deg] track angle of next leg
Example #10
0
    def __init__(self):
        super(ASAS, self).__init__()
        with RegisterElementParameters(self):
            # ASAS info per aircraft:
            self.inconf    = np.array([], dtype=bool)  # In-conflict flag per aircraft
            self.tcpamax = np.array([])  # Maximum time to CPA for aircraft in conflict
            self.active   = np.array([], dtype=bool)  # whether the autopilot follows ASAS or not
            self.trk      = np.array([])  # heading provided by the ASAS [deg]
            self.tas      = np.array([])  # speed provided by the ASAS (eas) [m/s]
            self.alt      = np.array([])  # speed alt by the ASAS [m]
            self.vs       = np.array([])  # speed vspeed by the ASAS [m/s]

        # All ASAS variables are initialized in the reset function
        self.reset()
Example #11
0
    def __init__(self):
        super(ASAS, self).__init__()
        with RegisterElementParameters(self):
            # ASAS info per aircraft:
            self.iconf    = []            # index in 'conflicting' aircraft database

            self.active   = np.array([], dtype=bool)  # whether the autopilot follows ASAS or not
            self.trk      = np.array([])  # heading provided by the ASAS [deg]
            self.tas      = np.array([])  # speed provided by the ASAS (eas) [m/s]
            self.alt      = np.array([])  # speed alt by the ASAS [m]
            self.vs       = np.array([])  # speed vspeed by the ASAS [m/s]

        # All ASAS variables are initialized in the reset function
        self.reset()
Example #12
0
 def __init__(self):
     super(ActiveWaypoint, self).__init__()
     with RegisterElementParameters(self):
         self.lat = np.array([])  # Active WP latitude
         self.lon = np.array([])  # Active WP longitude
         self.nextaltco = np.array(
             [])  # Altitude to arrive at after distance xtoalt
         self.xtoalt = np.array([])  # Distance to next altitude constraint
         self.spd = np.array([])  # Active WP speed
         self.vs = np.array([])  # Active vertical speed to use
         self.turndist = np.array(
             [])  # Distance when to turn to next waypoint
         self.flyby = np.array([])  # Distance when to turn to next waypoint
         self.next_qdr = np.array([])  # bearing next leg
Example #13
0
    def __init__(self):
        TrafficArrays.__init__(self)
        # From here, define object arrays
        with RegisterElementParameters(self):
            # Most recent broadcast data
            self.lastupdate = np.array([])
            self.lat        = np.array([])
            self.lon        = np.array([])
            self.alt        = np.array([])
            self.trk        = np.array([])
            self.tas        = np.array([])
            self.gs         = np.array([])
            self.vs         = np.array([])

        self.setnoise(False)
Example #14
0
    def __init__(self):
        super(ADSB, self).__init__()
        # From here, define object arrays
        with RegisterElementParameters(self):
            # Most recent broadcast data
            self.lastupdate = np.array([])
            self.lat = np.array([])
            self.lon = np.array([])
            self.alt = np.array([])
            self.trk = np.array([])
            self.tas = np.array([])
            self.gs = np.array([])
            self.vs = np.array([])

        self.SetNoise(False)
Example #15
0
    def __init__(self):
        super(OpenAP, self).__init__()

        self.ac_warning = False  # aircraft mdl to default warning
        self.eng_warning = False  # aircraft engine to default warning

        self.coeff = coeff.Coefficient()

        with RegisterElementParameters(self):
            self.actypes = np.array([], dtype=str)
            self.phase = np.array([])
            self.lifttype = np.array([])  # lift type, fixwing [1] or rotor [2]
            self.mass = np.array([])  # mass of aircraft
            self.engnum = np.array([], dtype=int)  # number of engines
            self.engthrmax = np.array([])  # static engine thrust
            self.engbpr = np.array([])  # engine bypass ratio
            self.thrust = np.array([])  # thrust ratio at current alt spd
            self.max_thrust = np.array([])  # thrust ratio at current alt spd
            self.ff_coeff_a = np.array([])  # icao fuel flows coefficient a
            self.ff_coeff_b = np.array([])  # icao fuel flows coefficient b
            self.ff_coeff_c = np.array([])  # icao fuel flows coefficient c
            self.engpower = np.array([])  # engine power, rotor ac
            self.cd0 = np.array([])  # zero drag coefficient
            self.cd0_clean = np.array([])  # Cd0, clean configuration
            self.k_clean = np.array([])  # k, clean configuration
            self.cd0_to = np.array([])  # Cd0, takeoff configuration
            self.k_to = np.array([])  # k, takeoff configuration
            self.cd0_ld = np.array([])  # Cd0, landing configuration
            self.k_ld = np.array([])  # k, landing configuration
            self.delta_cd_gear = np.array([])  # landing gear

            self.vmin = np.array([])
            self.vmax = np.array([])
            self.vminic = np.array([])
            self.vminer = np.array([])
            self.vminap = np.array([])
            self.vmaxic = np.array([])
            self.vmaxer = np.array([])
            self.vmaxap = np.array([])

            self.vsmin = np.array([])
            self.vsmax = np.array([])
            self.hmax = np.array([])
            self.axmax = np.array([])
            self.vminto = np.array([])
            self.hcross = np.array([])
            self.mmo = np.array([])
Example #16
0
    def __init__(self, min_update_dt=1):
        super(PerfNAP, self).__init__()

        self.min_update_dt = min_update_dt  # second, minimum update dt
        self.current_sim_time = 0  # last update simulation time
        self.ac_warning = False  # aircraft mdl to default warning
        self.eng_warning = False  # aircraft engine to default warning

        self.coeff = coeff.Coefficient()

        with RegisterElementParameters(self):
            self.engnum = np.array([])  # number of engines
            self.engthrust = np.array([])  # static engine thrust
            self.engbpr = np.array([])  # engine bypass ratio
            self.thrustratio = np.array([])  # thrust ratio at current alt spd
            self.fficao = np.array(
                [])  # list of icao fuel flows from emission data bank
Example #17
0
    def __init__(self):
        super(PerfBase, self).__init__()

        with RegisterElementParameters(self):
            # --- fixed parameters ---
            self.actype = np.array([], dtype=str)  # aircraft type
            self.Sref = np.array([])  # wing reference surface area [m^2]
            self.engtype = np.array([])  # integer, aircraft.ENG_TF...

            # --- dynamic parameters ---
            self.mass = np.array([])  # effective mass [kg]
            self.phase = np.array([])
            self.cd0 = np.array([])
            self.k = np.array([])
            self.bank = np.array([])
            self.thrust = np.array([])  # thrust
            self.drag = np.array([])  # drag
            self.fuelflow = np.array([])  # fuel flow
Example #18
0
    def __init__(self, dttrail=10.):
        super(Trails, self).__init__()
        self.active = False  # Wether or not to show trails
        self.dt = dttrail  # Resolution of trail pieces in time

        self.tcol0 = 60.  # After how many seconds old colour

        # This list contains some standard colors
        self.colorList = {
            'BLUE': np.array([0, 0, 255]),
            'CYAN': np.array([0, 255, 255]),
            'RED': np.array([255, 0, 0]),
            'YELLOW': np.array([255, 255, 0])
        }

        # Set default color to Blue
        self.defcolor = self.colorList['CYAN']

        # Foreground data on line pieces
        self.lat0 = np.array([])
        self.lon0 = np.array([])
        self.lat1 = np.array([])
        self.lon1 = np.array([])
        self.time = np.array([])
        self.col = []
        self.fcol = np.array([])

        # background copy of data
        self.bglat0 = np.array([])
        self.bglon0 = np.array([])
        self.bglat1 = np.array([])
        self.bglon1 = np.array([])
        self.bgtime = np.array([])
        self.bgcol = []

        with RegisterElementParameters(self):
            self.accolor = []
            self.lastlat = np.array([])
            self.lastlon = np.array([])
            self.lasttim = np.array([])

        self.clearnew()

        return
 def __init__(self):
     TrafficArrays.__init__(self)
     with RegisterElementParameters(self):
         self.lat = np.array([])  # [deg] Active WP latitude
         self.lon = np.array([])  # [deg] Active WP longitude
         self.nextaltco = np.array(
             [])  # [m] Altitude to arrive at after distance xtoalt
         self.xtoalt = np.array(
             [])  # [m] Distance to next altitude constraint
         self.nextspd = np.array(
             [])  # [CAS[m/s]/Mach] save speed from next wp for next leg
         self.spd = np.array(
             []
         )  # [CAS[m/s]/Mach]Active WP speed (constraint or calculated)
         self.spdcon = np.array(
             [])  # [CAS[m/s]/Mach]Active WP speed constraint
         self.vs = np.array([])  # [m/s] Active vertical speed to use
         self.turndist = np.array(
             [])  # [m] Distance when to turn to next waypoint
         self.flyby = np.array(
             [])  # Flyby switch, when False, flyover (turndist=0.0)
         self.flyturn = np.array(
             []
         )  # Flyturn switch, when False, when Fkase, use flyby/flyover
         self.turnrad = np.array(
             [])  # Flyturn turn radius (<0 => not specified)
         self.turnspd = np.array(
             []
         )  # [m/s, CAS] Flyturn turn speed for next turn (<=0 => not specified)
         self.oldturnspd = np.array(
             []
         )  # [TAS, m/s] Flyturn turn speed for previous turn (<=0 => not specified)
         self.turnfromlastwp = np.array(
             []
         )  # Currently in flyturn-mode from last waypoint (old turn, beginning of leg)
         self.turntonextwp = np.array(
             []
         )  # Currently in flyturn-mode to next waypoint (new flyturn mode, end of leg)
         self.torta = np.array(
             [])  # [s] NExt req Time of Arrival (RTA) (-999. = None)
         self.xtorta = np.array([])  # [m] distance ot next RTA
         self.next_qdr = np.array([])  # [deg] track angle of next leg
    def __init__(self):
        super(Afms, self).__init__()
        # Parameters of afms
        self.dt = 60.0  # [s] frequency of afms update (simtime)
        self.skip2next_rta_time_s = 300.0  # Time when skipping to the RTA beyond the active RTA
        self.rta_standard_window_size = 60.  # [s] standard time window size for rta in seconds
        self._patch_route(self.rta_standard_window_size)
        self._fms_modes = ['OFF', 'CONTINUE', 'OWN', 'RTA', 'TW']
        traf.resultstosave2 = pd.DataFrame()
        traf.resultstosave3 = pd.DataFrame()
        traf.index = 0

        # Adaptations by Johannes
        with RegisterElementParameters(self):
            # Set required for multiple fms-mode runs
            self.interval_counter = np.array([0])
            self.currentwp = np.array([])
            self.lat = np.array([])
            self.lon = np.array([])
            self.index = np.array([])
Example #21
0
    def __init__(self):
        TrafficArrays.__init__(self)
        # [-] switch to activate priority rules for conflict resolution
        self.swprio = False  # switch priority on/off
        self.priocode = ''  # select priority mode
        self.resopairs = set()  # Resolved conflicts that are still before CPA

        # Resolution factors:
        # set < 1 to maneuver only a fraction of the resolution
        # set > 1 to add a margin to separation values
        self.resofach = bs.settings.asas_mar
        self.resofacv = bs.settings.asas_mar

        with RegisterElementParameters(self):
            self.resooffac = np.array([], dtype=np.bool)
            self.noresoac = np.array([], dtype=np.bool)
            # whether the autopilot follows ASAS or not
            self.active = np.array([], dtype=bool)
            self.trk = np.array([])  # heading provided by the ASAS [deg]
            self.tas = np.array([])  # speed provided by the ASAS (eas) [m/s]
            self.alt = np.array([])  # alt provided by the ASAS [m]
            self.vs = np.array([])  # vspeed provided by the ASAS [m/s]
Example #22
0
    def __init__(self, min_update_dt=1):
        super(OpenAP, self).__init__()

        self.min_update_dt = min_update_dt  # second, minimum update dt
        self.current_sim_time = 0  # last update simulation time
        self.ac_warning = False  # aircraft mdl to default warning
        self.eng_warning = False  # aircraft engine to default warning

        self.coeff = coeff.Coefficient()
        self.n_ac = 0

        with RegisterElementParameters(self):
            self.actypes = np.array([], dtype=str)
            self.lifttype = np.array([])  # lift type, fixwing [1] or rotor [2]
            self.engnum = np.array([], dtype=int)  # number of engines
            self.engthrust = np.array([])  # static engine thrust
            self.engbpr = np.array([])  # engine bypass ratio
            self.thrustratio = np.array([])  # thrust ratio at current alt spd
            self.ff_coeff_a = np.array([])  # icao fuel flows coefficient a
            self.ff_coeff_b = np.array([])  # icao fuel flows coefficient b
            self.ff_coeff_c = np.array([])  # icao fuel flows coefficient c
            self.engpower = np.array([])  # engine power, rotor ac
Example #23
0
    def __init__(self):
        super(Traffic, self).__init__()

        # Traffic is the toplevel trafficarrays object
        TrafficArrays.SetRoot(self)

        self.ntraf = 0

        self.cond = Condition()  # Conditional commands list
        self.wind = WindSim()
        self.turbulence = Turbulence()
        self.translvl = 5000. * ft  # [m] Default transition level

        with RegisterElementParameters(self):
            # Aircraft Info
            self.id = []  # identifier (string)
            self.type = []  # aircaft type (string)

            # Positions
            self.lat = np.array([])  # latitude [deg]
            self.lon = np.array([])  # longitude [deg]
            self.distflown = np.array([])  # distance travelled [m]
            self.alt = np.array([])  # altitude [m]
            self.hdg = np.array([])  # traffic heading [deg]
            self.trk = np.array([])  # track angle [deg]

            # Velocities
            self.tas = np.array([])  # true airspeed [m/s]
            self.gs = np.array([])  # ground speed [m/s]
            self.gsnorth = np.array([])  # ground speed [m/s]
            self.gseast = np.array([])  # ground speed [m/s]
            self.cas = np.array([])  # calibrated airspeed [m/s]
            self.M = np.array([])  # mach number
            self.vs = np.array([])  # vertical speed [m/s]

            # Atmosphere
            self.p = np.array([])  # air pressure [N/m2]
            self.rho = np.array([])  # air density [kg/m3]
            self.Temp = np.array([])  # air temperature [K]
            self.dtemp = np.array([])  # delta t for non-ISA conditions

            # Wind speeds
            self.windnorth = np.array(
                [])  # wind speed north component a/c pos [m/s]
            self.windeast = np.array(
                [])  # wind speed east component a/c pos [m/s]

            # Traffic autopilot settings
            self.selspd = np.array([])  # selected spd(CAS or Mach) [m/s or -]
            self.aptas = np.array([])  # just for initializing
            self.selalt = np.array([])  # selected alt[m]
            self.selvs = np.array([])  # selected vertical speed [m/s]

            # Whether to perform LNAV and VNAV
            self.swlnav = np.array([], dtype=np.bool)
            self.swvnav = np.array([], dtype=np.bool)
            self.swvnavspd = np.array([], dtype=np.bool)

            # Flight Models
            self.asas = ASAS()
            self.ap = Autopilot()
            self.pilot = Pilot()
            self.adsb = ADSB()
            self.trails = Trails()
            self.actwp = ActiveWaypoint()
            self.perf = Perf()

            # Group Logic
            self.groups = TrafficGroups()

            # Traffic performance data
            self.apvsdef = np.array(
                [])  # [m/s]default vertical speed of autopilot
            self.aphi = np.array([])  # [rad] bank angle setting of autopilot
            self.ax = np.array(
                [])  # [m/s2] absolute value of longitudinal accelleration
            self.bank = np.array([])  # nominal bank angle, [radian]
            self.swhdgsel = np.array(
                [], dtype=np.bool)  # determines whether aircraft is turning

            # limit settings
            self.limspd = np.array([])  # limit speed
            self.limspd_flag = np.array(
                [], dtype=np.bool
            )  # flag for limit spd - we have to test for max and min
            self.limalt = np.array([])  # limit altitude
            self.limalt_flag = np.array(
                [])  # A need to limit altitude has been detected
            self.limvs = np.array(
                [])  # limit vertical speed due to thrust limitation
            self.limvs_flag = np.array([])  # A need to limit V/S detected

            # Display information on label
            self.label = []  # Text and bitmap of traffic label

            # Miscallaneous
            self.coslat = np.array([])  # Cosine of latitude for computations
            self.eps = np.array([])  # Small nonzero numbers

        # Default bank angles per flight phase
        self.bphase = np.deg2rad(np.array([15, 35, 35, 35, 15, 45]))

        self.reset()
Example #24
0
    def __init__(self):
        super(Traffic, self).__init__()

        # Traffic is the toplevel trafficarrays object
        TrafficArrays.SetRoot(self)

        self.ntraf = 0

        self.cond = Condition()  # Conditional commands list
        self.wind = WindSim()
        self.turbulence = Turbulence()
        self.translvl = 5000.*ft # [m] Default transition level

        # Define the periodic loggers
        # ToDo: explain what these line sdo in comments (type of logs?)
        datalog.definePeriodicLogger('SNAPLOG', 'SNAPLOG logfile.', settings.snapdt)
        datalog.definePeriodicLogger('INSTLOG', 'INSTLOG logfile.', settings.instdt)
        datalog.definePeriodicLogger('SKYLOG', 'SKYLOG logfile.', settings.skydt)

        with RegisterElementParameters(self):

            # Register the following parameters for logging
            with datalog.registerLogParameters('SNAPLOG', self):
                # Aircraft Info
                self.id      = []  # identifier (string)
                self.type    = []  # aircaft type (string)

                # Positions
                self.lat     = np.array([])  # latitude [deg]
                self.lon     = np.array([])  # longitude [deg]
                self.alt     = np.array([])  # altitude [m]
                self.hdg     = np.array([])  # traffic heading [deg]
                self.trk     = np.array([])  # track angle [deg]

                # Velocities
                self.tas     = np.array([])  # true airspeed [m/s]
                self.gs      = np.array([])  # ground speed [m/s]
                self.gsnorth = np.array([])  # ground speed [m/s]
                self.gseast  = np.array([])  # ground speed [m/s]
                self.cas     = np.array([])  # calibrated airspeed [m/s]
                self.M       = np.array([])  # mach number
                self.vs      = np.array([])  # vertical speed [m/s]
                
                
                #Creation time
                self.cretime = np.array([]) #Creation time [s]
                #time in conflict
                self.timeinconf = np.array([]) #Time in conflict [s] (this value is updated in area)
                
                # Atmosphere
                self.p       = np.array([])  # air pressure [N/m2]
                self.rho     = np.array([])  # air density [kg/m3]
                self.Temp    = np.array([])  # air temperature [K]
                self.dtemp   = np.array([])  # delta t for non-ISA conditions

                # Traffic autopilot settings
                self.selspd = np.array([])  # selected spd(CAS or Mach) [m/s or -]
                self.aptas  = np.array([])  # just for initializing
                self.selalt = np.array([])  # selected alt[m]
                self.selvs  = np.array([])  # selected vertical speed [m/s]

            # Whether to perform LNAV and VNAV
            self.swlnav   = np.array([], dtype=np.bool)
            self.swvnav   = np.array([], dtype=np.bool)

            # Flight Models
            self.asas   = ASAS()
            self.ap     = Autopilot()
            self.pilot  = Pilot()
            self.adsb   = ADSB()
            self.trails = Trails()
            self.actwp  = ActiveWaypoint()
            self.perf   = Perf()

            # Traffic performance data
            self.apvsdef  = np.array([])  # [m/s]default vertical speed of autopilot
            self.aphi     = np.array([])  # [rad] bank angle setting of autopilot
            self.ax       = np.array([])  # [m/s2] absolute value of longitudinal accelleration
            self.bank     = np.array([])  # nominal bank angle, [radian]
            self.swhdgsel = np.array([], dtype=np.bool)  # determines whether aircraft is turning

            # Crossover altitude
            self.abco   = np.array([])
            self.belco  = np.array([])

            # limit settings
            self.limspd      = np.array([])  # limit speed
            self.limspd_flag = np.array([], dtype=np.bool)  # flag for limit spd - we have to test for max and min
            self.limalt      = np.array([])  # limit altitude
            self.limalt_flag = np.array([])  # A need to limit altitude has been detected
            self.limvs       = np.array([])  # limit vertical speed due to thrust limitation
            self.limvs_flag  = np.array([])  # A need to limit V/S detected

            # Display information on label
            self.label       = []  # Text and bitmap of traffic label

            # Miscallaneous
            self.coslat = np.array([])  # Cosine of latitude for computations
            self.eps    = np.array([])  # Small nonzero numbers

        # Default bank angles per flight phase
        self.bphase = np.deg2rad(np.array([15, 35, 35, 35, 15, 45]))

        self.reset()
Example #25
0
    def __init__(self):
        super(PerfBS, self).__init__()
        self.warned = False  # Flag: Did we warn for default perf parameters yet?
        self.warned2 = False  # Flag: Use of piston engine aircraft?

        # prepare for coefficient readin
        coeffBS.coeff()

        # Flight performance scheduling
        self.dt = 0.1  # [s] update interval of performance limits
        self.t0 = -self.dt  # [s] last time checked (in terms of simt)

        with RegisterElementParameters(self):
            # index of aircraft types in library
            self.coeffidxlist = np.array([])

            # geometry and weight
            self.mass = np.array([])  # Mass [kg]
            self.Sref = np.array([])  # Wing surface area [m^2]

            # reference velocities
            self.refma = np.array([])  # reference Mach
            self.refcas = np.array([])  # reference CAS
            self.gr_acc = np.array([])  # ground acceleration
            self.gr_dec = np.array([])  # ground deceleration

            # limits
            self.vm_to = np.array([])  # min takeoff spd (w/o mass, density)
            self.vm_ld = np.array([])  # min landing spd (w/o mass, density)
            self.vmto = np.array([])  # min TO spd
            self.vmic = np.array([])  # min. IC speed
            self.vmcr = np.array([])  # min cruise spd
            self.vmap = np.array([])  # min approach speed
            self.vmld = np.array([])  # min landing spd
            self.vmin = np.array([])  # min speed over all phases
            self.vmo = np.array([])  # max CAS
            self.mmo = np.array([])  # max Mach

            self.hmaxact = np.array([])  # max. altitude
            self.maxthr = np.array([])  # maximum thrust

            # aerodynamics
            self.CD0 = np.array([])  # parasite drag coefficient
            self.k = np.array([])  # induced drag factor
            self.clmaxcr = np.array([])  # max. cruise lift coefficient
            self.qS = np.array([])  # Dynamic air pressure [Pa]
            self.atrans = np.array([])  # Transition altitude [m]

            # engines
            self.n_eng = np.array([])  # Number of engines
            self.etype = np.array([])  # jet /turboprop

            # jet engines:
            self.rThr = np.array([])  # rated thrust (all engines)
            self.SFC = np.array([])  # specific fuel consumption in cruise
            self.ff = np.array([])  # fuel flow
            self.ffto = np.array([])  # fuel flow takeoff
            self.ffcl = np.array([])  # fuel flow climb
            self.ffcr = np.array([])  # fuel flow cruise
            self.ffid = np.array([])  # fuel flow idle
            self.ffap = np.array([])  # fuel flow approach

            # turboprop engines
            self.P = np.array([])  # avaliable power at takeoff conditions
            self.PSFC_TO = np.array([])  # specific fuel consumption takeoff
            self.PSFC_CR = np.array([])  # specific fuel consumption cruise

            self.Thr = np.array([])  # Thrust
            self.Thr_pilot = np.array([])  # thrust required for pilot settings
            self.D = np.array([])  # Drag
            self.ESF = np.array(
                [])  # Energy share factor according to EUROCONTROL

            # flight phase
            self.phase = np.array([])  # flight phase
            self.bank = np.array([])  # bank angle
            self.post_flight = np.array([])  # check for ground mode:
            #taxi prior of after flight
            self.pf_flag = np.array([])

            self.engines = []  # avaliable engine type per aircraft type
        self.eta = 0.8  # propeller efficiency according to Raymer
        self.Thr_s = np.array(
            [1., 0.85, 0.07,
             0.3])  # Thrust settings per flight phase according to ICAO

        return
Example #26
0
    def __init__(self):
        super(PerfBADA, self).__init__()
        self.warned = False  # Flag: Did we warn for default perf parameters yet?
        self.warned2 = False  # Flag: Use of piston engine aircraft?

        # Flight performance scheduling
        self.warned2 = False  # Flag: Did we warn for default engine parameters yet?

        # Register the per-aircraft parameter arrays
        with RegisterElementParameters(self):
            # engine
            self.jet = np.array([])
            self.turbo = np.array([])
            self.piston = np.array([])
            # masses and dimensions
            self.mass = np.array([])  # effective mass [kg]
            # self.mref = np.array([]) # ref. mass [kg]: 70% between min and max. mass
            self.mmin = np.array([])  # OEW (or assumption) [kg]
            self.mmax = np.array([])  # MTOW (or assumption) [kg]
            # self.mpyld = np.array([]) # MZFW-OEW (or assumption) [kg]
            self.gw = np.array([])  # weight gradient on max. alt [m/kg]
            self.Sref = np.array([])  # wing reference surface area [m^2]

            # flight enveloppe
            self.vmto = np.array([])  # min TO spd [m/s]
            self.vmic = np.array([])  # min climb spd [m/s]
            self.vmcr = np.array([])  # min cruise spd [m/s]
            self.vmap = np.array([])  # min approach spd [m/s]
            self.vmld = np.array([])  # min landing spd [m/s]
            self.vmin = np.array([])  # min speed over all phases [m/s]

            self.vmo = np.array([])  # max operating speed [m/s]
            self.mmo = np.array([])  # max operating mach number [-]
            self.hmax = np.array(
                [])  # max. alt above standard MSL (ISA) at MTOW [m]
            self.hmaxact = np.array(
                [])  # max. alt depending on temperature gradient [m]
            self.hmo = np.array([])  # max. operating alt abov standard MSL [m]
            self.gt = np.array([])  # temp. gradient on max. alt [ft/k]
            self.maxthr = np.array([])  # maximum thrust [N]

            # Buffet Coefficients
            self.clbo = np.array([])  # buffet onset lift coefficient [-]
            self.k = np.array([])  # buffet coefficient [-]
            self.cm16 = np.array([])  # CM16

            # reference CAS speeds
            self.cascl = np.array([])  # climb [m/s]
            self.cascr = np.array([])  # cruise [m/s]
            self.casdes = np.array([])  # descent [m/s]

            #reference mach numbers [-]
            self.macl = np.array([])  # climb
            self.macr = np.array([])  # cruise
            self.mades = np.array([])  # descent

            # parasitic drag coefficients per phase [-]
            self.cd0to = np.array([])  # phase takeoff
            self.cd0ic = np.array([])  # phase initial climb
            self.cd0cr = np.array([])  # phase cruise
            self.cd0ap = np.array([])  # phase approach
            self.cd0ld = np.array([])  # phase land
            self.gear = np.array([])  # drag due to gear down

            # induced drag coefficients per phase [-]
            self.cd2to = np.array([])  # phase takeoff
            self.cd2ic = np.array([])  # phase initial climb
            self.cd2cr = np.array([])  # phase cruise
            self.cd2ap = np.array([])  # phase approach
            self.cd2ld = np.array([])  # phase land

            # max climb thrust coefficients
            self.ctcth1 = np.array([])  # jet/piston [N], turboprop [ktN]
            self.ctcth2 = np.array([])  # [ft]
            self.ctcth3 = np.array(
                [])  # jet [1/ft^2], turboprop [N], piston [ktN]

            # reduced climb power coefficient
            self.cred = np.array([])  # [-]

            # 1st and 2nd thrust temp coefficient
            self.ctct1 = np.array([])  # [k]
            self.ctct2 = np.array([])  # [1/k]
            self.dtemp = np.array([])  # [k]

            # Descent Fuel Flow Coefficients
            # Note: Ctdes,app and Ctdes,lnd assume a 3 degree descent gradient during app and lnd
            self.ctdesl = np.array(
                [])  # low alt descent thrust coefficient [-]
            self.ctdesh = np.array(
                [])  # high alt descent thrust coefficient [-]
            self.ctdesa = np.array([])  # approach thrust coefficient [-]
            self.ctdesld = np.array([])  # landing thrust coefficient [-]

            # transition altitude for calculation of descent thrust
            self.hpdes = np.array([])  # [m]

            # Energy Share Factor
            self.ESF = np.array([])  # [-]

            # reference speed during descent
            self.vdes = np.array([])  # [m/s]
            self.mdes = np.array([])  # [-]

            # flight phase
            self.phase = np.array([])
            self.post_flight = np.array([])  # taxi prior of post flight?
            self.pf_flag = np.array([])

            # Thrust specific fuel consumption coefficients
            self.cf1 = np.array(
                []
            )  # jet [kg/(min*kN)], turboprop [kg/(min*kN*knot)], piston [kg/min]
            self.cf2 = np.array([])  # [knots]
            self.cf3 = np.array([])  # [kg/min]
            self.cf4 = np.array([])  # [ft]
            self.cf_cruise = np.array([])  # [-]

            # performance
            self.Thr = np.array([])  # thrust
            self.D = np.array([])  # drag
            self.fuelflow = np.array([])  # fuel flow

            # ground
            self.tol = np.array([])  # take-off length[m]
            self.ldl = np.array([])  # landing length[m]
            self.ws = np.array([])  # wingspan [m]
            self.len = np.array([])  # aircraft length[m]
            self.gr_acc = np.array([])  # ground acceleration [m/s^2]