faa.tg.aircraft.adm.controllogic.latcontrol
Class AbstractTurn

java.lang.Object
  extended by faa.tg.aircraft.adm.controllogic.latcontrol.AbstractTurn
All Implemented Interfaces:
HeadingStrategist, TurnStrategist, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
LeftTurn, RightTurn

public abstract class AbstractTurn
extends java.lang.Object
implements TurnStrategist, java.io.Serializable

An abstract class that contains most of the functionality for a turn. There are two types of turns, both of which are implemented in concrete classes:

  1. RightTurn
  2. LeftTurn
See the source: AbstractTurn.java

Version:
$Id: AbstractTurn.java,v 3.6 2008/08/07 19:03:47 lykensj Exp $
Author:
Tim Kimmet
See Also:
LeftTurn, RightTurn, Serialized Form

Field Summary
private  Angle BANK_CAPTURE_DONE
          The bank capture is completed if the magnitude of the bank angle is less than the bank capture limit: finishes turn with a heading capture.
private  boolean bankCaptureCompleted
          If the turn magnitude is greater than the HEADING_ERROR_BOUNDARY, a bank (roll angle) capture is performed until the BANK_CAPTURE_LIMIT has been captured, then the bank capture portion of the turn is completed and a heading capture is used for the remainder of the turn.
static Angle CAPTURE_LIMIT
          The heading is considered captured if abs_e5 is less than the capture limit.
static java.lang.String CVS_VERSION_ID
          The CVS Version ID
private static double DEFAULT_DESIRED_ROLL_ANGLE__DEG
           
private  TrueHeading desiredHeading
          This is the user-specified (Commanded) heading during each timestep, we will try to get closer to this value.
private  RollAngle desiredRollAngle
          The roll angle calculated and returned by this control logic.
private  Angle e5
          The heading error as calculated by the loaded turn strategist.
private static Angle HDG_DIFF_FOR_DEF_DES_ROLL
          Heading difference above which the default desired roll angle is used.
private  Angle HDG_DIFF_FOR_ZERO_DES_ROLL
          Heading difference at which to switch the desired roll angle to zero, during bank capture.
private  boolean headingCaptured
          As specified in the analysis, once the desired heading has been captured, then it is captured for the life of the maneuver.
static Angle MIN_BANK_CAPTURE_HDG
          The minimum heading change that requires a bank capture for the first part of the turn.
(package private) static long serialVersionUID
           
 
Constructor Summary
AbstractTurn(TrueHeading desiredHeading, Angle initialE5)
          Constructor for the AbstractTurn class; to start the aircraft in a roll, just make the desired heading different from the current heading.
 
Method Summary
abstract  Angle calcE5(TrueHeading currentHeading)
          Calculates the error between the desired heading and the actual heading all sub classes must implement this method
private static RollAngle calcHdgCaptureDesiredRollAngle(Angle e5)
          Calculates the desired roll angle for heading capture stage.
protected static Angle calcLeftTurnMagnitude(TrueHeading currentHeading, TrueHeading desiredHeading)
          Calculates the magnitude of the turn required to make a left turn from the current to the desired heading.
protected static Angle calcRightTurnMagnitude(TrueHeading currentHeading, TrueHeading desiredHeading)
          Calculates the magnitude of the turn required to make a right turn from the current to the desired heading.
 AbstractTurn clone()
           
 RollAngle control(TrueHeading currentHeading, RollAngle currentRollAngle)
          Updates the state of this particular strategist implementation.
 TrueHeading getDesiredHeading()
          Returns the desired heading initially commanded by the sim pilot.
 RollAngle getRollAngle()
          Returns the desired roll angle.
 boolean isHeadingCaptured()
          Returns true if the heading has been captured, false otherwise.
protected static TurnStrategist loadStrategist(TrueHeading currHdg, TrueHeading desiredHdg)
          Loads a turn strategist, given the current and desired heading.
abstract  boolean normalize(TrueHeading currentHeading, TrueHeading desiredHeading)
          This method returns whether or not to normalize desiredHeading.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

CVS_VERSION_ID

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

See Also:
Constant Field Values

MIN_BANK_CAPTURE_HDG

public static final Angle MIN_BANK_CAPTURE_HDG
The minimum heading change that requires a bank capture for the first part of the turn.


CAPTURE_LIMIT

public static final Angle CAPTURE_LIMIT
The heading is considered captured if abs_e5 is less than the capture limit.


DEFAULT_DESIRED_ROLL_ANGLE__DEG

private static final double DEFAULT_DESIRED_ROLL_ANGLE__DEG

HDG_DIFF_FOR_DEF_DES_ROLL

private static final Angle HDG_DIFF_FOR_DEF_DES_ROLL
Heading difference above which the default desired roll angle is used.


HDG_DIFF_FOR_ZERO_DES_ROLL

private final Angle HDG_DIFF_FOR_ZERO_DES_ROLL
Heading difference at which to switch the desired roll angle to zero, during bank capture.


BANK_CAPTURE_DONE

