# The *.dat files for the graphs were produced by these commands.
#
# The calculated altitude begins to diverge from the recorded
# altitude at around t=-20 seconds, so there is no point to
# graphing the calculated altitude much earlier than that
# divergence.  The likely reasons for the divergence are:
#     rapidly changing vertical acceleration
#     rapidly changing pitch
#     pitch corrections were recorded every 4 seconds by the FDR
#         (i.e. not often enough)
#
# Justification for final parameters:
#
# Relatively non-controversial parameters:
#
# The last recorded velocity is about 815 ft/sec.
# That velocity is placed along the x-axis so the x-axis
# will become (approximate) distance from the Pentagon.
#
# Possibly controversial parameters:
#
# The base of the Pentagon is about 33 feet above sea level.
# The impact point is regarded as the origin.
# If the end of data does not coincide with impact at the
# Pentagon, then the final height of 35 feet may be a little
# off, but it probably isn't off by much.  That wouldn't
# change the shape of the calculated altitude in any case.
#
# The final velocity of -23 ft/sec was chosen because it
# makes the shape of the curve for calculated altitude
# approximate the shape of the curve for pressure altitude.
# If the shape of the pressure altitude for the final seconds
# is suspect, then so is the final velocity of -23 ft/sec.
#
# The pressure altitude is corrected by adding 163 feet
# because that is the smallest adjustment that makes the
# corrected pressure altitude greater than the radio height
# throughout the final 30 seconds.  (The radio height is a
# little higher than the corrected pressure altitude at roughly
# t=-40 seconds, but the radio altimeters are nearing their
# limits there and are not as accurate as at lower elevations.)
# The 163-foot adjustment also makes the calculated altitude
# coincide with the corrected pressure altitude at t=-1.
# That correction is within the range of corrections that
# have been suggested by competent people, but could well
# be off by a few feet.  If the pressure altitude for the
# final seconds is suspect, then the 163-foot correction
# could be off by more than a few feet.
#
# The radio height recorded by the FDR assumes the landing
# gear are down.  With the landing gear up, I am told that
# the radio height is 10 to 20 feet greater than recorded.
# A 20-foot adjustment yields a ground elevation consistent
# with the known elevation of the Pentagon lawn.  This may
# mean that another 20 feet should be added to the pressure
# altitude, however.

# Altitude versus distance graphs.

echo "generating *.dat files for graph-alt600"
larceny --path . --r6rs --program graph-alt-vs-x.sps \
    -- graph600pa.dat graph600rh.dat graph600terrain.dat graph600alt.dat \
       graph600cpa.dat 163 20 \
       600 0 0 35 815 0 -23

echo "generating *.dat files for graph-alt50"
larceny --path . --r6rs --program graph-alt-vs-x.sps \
    -- graph50pa.dat graph50rh.dat graph50terrain.dat graph50alt.dat \
       graph50cpa.dat 163 20 \
       50 0 0 35 815 0 -23

echo "generating *.dat files for graph-alt5"
larceny --path . --r6rs --program graph-alt-vs-x.sps \
    -- graph5pa.dat graph5rh.dat graph5terrain.dat graph5alt.dat \
       graph5cpa.dat 163 20 \
       5 0 0 35 815 0 -23

# Acceleration versus time graphs.

echo "generating *.dat files for graph-acc600"
larceny --path . --r6rs --program graph-acc-vs-t.sps \
    -- graph600vert.dat graph600long.dat graph600lat.dat \
       600

echo "generating *.dat files for graph-acc50"
larceny --path . --r6rs --program graph-acc-vs-t.sps \
    -- graph50vert.dat graph50long.dat graph50lat.dat \
       50

echo "generating *.dat files for graph-acc5"
larceny --path . --r6rs --program graph-acc-vs-t.sps \
    -- graph5vert.dat graph5long.dat graph5lat.dat \
       5
