Batch Least Squares

Top  Previous  Next

Below is a numbered list detailing the basic process of performing state estimation using a Batch Least Squares Estimator. For each step in the process, the options available in FreeFlyer script are listed, and a script example is given for each option.


There are a variety of Sample Mission Plans (included with your FreeFlyer installation) that demonstrate various applications of these topics. Continue to the Orbit Determination Samples page to view descriptions and images of these examples or jump to one of the Mission Plans listed below.



For information on creating and configuring a BatchLeastSquaresOD object, see Setting up Batch Least Squares.



1.Load tracking data into the observation buffer

The BatchLeastSquaresOD object automatically sorts and loads all data from registered Tracking Data files within the Span constraints into the observation buffer. To initialize the BatchLeastSquaresOD object's Observations array with the observations from the registered Tracking Data files, use the LoadObservationData() method. For example:


// Add the observation file to the Batch process




Note: The LoadObservationData() method is optional; if it is not executed prior to calling the Iterate() method, then the Iterate() method will perform the same initialization functions.


To add observations that were defined in FreeFlyer script, the AddObservation() method can be used. For example:


// Add an observation to the Batch process




2.Iterate the Batch

There are three options when iterating a Batch Least Squares OD object.


a.One Iteration


// Iterate the Batch once




b.N Iterations


// Iterate the Batch the specified number of times


// Solution statistics will only be available for the final iteration




c.Iterate until converged


// Iterate the Batch until the percent change in the weighted RMS of the Observation residuals is below the given tolerance, or the maximum number of iterations has been reached


// Solution statistics will only be available for the final iteration


BatchLeastSquaresOD1.Iterate(convergenceTolerance, maxIterations);



3.Inspect Solution Statistics

After the specified iterations have been performed, there are a few ways to examine the results.


a.Look at pre- and post-update residuals


// Calculate and report pre- and post-update residuals for all processed measurements at once:

BatchLeastSquaresOD1.GetPreUpdateResidualStatistics(PreMeasTypes, PreResMean, PreResSigma, PreResRMS);

BatchLeastSquaresOD1.GetPostUpdateResidualStatistics(PostMeasTypes, PostResMean, PostResSigma, PostResRMS);


Report PreResMean, PreResSigma, PreResRMS;

Report PostResMean, PostResSigma, PostResRMS;


// === OR === //


// Report and plot pre- and post-update residuals measurement by measurement:

Variable i;

Variable preAzimuthResid;

Variable preElevationResid;

Variable postAzimuthResid;

Variable postElevationResid;


For i = 0 to BatchLeastSquaresOD1.Observations.Count-1;


    Alias obs = (BatchLeastSquaresOD1.Observations[i] AsType GroundStationObservation);


    If (obs.Azimuth.ProcessingStatus == 1);

          preAzimuthResid  = obs.Azimuth.PreUpdateResidual;

          postAzimuthResid = obs.Azimuth.PostUpdateResidual;


          preAzimuthResid  = -999;

          postAzimuthResid = -999;


    If (obs.Elevation.ProcessingStatus == 1);

          preElevationResid  = obs.Elevation.PreUpdateResidual;

          postElevationResid = obs.Elevation.PostUpdateResidual;


          preElevationResid  = -999;

          postElevationResid = -999;



    Report obs.ObservedEpoch, preAzimuthResid, preElevationResid, postAzimuthResid, postElevationResid;

    Plot obs.ObservedEpoch, preAzimuthResid, preElevationResid, postAzimuthResid, postElevationResid;




b.Look at convergence criteria


// Inspect the measurement residuals for the RMS of the current iteration and predictions for the next iteration


Report BatchLeastSquaresOD1.IterationCount, BatchLeastSquaresOD1.RMS, BatchLeastSquaresOD1.WeightedRMS, BatchLeastSquaresOD1.PredictedRMS;