Classes | Defines | Typedefs | Enumerations | Functions

sc_formation.h File Reference

Holds the FFLib data structures and function definitions. More...

Classes

struct  alf_orb_data_s
 Alfriend orbital elements data structure. More...
struct  team_s
 Team data structure. More...
struct  state_s
 State data structure. More...
struct  geom_s
 Geometry data structure. More...
struct  ecc_geom_s
 Eccentric geometry data structure. More...
struct  ecc_geom_xy_s
 Eccentric geometry data structure (xy) More...
struct  window_s
 Time window data structure. More...
struct  plan_param_s
 Planning parameters data structure. More...
struct  constraints_s
 Constraints data structure. More...
struct  team_goals_s
 Team goals data structure. More...
struct  ecc_team_goals_s
 Eccentric team goals data structure. More...
struct  cost_s
 Cost estimate data structure. More...
struct  burn_s
 Burn data structure. More...
struct  maneuver_s
 Maneuver data structure. More...
struct  dv_command_s
 Delta-V command data structure. More...
struct  orientation_s
 Orientation data structure. More...
struct  assign_s
 Assignment data structure. More...
struct  coll_mon_data_s
 Collision monitor data. More...

Defines

#define FF_J2   0.001082
 J2 perturbation is 0.001082.
#define FF_TOL   1e-8
 Defines the default tolerance to use in comparing doubles.
#define FF_MAX_ITER   100
 Defines the default value for maximum number of iterations.
#define FF_MAX_BURNS   10
 Defines the maximum number of impulsive burns that can be included in a maneuver data structure.
#define FF_MAX_MEMBERS   8
 Defines the maximum number of satellite members that can be on a given team.
#define SC_OS_MACOSX
 Mac OS X.
#define SC_OS_UNIX
 UNIX OS.

Typedefs

typedef struct alf_orb_data_s alf_orb_data_t
 Alfriend orbital elements data structure.
typedef struct team_s team_t
 Team data structure.
typedef struct state_s state_t
 State data structure.
typedef struct geom_s geom_t
 Geometry data structure.
typedef struct ecc_geom_s ecc_geom_t
 Eccentric geometry data structure.
typedef struct ecc_geom_xy_s ecc_geom_xy_t
 Eccentric geometry data structure (xy)
typedef struct window_s window_t
 Time window data structure.
typedef struct plan_param_s plan_param_t
 Planning parameters data structure.
typedef struct constraints_s constraints_t
 Constraints data structure.
typedef struct team_goals_s team_goals_t
 Team goals data structure.
typedef struct ecc_team_goals_s ecc_team_goals_t
 Eccentric team goals data structure.
typedef struct cost_s cost_t
 Cost estimate data structure.
typedef struct burn_s burn_t
 Burn data structure.
typedef struct maneuver_s maneuver_t
 Maneuver data structure.
typedef struct dv_command_s dv_command_t
 Delta-V command data structure.
typedef struct orientation_s orientation_t
 Orientation data structure.
typedef struct assign_s assign_t
 Assignment data structure.
typedef struct coll_mon_data_s coll_mon_data_t
 Collision monitor data.
typedef double(* nr_function )(double x, double e, const ml_matrix &D, double dH)
 Newton-Raphson function.

Enumerations

enum  ff_error_codes { FF_NO_ERROR = 0, FF_NO_SOLN = 1, FF_MAX_ITER = 2, FF_BAD_VALUE = 3 }
 

Error codes for invalid matrix operations.

More...
enum  ff_formation_types {
  FF_IPLF = 1, FF_OOPLF_RGT = 2, FF_CIPE_REF_CENTER = 3, FF_CIPE_REF_ON = 4,
  FF_POS_PROJ_CIRC_REF_CENTER = 5, FF_POS_PROJ_CIRC_REF_ON = 6, FF_NEG_PROJ_CIRC_REF_CENTER = 7, FF_NEG_PROJ_CIRC_REF_ON = 8,
  FF_DUAL_PROJ_CIRC_REF_CENTER = 9, FF_DUAL_PROJ_CIRC_REF_ON = 10, FF_TETRA = 11
}
 

Formation type enumerations.

More...

Functions

maneuver_s IterativeImpulsiveManeuver (state_t state, geom_t goals_circ, window_t window, plan_param_t param, bool &foundSoln)
 Computes the delta-v's required to implement a formation flying maneuver for a single spacecraft.(circular orbit)
maneuver_s IterativeImpulsiveManeuver (state_t state, ecc_geom_t goals_ecc, window_t window, plan_param_t param, bool &foundSoln)
 Computes the delta-v's required to implement a formation flying maneuver for a single spacecraft. (eccentric orbit)
maneuver_s ImpulsiveLPManeuver (state_t state, geom_t goals_circ, window_t window, plan_param_t param, double &maxDV)
 Plans an impulsive burn sequence (using simplex) to achieve the specified trajectory within the given time window. (circular orbit)
maneuver_s ImpulsiveLPManeuver (state_t state, ecc_geom_t goals_ecc, window_t window, plan_param_t param, double &maxDV)
 Plans an impulsive burn sequence (using simplex) to achieve the specified trajectory within the given time window. (eccentric orbit)
maneuver_s ImpulsiveManeuver (state_t state, geom_t goals, window_t window, plan_param_t param, double &maxDV)
 Plans an impulsive burn sequence (using closed-form equations) to achieve the specified trajectory within the given time window. For circular orbits only.
bool OptimalInPlaneDeltaV (double nOrbMin, double nOrbMax, double a, double th0, double th1, double delta_a, double delta_th0, double delta_q1, double delta_q2, double &dV1, double &dV2, double &dV3, unsigned short &M, unsigned short &N)
 Computes the in-plane delta-v sequence for the given time window that achieves the desired element differences and results in the minimum total delta-v. For circular orbits only.
burn_tInPlane (alf_orb_data_t meas_elem, alf_orb_data_t delta_elem, double accNom, double dTMin, double nOrbMin, double nOrbMax, double horizon, double &t0, double &tF, unsigned short &nBurns)
 Computes the in-plane burn sequence for the given time window that achieves the desired element differences. For circular orbits only.
burn_t OutOfPlane (alf_orb_data_t meas_elem, alf_orb_data_t delta_elem, double accNom, double dTMin, unsigned short &nBurns, double &th1)
 Compute the out-of-plane burn sequence for the given time window that achieves the desired element differences. For circular orbits only.
geom_t AutoFormGeometry (state_t state, geom_t memberGoals[], int num, double minSepDist, double maxSepDist)
 Define new geometric goals for a single satellite, such that any semi-major axis difference is eliminated, any radial oscillation is eliminated, and the new trajectory maintains a minimum separation distance from all other known trajectories.
ecc_geom_t AutoFormGeometry (state_t state, ecc_geom_t memberGoals[], int num, double minSepDist, double maxSepDist)
 Define new geometric goals for a single satellite, such that any semi-major axis difference is eliminated, any radial oscillation is eliminated, and the new trajectory maintains a minimum separation distance from all other known trajectories.
double NearestOffset (double y0, double width, ml_matrix extrema, double minSepDistance, double maxSepDistance)
 Determine the nearest along-track offset for a trajectory that is safe such that the minimum and maximum required separation distances are respected.
ml_matrix InitializeCostMatrix (team_goals_t teamGoals, int nRelatives)
 Given the team goals, initialize the cost matrix "f" with the right size.
ml_matrix InitializeCostMatrix (ecc_team_goals_t teamGoals, int nRelatives)
 Given the team goals, initialize the cost matrix "f" with the right size.
int PopulateCostMatrix (ml_matrix &f, cost_t costEstimate, team_goals_t teamGoals, ml_int_array relativeIDs)
 Fill in a single column of the cost matrix.
int PopulateCostMatrix (ml_matrix &f, cost_t costEstimate, ecc_team_goals_t teamGoals, ml_int_array relativeIDs)
 Fill in a single column of the cost matrix.
void CostMatrixRows (team_goals_t teamGoals, int index, int &a, int &b)
 Compute the starting and ending rows in the cost matrix that correspond to a give target state index.
void CostMatrixRows (ecc_team_goals_t teamGoals, int index, int &a, int &b)
 Compute the starting and ending rows in the cost matrix that correspond to a give target state index.
cost_s EstimateCost (alf_orb_data_t el0, alf_orb_data_t dEl, team_goals_t teamGoals, int memID, window_t window, double weight)
 Estimate the (weighted) cost to achieve all specified unique target states.
cost_s FFEccEstimateCost (orb_data_t el0, const ml_matrix &xH0, ecc_team_goals_t teamGoals, int memID, window_t window, double weight, int nSPO)
 Estimate the (weighted) cost to achieve all specified unique target states.
team_goals_s GenerateTeamGoals (alf_orb_data_t el0, int fType, double fSize, unsigned short nRels, int teamID, double angRes)
 Generate a set of team goals given the formation type and size.
ecc_team_goals_s FFEccGenerateTeamGoals (orb_data_t el0, int fType, double fSize, unsigned short nRels, int teamID, double nu, const ml_matrix &eul)
 Generate a set of team goals given the formation type, size, location and orientation.
ecc_geom_xy_sFFEccTetrahedronGeometry (double nu, double d, const ml_matrix &eul)
 Compute the geometric goals for a formation that achieves a tetrahedron shape at a given true anomaly in an eccentric reference orbit.
geom_s PCGoals (double R, double alpha0, double sgn, double y0)
 Generate the geometric goals for a projected circular formation.
void SortTeamGoals (team_goals_t &teamGoals)
 Sort the team goals with fixed states listed before variable states.
void SortTeamGoals (ecc_team_goals_t &teamGoals)
 Sort the team goals with fixed states listed before variable states.
assign_s SetupAssignmentProblem (team_goals_t teamGoals, double orbFrac=1)
 Set up the assignment problem given the team goals by computing the number of fixed, variable and unique variable states, plus with the phases and indices of repeated variable states.
assign_s SetupAssignmentProblem (ecc_team_goals_t teamGoals, double orbFrac=1)
 Set up the assignment problem given the team goals by computing the number of fixed, variable and unique variable states, plus with the phases and indices of repeated variable states.
int RestrictIDSet (ml_int_array &relIDs, constraints_t constraints[], int numC)
 Restrict the set of relative IDs to respect the specified assignment constraints.
int VerifyAssignmentParams (assign_t a, const ml_matrix &f)
 Check for inconsistencies in the assignment parameters.
int PrivilegedAssignment (assign_t assign, const ml_matrix &f, int method, ml_int_array &optOrder, ml_matrix &optPhi, double &optCost)
 Assign N targets to N satellites one at a time, so that the satellite with the largest minimum cost is assigned its min-cost target first.
int OptimalAssignment (assign_t assign, ml_matrix f, ml_int_array &optOrder, ml_matrix &optPhi, double &optCost)
 Assign N targets to N satellites so that the weighted sum of costs to reach all targets is minimized.
bool EquallyPhased (const ml_matrix &phi, ml_int_array u, int Pu)
 Determine if the phase angles are equally phased.
ml_int_array FindMinSet (ml_matrix &mat, double &minSum)
 Find the order in which to arrange the columns so that the matrix diagonal sum is minimized.
void permute (ml_int_array arr, int start, int num, const ml_matrix &mat, double &cost, ml_int_array &best)
 Permute the supplied array, called recursively by FindMinSet.
void LPCircular (const ml_matrix &x0, const ml_matrix &xF, double n, double duration, double dT, unsigned short constraintType, double maxConstraint, ml_matrix &aC, ml_matrix &t, bool &exitFlag)
 Computes the thrust trajectory to go from an initial state to a final state in Hills frame. For circular orbits.