private final Angle BANK_CAPTURE_DONE
The bank capture is completed if the magnitude of the bank angle is less than the bank capture limit: finishes turn with a heading capture.


headingCaptured

private boolean headingCaptured
As specified in the analysis, once the desired heading has been captured, then it is captured for the life of the maneuver. This flag is used to denote a completed maneuver.


bankCaptureCompleted

private boolean bankCaptureCompleted
If the turn magnitude is greater than the HEADING_ERROR_BOUNDARY, a bank (roll angle) capture is performed until the BANK_CAPTURE_LIMIT has been captured, then the bank capture portion of the turn is completed and a heading capture is used for the remainder of the turn.


desiredHeading

private TrueHeading desiredHeading
This is the user-specified (Commanded) heading during each timestep, we will try to get closer to this value.


desiredRollAngle

private RollAngle desiredRollAngle
The roll angle calculated and returned by this control logic.


e5

private Angle e5
The heading error as calculated by the loaded turn strategist.

Constructor Detail

AbstractTurn

public AbstractTurn(TrueHeading desiredHeading,
                    Angle initialE5)
Constructor for the AbstractTurn class; to start the aircraft in a roll, just make the desired heading different from the current heading.

Parameters:
desiredHeading - the desired heading
initialE5 - the initial value of e5 (the error between the desired and actual heading)
Method Detail

calcE5

public abstract Angle calcE5(TrueHeading currentHeading)
Calculates the error between the desired heading and the actual heading all sub classes must implement this method

Specified by:
calcE5 in interface TurnStrategist
Parameters:
currentHeading - the current heading of the aircraft

normalize

public abstract boolean normalize(TrueHeading currentHeading,
                                  TrueHeading desiredHeading)
This method returns whether or not to normalize desiredHeading. Its primary use is to circumvent the CAPTURE_LIMIT temporarily for a 360-degree relative turn.

WARNING: This method assunes that 360-degree reative turns are NOT in normalized format.

All sub classes must implement this method.

Specified by:
normalize in interface TurnStrategist
Parameters:
currentHeading - the current heading of the aircraft
desiredHeading - the desired heading
Returns:
Boolean indicating whether or not to normalize desiredHeading.

control

public RollAngle control(TrueHeading currentHeading,
                         RollAngle currentRollAngle)
Updates the state of this particular strategist implementation.

Specified by:
control in interface HeadingStrategist
Parameters:
currentHeading - The current heading of the aircraft.
currentRollAngle - The current roll angle.
Returns:
RollAngle specifying the desired roll angle to use.

getRollAngle

public RollAngle getRollAngle()
Returns the desired roll angle. This is the value that the lateral control is responsible for updating.

Specified by:
getRollAngle in interface HeadingStrategist

getDesiredHeading

public TrueHeading getDesiredHeading()
Returns the desired heading initially commanded by the sim pilot.

Specified by:
getDesiredHeading in interface HeadingStrategist

isHeadingCaptured

public boolean isHeadingCaptured()
Returns true if the heading has been captured, false otherwise.

Specified by:
isHeadingCaptured in interface HeadingStrategist

calcHdgCaptureDesiredRollAngle

private static RollAngle calcHdgCaptureDesiredRollAngle(Angle e5)
Calculates the desired roll angle for heading capture stage.

Parameters:
e5 - The calculated heading error.
Returns:
Return the desired roll angle.

loadStrategist

protected static TurnStrategist loadStrategist(TrueHeading currHdg,
                                               TrueHeading desiredHdg)
Loads a turn strategist, given the current and desired heading.
 Actually does NOT load a Strategist. It measures the Turn Magnitude for
 a left and right turn, constructs a LeftTurn or RightTurn Strategist and
 returns the TurnStrategist constructed. Leaves the assignment to the
 calling method. (dw)

 The turn strategist returned is either one of LeftTurn or RightTurn.
 Note that this method is static because it is does not depend on a "live"
 AbstractTurn object.   

Parameters:
currHdg - the current heading of the aircraft.
desiredHdg - the desired heading of the aircraft.
Returns:
TurnStrategist that produces the shortest direction of turn

calcLeftTurnMagnitude

protected static Angle calcLeftTurnMagnitude(TrueHeading currentHeading,
                                             TrueHeading desiredHeading)
Calculates the magnitude of the turn required to make a left turn from the current to the desired heading.

Parameters:
currentHeading - The current heading of the aircraft.
desiredHeading - The desired heading of the aircraft.
Returns:
The magnitude of left turn, between current and desired heading.

calcRightTurnMagnitude

protected static Angle calcRightTurnMagnitude(TrueHeading currentHeading,
                                              TrueHeading desiredHeading)
Calculates the magnitude of the turn required to make a right turn from the current to the desired heading.

Parameters:
currentHeading - The current heading of the aircraft.
desiredHeading - The desired heading of the aircraft.
Returns:
Magnitude of right turn, between current and desired heading.

clone

public final AbstractTurn clone()
                         throws java.lang.CloneNotSupportedException
Specified by:
clone in interface HeadingStrategist
Specified by:
clone in interface TurnStrategist
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException