faa.tg.aircraft
Class Controller

java.lang.Object
  extended by faa.tg.aircraft.Controller
Direct Known Subclasses:
ADMController, CrashController, DeadReckonController, ProfileManager, TransitionManager

public abstract class Controller
extends java.lang.Object

Defines the methods needed for controlling an aircraft.

See the source: Controller.java

Version:
$Id: Controller.java,v 1.41 2009/01/14 00:29:15 lykensj Exp $
Author:
lykensj

Field Summary
static java.lang.String CVS_VERSION_ID
          The CVS Version ID.
private  ControllerResult notAvailable
           
private  java.lang.String unavailableMsg
           
 
Constructor Summary
protected Controller(Dynamics dynamics)
           
 
Method Summary
 void addSimEvent(SimEventPredicate pred, CommandLine commandLine, Scenario scenario, Acid acid)
          Must override to allow a sim event to be applied to this aircraft.
 void cancelAltitudeConstraints()
          SpCommand must call this when a controller commands a new altitude.
 void cancelRouteConstraints()
          Cancels route constraints and crossing maneuvers, replacing them with a maneuver using the current desired speed and current desired altitude.
 void cancelSpeedConstraints()
          SpCommand must call this when an aircraft receives a speed command.
 void captureLocalizer(Runway arrRwy)
          Must override to allow aircraft to capture the localizer.
 void clearForILSApproach(Runway arrRwy)
          Must override to allow aircraft to perform the ILS Approach.
 void clearForRNavApproach(Aircraft aircraft, Runway arrRwy)
          Must override to allow aircraft to perform the RNav Approach.
 java.lang.String crossFix(Fix fix, AltitudeRestriction altRestr, GenericSpeed speedRestr)
          Instruction for the aircraft to cross a fix that allows an altitude restriction or a speed restriction to be specified.
 void descendGlideSlope(Runway arrRwy)
          Must override to allow aircraft to descend the glide slope.
 void directFix(Fix fix)
          Instructs the aircraft to go directly to the specified fix.
 void disableGps()
          These methods are accessors to functionality of the navigation equipment.
 void enableGps()
           
 java.lang.String expediteThroughAlt(Altitude expediteAlt)
          Must override to allow an expedited altitude change.
 void followAt(Altitude followOnAltitude, Fix fix, Position currPos)
          Must override to allow an altitude profile to follow the current profile.
 void followAt(GenericSpeed followOnSpeed, boolean maxRateDecel, Fix fix, Position currPos)
          Must override to allow a speed profile to follow the current profile.
 void followOn(Altitude followOnAltitude)
          Must override to allow an altitude profile to follow the current profile.
 void followOn(GenericSpeed followOnSpeed, boolean maxRateDecel)
          Must override to allow a speed profile to follow the current profile.
 void followOn(MagneticHeading heading)
          Must override to allow a aircraft to follow the current profile.
 void followTrack(Track track)
          Follow the track specified.
abstract  RouteSegment getCurrentSegment()
          Returns the current route segment, or null if not on a route.
 boolean getEnforceNavigationLimits()
          Returns whether to force an aircraft to obey the limits of its navigation equipment when following a route
 Altitude getExpeditedDescentCapture(Position crossPos)
          Method called to determine the altitude at which the crossing point's latitude/longitude can be captured with an expedited descent.
 Route getPreviousRoute()
          Returns the previous route, or null if not on a route.
abstract  Route getRoute()
          Returns the current route, or null if not on a route.
abstract  java.lang.String getRouteString()
          Return the current route of this aircraft as a dot-separated string, if no route, returns "N/A".