void LPEccentric (double e, double n, const ml_matrix &x0, const ml_matrix &xF, double nu0, double nuF, int nS, ml_matrix cW, unsigned short constraintType, double maxConstraint, ml_matrix &aC, ml_matrix &t, bool &exitFlag)
 Computes the thrust trajectory to go from an initial state to a final state in Hills frame. For eccentric orbits.
void LPCircularTimeWeight (orb_data_t el0, const ml_matrix &xH0, geom_t goals, window_t window, int nSPO, ml_matrix &xHF, double &nOrbMvr)
 Determine the target state on the desired trajectory that gives the minimum time-weighted cost. For circular orbits.
void LPEccentricTimeWeight (orb_data_t el0, const ml_matrix &xH0, ecc_geom_t goals, window_t window, int nSPO, ml_matrix &xHF, double &nOrbMvr)
 Determine the target state on the desired trajectory that gives the minimum time-weighted cost. For eccentric orbits.
void GVEErrorDynamics (orb_data_t el0, ml_matrix &A, ml_matrix &B)
 Compute continuous-time dynamics for Gauss' variational equations.
void LPEccentricGVE (orb_data_t el0, const ml_matrix &x0, const ml_matrix &xF, double MF, int nS, ml_matrix cW, unsigned short constraintType, double maxConstraint, ml_matrix &aC, ml_matrix &t, bool &exitFlag)
 Computes the thrust trajectory to go from an initial state to a final state in Hills frame. For eccentric orbits.
void FFEccLinOrb (double n, double nu, double e, ml_matrix &a, ml_matrix &b, double dT)
 Compute the continous A,B matrices for linearized relative motion in an eccentric reference orbit, discretized with a zero-order hold with timestep dT. *sctlib (overload LinOrb)
ml_matrix FFEccLinOrb (const ml_matrix &x, const ml_matrix &acc, double n, double nu, double e)
 Compute the right-hand-side for linearized relative motion in an eccentric reference orbit.
ml_matrix FFEccProp (const ml_matrix &D, const ml_matrix &nu, double e, double dH)
 Compute Hills frame state at specified true anomaly given integration constants and eccentricity.
ml_matrix FFEccProp (const ml_matrix &D, double nu, double e, double dH)
 Compute Hills frame state at specified true anomaly given integration constants and eccentricity.
double FFEccDH (double nu0, double e)
 Compute integration constant dH for homogeneous solution to LTV differential equations of relative orbit motion. Found by setting H=0 at initial true anomaly.
void FFEccGoals (double e, ecc_geom_t goals, ml_matrix &D, ml_matrix &xH)
 Compute integration constants and initial state from the geometric goals.
void FFEccGoals (double e, ecc_geom_xy_t goals, ml_matrix &D, ml_matrix &xH)
 Compute integration constants and initial state from the geometric goals.
void FFEccIntConst (const ml_matrix &xH0, double nu0, double e, ml_matrix &D, double &dH, ml_matrix &R)
 Compute integration constants for homogeneous solution to LTV differential equations of relative orbit motion.
ml_matrix FFEccRMat (double nu, double e, double dH)
 Compute the state-transition matrix, R, given the eccentricity and true anomaly so that xH = R*D, where D is the vector of integration constants found from initial conditions.
ml_matrix FFEccRMat (double nu, double e)
 Compute the state-transition matrix, R, given the eccentricity and true anomaly so that xH = R*D, where D is the vector of integration constants found from initial conditions. Here, the integration constant "dH" is computed using the first element of the "nu" matrix.
void FFEccXExt (double e, const ml_matrix &D, double dH, double epsilon, int nMax, ml_matrix &x, ml_matrix &nu)
 Compute extreme x-values and associated true anomalies for given relative motion.
void FFEccYExt (double e, const ml_matrix &D, double dH, double epsilon, int nMax, ml_matrix &y, ml_matrix &nu)
 Compute extreme y-values and associated true anomalies for given relative motion.
void FFEccZExt (double e, const ml_matrix &D, double dH, double epsilon, int nMax, ml_matrix &z, ml_matrix &nu)
 Compute extreme z-values and associated true anomalies for given relative motion.
void NuDot (double n, double e, double nu, double &nuDot, double &nuDotDot)
 Compute the time-derivative of the true anomaly. *sctlib.
double FFEccDX (double nu, double e, const ml_matrix &D, double dH)
 Compute the first derivative of x with respect to true anomaly.
double FFEccDY (double nu, double e, const ml_matrix &D, double dH)
 Compute the first derivative of y with respect to true anomaly.
double FFEccDZ (double nu, double e, const ml_matrix &D, double dH)
 Compute the first derivative of z with respect to true anomaly.
double FFEccDDX (double nu, double e, const ml_matrix &D, double dH)
 Compute the second derivative of x with respect to true anomaly.
double FFEccDDY (double nu, double e, const ml_matrix &D, double dH)
 Compute the second derivative of y with respect to true anomaly.
double FFEccDDZ (double nu, double e, const ml_matrix &D, double dH)
 Compute the second derivative of z with respect to true anomaly.
orb_data_t Alfriend2El (alf_orb_data_t elA)
 Convert an Alfriend orbital element set into the standard orbital element set *sctlib.
alf_orb_data_t El2Alfriend (orb_data_t el)
 Convert a standard orbital element set into the Alfriend orbital element set *sctlib.
alf_orb_data_t El2Alfriend (orb_data_t el, double true_anom)
 Convert a standard orbital element set into the Alfriend orbital element set *sctlib.
alf_orb_data_s add_elements (alf_orb_data_t el1, alf_orb_data_t el2)
 Add two sets of orbital elements *sctlib.
orb_data_s add_elements (orb_data_t el1, orb_data_t el2)
 Add two sets of orbital elements *sctlib.
alf_orb_data_s sub_elements (alf_orb_data_t el1, alf_orb_data_t el2)
 Subtract one element set from another.
orb_data_s sub_elements (orb_data_t el1, orb_data_t el2)
 Subtract one element set from another.
double CirclePhase (double beta)
 Compute the desired phase on a circle from the desired phase on the ellipse. The circle is superscribed about the ellipse.
double EllipsePhase (double alpha)
 Compute the desired phase on an ellipse from the desired phase on the circle. The circle is superscribed about the ellipse.
alf_orb_data_t OrbElemDiff (alf_orb_data_t el0, alf_orb_data_t el)
 Computes the differences between Alfriend orbital element vectors.
orb_data_t OrbElemDiff (orb_data_t el0, orb_data_t el)
 Computes the differences between standard orbital element vectors.
alf_orb_data_t Goals2DeltaElem (alf_orb_data_t el0, geom_t goals)
 Computes the desired element differences, given the geometric goals and the measured orbital elements.
geom_t DeltaElem2Goals (alf_orb_data_t el0, alf_orb_data_t dEl)
 Computes the geoemtric goals, given the desired element differences and the measured orbital elements.
ml_matrix DeltaElem2Hills (alf_orb_data_t elA, alf_orb_data_t dEl)
 Computes the Hills frame state from the element differences and reference elements.
alf_orb_data_s Hills2DeltaElem (alf_orb_data_t el0, const ml_matrix &xH)
 Computes the element differences from the Hills frame state and reference elements.
geom_s Hills2Goals (alf_orb_data_t el0, const ml_matrix &xH)
 Computes the geometric goals from the Hills frame state and reference elements.
ml_matrix Goals2Hills (alf_orb_data_t el0, geom_t goals)
 Computes the Hills frame state from the geometric goals and reference elements.
orb_data_s FFEccHills2DeltaElem (orb_data_t el0, const ml_matrix &xH)
 Computes the orbital element differences from the Hills frame state and the reference orbital elements.
alf_orb_data_s FFEccHills2DeltaElem (alf_orb_data_t el0, const ml_matrix &xH)
 Computes the orbital element differences from the Hills frame state and the reference orbital elements.
ml_matrix FFEccDeltaElem2Hills (alf_orb_data_t el0, alf_orb_data_t dEl)
 Convert element differences to Hills frame coordinates in an eccentric orbit.
ecc_geom_t FFEccDeltaElem2Goals (alf_orb_data_t el0, alf_orb_data_t dEl)
 Convert element differences to eccentric geometric goals.
ml_matrix FFEccGoals2Hills (double e, double nu, ecc_geom_t g, double n)
 Compute Hills frame state (in time-domain) given geometric goals and orbit data.
ml_matrix FFEccGoals2Hills (double e, double nu, ecc_geom_xy_t g, double n)
 Compute Hills frame state (in time-domain) given geometric goals and orbit data.
ml_matrix FFEccGoals2Hills (double e, double nu, ecc_geom_t g)
 Compute Hills frame state (in nu-domain) given geometric goals and orbit data.
ecc_geom_t FFEccHills2Goals (double e, double nu, ml_matrix xH, double n)
 Compute geometric goals given Hills frame state (in time-domain) and orbit data.
ecc_geom_t FFEccHills2Goals (double e, double nu, const ml_matrix &xH)
 Compute geometric goals given Hills frame state (in nu-domain) and orbit data.
void Nu2TimeDomain (ml_matrix &x, double n, double e, double nu)
 Convert a relative orbit state from the nu-domain to the time-domain.
void Time2NuDomain (ml_matrix &x, double n, double e, double nu)
 Convert a relative orbit state from the time-domain to the nu-domain.
ecc_geom_t GeometryCirc2Ecc (double w, geom_t gCirc)
 Convert a circular geometry structure to an eccentric geometry structure.
geom_t GeometryEcc2Circ (double w, ecc_geom_t gEcc)
 Convert an eccentric geometry structure to a circular geometry structure.
geom_t RotateState (geom_t goals, double phi)
 Rotate a geometric goal set to the circular phase angle phi.
double MeanAnom2TrueLat (double e, double w, double M)
 Convert mean anomlay to true latitude.
void GetHillsMats (const ml_matrix &r0, const ml_matrix &v0, ml_matrix &A, ml_matrix &Adot)
 Computes the A and Adot matrices used for transformation to Hills frame.
void AbsRelECI2Hills (ml_matrix r0, ml_matrix v0, ml_matrix dr, ml_matrix dv, ml_matrix &rH, ml_matrix &vH)
 Compute the relative position and velocity in Hills frame given an absolute ECI position & velocity and a relative inertial position & velocity.
alf_orb_data_t Osc2Mean (alf_orb_data_t el, double J2)
 Transforms osculating orbital elements to mean orbital elements.
alf_orb_data_tECI2MeanElements (const ml_matrix &xRefECI, const ml_matrix &xRelECI, double J2, alf_orb_data_t &elRefMean)
 Computes mean orbital elements and mean orbital element differences from reference and relative ECI position and velocity.
bool AlignThruster (const ml_matrix &aH, const ml_matrix &bTh, ml_matrix &qHB)
 Computes desired Hills-to-body quaternion for a thruster firing. Rotation about thruster-axis is ignored.
bool AlignThruster (const ml_matrix &aH, const ml_matrix &bTh, const ml_matrix &bST, const ml_matrix &r, const ml_matrix &v, double jD, double sep, ml_matrix &qHB)
 Computes desired Hills-to-body quaternion for a thruster firing such that the star tracker is pointed as far away as possible from the sun, earth and moon.
ml_matrix Hills2Frenet (const ml_matrix &xH, const double &e, const double &nu, const double &n)
 Transforms from the Hills frame to the Frenet frame.
ml_matrix HillsEqns (const ml_matrix &xH0, double n, double t)
 Closed form solution of relative orbital motion using Hills equations. For circular orbits only.
ml_matrix FFEccHillsEqns (ml_matrix xH0, double nu0, const ml_matrix &nu, double e, double n)
 Compute Hills frame state (in time-domain) at future true anomaly(s). For eccentric or circular orbits.
ml_matrix FFEccHillsEqns (const ml_matrix &xH0, double nu0, const ml_matrix &nu, double e)
 Compute Hills frame state (in nu-domain) at future true anomaly(s). For eccentric or circular orbits.
ml_matrix DiscreteHills (const ml_matrix &x0, double n, const ml_matrix &aC, double dT)
 Compute the force relative trajectory from the initial state and time-history of applied accelerations. For circular orbits only.
ml_matrix FFEccDiscreteHills (double e, double n, const ml_matrix &x0, double nu0, const ml_matrix &aC, const ml_matrix &t)
 Compute the force relative trajectory from the initial state and time-history of applied accelerations. For circular orbits only.
double CollProbSet (double sigma, const ml_matrix &S, const ml_matrix &xc, const ml_matrix &Ssc, int n)
 Collision probability calculation using sets of ellipsoids.
ml_matrix MonitoringAlg (ml_matrix &y, ml_matrix &t, ml_matrix &M, ml_matrix &nu, ml_matrix &accel, ml_matrix &aDiff, coll_mon_data_t d)
 Collision monitoring algorithm implementation used for both modes, monitoring and surveying.
ml_matrix CollisionSurvey (ml_matrix &y, double t0, maneuver_t mvr1, maneuver_t mvr2[], int n_points, coll_mon_data_s d)
 Collision survey implementation which changes maneuvers to acceleration vectors and calls monitoring algorithm.
ml_matrix DeltaElem2HillsMat (const ml_matrix &elA)
 Compute transformation matrix from delta elements to Hills.
ml_matrix DeltaEl2AlfriendMat (orb_data_t el)
 Compute transformation matrix from standard differential elements to Alfriend differential elements.
double distant_pt_ell (const ml_matrix &S, const ml_matrix &U, const ml_matrix &xc, const ml_matrix &x0, ml_matrix &x)
 Compute minimum distance from a distance point to an ellipsoid's surface.
double Laguerre (const ml_matrix &a, double x_guess)
 Laguerre root finding algorithm adapted to real roots.
ml_matrix GenerateTimeVector (orb_data_t d, const double tF, const int nPts, ml_matrix &M, ml_matrix &nu)
 Generate a time vector evenly spaced over true anomaly.
ml_matrix ManeuverStruct2AccelVector (maneuver_t mvr, const ml_matrix &tProp)
 Compute a 3xN acceleration vector from a maneuver data structure.
bool TeamLevels (team_t teams[], int num, ml_int_array &levels)
 Assign a hierarchical level to each team in the array.
int IsRelative (int iD, team_t teams[], int num)
 Determine whether the given satellite ID is a relative of any team.
bool FindUpperTeams (int kBot, team_t teams[], int num, ml_int_array &kUpper)
 Find teams above this one in the hierarchy.
double TimeUntilTheta (double a, double w, double e, double theta0, double &theta1)
 Computes the time in seconds until the new latitude is reached from the original latitude.
void AccelVector2ManeuverStruct (const ml_matrix &aC, ml_matrix t, double tRef, double nomAccel, double minSepTime, maneuver_t &mvr, ml_matrix &dV)
 Build a maneuver structure from acceleration and time vectors.
void ManeuverStruct2AccelVector (maneuver_t mvr, double dT, ml_matrix &aC, ml_matrix &t)
 Compute a 3xN acceleration vector from a maneuver data structure.
ml_matrix NOrbVector (window_t window)
 Compute a vector of maneuver durations (in orbits) from time window data.
ml_matrix TargetTrueAnom (double e, double nu0, ml_matrix nOrb)
 Compute the future true anomaly (unwrapped) at the specified number of orbits after the initial true anomaly.
ml_matrix Tetrahedron (double d, const ml_matrix &eul)
 Compute the 4 points of a regular tetrahedron, the surface area and volume.
double vsum (const ml_matrix &a)
 Compute the sum of all elements in a row or column vector.
double newton_raphson (nr_function f, nr_function df, double x, double epsilon, int &n_max, double e, const ml_matrix &D, const double &dH)
 Newton-Raphson (optimized for FFEccXExt and similar)
char * matout (ml_matrix mat)
 Output a matrix to a string with higher precision than built-in "to_string" function.

Detailed Description


Enumeration Type Documentation

Enumerator:
FF_NO_ERROR 

No error reported.

FF_NO_SOLN 

No solution was found.

FF_MAX_ITER 

The maximum number of iterations was reached.

FF_BAD_VALUE 

Occurs when a supplied value is physically impossible (ie, SMA < 0).

Enumerator:
FF_IPLF 

Equally spaced in-plane leader-follower.

FF_OOPLF_RGT 

Equally spaced out-of-plane leader-follower with right ascen.

diff. for repeated ground track

FF_CIPE_REF_CENTER 

Equqlly phased centered in-plane ellipse, reference at center of ellipse.

FF_CIPE_REF_ON 

Equqlly phased centered in-plane ellipse, reference on ellipse.

FF_POS_PROJ_CIRC_REF_CENTER 

Equqlly phased positive-plane projected circle, reference at center of circle.

FF_POS_PROJ_CIRC_REF_ON 

Equqlly phased positive-plane projected circle, reference on circle.

FF_NEG_PROJ_CIRC_REF_CENTER 

Equqlly phased negative-plane projected circle, reference at center of circle.

FF_NEG_PROJ_CIRC_REF_ON 

Equqlly phased negative-plane projected circle, reference on circle.

FF_DUAL_PROJ_CIRC_REF_CENTER 

Equally phased dual-plane projected circle, reference at center of circle.

FF_DUAL_PROJ_CIRC_REF_ON 

Equally phased dual-plane projected circle, reference on circle.

FF_TETRA 

Repeating tetrahedron geometry at a specified true anomaly, any orientation.


Function Documentation

maneuver_s IterativeImpulsiveManeuver ( state_t  state,
geom_t  goals_circ,
window_t  window,
plan_param_t  param,
bool &  foundSoln 
)

Computes the delta-v's required to implement a formation flying maneuver for a single spacecraft.(circular orbit)

(circular orbit)

Parameters:
stateAbsolute and relative state information
goals_circGeometric goals for relative trajectory (circular)
windowTime window for the maneuver
paramPlanning parameters for maneuver
foundSolnFlag indicating whether a solution was found or not. Passed by reference.
Returns:
maneuver Maneuver data consisting of a series of impulsive burns

References orb_data_s::ecc, state_s::el, state_s::elA, plan_param_s::eTol, plan_param_s::maxDeltaV, orb_data_s::mean_anom, orb_data_s::perigee, orb_data_s::sma, and state_s::xH.

maneuver_s IterativeImpulsiveManeuver ( state_t  state,
ecc_geom_t  goals_ecc,
window_t  window,
plan_param_t  param,
bool &  foundSoln 
)

Computes the delta-v's required to implement a formation flying maneuver for a single spacecraft. (eccentric orbit)

(eccentric orbit)

Parameters:
stateAbsolute and relative state information
goals_eccGeometric goals for relative trajectory (eccentric)
windowTime window for the maneuver
paramPlanning parameters for maneuver
foundSolnFlag indicating whether a solution was found or not. Passed by reference.
Returns:
maneuver Maneuver data consisting of a series of impulsive burns

References orb_data_s::ecc, state_s::el, state_s::elA, plan_param_s::eTol, plan_param_s::maxDeltaV, orb_data_s::mean_anom, orb_data_s::perigee, orb_data_s::sma, and state_s::xH.

maneuver_s ImpulsiveLPManeuver ( state_t  state,
geom_t  goals_circ,
window_t  window,
plan_param_t  param,
double &  maxDV 
)

Plans an impulsive burn sequence (using simplex) to achieve the specified trajectory within the given time window. (circular orbit)

For circular orbits.

Parameters:
stateData structure of Orbit state
goals_circData structure of geometric goal information
windowData structure of commanded time window
paramData structure of planning parameters
maxDVThe maximum delta-V of the sequence
Returns:
maneuver Maneuver data structure

References maneuver_s::achieve, orb_data_s::ecc, state_s::el, plan_param_s::eTol, plan_param_s::fNom, plan_param_s::horizon, state_s::mass, orb_data_s::mean_anom, plan_param_s::nSPOCoarse, plan_param_s::nSPOFine, orb_data_s::perigee, orb_data_s::sma, window_s::startTime, state_s::tM, TWO_PI, and state_s::xH.

maneuver_s ImpulsiveLPManeuver ( state_t  state,
ecc_geom_t  goals_ecc,
window_t  window,
plan_param_t  param,
double &  maxDV 
)

Plans an impulsive burn sequence (using simplex) to achieve the specified trajectory within the given time window. (eccentric orbit)

For eccentric orbits.

Parameters:
stateData structure of Orbit state
goals_eccData structure of geometric goal information
windowData structure of commanded time window
paramData structure of planning parameters
maxDVThe maximum delta-V of the sequence. Passed by reference.
Returns:
maneuver Maneuver data structure

References maneuver_s::achieve, orb_data_s::ecc, state_s::el, plan_param_s::eTol, plan_param_s::fNom, plan_param_s::horizon, state_s::mass, orb_data_s::mean_anom, plan_param_s::nSPOCoarse, plan_param_s::nSPOFine, orb_data_s::perigee, orb_data_s::sma, window_s::startTime, state_s::tM, TWO_PI, and state_s::xH.

maneuver_s ImpulsiveManeuver ( state_t  state,
geom_t  goals,
window_t  window,
plan_param_t  param,
double &  maxDV 
)

Plans an impulsive burn sequence (using closed-form equations) to achieve the specified trajectory within the given time window. For circular orbits only.

For circular orbits only.

Parameters:
stateData structure of Orbit state
goalsData structure of geometric goal information
windowData structure of commanded time window
paramData structure of planning parameters
maxDVThe maximum delta-V of the sequence
Returns:
maneuver Maneuver data structure

References maneuver_s::achieve, maneuver_s::burnData, burn_s::dT, plan_param_s::dTMin, burn_s::dV, orb_data_s::ecc, state_s::el, state_s::elA, plan_param_s::fNom, plan_param_s::horizon, maneuver_s::iD, burn_s::iD, alf_orb_data_s::inc, orb_data_s::inc, state_s::mass, MU_EARTH, maneuver_s::nBurns, window_s::nOrbMin, alf_orb_data_s::q1, alf_orb_data_s::q2, alf_orb_data_s::raan, alf_orb_data_s::sma, orb_data_s::sma, window_s::startTime, burn_s::t, maneuver_s::t0, maneuver_s::tF, window_s::timeWeightExp, state_s::tM, alf_orb_data_s::true_lat, TWO_PI, burn_s::uZ, and state_s::xH.

bool OptimalInPlaneDeltaV ( double  nOrbMin,
double  nOrbMax,
double  a,
double  th0,
double  th1,
double  delta_a,
double  delta_th0,
double  delta_q1,
double  delta_q2,
double &  dV1,
double &  dV2,
double &  dV3,
unsigned short &  M,
unsigned short &  N 
)

Computes the in-plane delta-v sequence for the given time window that achieves the desired element differences and results in the minimum total delta-v. For circular orbits only.

For circular orbits only.

Parameters:
nOrbMinMinimum number of orbits the maneuver may last
nOrbMaxMaximum number of orbits the maneuver may last
aMean semi-major axis of reference [km]
th0Latitude of reference at measurement [rad]
th1Latitude at first burn [rad]
delta_aError in semi-major axis difference [km]
delta_th0Error in latitude difference [rad]
delta_q1Error in q1 difference
delta_q2Error in q2 difference
dV1First delta-v [km/s]. Passed by reference.
dV2Second delta-v [km/s]. Passed by reference.
dV3Third delta-v [km/s]. Passed by reference.
MNumber of half-orbits between burn 1 and burn 2. Passed by reference.
NNumber of half-orbits between burn 1 and burn 3. Passed by reference.
Returns:
Bool indicating status

References MU_EARTH, and PI.

burn_t* InPlane ( alf_orb_data_t  meas_elem,
alf_orb_data_t  delta_elem,
double  accNom,
double  dTMin,
double  nOrbMin,
double  nOrbMax,
double  horizon,
double &  t0,
double &  tF,
unsigned short &  nBurns 
)

Computes the in-plane burn sequence for the given time window that achieves the desired element differences. For circular orbits only.

For circular orbits only.

Parameters:
meas_elemReference orbital elements (Alfriend format)
delta_elemError in orbital element differences (Alfriend format)
accNomNominal acceleration [km/s/s]
dTMinMinimum achievable burn duration [sec]
nOrbMinMinimum number of orbits maneuver may last
nOrbMaxMaximum number of orbits maneuver may last
horizonMinimum amount of time required prior to first burn [sec]
t0First burn time [sec from meas time]. Passed by reference.
tFFinal burn time [sec from meas time]. Passed by reference.
nBurnsNumber of burns required. Passed by reference.
Returns:
burn_t Burn Data structure

References burn_s::dT, burn_s::dV, MU_EARTH, PI, alf_orb_data_s::q1, alf_orb_data_s::q2, alf_orb_data_s::sma, burn_s::t, alf_orb_data_s::true_lat, TWO_PI, burn_s::uX, burn_s::uY, and burn_s::uZ.

burn_t OutOfPlane ( alf_orb_data_t  meas_elem,
alf_orb_data_t  delta_elem,
double  accNom,
double  dTMin,
unsigned short &  nBurns,
double &  th1 
)

Compute the out-of-plane burn sequence for the given time window that achieves the desired element differences. For circular orbits only.

For circular orbits only.

Parameters:
meas_elemReference orbital elements (Alfriend format)
delta_elemError in orbital element differences (Alfriend format)
accNomNominal acceleration [km/s/s]
dTMinMinimum achievable burn duration [sec]
nBurnsNumber of burns required. Passed by reference.
th1Argument of latitude at which burn is applied. Passed by reference.
Returns:
burn_t Burn Data structure

References burn_s::dT, burn_s::dV, alf_orb_data_s::inc, MU_EARTH, alf_orb_data_s::q1, alf_orb_data_s::q2, alf_orb_data_s::raan, alf_orb_data_s::sma, burn_s::t, alf_orb_data_s::true_lat, TWO_PI, burn_s::uX, burn_s::uY, and burn_s::uZ.

geom_t AutoFormGeometry ( state_t  state,
geom_t  memberGoals[],
int  num,
double  minSepDist,
double  maxSepDist 
)
Parameters:
stateOrbital state data structure
memberGoalsGeometric goals for all other members in the cluster
numNumber of samples to use
minSepDistMinimum allowable separation distance between satellites
maxSepDistMaximum allowable separation distance between satellites
Returns:
goals Geometric goals

References geom_s::aE, state_s::dEl, state_s::elA, alf_orb_data_s::sma, and geom_s::y0.

ecc_geom_t AutoFormGeometry ( state_t  state,
ecc_geom_t  memberGoals[],
int  num,
double  minSepDist,
double  maxSepDist 
)
Parameters:
stateOrbital state data structure
memberGoalsGeometric goals for all other members in the cluster
numNumber of samples to use
minSepDistMinimum allowable separation distance between satellites
maxSepDistMaximum allowable separation distance between satellites
Returns:
goals Geometric goals

References state_s::dEl, orb_data_s::ecc, state_s::el, state_s::elA, orb_data_s::mean_anom, alf_orb_data_s::sma, ecc_geom_s::xMax, and ecc_geom_s::y0.

double NearestOffset ( double  y0,
double  width,
ml_matrix  extrema,
double  minSepDistance,
double  maxSepDistance = 1e9 
)
Parameters:
y0Original along-track offset (on y-axis)
widthWidth of trajectory on y-axis
extremaExtrema pairs (min, max) on y-axis for N other trajectories
minSepDistanceMinimum separation distance between trajectories
maxSepDistanceMaximum separation distance between trajectories
Returns:
y0 Nearest along-track offset that meets separation objectives
ml_matrix InitializeCostMatrix ( team_goals_t  teamGoals,
int  nRelatives 
)
Parameters:
teamGoalsTeam goals data structure
nRelativesNumber of relatives in the team
Returns:
f Cost matrix of the appropriate size, filled with zeros

References team_goals_s::constraints, team_goals_s::dPhi, team_goals_s::nU, TWO_PI, and constraints_s::variable.

ml_matrix InitializeCostMatrix ( ecc_team_goals_t  teamGoals,
int  nRelatives 
)
Parameters:
teamGoalsTeam goals data structure
nRelativesNumber of relatives in the team
Returns:
f Cost matrix of the appropriate size, filled with zeros

References ecc_team_goals_s::constraints, ecc_team_goals_s::dPhi, constraints_s::nDuplicates, ecc_team_goals_s::nU, TWO_PI, and constraints_s::variable.

int PopulateCostMatrix ( ml_matrix &  f,
cost_t  costEstimate,
team_goals_t  teamGoals,
ml_int_array  relativeIDs 
)
Parameters:
fInitial cost matrix
costEstimateCost estimate data structure supplied from a team member
teamGoalsTeam goals data structure used to generate the cost estimates
relativeIDsArray of member IDs for all relatives in the team
Returns:
f Updated cost matrix
col Index of the cost matrix column that was filled in. Returns -1 if the member ID occurs multiple times in the relativeIDs array. Returns -2 if the target index list has repeated elements. Returns -3 if the size of the cost estimate to be inserted does not match the size of the matrix

References cost_s::cost, cost_s::costLength, team_goals_s::dPhi, cost_s::memID, cost_s::nU, team_goals_s::nU, cost_s::targetIndex, and TWO_PI.

int PopulateCostMatrix ( ml_matrix &  f,
cost_t  costEstimate,
ecc_team_goals_t  teamGoals,
ml_int_array  relativeIDs 
)
Parameters:
fInitial cost matrix
costEstimateCost estimate data structure supplied from a team member
teamGoalsTeam goals data structure used to generate the cost estimates
relativeIDsArray of member IDs for all relatives in the team
Returns:
f Updated cost matrix
col Index of the cost matrix column that was filled in. Returns -1 if the member ID occurs multiple times in the relativeIDs array. Returns -2 if the target index list has repeated elements. Returns -3 if the size of the cost estimate to be inserted does not match the size of the matrix

References cost_s::cost, cost_s::costLength, ecc_team_goals_s::dPhi, cost_s::memID, cost_s::nU, ecc_team_goals_s::nU, cost_s::targetIndex, and TWO_PI.

void CostMatrixRows ( team_goals_t  teamGoals,
int  index,
int &  a,
int &  b 
)

Compute the starting and ending rows in the cost matrix that correspond to a give target state index.

Parameters:
teamGoalsTeam goals data structure
indexTarget state index
aStarting row. Passed by reference.
bEnding row. Passed by reference.

References team_goals_s::constraints, team_goals_s::dPhi, team_goals_s::nU, TWO_PI, and constraints_s::variable.

void CostMatrixRows ( ecc_team_goals_t  teamGoals,
int  index,
int &  a,
int &  b 
)

Compute the starting and ending rows in the cost matrix that correspond to a give target state index.

Parameters:
teamGoalsTeam goals data structure
indexTarget state index
aStarting row. Passed by reference.
bEnding row. Passed by reference.

References ecc_team_goals_s::constraints, ecc_team_goals_s::dPhi, ecc_team_goals_s::nU, TWO_PI, and constraints_s::variable.

cost_s EstimateCost ( alf_orb_data_t  el0,
alf_orb_data_t  dEl,
team_goals_t  teamGoals,
int  memID,
window_t  window,
double  weight 
)
Parameters:
el0Initial reference orbital elements (Alfriend format) [a,theta,i,q1,q2,W]
dElInitial orbital element differences (Alfriend format)
teamGoalsTeam goals data structure defining desired relative motion for team
memIDUnique member ID
windowTime window data structure
weightScalar weight to be applied to all costs for this spacecraft
Returns:
costEstimate Data structure including weighted cost to achieve all specified unique target states.

References team_goals_s::constraints, cost_s::cost, cost_s::costLength, team_goals_s::dPhi, team_goals_s::geometry, alf_orb_data_s::inc, assign_s::M, cost_s::memID, MU_EARTH, window_s::nOrbMax, window_s::nOrbMin, constraints_s::nRestrict, cost_s::nU, team_goals_s::nU, assign_s::Pu, assign_s::Q, alf_orb_data_s::q1, alf_orb_data_s::q2, alf_orb_data_s::raan, constraints_s::restrictID, alf_orb_data_s::sma, cost_s::targetIndex, alf_orb_data_s::true_lat, and constraints_s::variable.

cost_s FFEccEstimateCost ( orb_data_t  el0,
const ml_matrix &  xH0,
ecc_team_goals_t  teamGoals,
int  memID,
window_t  window,
double  weight,
int  nSPO 
)
Parameters:
el0Initial reference orbital elements (Alfriend format) [a,theta,i,q1,q2,W]
xH0Initial relative state, Hills frame
teamGoalsTeam goals data structure defining desired relative motion for team
memIDUnique member ID
windowTime window data structure
weightScalar weight to be applied to all costs for this spacecraft
nSPONumber of samples to use per orbit for LP algorithm
Returns:
costEstimate Data structure including weighted cost to achieve all specified unique target states.

References ecc_team_goals_s::constraints, cost_s::cost, cost_s::costLength, orb_data_s::ecc, ecc_team_goals_s::geometry, orb_data_s::mean_anom, cost_s::memID, window_s::nOrbMax, constraints_s::nRestrict, cost_s::nU, ecc_team_goals_s::nU, constraints_s::restrictID, orb_data_s::sma, cost_s::targetIndex, and TWO_PI.

team_goals_s GenerateTeamGoals ( alf_orb_data_t  el0,
int  fType,
double  fSize,
unsigned short  nRels,
int  teamID,
double  angRes 
)
Parameters:
el0reference orbital elements [a,th,i,q1,q2,W]
fTypeformation type
fSizeformation size
nRelsnumber of relatives in the team
teamIDunique integer team ID
angResangular resolution for discretized search with variable states [rad]
Returns:
teamGoals Team Goals data structure, with geometric goals for all unique states, and corresponding constraints

References geom_s::aE, geom_s::beta, team_goals_s::constraints, team_goals_s::dPhi, FF_CIPE_REF_CENTER, FF_CIPE_REF_ON, FF_DUAL_PROJ_CIRC_REF_CENTER, FF_DUAL_PROJ_CIRC_REF_ON, FF_IPLF, FF_NEG_PROJ_CIRC_REF_CENTER, FF_NEG_PROJ_CIRC_REF_ON, FF_OOPLF_RGT, FF_POS_PROJ_CIRC_REF_CENTER, FF_POS_PROJ_CIRC_REF_ON, team_goals_s::geometry, alf_orb_data_s::inc, constraints_s::nDuplicates, constraints_s::nRestrict, team_goals_s::nU, constraints_s::phase, SECS_TO_DAYS, alf_orb_data_s::sma, team_goals_s::teamID, TWO_PI, constraints_s::variable, geom_s::y0, geom_s::zInc, and geom_s::zLan.

ecc_team_goals_s FFEccGenerateTeamGoals ( orb_data_t  el0,
int  fType,
double  fSize,
unsigned short  nRels,
int  teamID,
double  nu,
const ml_matrix &  eul 
)
ecc_geom_xy_s* FFEccTetrahedronGeometry ( double  nu,
double  d,
const ml_matrix &  eul 
)
Parameters:
nuTrue anomaly where tetrahedron occurs
dLength of each side
eulEuler angles defining the orientation
Returns:
g Geometric goals data structure

References ecc_geom_xy_s::nu_xy, ecc_geom_xy_s::nu_zMax, ecc_geom_xy_s::x, ecc_geom_xy_s::y, ecc_geom_xy_s::y0, and ecc_geom_xy_s::zMax.

geom_s PCGoals ( double  R,
double  alpha0,
double  sgn,
double  y0 
)
Parameters:
Rradius of the projected circle [km]
alpha0angular offset around circle [rad]
sgnorientation of plane
y0along-track offset [km]
Returns:
g geomtric goals data structures

References geom_s::aE, geom_s::beta, geom_s::y0, geom_s::zInc, and geom_s::zLan.

void SortTeamGoals ( team_goals_t teamGoals )
Parameters:
teamGoalsTeam goals data structure, supplied from ground. Passed by reference.

References team_goals_s::constraints, team_goals_s::geometry, team_goals_s::nU, and constraints_s::variable.

void SortTeamGoals ( ecc_team_goals_t teamGoals )
Parameters:
teamGoalsTeam goals data structure, supplied from ground. Passed by reference.

References ecc_team_goals_s::constraints, ecc_team_goals_s::geometry, ecc_team_goals_s::nU, and constraints_s::variable.

assign_s SetupAssignmentProblem ( team_goals_t  teamGoals,
double  orbFrac 
)
Parameters:
teamGoalsTeam goals data structure
orbFracfraction of orbit
Returns:
assign assignment parameters data structure

References geom_s::beta, team_goals_s::constraints, team_goals_s::dPhi, team_goals_s::geometry, assign_s::M, assign_s::N, constraints_s::nDuplicates, team_goals_s::nU, assign_s::P, constraints_s::phase, assign_s::phi, assign_s::Pu, assign_s::Q, TWO_PI, assign_s::u, and constraints_s::variable.

assign_s SetupAssignmentProblem ( ecc_team_goals_t  teamGoals,
double  orbFrac 
)
Parameters:
teamGoalsTeam goals data structure
orbFracfraction of orbit
Returns:
assign assignment parameters data structure

References assign_s::M, assign_s::N, ecc_team_goals_s::nU, assign_s::P, assign_s::Pu, and assign_s::Q.

int RestrictIDSet ( ml_int_array &  relIDs,
constraints_t  constraints[],
int  numC 
)
Parameters:
relIDsUnique set of relative IDs. There must be no repeated IDs in this list.
constraintsArray of constraint data structures. Each one contains a list of IDs
numCNumber of constraint data structures.
Returns:
relIDs Updated set of relative IDs.
status If relIDs is not unique, the function immediately returns 0. Otherwise, it returns 1.

References constraints_s::nRestrict.

int VerifyAssignmentParams ( assign_t  a,
const ml_matrix &  f 
)
Parameters:
aAssignment parameters structure
fCost matrix, with N columns for N satellites
Returns:
status 0 if all parameters consistent, negative integer for error -1 Cost matrix does not have N columns -2 P is greater than N -3 Pu is greater than P -4 Q is not positive -5 Phase vector "phi" is not the right length -6 Index vector "u" is not the right length -7 One or more elements of "u" is greater than P -8 One or more elements of "u" is not positive

References assign_s::N, assign_s::P, assign_s::phi, assign_s::Pu, assign_s::Q, and assign_s::u.

int PrivilegedAssignment ( assign_t  assign,
const ml_matrix &  f,
int  method,
ml_int_array &  optOrder,
ml_matrix &  optPhi,
double &  optCost 
)
Parameters:
assignAssignment parameters, dictated by the team goals.
fCost matrix, with N columns for N satellites
methodIndicates whether to use the minimum cost (1) or the average cost (not 1) as the cost metric.
optOrderThe order in which the target states should be assigned to each satellite. Passed by reference.
optPhiThe corresponding phase angles associated with each target. Passed by reference.
optCostThe total cost to achieve all target states. Passed by reference.
Returns:
errorFlag Returns 0 if algorithm runs nominally. Returns a negative integer if an error is found with the supplied assignment structure.

References assign_s::N, assign_s::P, assign_s::phi, assign_s::Q, TWO_PI, and assign_s::u.

int OptimalAssignment ( assign_t  assign,
ml_matrix  f,
ml_int_array &  optOrder,
ml_matrix &  optPhi,
double &  optCost 
)
Parameters:
assignAssignment parameters data structure
fSet of weighted cost vectors
optOrderOptimal order of the target states. Passed by reference.
optPhiOptimal phases for variable states. Passed by reference.
optCostTotal cost to achieve the optimal configuration. Passed by reference.
Returns:
status Indicates status of assignment parameters, <0 if poorly defined, 0 if okay.

References assign_s::N, assign_s::P, assign_s::phi, assign_s::Pu, assign_s::Q, TWO_PI, and assign_s::u.

bool EquallyPhased ( const ml_matrix &  phi,
ml_int_array  u,
int  Pu 
)

Determine if the phase angles are equally phased.

Parameters:
phiPhase angle array
uUnique variable indices
PuNumber of unique variable states
Returns:
Whether the variable states are equally phased

References PI, and TWO_PI.

ml_int_array FindMinSet ( ml_matrix &  mat,
double &  minSum 
)
Parameters:
matMatrix of costs. Passed by reference.
minSumMinimum sum solution. Passed by reference.
Returns:
Array of matrix columns for optimal assignment.
void permute ( ml_int_array  arr,
int  num,
int  start,
const ml_matrix &  mat,
double &  cost,
ml_int_array &  best 
)
Parameters:
arrArray to be permuted
numNumber of remaining rows to permute.
startStarting row for current permutation.
matMatrix of costs. Passed by reference.
costCurrent cost.
bestBest cost thus far. Passed by reference.
void LPCircular ( const ml_matrix &  x0,
const ml_matrix &  xF,
double  n,
double  duration,
double  dT,
unsigned short  constraintType,
double  maxConstraint,
ml_matrix &  aC,
ml_matrix &  t,
bool &  exitFlag 
)

Computes the thrust trajectory to go from an initial state to a final state in Hills frame. For circular orbits.

For circular orbits.

Parameters:
x0Initial state in Hill's frame
xFFinal state in Hill's frame
nReference orbit rate (rad/sec)
durationManeuver duration (secs)
dTThruster time step
constraintTypeFlag [0: Equality; 1: Inequality constraint]
maxConstraintMaximum constraint on u
aCCommanded acceleration in Hill's frame
tTime vector (secs)
exitFlagFlag [0: No feasible solution; 1: Feasible solution]
void LPEccentric ( double  e,
double  n,
const ml_matrix &  x0,
const ml_matrix &  xF,
double  nu0,
double  nuF,
int  nS,
ml_matrix  cW,
unsigned short  constraintType,
double  maxConstraint,
ml_matrix &  aC,
ml_matrix &  t,
bool &  exitFlag 
)

Computes the thrust trajectory to go from an initial state to a final state in Hills frame. For eccentric orbits.

For eccentric orbits.

Parameters:
eOrbit eccentricity
nMean orbit rate (rad/sec)
x0Initial state in Hill's frame
xFFinal state in Hill's frame
nu0Initial true anomaly (rad)
nuFFinal true anomaly (rad)
nSNumber of samples to use for control vector
cWCost weighting vector
constraintTypeFlag [0: Equality; 1: Inequality constraint]
maxConstraintMaximum constraint on u
aCCommanded acceleration in Hill's frame. Passed by reference.
tTime vector (secs). Passed by reference.
exitFlagFlag [0: No feasible solution; 1: Feasible solution]. Passed by reference.
void LPCircularTimeWeight ( orb_data_t  el0,
const ml_matrix &  xH0,
geom_t  goals,
window_t  window,
int  nSPO,
ml_matrix &  xHF,
double &  nOrbMvr 
)

Determine the target state on the desired trajectory that gives the minimum time-weighted cost. For circular orbits.

For circular orbits.

Parameters:
el0Initial orbital element set [a,i,W,w,e,M]
xH0Initial state in Hill's frame
goalsGeometric goals data structure
windowManeuver time window data structure, containing:

  • nOrbMin Minimum number of orbits
  • nOrbMax Maximum number of orbits
  • nManeuvers Number of maneuvers to search over
  • timeWeightExp Time-weighting exponent
nSPONumber of samples to use for control vector (per orbit of maneuver duration)
xHFTarget Hills-frame state (at maneuver completion). Passed by reference.
nOrbMvrChosen maneuver duration (in orbits). Passed by reference.

References orb_data_s::ecc, orb_data_s::mean_anom, orb_data_s::perigee, PI, orb_data_s::sma, window_s::timeWeightExp, alf_orb_data_s::true_lat, and TWO_PI.

void LPEccentricTimeWeight ( orb_data_t  el0,
const ml_matrix &  xH0,
ecc_geom_t  goals,
window_t  window,
int  nSPO,
ml_matrix &  xHF,
double &  nOrbMvr 
)

Determine the target state on the desired trajectory that gives the minimum time-weighted cost. For eccentric orbits.

For eccentric orbits.

Parameters:
el0Initial orbital element set [a,i,W,w,e,M]
xH0Initial state in Hill's frame
goalsGeometric goals data structure
windowManeuver time window data structure, containing:
nSPONumber of samples to use for control vector (per orbit of maneuver duration)
xHFTarget Hills-frame state (at maneuver completion). Passed by reference.
nOrbMvrChosen maneuver duration (in orbits). Passed by reference.

References orb_data_s::ecc, orb_data_s::mean_anom, orb_data_s::sma, and window_s::timeWeightExp.

void GVEErrorDynamics ( orb_data_t  el0,
ml_matrix &  A,
ml_matrix &  B 
)
Parameters:
el0Standard orbital elements
AState dynamics. Passed by reference.
BInput effect matrix. Passed by reference.

References orb_data_s::ecc, orb_data_s::inc, orb_data_s::mean_anom, orb_data_s::perigee, and orb_data_s::sma.

void LPEccentricGVE ( orb_data_t  el0,
const ml_matrix &  x0,
const ml_matrix &  xF,
double  MF,
int  nS,
ml_matrix  cW,
unsigned short  constraintType,
double  maxConstraint,
ml_matrix &  aC,
ml_matrix &  t,
bool &  exitFlag 
)

Computes the thrust trajectory to go from an initial state to a final state in Hills frame. For eccentric orbits.

For eccentric orbits.

Parameters:
el0Initial orbital elements
x0Initial state in Hill's frame
xFFinal state in Hill's frame
MFFinal mean anomaly (rad)
nSNumber of samples to use for control vector
cWCost weighting vector
constraintTypeFlag [0: Equality; 1: Inequality constraint]
maxConstraintMaximum constraint on u
aCCommanded acceleration in Hill's frame. Passed by reference.
tTime vector (secs). Passed by reference.
exitFlagFlag [0: No feasible solution; 1: Feasible solution]. Passed by reference.

References orb_data_s::ecc, orb_data_s::mean_anom, PI, and orb_data_s::sma.

void FFEccLinOrb ( double  n,
double  nu,
double  e,
ml_matrix &  a,
ml_matrix &  b,
double  dT 
)

Compute the continous A,B matrices for linearized relative motion in an eccentric reference orbit, discretized with a zero-order hold with timestep dT. *sctlib (overload LinOrb)

*sctlib (overload LinOrb)

Parameters:
nMean orbit rate [rad/s]
nuTrue anomaly [rad]
eEccentricity
aPlant matrix. Passed by reference.
bInput matrix. Passed by reference.
dTTime-step for discretization
ml_matrix FFEccLinOrb ( const ml_matrix &  x,
const ml_matrix &  acc,
double  n,
double  nu,
double  e 
)

Compute the right-hand-side for linearized relative motion in an eccentric reference orbit.

