Skip to content

Commit

Permalink
Capping the performance limits based on the general (BADA/OpenAP) bs.…
Browse files Browse the repository at this point in the history
…traf.perf.limits function instead of the OpenAP specific limits. Therefore, speed is converted from GS to TAS and the right vertical speed direction is set.
  • Loading branch information
ninyes committed Apr 21, 2022
1 parent 0173994 commit ebe4145
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions bluesky/traffic/asas/mvp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
''' Conflict resolution based on the Modified Voltage Potential algorithm. '''
import numpy as np
import bluesky as bs
from bluesky import stack, settings
from bluesky.traffic.asas import ConflictResolution

Expand Down Expand Up @@ -250,11 +251,16 @@ def resolve(self, conf, ownship, intruder):

# Determine ASAS module commands for all aircraft--------------------------

# Cap the velocity
newgscapped = np.maximum(ownship.perf.vmin,np.minimum(ownship.perf.vmax,newgs))

# Cap the vertical speed
vscapped = np.maximum(ownship.perf.vsmin,np.minimum(ownship.perf.vsmax,newvs))
# Compute the true airspeed from newgs (GS=TAS if no wind)
vwn, vwe = bs.traf.wind.getdata(bs.traf.lat, bs.traf.lon, bs.traf.alt)
newtasnorth = newgs * np.cos(np.radians(newtrack)) - vwn
newtaseast = newgs * np.sin(np.radians(newtrack)) - vwe
newtas = np.sqrt(newtasnorth**2 + newtaseast**2)

# Cap the velocity and vertical speed
tascapped, vscapped, altcapped = bs.traf.perf.limits(newtas, newvs, ownship.alt, ownship.ax)
signvs = np.sign(newvs)
vscapped = np.where(np.logical_or(signvs == 0, signvs == np.sign(vscapped)), vscapped, -vscapped)

# Calculate if Autopilot selected altitude should be followed. This avoids ASAS from
# climbing or descending longer than it needs to if the autopilot leveloff
Expand Down

0 comments on commit ebe4145

Please sign in to comment.