abstract  java.lang.String getRouteWithBracketLogicString()
           
 ControllerResult haltTaxi()
           
 void hold(Fix holdFix, HoldingPattern holdingPattern)
          Method called to direct the aircraft to follow a holding pattern.
 ControllerResult holdAt(GroundFix fix)
           
 ControllerResult holdShort(GroundFix fix)
          Must override to allow an aircraft to hold short of a ground fix.
 ControllerResult holdShort(GroundRunway rwy)
           
 ControllerResult holdShort(Taxiway taxiway)
          Must override to allow an aircraft to hold short of a taxiway.
 void joinGroundRoute()
           
 ControllerResult killNextHold(HoldMarker type)
           
 void leaveSegment()
           
 void leftTurn(TrueHeading targetHdg)
          Change the heading of the aircraft by turning left until the specified true heading is achieved.
 void maintainAltRate(AltitudeRate altRate, boolean notifyOnFailure)
          Method used to command an aircraft to maintain a constant vertical speed (altRate)
 void missApproach()
          Method called to direct the aircraft to abort the landing.
 void newAltitude(Altitude targetAlt)
          Must override to allow a standard altitude change.
 void newHeading(TrueHeading targetHdg)
          Change the heading of the aircraft to a new heading.
 void newRoute(Route route)
          Causes this aircraft to capture this route
 void newRoute(Route route, Fix captureFix)
          Capture and follow this route through this capture fix.
 void newRoute(Route route, TrueHeading headingToRoute)
          Instructs aircraft to follow the specified heading until the specified route is intercepted, then to follow the route thereafter.
 void newSpeed(GenericSpeed speed, boolean maxRateDecel)
          Instructs an aircraft to change the speed.
 ControllerResult reroute(java.lang.String destination, java.lang.String via)
           
 void resumeSpeed()
          Instructs the aircraft to resume its normal speed.
 ControllerResult resumeTaxi()
           
 void rightTurn(TrueHeading targetHdg)
          Change the heading of the aircraft by turning right until the specified true heading is achieved.
 ControllerResult setClearedForTakeoff(boolean cleared)
           
 java.lang.String setEnforceNavigationLimits(boolean enforce, AcType type)
          Set whether to force an aircraft to obey the limits of its navigation equipment when following a route
 ControllerResult takeOffPositionHold()
          Get into takeoff position on departure runway and await further instructions
protected  ControllerResult unavailable()
           
protected  java.lang.String unavailableMessage()
           
protected  UnableToComplyException undefinedControlAction(java.lang.String methodName)
          This is the default action to execute when a control action is not defined for this Controller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CVS_VERSION_ID

public static final java.lang.String CVS_VERSION_ID
The CVS Version ID.

See Also:
Constant Field Values

unavailableMsg

private final java.lang.String unavailableMsg

notAvailable

private final ControllerResult notAvailable
Constructor Detail

Controller

protected Controller(Dynamics dynamics)
Method Detail

unavailable

protected ControllerResult unavailable()

unavailableMessage

protected java.lang.String unavailableMessage()

getRoute

public abstract Route getRoute()
Returns the current route, or null if not on a route.


getCurrentSegment

public abstract RouteSegment getCurrentSegment()
Returns the current route segment, or null if not on a route.


getRouteString

public abstract java.lang.String getRouteString()
Return the current route of this aircraft as a dot-separated string, if no route, returns "N/A".


getRouteWithBracketLogicString

public abstract java.lang.String getRouteWithBracketLogicString()

getPreviousRoute

public Route getPreviousRoute()
Returns the previous route, or null if not on a route. This must be overridden to get a non-null value.


undefinedControlAction

protected UnableToComplyException undefinedControlAction(java.lang.String methodName)
This is the default action to execute when a control action is not defined for this Controller.

Redefining this method in Controller subclasses, will redefine the default action for all undefined control methods.

Parameters:
methodName - String describing the method called.
Returns:
UnableToComplyException Default for undefined control actions.

cancelAltitudeConstraints

public void cancelAltitudeConstraints()
SpCommand must call this when a controller commands a new altitude. SpCommand must call this when an aircraft receives a altitude command. Allows behavior specific to the issuance of a new altitude command to be performed.


cancelRouteConstraints

public void cancelRouteConstraints()
Cancels route constraints and crossing maneuvers, replacing them with a maneuver using the current desired speed and current desired altitude.


cancelSpeedConstraints

public void cancelSpeedConstraints()
SpCommand must call this when an aircraft receives a speed command.


clearForILSApproach

public void clearForILSApproach(Runway arrRwy)
                         throws UnableToComplyException
Must override to allow aircraft to perform the ILS Approach.

Parameters:
arrRwy - The arrival runway for the ILS approach.
Throws:
UnableToComplyException - - is thrown if unable to comply

clearForRNavApproach

public void clearForRNavApproach(Aircraft aircraft,
                                 Runway arrRwy)
                          throws UnableToComplyException
Must override to allow aircraft to perform the RNav Approach.

Parameters:
aircraft - The aircraft to clear for the RNAV approach.
arrRwy - The arrival runway for the RNAV approach.
Throws:
UnableToComplyException - Can not perform an RNAV approach.

captureLocalizer

public void captureLocalizer(Runway arrRwy)
                      throws UnableToComplyException
Must override to allow aircraft to capture the localizer.

Parameters:
arrRwy - The arrival runway for the localizer.
Throws:
UnableToComplyException - If unable to comply.

descendGlideSlope

public void descendGlideSlope(Runway arrRwy)
                       throws UnableToComplyException
Must override to allow aircraft to descend the glide slope.

Parameters:
arrRwy - The arrival runway for the glide slope.
Throws:
UnableToComplyException - If unable to comply.

newAltitude

public void newAltitude(Altitude targetAlt)
                 throws UnableToComplyException
Must override to allow a standard altitude change.