Parameters:
xState vector
accAcceleration vector
nMean orbit rate [rad/s]
nuTrue anomaly [rad]
eEccentricity
Returns:
xDot
ml_matrix FFEccProp ( const ml_matrix &  D,
const ml_matrix &  nu,
double  e,
double  dH 
)
Parameters:
DIntegration constants computed from i.c.'s
nuTrue anomaly [rad]
eEccentricity
dHIntegration constant found by setting H = 0 at nu0
Returns:
xH Hills frame state computed at nu
ml_matrix FFEccProp ( const ml_matrix &  D,
double  nu,
double  e,
double  dH 
)
Parameters:
DIntegration constants computed from i.c.'s
nuTrue anomaly [rad]
eEccentricity
dHIntegration constant found by setting H = 0 at nu0
Returns:
xH Hills frame state computed at nu
double FFEccDH ( double  nu0,
double  e 
)

Compute integration constant dH for homogeneous solution to LTV differential equations of relative orbit motion. Found by setting H=0 at initial true anomaly.

Found by setting H=0 at initial true anomaly.

Parameters:
nu0True Anomaly (at initial state) [rad]
eEccentricity
Returns:
dH Integration constant found by setting H = 0 at nu0

References PI.

void FFEccGoals ( double  e,
ecc_geom_t  goals,
ml_matrix &  D,
ml_matrix &  xH 
)
Parameters:
eEccentricity
goalsEccentric geometric goals
DIntegration constants computed from i.c.'s. Passed by reference.
xHHills frame state at nu = 0. Passed by reference.

References ecc_geom_s::nu_xMax, ecc_geom_s::nu_zMax, PI, ecc_geom_s::xMax, ecc_geom_s::y0, and ecc_geom_s::zMax.

void FFEccGoals ( double  e,
ecc_geom_xy_t  goals,
ml_matrix &  D,
ml_matrix &  xH 
)
Parameters:
eEccentricity
goalsEccentric geometric goals (xy)
DIntegration constants computed from i.c.'s. Passed by reference.
xHHills frame state at nu = 0. Passed by reference.

References ecc_geom_xy_s::nu_xy, ecc_geom_xy_s::nu_zMax, PI, ecc_geom_xy_s::x, ecc_geom_xy_s::y, ecc_geom_xy_s::y0, and ecc_geom_xy_s::zMax.

void FFEccIntConst ( const ml_matrix &  xH0,
double  nu0,
double  e,
ml_matrix &  D,
double &  dH,
ml_matrix &  R 
)
Parameters:
xH0Initial state in Hills frame
nu0True anomaly (at initial state) [rad]
eEccentricity
DVector of integration constants. Passed by reference.
dHIntegration constant found by setting H = 0 at nu0. Passed by reference.
RState transition matrix. Passed by reference.
ml_matrix FFEccRMat ( double  nu,
double  e,
double  dH 
)
Parameters:
nuTrue Anomaly [rad]
eEccentricity
dHIntegration constant found by setting H = 0 at nu0
Returns:
matrix Transformation matrix for equation xH = R*D

References PI.

ml_matrix FFEccRMat ( double  nu,
double  e 
)

Compute the state-transition matrix, R, given the eccentricity and true anomaly so that xH = R*D, where D is the vector of integration constants found from initial conditions. Here, the integration constant "dH" is computed using the first element of the "nu" matrix.

Here, the integration constant "dH" is computed using the first element of the "nu" matrix.

Parameters:
nuTrue Anomaly [rad]
eEccentricity
Returns:
matrix Transformation matrix for equation xH = R*D

References PI.

void FFEccXExt ( double  e,
const ml_matrix &  D,
double  dH,
double  epsilon,
int  nMax,
ml_matrix &  x,
ml_matrix &  nu 
)
Parameters:
eEccentricity
DIntegration constants computed from i.c.'s
dHIntegration constant found by setting H = 0 at nu0
epsilonAngular tolerance [rad]
nMaxMaximum number of iterations
xExtreme values of radial oscillations [km]. Passed by reference.
nuTrue anomaly where extreme values occur [rad]. Passed by reference.

References PI.

void FFEccYExt ( double  e,
const ml_matrix &  D,
double  dH,
double  epsilon,
int  nMax,
ml_matrix &  y,
ml_matrix &  nu 
)
Parameters:
eEccentricity
DIntegration constants computed from i.c.'s
dHIntegration constant found by setting H = 0 at nu0
epsilonAngular tolerance [rad]
nMaxMaximum number of iterations
yExtreme values of along-track offsets [km]. Passed by reference.
nuTrue anomaly where extreme along-track offsets occur [rad]. Passed by reference.

References PI.

void FFEccZExt ( double  e,
const ml_matrix &  D,
double  dH,
double  epsilon,
int  nMax,
ml_matrix &  z,
ml_matrix &  nu 
)
Parameters:
eEccentricity
DIntegration constants computed from i.c.'s
dHIntegration constant found by setting H = 0 at nu0
epsilonAngular tolerance [rad]
nMaxMaximum number of iterations
zExtreme values of cross track amplitude [km]. Passed by reference.
nuTrue anomaly where extreme amplitudes occur [rad]. Passed by reference.

References PI.

void NuDot ( double  n,
double  e,
double  nu,
double &  nuDot,
double &  nuDotDot 
)

Compute the time-derivative of the true anomaly. *sctlib.

*sctlib

Parameters:
nMean orbit rate [rad/s]
eEccentricity
nuTrue Anomaly [rad]
nuDotTime derivative of true anomaly [rad/s]. Passed by reference.
nuDotDotSecond time derivative of true anomaly [rad/s]. Passed by reference.
double FFEccDX ( double  nu,
double  e,
const ml_matrix &  D,
double  dH 
)
Parameters:
nuTrue anomaly [rad]
eEccentricity
DIntegration constants computed from i.c.'s
dHIntegration constant computed from H(nu0)=0
Returns:
dx First derivative of x with respect to true anomaly
double FFEccDY ( double  nu,
double  e,
const ml_matrix &  D,
double  dH 
)
Parameters:
nuTrue anomaly [rad]
eEccentricity
DIntegration constants computed from i.c.'s
dHIntegration constant computed from H(nu0)=0
Returns:
dy First derivative of y with respect to true anomaly
double FFEccDZ ( double  nu,
double  e,
const ml_matrix &  D,
double  dH 
)
Parameters:
nuTrue anomaly [rad]
eEccentricity
DIntegration constants computed from i.c.'s
dHIntegration constant computed from H(nu0)=0
Returns:
dz First derivative of x with respect to true anomaly
double FFEccDDX ( double  nu,
double  e,
const ml_matrix &  D,
double  dH 
)
Parameters:
nuTrue anomaly [rad]
eEccentricity
DIntegration constants computed from i.c.'s
dHIntegration constant computed from H(nu0)=0
Returns:
ddx Second derivative of x with respect to true anomaly
double FFEccDDY ( double  nu,
double  e,
const ml_matrix &  D,
double  dH 
)
Parameters:
nuTrue anomaly [rad]
eEccentricity
DIntegration constants computed from i.c.'s
dHIntegration constant computed from H(nu0)=0
Returns:
ddy Second derivative of y with respect to true anomaly
double FFEccDDZ ( double  nu,
double  e,
const ml_matrix &  D,
double  dH 
)
Parameters:
nuTrue anomaly [rad]
eEccentricity
DIntegration constants computed from i.c.'s
dHIntegration constant computed from H(nu0)=0
Returns:
ddz Second derivative of z with respect to true anomaly
orb_data_t Alfriend2El ( alf_orb_data_t  elA )
alf_orb_data_t El2Alfriend ( orb_data_t  el )

Convert a standard orbital element set into the Alfriend orbital element set *sctlib.

Parameters:
elStandard orbital elements [a,i,W,w,e,M]
Returns:
elA Alfriend orbital elements [a,theta,i,q1,q2,W]

References orb_data_s::ecc, orb_data_s::inc, alf_orb_data_s::inc, orb_data_s::mean_anom, orb_data_s::perigee, alf_orb_data_s::q1, alf_orb_data_s::q2, orb_data_s::raan, alf_orb_data_s::raan, orb_data_s::sma, alf_orb_data_s::sma, alf_orb_data_s::true_lat, and TWO_PI.

alf_orb_data_t El2Alfriend ( orb_data_t  el,
double  true_anom 
)

Convert a standard orbital element set into the Alfriend orbital element set *sctlib.

Parameters:
elStandard orbital elements [a,i,W,w,e,M]
true_anomTrue anomaly
Returns:
elA Alfriend orbital elements [a,theta,i,q1,q2,W]

References orb_data_s::ecc, orb_data_s::inc, alf_orb_data_s::inc, orb_data_s::perigee, alf_orb_data_s::q1, alf_orb_data_s::q2, orb_data_s::raan, alf_orb_data_s::raan, orb_data_s::sma, alf_orb_data_s::sma, alf_orb_data_s::true_lat, and TWO_PI.

alf_orb_data_s add_elements ( alf_orb_data_t  el1,
alf_orb_data_t  el2 
)

Add two sets of orbital elements *sctlib.

Parameters:
el1First element set
el2Second element set
Returns:
el Sum of two element sets (all angles are wrapped between -PI and +PI)

References alf_orb_data_s::inc, alf_orb_data_s::q1, alf_orb_data_s::q2, alf_orb_data_s::raan, alf_orb_data_s::sma, and alf_orb_data_s::true_lat.

orb_data_s add_elements ( orb_data_t  el1,
orb_data_t  el2 
)

Add two sets of orbital elements *sctlib.

epoch and orb_rate are not set.

Parameters:
el1First element set
el2Second element set
Returns:
el Sum of two element sets (all angles are wrapped between -PI and +PI)

References orb_data_s::ecc, orb_data_s::inc, orb_data_s::mean_anom, orb_data_s::perigee, orb_data_s::raan, orb_data_s::sma, and orb_data_s::true_anom.

alf_orb_data_s sub_elements ( alf_orb_data_t  el1,
alf_orb_data_t  el2 
)
Parameters:
el1First element set
el2Second element set, subtracted from first
Returns:
el Difference of two element sets (all angles are wrapped between -PI and +PI)

References alf_orb_data_s::inc, alf_orb_data_s::q1, alf_orb_data_s::q2, alf_orb_data_s::raan, alf_orb_data_s::sma, and alf_orb_data_s::true_lat.

orb_data_s sub_elements ( orb_data_t  el1,
orb_data_t  el2 
)

epoch and orb_rate are not set.

Parameters:
el1First element set
el2Second element set, subtracted from first
Returns:
el Difference of two element sets (all angles are wrapped between -PI and +PI)

References orb_data_s::ecc, orb_data_s::inc, orb_data_s::mean_anom, orb_data_s::perigee, orb_data_s::raan, orb_data_s::sma, and orb_data_s::true_anom.

double CirclePhase ( double  beta )

Compute the desired phase on a circle from the desired phase on the ellipse. The circle is superscribed about the ellipse.

The circle is superscribed about the ellipse.

Parameters:
betaPhase angle measured on ellipse [rad]
Returns:
alpha Phase angle measured on superscribed circle [rad]

References PI.

double EllipsePhase ( double  alpha )

Compute the desired phase on an ellipse from the desired phase on the circle. The circle is superscribed about the ellipse.

The circle is superscribed about the ellipse.

Parameters:
alphaPhase angle measured on superscribed circle [rad]
Returns:
beta Phase angle measured on ellipse

References PI.

alf_orb_data_t OrbElemDiff ( alf_orb_data_t  el0,
alf_orb_data_t  el 
)
Parameters:
el0Reference orbital elements (Alfriend format)
elSecondary orbital elements (Alfriend format)
Returns:
dEl Orbital element difference

References alf_orb_data_s::inc, alf_orb_data_s::q1, alf_orb_data_s::q2, alf_orb_data_s::raan, alf_orb_data_s::sma, and alf_orb_data_s::true_lat.

