00001 #pragma ident "$Id: DOP.cpp 1889 2009-05-11 15:47:23Z afarris $" 00002 00008 //============================================================================ 00009 // 00010 // This file is part of GPSTk, the GPS Toolkit. 00011 // 00012 // The GPSTk is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU Lesser General Public License as published 00014 // by the Free Software Foundation; either version 2.1 of the License, or 00015 // any later version. 00016 // 00017 // The GPSTk is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU Lesser General Public License for more details. 00021 // 00022 // You should have received a copy of the GNU Lesser General Public 00023 // License along with GPSTk; if not, write to the Free Software Foundation, 00024 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 // 00026 // Dagoberto Salazar - gAGE. 2006 00027 // 00028 //============================================================================ 00029 00030 00031 #include "DOP.hpp" 00032 00033 00034 namespace gpstk 00035 { 00036 00037 // Compute the DOP values associated with the given Covariance Matrix 00038 // @param covarianceMatrix Covariance matrix for the equation system 00039 // 00040 // @return 00041 // 0 if OK 00042 // -1 if problems arose 00043 // 00044 int DOP::Compute(const Matrix<double>& covarianceMatrix) throw(InvalidDOP) 00045 { 00046 int covCol = (int) covarianceMatrix.cols(); 00047 int covRow = (int) covarianceMatrix.rows(); 00048 if (!(covRow==covCol)) { 00049 InvalidDOP e("covarianceMatrix is not square"); 00050 GPSTK_THROW(e); 00051 } 00052 00053 try { 00054 GDOP = RSS(covarianceMatrix(0,0), covarianceMatrix(1,1), covarianceMatrix(2,2), covarianceMatrix(3,3)); 00055 PDOP = RSS(covarianceMatrix(0,0), covarianceMatrix(1,1), covarianceMatrix(2,2)); 00056 TDOP = SQRT(covarianceMatrix(3,3)); 00057 } 00058 catch(...) { 00059 InvalidDOP e("Unable to compute RSS of covarianceMatrix values."); 00060 GPSTK_THROW(e); 00061 } 00062 00063 00064 // If everything is fine so far, then the results should be valid 00065 valid = true; 00066 00067 return 0; 00068 00069 } // end DOP::Compute() 00070 00071 00072 } // end namespace gpstk
1.3.9.1