Index: trunk/BNC/combination/bnccomb.cpp
===================================================================
--- trunk/BNC/combination/bnccomb.cpp	(revision 3486)
+++ trunk/BNC/combination/bnccomb.cpp	(revision 3487)
@@ -44,11 +44,4 @@
 using namespace std;
 
-// Auxiliary Class for Single-Differences
-////////////////////////////////////////////////////////////////////////////
-class t_sDiff {
- public:
-  QMap<QString, double> diff;
-};
-
 // Constructor
 ////////////////////////////////////////////////////////////////////////////
@@ -546,8 +539,13 @@
   }
 
-  SymmetricMatrix QQ_sav = _QQ;
+  // Check Satellite Positions for Outliers
+  // --------------------------------------
+  if (checkOrbits() != success) {
+    return failure;
+  }
 
   // Update and outlier detection loop
   // ---------------------------------
+  SymmetricMatrix QQ_sav = _QQ;
   while (true) {
 
@@ -782,5 +780,5 @@
     cmbCorr* corr = itCorr.next();
     QString  prn  = corr->prn;
-    switchToLastEph(_eph[prn]->last, corr);
+
     ++iObs;
 
@@ -848,4 +846,10 @@
                                         QMap<QString, t_corr*>& resCorr,
                                         ColumnVector& dx) {
+
+  // Check Satellite Positions for Outliers
+  // --------------------------------------
+  if (checkOrbits() != success) {
+    return failure;
+  }
 
   // Outlier Detection Loop
@@ -991,2 +995,40 @@
   return failure;
 }
+
+// Check Satellite Positions for Outliers
+////////////////////////////////////////////////////////////////////////////
+t_irc bncComb::checkOrbits() {
+
+  // Compute Mean Corrections for all Satellites
+  // -------------------------------------------
+  QMap<QString, ColumnVector> meanRao;
+  QVectorIterator<cmbCorr*> itCorr(corrs());
+  while (itCorr.hasNext()) {
+    cmbCorr* corr = itCorr.next();
+    QString  prn  = corr->prn;
+    if (meanRao.find(prn) == meanRao.end()) {
+      meanRao[prn].ReSize(4);
+      meanRao[prn].Rows(1,3) = corr->rao;
+      meanRao[prn](4)        = 1; 
+    }
+    else {
+      meanRao[prn].Rows(1,3) += corr->rao;
+      meanRao[prn](4)        += 1; 
+    }
+    switchToLastEph(_eph[prn]->last, corr);
+  }
+
+  QMutableVectorIterator<cmbCorr*> it(corrs());
+  while (it.hasNext()) {
+    cmbCorr* corr = it.next();
+    QString  prn  = corr->prn;
+    if (meanRao[prn](4) != 0) {
+      meanRao[prn] /= meanRao[prn](4);
+      meanRao[prn](4) = 0;
+    }
+    ColumnVector dRao = corr->rao - meanRao[prn].Rows(1,3);
+  }
+
+
+  return success;
+}
Index: trunk/BNC/combination/bnccomb.h
===================================================================
--- trunk/BNC/combination/bnccomb.h	(revision 3486)
+++ trunk/BNC/combination/bnccomb.h	(revision 3487)
@@ -87,4 +87,5 @@
   void printResults(QTextStream& out, const QMap<QString, t_corr*>& resCorr);
   void switchToLastEph(const t_eph* lastEph, t_corr* corr);
+  t_irc checkOrbits();
 
   QVector<cmbCorr*>& corrs() {return _buffer[_resTime].corrs;}