orb_data_t OrbElemDiff ( orb_data_t  el0,
orb_data_t  el 
)

epoch and orb_rate are not set.

Parameters:
el0Reference orbital elements (standard format)
elSecondary orbital elements (standard format)
Returns:
dEl Orbital element difference

References orb_data_s::ecc, orb_data_s::inc, orb_data_s::mean_anom, orb_data_s::perigee, orb_data_s::raan, orb_data_s::sma, and orb_data_s::true_anom.

alf_orb_data_t Goals2DeltaElem ( alf_orb_data_t  el0,
geom_t  goals 
)
Parameters:
el0Measured orbital elements (Alfriend format)
goalsGeometric goals data structure
Returns:
alf_orb_data_t Desired orbital element differences
geom_t DeltaElem2Goals ( alf_orb_data_t  el0,
alf_orb_data_t  dEl 
)
Parameters:
el0Measured orbital elements (Alfriend format) [a,theta,i,q1,q2,W]
dElDesired orbital element differences
Returns:
goals Geometric goals
ml_matrix DeltaElem2Hills ( alf_orb_data_t  elA,
alf_orb_data_t  dEl 
)
Parameters:
elAReference orbital elements [Alfriend format]
dElOrbital element difference
Returns:
xH Hills frame position and velocity

References alf_orb_data_s::inc, MU_EARTH, alf_orb_data_s::q1, alf_orb_data_s::q2, alf_orb_data_s::raan, alf_orb_data_s::sma, and alf_orb_data_s::true_lat.

alf_orb_data_s Hills2DeltaElem ( alf_orb_data_t  el0,
const ml_matrix &  xH 
)
Parameters:
el0Chief orbital elements in alfriend format
xHRelative position and velocity in Hills frame
Returns:
alf_orb_data Orbital element difference in alfriend format

References alf_orb_data_s::inc, MU_EARTH, alf_orb_data_s::q1, alf_orb_data_s::q2, alf_orb_data_s::raan, RADIUS_EARTH, alf_orb_data_s::sma, and alf_orb_data_s::true_lat.

geom_s Hills2Goals ( alf_orb_data_t  el0,
const ml_matrix &  xH 
)
Parameters:
el0Reference orbital elements
xHRelative state in Hills frame
Returns:
goals Geometric goals

References geom_s::aE, geom_s::beta, MU_EARTH, alf_orb_data_s::sma, alf_orb_data_s::true_lat, geom_s::y0, geom_s::zInc, and geom_s::zLan.

ml_matrix Goals2Hills ( alf_orb_data_t  el0,
geom_t  goals 
)
Parameters:
el0Reference orbital elements
goalsGeometric goals
Returns:
xH Relative state in Hills frame

References geom_s::aE, geom_s::beta, alf_orb_data_s::sma, alf_orb_data_s::true_lat, geom_s::y0, geom_s::zInc, and geom_s::zLan.

orb_data_s FFEccHills2DeltaElem ( orb_data_t  el0,
const ml_matrix &  xH 
)

[standard format]

Parameters:
el0Reference orbital elements
xHRelative position and velocity in Hills frame [km, km/s]
Returns:
dEl Orbital element differences
alf_orb_data_s FFEccHills2DeltaElem ( alf_orb_data_t  el0,
const ml_matrix &  xH 
)

[alfriend format]

Parameters:
el0Reference orbital elements
xHRelative position and velocity in Hills frame [km, km/s]
Returns:
dEl Orbital element differences

References orb_data_s::true_anom.

ml_matrix FFEccDeltaElem2Hills ( alf_orb_data_t  el0,
alf_orb_data_t  dEl 
)
Parameters:
el0Reference orbital elements [Alfriend format]
dElOrbit element differences
Returns:
xH Relative state in Hills frame
ecc_geom_t FFEccDeltaElem2Goals ( alf_orb_data_t  el0,
alf_orb_data_t  dEl 
)
Parameters:
el0Orbital elements [Alfriend format]
dElOrbital element differences
Returns:
goals Eccentric geometric data structure

References alf_orb_data_s::q1, alf_orb_data_s::q2, alf_orb_data_s::sma, and alf_orb_data_s::true_lat.

ml_matrix FFEccGoals2Hills ( double  e,
double  nu,
ecc_geom_t  g,
double  n 
)
Parameters:
eEccentricity
nuTrue anomaly [rad]
gData structure of geometric goals
nMean orbit rate [rad/s]
Returns:
xH Hills frame state
ml_matrix FFEccGoals2Hills ( double  e,
double  nu,
ecc_geom_xy_t  g,
double  n 
)
Parameters:
eEccentricity
nuTrue anomaly [rad]
gData structure of geometric goals
nMean orbit rate [rad/s]
Returns:
xH Hills frame state
ml_matrix FFEccGoals2Hills ( double  e,
double  nu,
ecc_geom_t  g 
)
Parameters:
eEccentricity
nuTrue anomaly [rad]
gData structure of geometric goals
Returns:
xH Hills frame state
ecc_geom_t FFEccHills2Goals ( double  e,
double  nu,
ml_matrix  xH,
double  n 
)
Parameters:
eEccentricity
nuTrue anomaly [rad]
xHHills frame state
nMean orbit rate [rad/s]
Returns:
g Data structure of geometric goals

References ecc_geom_s::nu_xMax, ecc_geom_s::nu_zMax, PI, ecc_geom_s::xMax, ecc_geom_s::y0, and ecc_geom_s::zMax.

ecc_geom_t FFEccHills2Goals ( double  e,
double  nu,
const ml_matrix &  xH 
)
Parameters:
eEccentricity
nuTrue anomaly [rad]
xHHills frame state
Returns:
g Data structure of geometric goals

References ecc_geom_s::nu_xMax, ecc_geom_s::nu_zMax, PI, ecc_geom_s::xMax, ecc_geom_s::y0, and ecc_geom_s::zMax.

void Nu2TimeDomain ( ml_matrix &  x,
double  n,
double  e,
double  nu 
)
Parameters:
xRelative State in nu-domain. Passed by reference.
nMean orbit rate [rad/s]
eEccentricity
nuTrue anomaly [rad]
void Time2NuDomain ( ml_matrix &  x,
double  n,
double  e,
double  nu 
)
Parameters:
xRelative State in time-domain
nMean orbit rate [rad/s]
eEccentricity
nuTrue anomaly [rad]
xRelative State in nu-domain. Passed by reference.
ecc_geom_t GeometryCirc2Ecc ( double  w,
geom_t  gCirc 
)
Parameters:
wArgument of perigee [rad]
gCircGeometry goals structure for circular orbits
Returns:
gEcc Geometry goals structure for Eccentric orbits

References geom_s::aE, geom_s::beta, ecc_geom_s::nu_xMax, ecc_geom_s::nu_zMax, PI, ecc_geom_s::xMax, geom_s::y0, ecc_geom_s::y0, geom_s::zInc, geom_s::zLan, and ecc_geom_s::zMax.

geom_t GeometryEcc2Circ ( double  w,
ecc_geom_t  gEcc 
)
Parameters:
wArgument of perigee [rad]
gEccGeometry goals structure for Eccentric orbits
Returns:
gCirc Geometry goals structure for Circular orbits

References geom_s::aE, geom_s::beta, ecc_geom_s::nu_xMax, ecc_geom_s::nu_zMax, PI, ecc_geom_s::xMax, ecc_geom_s::y0, geom_s::y0, geom_s::zInc, geom_s::zLan, and ecc_geom_s::zMax.

geom_t RotateState ( geom_t  goals,
double  phi 
)
Parameters:
goalsGeometric goals data structure
phiCircular phase angle
Returns:
goals New geometric data structure rotated to phi

References geom_s::beta, geom_s::zInc, and geom_s::zLan.

double MeanAnom2TrueLat ( double  e,
double  w,
double  M 
)

Convert mean anomlay to true latitude.

Parameters:
eEccentricity
wArgument of Perigee [rad]
MMean Anomaly [rad]
Returns:
theta True Latitude [rad]

References TWO_PI.

void GetHillsMats ( const ml_matrix &  r0,
const ml_matrix &  v0,
ml_matrix &  A,
ml_matrix &  Adot 
)
Parameters:
r0Position, ECI frame
v0Velocity, ECI frame
ARotation Matrix (position). Passed by reference.
AdotRotation Matrix (velocity). Passed by reference.

References orb_data_s::ecc, MU_EARTH, orb_data_s::sma, and orb_data_s::true_anom.

void AbsRelECI2Hills ( ml_matrix  r0,
ml_matrix  v0,
ml_matrix  dr,
ml_matrix  dv,
ml_matrix &  rH,
ml_matrix &  vH 
)
Parameters:
r0Reference position in ECI frame
v0Reference velocity in ECI frame
drRelative position in ECI frame
dvRelative velocity in ECI frame
rHCurvilinear Hills frame position [dR; r1*dTheta; dZ ]. Passed by reference.
vHCurvilinear Hills frame velocity [dRDot; r1*dThetaDot + r1Dot*dTheta; dZDot]. Passed by reference.
alf_orb_data_t Osc2Mean ( alf_orb_data_t  el,
double  J2 
)
Parameters:
elOsculating orbital elements
J2J2 perturbation
Returns:
el Mean orbital elements

References alf_orb_data_s::inc, alf_orb_data_s::q1, alf_orb_data_s::q2, alf_orb_data_s::raan, RADIUS_EARTH, alf_orb_data_s::sma, and alf_orb_data_s::true_lat.

alf_orb_data_t* ECI2MeanElements ( const ml_matrix &  xRefECI,
const ml_matrix &  xRelECI,
double  J2,
alf_orb_data_t elRefMean 
)
Parameters:
xRefECIReference position & velocity in ECI frame
xRelECIRelative positions & velocities in ECI frame
J2Size of J2 perturbation
elRefMeanMean orbital elements of the reference orbit. Passed by reference.
Returns:
dElMean Mean orbital element differences

References orb_data_s::true_anom.

bool AlignThruster ( const ml_matrix &  aH,
const ml_matrix &  bTh,
ml_matrix &  qHB 
)

Computes desired Hills-to-body quaternion for a thruster firing. Rotation about thruster-axis is ignored.

Rotation about thruster-axis is ignored.

Parameters:
aHUnit Hills frame vector of applied acceleration
bThUnit body vector of Hall Effect Thruster nozzle
qHBDesired ECI-to-body quaternion. Passed by reference.
Returns:
Always returns true. Output provided for compatibility with other AlignThruster function.
bool AlignThruster ( const ml_matrix &  aH,
const ml_matrix &  bTh,
const ml_matrix &  bST,
const ml_matrix &  r,
const ml_matrix &  v,
double  jD,
double  sep,
ml_matrix &  qHB 
)
Parameters:
aHUnit Hills frame vector of applied acceleration
bThUnit body vector of Hall Effect Thruster nozzle
bSTUnit body vector of star tracker bore-sight
rPosition in ECI at burn time [km]
vVelocity in ECI at burn time [km/s]
jDJulian Date of burn time [JD]
sepRequired angular separation between bore-sight and bright body horizon [rad]
qHBDesired ECI-to-body quaternion. Passed by reference.
Returns:
Flag indicating whether angular separation constraint is satisfied for all: sun, Earth, and moon

References PI.

ml_matrix Hills2Frenet ( const ml_matrix &  xH,
const double &  e,
const double &  nu,
const double &  n 
)

Transforms from the Hills frame to the Frenet frame.

Parameters:
xH(6,1) Relative position and velocity in Hills-frame
e(1,1) Orbit eccentricity
nu(1,1) True anomaly (rad)
n(1,1) Mean orbit rate (rad/s)
Returns:
xF (6,1) Relative position and velocity in Frenet-frame
ml_matrix HillsEqns ( const ml_matrix &  xH0,
double  n,
double  t 
)

