R Function fpnn
to run, source('fpnn.r'), then fpnn()
to run multiple plans at once, source('all_fpnn.r')

Command line input and defaults:

flightname='Hippolike_80W50-70S'; netdir='/net/www/docs/homes/stephens/ORCAS/FLTPLAN'; infile='fltplan_input.txt'; wdir=315; tstep=1/3; svstep=10; hdstep=60
where:
wdir = wind direction, for upwind (uw), downwind (dw), crosswind (cw), and reverse crosswind (revcw) calls (time enroute currently assumes no wind)
tstep = time step of calculation, 1/3 of a second corresponds to 1 degree in 2 min turns
svstep = save step, time interval at which to save position data
hdstep = heading step, time interval at which to recalculate heading

Input files:
(all input files allow comments following a #)

Standard input files:

config_files/fltplan_input.txt
2 columns (followed by comments) of value and variable name.  
Variables (and comments) are: 
maxalt # Maximum Altitude
pblalt # PBL Sampling Altitude
maxgs # Max. Altitude Ground Speed
pblgs # PBL Sampling Ground Speed
maxfb # Max. Altitude Fuel Burn
pblfb # PBL Sampling Fuel Burn
fullfuel # Takeoff Fuel at Sea Level
rate # Ascent/Descent Rate

config_files/specloc.txt
specified locations (allows calling with set course or arrive statements below)
4 columns:
'alt' is in feet
lat  lon     alt   name
23.15185 -109.721044 374 MMSD
-53.01062 -70.85168 42  SCCI
39.9088056 -105.1171944 5673.4  KBJC



Flight specific input in *.txt file with flight name as the prefix, single header row, then a table with 5 columns:
Alt	Min	Directive  	Phase		Waypoint 	Selected
Can either specify a new altitude to go to, an amount of time to hold a
specific altitude, or a turn/heading/destination "Directive".  Phase names
control colors on plots, while Waypoints are labelled on plots.
Waypoints with 'Y' for Selected will be reported in a separate file for the
pilots.

Directive can take any of the following forms:
'lh_xxx' = left hand turn of specified degrees (xxx = 3 digit degrees)
'rh_xxx' = right hand turn of specified degrees (xxx = 3 digit degrees)
'lh2_xxx' = left hand turn to new heading (xxx = 3 digit degrees or cw, revcw, uw, or dw)
'rh2_xxx' = right hand turn to new heading (xxx = 3 digit degrees or cw, revcw, uw, or dw)
't2_xxx' = shortest direction turn to new heading (xxx = 3 digit degrees or cw, revcw, uw, or dw)
'lhspiral' = left hand circle (while climbing or descending dep on alt)
'rhspiral' = right hand circle (while climbing or descending dep on alt)
'scDDMMSDDDMMW' = set course (great circle) towards waypoint (start any climb/descent immediately)
'arDDMMSDDDMMW' = arrive (same as sc but hold alt until time to ascend/descend to arrive at waypoint)
'gtDDMMSDDDMMW' = go to (same as sc but continues until destination reached)
'sc_****' = same as sc, but using a location name with lat/lon specified in specloc.txt
'ar_****' = same as ar, but using a location name with lat/lon specified in specloc.txt
'gt_****' = same as gt, but using a location name with lat/lon specified in specloc.txt
'inbound' = same as sc, but location set to SCCI
'approach' = same as ar but location set to SCCI
'inbound' and 'set course' directives propagated until next non-NA directive, so only need to be set once and great circle heading adjustments will continue

Notes:
1) if Alt is new, then Min must be NA or > Alt/rate
2) if heading determined from Directive is new, then Min must be NA or > change in degrees / 180
3) if heading determined from Directive is new, the turn starts immediately
4) if Alt is new and Directive is an 'sc', then climb/descent starts immediately
5) if Alt is new and Directive is an 'ar' then climb/descent starts when needed to end at waypoint
6) if Min = NA, then duration is calculated from time to climb/descend or time to turn (whichever is longer)
7) if Phase = NA, then Phase is set to be same as previous row
8) a Directive of 'sc' or 'inbound' is propagated until the next non-NA Directive. All other NA Directives are left as is
9) Min must be specified if Alt is not new and Directive is NA
10) input file must start with a 'sc' or a fixed heading (specified as xxx in dir)
11) Alt on first row is ignored and replaced by initalt
12) on first row, 'sc' does not add any time, but on other rows, 'sc' adds in a standard (shortest direction) turn
13) the Waypoint and Selected columns can be left blank, but if Waypoint is blank Selected must be too.  All other columns need either a value or NA.
14) the Waypoint name on the first row must reference a specified location in specloc.txt
