IterativeImpulsiveManeuver:

Path: FormationFlying/Control

% Iterative impulsive maneuver delta-V
 Computes the delta-v's required to implement a formation flying maneuver for a
 single spacecraft. The desired relative state is iteratively recomputed,
 bringing the desired state closer to the current state, until the largest
 single delta-v in the maneuver is under the maximum limit.

 A fixed thrust actuator is assumed when converting delta-v to burn duration.
 Algorithms do not account for gravitational perturbations or disturbances.

--------------------------------------------------------------------------
   Usage:
   [maneuver, foundSoln, resetGoals] = IterativeImpulsiveManeuver( state, goals, window, parameters );
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   state             (.)  Data structure of the orbit state with following fields
                          - el           Measured mean orbital elements of reference, Alfriend format: [a,i,W,w,e,M]
                          - xH           Measured relative state in Hills frame
                          - mass         Spacecraft mass                              [kg]
                          - tM           Timetag of measurement                       [sec]

   goals             (.)  Geometric goals describing desired relative periodic trajectory 


   window            (.)  Data structure of commanded time window with following fields
                          - startTime       Earliest possible start time                    [sec since 1970]
                          - nOrbMin         Minimum number of orbits maneuver may last      [orbits]
                          - nOrbMax         Maximum number of orbits maneuver may last      [orbits]
                          - nManeuvers      Number of maneuvers to search over
                          - timeWeightExp   Time-weighting exponent (greater than 0)

   parameters        (.)  Data structure of planning parameters with following fields
                          - fNom         Nominal Thruster force                             [kN]
                          - dTMax        Maximum allowable burn duration                    [sec]
                          - horizon      Minimum time between planning and first burn       [sec]
                          - tDelayOOP    Minimum time between final IP burn and OOP burn    [sec]
                          - nSPOCoarse   Number of samples per orbit for LP (coarse computation)
                          - nSPOFine     Number of samples per orbit for LP (fine computation)
                          - maxDeltaV    Maximum delta-v

   -------
   Outputs
   -------
   maneuver          (.)  Maneuver data structure with following fields
                          - t0           Earliest burn start time
                          - tF           Latest burn finish time
                          - nBurns       Number of burns required
                          + burnData[]   Array of burn data structures with following fields
                             - t   Burn start time   [sec since 1970]
                             - dT  Burn duration     [sec]
                             - dV  Delta-V           [km/s]
                             - uX  unit x Hills direction 
                             - uY  unit y Hills direction
                             - uZ  unit z Hills direction
   foundSoln         (1)  Flag indicating whether a solution was found or not
   resetGoals        (1)  Flag indicating whether the goals were reset or not
   
--------------------------------------------------------------------------