Closed form solution of relative orbital motion using Hills equations. For circular orbits only.

For circular orbits only.

Parameters:
xH0Initial state in Hills frame
nOrbital Rate (rad/s)
tTime (sec)
Returns:
X State
ml_matrix FFEccHillsEqns ( ml_matrix  xH0,
double  nu0,
const ml_matrix &  nu,
double  e,
double  n 
)

Compute Hills frame state (in time-domain) at future true anomaly(s). For eccentric or circular orbits.

For eccentric or circular orbits

Parameters:
xH0Initial Hills frame state
nu0True anomaly (at initial state) [rad]
nuTrue anomaly (at new state) [rad]
eEccentricity
nMean orbit rate [rad/s]
Returns:
xH New Hills frame state at nu (with nu-derivatives)
ml_matrix FFEccHillsEqns ( const ml_matrix &  xH0,
double  nu0,
const ml_matrix &  nu,
double  e 
)

Compute Hills frame state (in nu-domain) at future true anomaly(s). For eccentric or circular orbits.

For eccentric or circular orbits

Parameters:
xH0Initial Hills frame state
nu0True anomaly (at initial state) [rad]
nuTrue anomaly (at new state) [rad]
eEccentricity
Returns:
xH New Hills frame state at nu (with nu-derivatives)
ml_matrix DiscreteHills ( const ml_matrix &  x0,
double  n,
const ml_matrix &  aC,
double  dT 
)

Compute the force relative trajectory from the initial state and time-history of applied accelerations. For circular orbits only.

For circular orbits only.

Parameters:
x0Initial state
nReference orbit rate (rad/sec)
aCCommanded accelerations
dTThruster sampling time
Returns:
xS State trajectory
ml_matrix FFEccDiscreteHills ( double  e,
double  n,
const ml_matrix &  x0,
double  nu0,
const ml_matrix &  aC,
const ml_matrix &  t 
)

Compute the force relative trajectory from the initial state and time-history of applied accelerations. For circular orbits only.

For circular orbits only.

Parameters:
eEccentricity
nMean orbit rate (rad/sec)
x0Initial relative state
nu0Initial true anomaly
aCCommanded accelerations
tTime vector (final time corresponds to final state)
Returns:
xS Discrete Hills state
double CollProbSet ( double  sigma,
const ml_matrix &  S,
const ml_matrix &  xc,
const ml_matrix &  Ssc0,
int  n 
)

Collision probability calculation using sets of ellipsoids.

The units of the inputs should all be consistent, for example km and km2. Only the position of the ellipsoid shold be input.

Parameters:
sigmaStandard deviations of input ellipsoid, ex. 1.0 or 2.0
SEllipsoid matrix, 3x3, [length2]
xcEllipsoid center, 3x1, [length]
Ssc0Hard-body ellipsoid for single spacecraft [length2]
nNumber of shells in computation
Returns:
prob Probability of a collision

References PI.

ml_matrix MonitoringAlg ( ml_matrix &  y,
ml_matrix &  t,
ml_matrix &  M,
ml_matrix &  nu,
ml_matrix &  accel,
ml_matrix &  aDiff,
coll_mon_data_s  d 
)

Collision monitoring algorithm implementation used for both modes, monitoring and surveying.

Requires an acceleration matrix for each relative spacecraft, which will be zero for monitoring. The differential accelerations aDiff may not be zero or else the data output will be corrupted. Currently only the first element of aDiff is used to scale Q assuming that it is a worst-case representation. The function GenerateTimeVector can be used to create t, M, and nu given the total time window.

Parameters:
yRelative state, 6xm
tTime vector (sec), 1xn
MMean anomaly, 1xn
nuTrue anomaly, 1xn
accelStacked relative accleration vectors, 3mxn
aDiffDifferential accelerations, 3x1
dCollision monitoring data structure
Returns:
Probability, mxn

References orb_data_s::ecc, coll_mon_data_s::el_ref, alf_orb_data_s::inc, coll_mon_data_s::lenSC, orb_data_s::mean_anom, coll_mon_data_s::nPts, orb_data_s::perigee, coll_mon_data_s::Pmin, alf_orb_data_s::q1, alf_orb_data_s::q2, alf_orb_data_s::raan, coll_mon_data_s::S0, coll_mon_data_s::sigma, orb_data_s::sma, alf_orb_data_s::sma, coll_mon_data_s::Ssc, and alf_orb_data_s::true_lat.

ml_matrix CollisionSurvey ( ml_matrix &  y,
double  t0,
maneuver_t  mvr1,
maneuver_t  mvr2[],
int  n_points,
coll_mon_data_s  d 
)
Parameters:
yRelative state (6,n). Passed by reference.
t0Current time (MET)
mvr1Maneuver data structure for self
mvr2Maneuver structure array for relative spacecraft, must be [n]
n_pointsNumber of points for time vector
dCollision monitor data structure
Returns:
Probability matrix, one row per relative

References coll_mon_data_s::el_ref, maneuver_s::nBurns, and maneuver_s::tF.

ml_matrix DeltaElem2HillsMat ( const ml_matrix &  elA )

Compute transformation matrix from delta elements to Hills.

Parameters:
elAReference orbital elements [Alfriend format]
Returns:
m Transformation matrix

References MU_EARTH.

ml_matrix DeltaEl2AlfriendMat ( orb_data_t  el )

Compute transformation matrix from standard differential elements to Alfriend differential elements.

Parameters:
elReference orbit data
Returns:
T Transformation matrix

References orb_data_s::ecc, orb_data_s::mean_anom, and orb_data_s::perigee.

double distant_pt_ell ( const ml_matrix &  S,
const ml_matrix &  U,
const ml_matrix &  xc,
const ml_matrix &  x0,
ml_matrix &  x 
)

Compute minimum distance from a distance point to an ellipsoid's surface.

Parameters:
SSingular value matrix of ellipsoid (3,3)
URotation matrix of ellipsoid (3,3)
xcCenter of ellipsoid (3,1)
x0Outside point (3D) (3,1)
xPoint on the ellipsoid (3,1)
Returns:
Distance
double Laguerre ( const ml_matrix &  a,
double  x_guess 
)

Laguerre root finding algorithm adapted to real roots.

Parameters:
aVector containing the coefficients of the polynomial, a[i] x^i
x_guessInitial guess for the root
Returns:
Root
ml_matrix GenerateTimeVector ( orb_data_t  d,
const double  tF,
const int  nPts,
ml_matrix &  M,
ml_matrix &  nu 
)

Also returns the corresponding mean and true anomaly vectors.

Parameters:
dOrbit elements data
tFFinal time
nPtsNumber of points per orbit
MMatrix for returning mean anomaly vector
nuMatrix for returning true anomaly vector
Returns:
Time vector

References orb_data_s::ecc, orb_data_s::mean_anom, PI, orb_data_s::sma, and TWO_PI.

ml_matrix ManeuverStruct2AccelVector ( maneuver_t  mvr,
const ml_matrix &  tProp 
)

Compute a 3xN acceleration vector from a maneuver data structure.

Parameters:
mvrManeuver data structure, containing an array of burn data structures
tPropTime history to use for acceleration vector [sec]
Returns:
aC 3xN acceleration matrix [km/s/s]

References maneuver_s::burnData, burn_s::dT, burn_s::dV, maneuver_s::nBurns, burn_s::t, burn_s::uX, burn_s::uY, and burn_s::uZ.

bool TeamLevels ( team_t  teams[],
int  num,
ml_int_array &  levels 
)
Parameters:
teamsArray of team data structures.
numNumber of team data structures.
levelsArray of team hierarchical team levels. Passed by reference.
Returns:
circular Flag indicating whether the supplied team organization is circular (true) or not (false).
int IsRelative ( int  iD,
team_t  teams[],
int  num 
)

Determine whether the given satellite ID is a relative of any team.

Parameters:
iDUnique integer ID of the satellite being checked.
teams[]Array of team data structures.
numNumber of team data structures.
Returns:
kTeam Index of the team for which it is a relative (counts from 1). Returns 0 if not a relative.

References team_s::memID.

bool FindUpperTeams ( int  kBot,
team_t  teams[],
int  num,
ml_int_array &  kUpper 
)

Find teams above this one in the hierarchy.

Parameters:
kBotIndex of team to consider. Find all teams above this one.
teamsArray of team data structures.
numNumber of team data structures.
kUpperArray of team indices that are above this one in the hierarchy. Passed by reference.
Returns:
circular Flag indicating whether the supplied team organization is circular (true) or not (false).
double TimeUntilTheta ( double  a,
double  w,
double  e,
double  theta0,
double &  theta1 
)
Parameters:
aSemi-major axis [km]
wArgument of perigee [rad]
eEccentricity
theta0Initial true latitude [rad]
theta1Final true latitude [rad]
Returns:
dT Elapsed time between initial and final true latitude
theta1 Updated value for final latitude (increased by 2*PI if originally less than initial latitude)

References TWO_PI.

void AccelVector2ManeuverStruct ( const ml_matrix &  aC,
ml_matrix  t,
double  tRef,
double  nomAccel,
double  minSepTime,
maneuver_t mvr,
ml_matrix &  dV 
)
Parameters:
aC3xN acceleration matrix. [km/s/s]
tTime vector in seconds, starting at 0.
tRefReference time in seconds, [MET]. This is added to the time vector "t" after differencing to avoid numerical rounding errors.
nomAccelNominal acceleration in [km/s]. Each burn is assumed to apply this acceleration. This relates the burn duration to the delta-v magnitude.
minSepTimeMinimum allowable separation time between end of one burn and beginning of next. Multiple burns closer together than this will be grouped into a single burn.
mvrManeuver data structure with burn info. Passed by reference.
dVNon-zero delta-v magnitudes. Passed by reference.

References maneuver_s::burnData, burn_s::dT, burn_s::dV, FF_TOL, maneuver_s::iD, burn_s::iD, maneuver_s::nBurns, burn_s::t, maneuver_s::t0, maneuver_s::tF, burn_s::uX, burn_s::uY, and burn_s::uZ.

void ManeuverStruct2AccelVector ( maneuver_t  mvr,
double  dT,
ml_matrix &  aC,
ml_matrix &  t 
)
Parameters:
mvrManeuver data structure, containing an array of burn data structures
dTTime-step to use in creating the acceleration time-history [sec]
aC3xN acceleration matrix [km/s/s]. Passed by reference.
t1xN+1 time vector [sec]. Passed by reference.

References maneuver_s::burnData, burn_s::dT, burn_s::dV, maneuver_s::nBurns, burn_s::t, burn_s::uX, burn_s::uY, and burn_s::uZ.

ml_matrix NOrbVector ( window_t  win )
Parameters:
winTime window data structure
Returns:
nOrb Vector of maneuver durations (in orbits) to consider in planning

References window_s::nManeuvers, window_s::nOrbMax, and window_s::nOrbMin.

ml_matrix TargetTrueAnom ( double  e,
double  nu0,
ml_matrix  nOrb 
)
Parameters:
eEccentricity
nu0Initial true anomaly [rad]
nOrbNumber of orbits into the future to evaluate the true anomaly
Returns:
nuF Target true anomay at future times, unwrapped [rad]

References TWO_PI.

ml_matrix Tetrahedron ( double  d,
const ml_matrix &  eul 
)
Parameters:
dDistance of each side.
eulEuler angles for rotating the tetrahedron. [rad]
Returns:
p 3x4 matrix containing the [x;y;z]' coordinates of each point.
char* matout ( ml_matrix  mat )

Output a matrix to a string with higher precision than built-in "to_string" function.

Parameters:
matMatrix to convert to a string.
Returns:
String representation of the matrix in "MATLAB readable" format