LPCircular:

--------------------------------------------------------------------------
   Computes the thrust trajectory to go from an initial state x0
   to a final state xF in the Hill's frame. Simplex is used to optimize the thrust.
   Algorithm assumes a circular reference orbit and does not account for
   disturbances.
   
   A control system can be expressed in its discrete state-space form as:
   X(k+1)      = AX(k) + BU(k)
   Y(k)        = CX(k)
   where X is state , U is control, Y is output
   For the nth timestep, this can be rewritten as:
   X(n)        = A^n*X(0) + [A^(n-1)B   A^(n-2)B ..... B]u
   where u     = [ U(0)' U(1)' ..... U(n-1)']'
   For a fully controllable and observable system,
   Y(n) = X(n) = A^n*X(0) + pu where p = [A^(n-1)B A^(n-2)B ... B]
   error       >= |Y(n) - Y(desired)|  = A^n*X(0) + pu - Y(desired)
   
   The Simplex problem (minimise cu(cost) such that au <= b) and u >= 0 can now be posed as
   [-p; p]u    <= [error + A^n*X(0) - Y(desired); error - A^n*X(0) + Y(desired)]
   In case of an Equality Constraint with 0 error, this reduces to 
   [-p]u        =  A^n*X(0) - Y(desired)
   Note: The constraintType determines whether it is an equality
   technological constraint( au = b, flag: 0) or an inequality technological
   constraint( au <= b, flag: 1)   

   u are called 'decision variables', in this case thrust vector
   Since u is unrestricted in sign (u can be positive and negative),
   we split u into two parts: u=up-um, where up>=0 and um>=0.
   
   Since version 7.
--------------------------------------------------------------------------
   Form:
   [aC,t,exitFlag] = LPCircular(x0, xF, n, duration, dT, constraintType, maxConstraint)
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   x0               (6,1) Initial state in Hill's frame
   xF               (6,1) Final state in Hill's frame
   n                 (1)  Reference orbit rate (rad/sec)
   duration          (1)  Maneuver duration (secs)
   dT                (1)  Thruster time step
   constraintType    (1)  Flag with value 0 or 1
                               0 : Equality Constraint on the Linear program formulation  
                               1 : Inequality Constraint on the Linear program
                                   formulation
   maxConstraint     (1)  Maximum constraint on u

   -------
   Outputs
   -------
   aC               (3,:) Commanded acceleration in Hill's frame
   t                (1,:) Time vector (secs) 
   exitFlag          1    Feasible solution = 1, No feasible solution = 0
--------------------------------------------------------------------------

Children:

Common: Control/C2DZOH
Math: Analysis/Simplex
Orbit: RHSOrbit/LinOrb
SC: BasicOrbit/OrbRate