Parameters:
targetAlt - Altitude to climb/descend to.
Throws:
UnableToComplyException

expediteThroughAlt

public java.lang.String expediteThroughAlt(Altitude expediteAlt)
                                    throws UnableToComplyException
Must override to allow an expedited altitude change.

Parameters:
expediteAlt - Altitude to expedite to.
Throws:
UnableToComplyException - If unable to expedite.

followOn

public void followOn(MagneticHeading heading)
              throws UnableToComplyException
Must override to allow a aircraft to follow the current profile.

Parameters:
heading - - the heading to go to after the current profile finishes
Throws:
UnableToComplyException - - is thrown if aircraft is unable to do

followAt

public void followAt(GenericSpeed followOnSpeed,
                     boolean maxRateDecel,
                     Fix fix,
                     Position currPos)
              throws UnableToComplyException
Must override to allow a speed profile to follow the current profile.

Parameters:
followOnSpeed - - speed to go to after current profile finishes.
maxRateDecel - - Whether speed chg should be a max rate deceleration.
fix - - where to start next profile
currPos - - the aircraft's current position
Throws:
UnableToComplyException - - is thrown if aircraft is unable to do

followAt

public void followAt(Altitude followOnAltitude,
                     Fix fix,
                     Position currPos)
              throws UnableToComplyException
Must override to allow an altitude profile to follow the current profile.

Parameters:
followOnAltitude - - the altitude to go to after finished current profile
fix - - where to start next profile
currPos - - the current position
Throws:
UnableToComplyException - - is thrown if aircraft is unable to do

followOn

public void followOn(Altitude followOnAltitude)
              throws UnableToComplyException
Must override to allow an altitude profile to follow the current profile.

Parameters:
followOnAltitude - Altitude to go to after current profile finishes.
Throws:
UnableToComplyException

followOn

public void followOn(GenericSpeed followOnSpeed,
                     boolean maxRateDecel)
              throws UnableToComplyException
Must override to allow a speed profile to follow the current profile.

Parameters:
followOnSpeed - Speed to go to after current profile finishes.
maxRateDecel - Whether speed chg should be a max rate deceleration.
Throws:
UnableToComplyException

addSimEvent

public void addSimEvent(SimEventPredicate pred,
                        CommandLine commandLine,
                        Scenario scenario,
                        Acid acid)
                 throws UnableToComplyException
Must override to allow a sim event to be applied to this aircraft.

Parameters:
pred - Determines when the SimEvent is triggered.
commandLine - - the command line to execute.
scenario - The scenario of this aircraft.
acid - - the acid.
Throws:
UnableToComplyException - Aircraft is unable to add simevent.

newHeading

public void newHeading(TrueHeading targetHdg)
                throws UnableToComplyException
Change the heading of the aircraft to a new heading. It will also maintain its current altitude and indicated airspeed.

Parameters:
targetHdg - The desired true heading for the aircraft.
Throws:
UnableToComplyException

leftTurn

public void leftTurn(TrueHeading targetHdg)
              throws UnableToComplyException
Change the heading of the aircraft by turning left until the specified true heading is achieved.

Parameters:
targetHdg - The desired true heading for the aircraft.
Throws:
UnableToComplyException

rightTurn

public void rightTurn(TrueHeading targetHdg)
               throws UnableToComplyException
Change the heading of the aircraft by turning right until the specified true heading is achieved.

Parameters:
targetHdg - The desired true heading for the aircraft.
Throws:
UnableToComplyException

newSpeed

public void newSpeed(GenericSpeed speed,
                     boolean maxRateDecel)
              throws UnableToComplyException
Instructs an aircraft to change the speed. The speed will remain the commanded speed until a flight plan speed change is specified or a new speed command occurs.

Parameters:
speed - Speed that the sim pilot requested the aircraft follow.
maxRateDecel - Whether speed chg should be a max rate deceleration.
Throws:
UnableToComplyException - - is thrown if unable to comply

maintainAltRate

public void maintainAltRate(AltitudeRate altRate,
                            boolean notifyOnFailure)
                     throws UnableToComplyException
Method used to command an aircraft to maintain a constant vertical speed (altRate)

Parameters:
altRate - The altitude rate to maintain.
notifyOnFailure - - whether to send prompt to SPW to notify controller if command fails
Throws:
UnableToComplyException

crossFix

public java.lang.String crossFix(Fix fix,
                                 AltitudeRestriction altRestr,
                                 GenericSpeed speedRestr)
                          throws FixNotOnRouteException,
                                 UnableToComplyException
Instruction for the aircraft to cross a fix that allows an altitude restriction or a speed restriction to be specified. The fix can be any type of fix. Therefore, CrossDME functionality is already included in this method.

