How to use the bluesky.tools.aero.vtas2cas function in bluesky

To help you get started, we’ve selected a few bluesky examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TUDelft-CNS-ATM / bluesky / bluesky / traffic / performance / legacy / perfbs.py View on Github external
self.vmld = self.vm_ld*np.sqrt(self.mass/bs.traf.rho)

        # summarize and convert to cas
        # note: aircraft on ground may be pushed back
        self.vmin = (self.phase==1)*vtas2cas(self.vmto, bs.traf.alt) + \
                        ((self.phase==2) + (self.phase==3) + (self.phase==4))*vtas2cas(self.vmcr, bs.traf.alt) + \
                            (self.phase==5)*vtas2cas(self.vmld, bs.traf.alt) + (self.phase==6)*-10.0


        # forwarding to tools
        bs.traf.limspd,          \
        bs.traf.limspd_flag,     \
        bs.traf.limalt,          \
        bs.traf.limalt_flag,     \
        bs.traf.limvs,           \
        bs.traf.limvs_flag  =  calclimits(vtas2cas(bs.traf.pilot.tas, bs.traf.alt), \
                                        bs.traf.gs,          \
                                        self.vmto,           \
                                        self.vmin,           \
                                        self.vmo,            \
                                        self.mmo,            \
                                        bs.traf.M,           \
                                        bs.traf.alt,         \
                                        self.hmaxact,        \
                                        bs.traf.pilot.alt,   \
                                        bs.traf.pilot.vs,    \
                                        self.maxthr,         \
                                        self.thrust_pilot,      \
                                        self.D,              \
                                        bs.traf.tas,         \
                                        self.mass,           \
                                        self.ESF,            \
github TUDelft-CNS-ATM / bluesky / bluesky / traffic / performance / legacy / perfbada.py View on Github external
# values above 0 remain, values below are replaced through 0
        c1m = np.array(c1<0)*0.00000000000001
        c1def = np.maximum(c1, c1m)

        self.hact = self.hmax+self.gt*c1def+self.gw*(self.mmax-self.mass)
        # if hmax in OPF File ==0: hmaxact = hmo, else minimum(hmo, hmact)
        self.hmaxact = (self.hmax==0)*self.hmo +(self.hmax !=0)*np.minimum(self.hmo, self.hact)

        # forwarding to tools
        # forwarding to tools
        bs.traf.limspd,          \
        bs.traf.limspd_flag,     \
        bs.traf.limalt,          \
        bs.traf.limalt_flag,      \
        bs.traf.limvs,           \
        bs.traf.limvs_flag  =  calclimits(vtas2cas(bs.traf.pilot.tas, bs.traf.alt),   \
                                        bs.traf.gs,            \
                                        self.vmto,             \
                                        self.vmin,             \
                                        self.vmo,              \
                                        self.mmo,              \
                                        bs.traf.M,             \
                                        bs.traf.alt,           \
                                        self.hmaxact,          \
                                        bs.traf.pilot.alt,     \
                                        bs.traf.pilot.vs,      \
                                        self.maxthr,           \
                                        self.Thr,              \
                                        self.D,                \
                                        bs.traf.cas,           \
                                        self.mass,             \
                                        self.ESF,              \
github TUDelft-CNS-ATM / bluesky / bluesky / traffic / performance / legacy / perfbs.py View on Github external
def limits(self):
        """Flight envelope""" # Connect this with function limits in performance.py

        # combine minimum speeds and flight phases. Phases initial climb, cruise
        # and approach use the same CLmax and thus the same function for Vmin
        self.vmto = self.vm_to*np.sqrt(self.mass/bs.traf.rho)
        self.vmic = np.sqrt(2*self.mass*g0/(bs.traf.rho*self.clmaxcr*self.Sref))
        self.vmcr = self.vmic
        self.vmap = self.vmic
        self.vmld = self.vm_ld*np.sqrt(self.mass/bs.traf.rho)

        # summarize and convert to cas
        # note: aircraft on ground may be pushed back
        self.vmin = (self.phase==1)*vtas2cas(self.vmto, bs.traf.alt) + \
                        ((self.phase==2) + (self.phase==3) + (self.phase==4))*vtas2cas(self.vmcr, bs.traf.alt) + \
                            (self.phase==5)*vtas2cas(self.vmld, bs.traf.alt) + (self.phase==6)*-10.0


        # forwarding to tools
        bs.traf.limspd,          \
        bs.traf.limspd_flag,     \
        bs.traf.limalt,          \
        bs.traf.limalt_flag,     \
        bs.traf.limvs,           \
        bs.traf.limvs_flag  =  calclimits(vtas2cas(bs.traf.pilot.tas, bs.traf.alt), \
                                        bs.traf.gs,          \
                                        self.vmto,           \
                                        self.vmin,           \
                                        self.vmo,            \
                                        self.mmo,            \
github TUDelft-CNS-ATM / bluesky / bluesky / traffic / performance / openap / thrust.py View on Github external
)
                )
            )
        )
        m = np.where(
            roc<1500, m-0.06, np.where(
                roc<2500, m-0.01, m
            )
        )
        return m

    roc = np.abs(np.asarray(vs/aero.fpm))
    v = np.where(v < 10, 10, v)

    mach = aero.vtas2mach(v, h)
    vcas = aero.vtas2cas(v, h)

    p = aero.vpressure(h)
    p10 = aero.vpressure(10000*aero.ft)
    p35 = aero.vpressure(35000*aero.ft)

    # approximate thrust at top of climb (REF 2)
    F35 = (200 + 0.2 * thr0/4.448) * 4.448
    mach_ref = 0.8
    vcas_ref = aero.vmach2cas(mach_ref, 35000*aero.ft)

    # segment 3: alt > 35000:
    d = dfunc(mach/mach_ref)
    b = (mach / mach_ref) ** (-0.11)
    ratio_seg3 = d * np.log(p/p35) + b

    # segment 2: 10000 < alt <= 35000:
github TUDelft-CNS-ATM / bluesky / plugins / geovector.py View on Github external
for vec in geovecs:
        areaname = vec[0]
        if areafilter.hasArea(areaname):
            swinside  = areafilter.checkInside(areaname, traf.lat, traf.lon, traf.alt)

            gsmin,gsmax,trkmin,trkmax,vsmin,vsmax = vec[1:]

            # -----Ground speed limiting
            # For now assume no wind:  so use tas as gs
            if gsmin:
                casmin = vtas2cas(np.ones(traf.ntraf)*gsmin,traf.alt)
                usemin = traf.selspd casmax
                traf.selspd[swinside & usemax] = casmax[swinside & usemax]

            #------ Limit Track(so hdg)
            # Max track interval is 180 degrees to avoid ambiguity of what is inside the interval

            if trkmin and trkmax:

                # Use degto180 to avodi problems for e.g interval [350,30]
                usemin = swinside & (degto180(traf.trk - trkmin)<0) # Left of minimum
                usemax = swinside & (degto180(traf.trk - trkmax)>0) # Right of maximum

                #print(usemin,usemax)

                traf.ap.trk[swinside & usemin] = trkmin
                traf.ap.trk[swinside & usemax] = trkmax
github TUDelft-CNS-ATM / bluesky / bluesky / traffic / performance / bada / perfbada.py View on Github external
# values above 0 remain, values below are replaced through 0
        c1m = np.array(c1<0)*0.00000000000001
        c1def = np.maximum(c1, c1m)

        self.hact = self.hmax+self.gt*c1def+self.gw*(self.mmax-self.mass)
        # if hmax in OPF File ==0: hmaxact = hmo, else minimum(hmo, hmact)
        self.hmaxact = (self.hmax==0)*self.hmo +(self.hmax !=0)*np.minimum(self.hmo, self.hact)

        # forwarding to tools
        # forwarding to tools
        bs.traf.limspd,          \
        bs.traf.limspd_flag,     \
        bs.traf.limalt,          \
        bs.traf.limalt_flag,      \
        bs.traf.limvs,           \
        bs.traf.limvs_flag  =  calclimits(vtas2cas(bs.traf.pilot.tas, bs.traf.alt),   \
                                        bs.traf.gs,            \
                                        self.vmto,             \
                                        self.vmin,             \
                                        self.vmo,              \
                                        self.mmo,              \
                                        bs.traf.M,             \
                                        bs.traf.alt,           \
                                        self.hmaxact,          \
                                        bs.traf.pilot.alt,     \
                                        bs.traf.pilot.vs,      \
                                        self.maxthr,           \
                                        self.thrust,              \
                                        self.D,                \
                                        bs.traf.tas,           \
                                        self.mass,             \
                                        self.ESF,              \
github TUDelft-CNS-ATM / bluesky / bluesky / traffic / performance / legacy / perfbs.py View on Github external
self.warned = True
                else:
                    print("Flight " + bs.traf.id[-1] + " has an unknown aircraft type, " + actype + ", BlueSky then uses default B747-400 performance.")
        coeffidx = np.array(coeffidx)

        # note: coefficients are initialized in SI units

        self.coeffidxlist[-n:]      = coeffidx
        self.mass[-n:]              = coeffBS.MTOW[coeffidx] # aircraft weight
        self.Sref[-n:]              = coeffBS.Sref[coeffidx] # wing surface reference area
        self.etype[-n:]             = coeffBS.etype[coeffidx] # engine type of current aircraft
        self.engines[-n:]           = [coeffBS.engines[c] for c in coeffidx]

        # speeds
        self.refma[-n:]             = coeffBS.cr_Ma[coeffidx] # nominal cruise Mach at 35000 ft
        self.refcas[-n:]            = vtas2cas(coeffBS.cr_spd[coeffidx], 35000*ft) # nominal cruise CAS
        self.gr_acc[-n:]            = coeffBS.gr_acc[coeffidx] # ground acceleration
        self.gr_dec[-n:]            = coeffBS.gr_dec[coeffidx] # ground acceleration

        # limits
        self.vm_to[-n:]             = coeffBS.vmto[coeffidx]
        self.vm_ld[-n:]             = coeffBS.vmld[coeffidx]
        self.mmo[-n:]               = coeffBS.max_Ma[coeffidx] # maximum Mach
        self.vmo[-n:]               = coeffBS.max_spd[coeffidx] # maximum CAS
        self.hmaxact[-n:]           = coeffBS.max_alt[coeffidx] # maximum altitude
        # self.vmto/vmic/vmcr/vmap/vmld/vmin are initialised as 0 by super.create

        # aerodynamics
        self.CD0[-n:]               = coeffBS.CD0[coeffidx]  # parasite drag coefficient
        self.k[-n:]                 = coeffBS.k[coeffidx]    # induced drag factor
        self.clmaxcr[-n:]           = coeffBS.clmax_cr[coeffidx]   # max. cruise lift coefficient
        self.ESF[-n:]               = 1.
github TUDelft-CNS-ATM / bluesky / bluesky / traffic / performance / legacy / perfbs.py View on Github external
coeffidx = np.array(coeffidx)

        # note: coefficients are initialized in SI units

        self.coeffidxlist[-n:]      = coeffidx
        self.mass[-n:]              = coeffBS.MTOW[coeffidx] # aircraft weight
        self.Sref[-n:]              = coeffBS.Sref[coeffidx] # wing surface reference area
        self.etype[-n:]             = coeffBS.etype[coeffidx] # engine type of current aircraft

        #self.engines is a list of list, not part of the RegisterElementParameters
        for c in coeffidx:
            self.engines.append(coeffBS.engines[c]) # avaliable engine type per aircraft type

        # speeds
        self.refma[-n:]             = coeffBS.cr_Ma[coeffidx] # nominal cruise Mach at 35000 ft
        self.refcas[-n:]            = vtas2cas(coeffBS.cr_spd[coeffidx], 35000*ft) # nominal cruise CAS
        self.gr_acc[-n:]            = coeffBS.gr_acc[coeffidx] # ground acceleration
        self.gr_dec[-n:]            = coeffBS.gr_dec[coeffidx] # ground acceleration

        # calculate the crossover altitude according to the BADA 3.12 User Manual
        self.atrans[-n:]            = ((1000/6.5)*(T0*(1-((((1+gamma1*(self.refcas[-n:]/a0)*(self.refcas[-n:]/a0))** \
                                (gamma2))-1) / (((1+gamma1*self.refma[-n:]*self.refma[-n:])** \
                                    (gamma2))-1))**((-(beta)*R)/g0))))

        # limits
        self.vm_to[-n:]             = coeffBS.vmto[coeffidx]
        self.vm_ld[-n:]             = coeffBS.vmld[coeffidx]
        self.mmo[-n:]               = coeffBS.max_Ma[coeffidx] # maximum Mach
        self.vmo[-n:]               = coeffBS.max_spd[coeffidx] # maximum CAS
        self.hmaxact[-n:]           = coeffBS.max_alt[coeffidx] # maximum altitude
        # self.vmto/vmic/vmcr/vmap/vmld/vmin are initialised as 0 by super.create