
NPOI simulation

==================================================================
changes log

020605 -- modified combiner to deal with integrations over the aperture.

==================================================================
==================================================================
The main program

The Simulation consists of three main.  Configuration, Initialization
and operation.

I.  Configuration.  These parameters need to be set by the user.  For
now, they have to changed in the source code and the the source code
has to be recompiled.  Later on, we should make this process easier.

Array geometry -- set the number of apertures, the locations of each
aperture, the aperture diameter and the number and position of sample
points across each aperture.

Fringe Detection Parameters -- set the modulation amplitude for each
input beam and the mapping of array stations to beam combiner input beams.

Atmsophere Screen File -- Set the window length, the wind velocity,
internal sample time in the code and r_0, the Fried parameter.  The
window length is atmospheric decorrelation length, measured in units
of r_0.

II.  Initialization.

This section allocates memory and creates instances of all the classes
needed to run the simulation.  It should be transparant to the user.

III.  Simulation.

The simulation is a loop over times.  There are three operations that
need to be performed:  propagation, calculation and control.

The propagation happens naturally and is completely hidden from the
user.  When new atmospheric phases are need, the underlying atmosphere
simulation calculates what is needed automatically.  The same is true
for the delay line and fast steering mirrors.  It will be true for the
adaptive optics when that is added to the simulation.

The calculation stage has to be requested by the user.  These consist
of "getData" commands sent to the beam combiners and the Fast Steering
Mirrors.  Eventually an AO class we be added.  These commands return
the data that will be available to the user at the requested times.
These commands know the time delays between when the data is taken and
when is it delivered to the user.  Thus, they request data from the
past.

After the data are accumulated, the servo calculations have to be
performed to determine the appropriate error signals for the various
servos.  These calculations are done with "calculate" commands.

Finally, the error signals are delived to the appropriate servos.

The final task in the simulation loop is to provide outputs for the
user.

==================================================================
==================================================================
what happens where?

===================================================================
atmosphere.cpp -- wrapper for Deane's atmosphere code.  Currently, we
have three methods.

Piston  returns the mean piston  for the wavefront.
tip     returns the best fit tip  to the wavefront.
tilt    returns the best fit tilt to the wavefront.

These are archaic.  The simulation does a point by point integration
over the wavefront. These will be replaced with

getWavefront  which returns a structure of offset positions.

===================================================================
combiner.cpp -- performs the beam combination tasks.  The assumption
here is the beam combiner consists of a single detector with an
arbitrary number of beams superimposed on it.  Two beams is pairwise
combination, more than two beams is an all-on-one type combination.
Intermediate schemes can be created by invoking several instances of
this combiner.

setBinMask -- initializes the bin mask.  This must be called exactly
once, before any data taking and is used to make the operation of the
simulation as much like the real thing as possible.

getData -- returns bin counts for one integration.  This is all the
bins for all the wavelength channels.

getWavelengths -- returns the list of center wavelengths for each of
the spectrograph channels.

showBinMap -- this displays the bin map for debugging.

showData -- this displays a frame of data.  Not sure why its here.

plotData -- this code is character for character identical to showData

n_dryAir -- returns (n-1) where n is the index of refraction of dry
air for a specified wavelength.

comments.  These routines need work because they are too slow.
Instead of calculating the intensity pattern at each time tick, I
should do a Simpson's rule integration over the bins.  That will
require storing the start and stop times for each bin somewhere.

====================================================================