Parameters:
fix - Fix for the aircraft to cross.
altRestr - Altitude restriction for crossing fix (null if none).
speedRestr - Speed restriction for crossing fix (null if none).
Returns:
Returns message to be provided to the simpilot on success.
Throws:
FixNotOnRouteException - The fix is not on the route.
UnableToComplyException - Fix is not visible to ac's nav equip.

followTrack

public void followTrack(Track track)
                 throws UnableToComplyException
Follow the track specified.

Parameters:
track - The track for the aircraft to follow.
Throws:
UnableToComplyException - If tracked aircraft is not visible.

directFix

public void directFix(Fix fix)
               throws UnableToComplyException
Instructs the aircraft to go directly to the specified fix.

Parameters:
fix - The fix for the aircraft to go to.
Throws:
UnableToComplyException - See error text for failure reason.

newRoute

public void newRoute(Route route)
              throws UnableToComplyException
Causes this aircraft to capture this route

Parameters:
route - The route to capture.
Throws:
UnableToComplyException

newRoute

public void newRoute(Route route,
                     Fix captureFix)
              throws FixNotOnRouteException,
                     UnableToComplyException
Capture and follow this route through this capture fix. The aircraft goes directly to captureFix, then follows the route.

Parameters:
route - The route to capture and follow.
captureFix - Capture this route at this fix.
Throws:
FixNotOnRouteException - if captureFix is not on route
UnableToComplyException

newRoute

public void newRoute(Route route,
                     TrueHeading headingToRoute)
              throws UnableToComplyException
Instructs aircraft to follow the specified heading until the specified route is intercepted, then to follow the route thereafter.

Parameters:
route - The intercepting route.
headingToRoute - Heading pointing in the route direction.
Throws:
UnableToComplyException - Heading does not intercept the route.

resumeSpeed

public void resumeSpeed()
                 throws UnableToComplyException
Instructs the aircraft to resume its normal speed.

Throws:
UnableToComplyException

missApproach

public void missApproach()
                  throws UnableToComplyException
Method called to direct the aircraft to abort the landing.

Throws:
UnableToComplyException

hold

public void hold(Fix holdFix,
                 HoldingPattern holdingPattern)
          throws FixNotOnRouteException,
                 UnableToComplyException
Method called to direct the aircraft to follow a holding pattern. The implementing class is responsible for updating the state.

Parameters:
holdFix - The Fix to hold at.
holdingPattern - Instructions for following a holding pattern.
Throws:
FixNotOnRouteException - Fix is not on the route.
UnableToComplyException

disableGps

public void disableGps()
                throws UnableToComplyException
These methods are accessors to functionality of the navigation equipment. Disables GPS

Throws:
UnableToComplyException

enableGps

public void enableGps()
               throws UnableToComplyException
Throws:
UnableToComplyException

resumeTaxi

public ControllerResult resumeTaxi()

haltTaxi

public ControllerResult haltTaxi()

setClearedForTakeoff

public ControllerResult setClearedForTakeoff(boolean cleared)
Parameters:
cleared -

holdAt

public ControllerResult holdAt(GroundFix fix)
Parameters:
fix -

holdShort

public ControllerResult holdShort(GroundRunway rwy)
Parameters:
rwy -

holdShort

public ControllerResult holdShort(GroundFix fix)
Must override to allow an aircraft to hold short of a ground fix.

Parameters:
fix - The ground fix to hold short of.

holdShort

public ControllerResult holdShort(Taxiway taxiway)
Must override to allow an aircraft to hold short of a taxiway.

Parameters:
taxiway - The taxiway to hold short of.

takeOffPositionHold

public ControllerResult takeOffPositionHold()
Get into takeoff position on departure runway and await further instructions


reroute

public ControllerResult reroute(java.lang.String destination,
                                java.lang.String via)
Parameters:
destination -
via -

killNextHold

public ControllerResult killNextHold(HoldMarker type)
Parameters:
type -

setEnforceNavigationLimits

public java.lang.String setEnforceNavigationLimits(boolean enforce,
                                                   AcType type)
Set whether to force an aircraft to obey the limits of its navigation equipment when following a route

Parameters:
enforce - - the new setting
type - - the type of aircraft.
Returns:
Returns what if any part of its current route the aircraft should not be able to follow.

getEnforceNavigationLimits

public boolean getEnforceNavigationLimits()
Returns whether to force an aircraft to obey the limits of its navigation equipment when following a route

Returns:
Returns true if aircraft should only follow a route that its navigation equipment can do, otherwise false

joinGroundRoute

public void joinGroundRoute()

leaveSegment

public void leaveSegment()

getExpeditedDescentCapture

public Altitude getExpeditedDescentCapture(Position crossPos)
Method called to determine the altitude at which the crossing point's latitude/longitude can be captured with an expedited descent.