Index: trunk/BNC/src/PPP/pppClient.cpp
===================================================================
--- trunk/BNC/src/PPP/pppClient.cpp	(revision 10001)
+++ trunk/BNC/src/PPP/pppClient.cpp	(revision 10002)
@@ -73,7 +73,5 @@
   }
 
-  _offGR = 0.0;
-  _offGE = 0.0;
-  _offGC = 0.0;
+  _offGG = 0.0;
   CLIENTS.setLocalData(this);  // CLIENTS takes ownership over "this"
 }
@@ -357,4 +355,57 @@
   return success;
 }
+// Compute A Priori GPS-Glonass Offset
+//////////////////////////////////////////////////////////////////////////////
+double t_pppClient::cmpOffGG(vector<t_pppSatObs*>& obsVector) {
+
+  t_lc::type tLC   = t_lc::dummy;
+  double     offGG = 0.0;
+
+  if (OPT->useSystem('R')) {
+
+    while (obsVector.size() > 0) {
+      offGG = 0.0;
+      double   maxRes      = 0.0;
+      int      maxResIndex = -1;
+      t_prn    maxResPrn;
+      unsigned nObs        = 0;
+      for (unsigned ii = 0; ii < obsVector.size(); ii++) {
+        t_pppSatObs* satObs = obsVector.at(ii);
+        if (satObs->prn().system() == 'R') {
+          if (tLC == t_lc::dummy) {
+            tLC = satObs->isValid(t_lc::cIF) ? t_lc::cIF : t_lc::c1;
+          }
+          if (satObs->isValid(tLC) && (!satObs->modelSet() || satObs->eleSat() >= OPT->_minEle)) {
+            double ll = satObs->obsValue(tLC) - satObs->cmpValue(tLC);
+            ++nObs;
+            offGG += ll;
+            if (fabs(ll) > fabs(maxRes)) {
+              maxRes      = ll;
+              maxResIndex = ii;
+              maxResPrn   = satObs->prn();
+            }
+          }
+        }
+      }
+
+      if (nObs > 0) {
+        offGG = offGG / nObs;
+      }
+      else {
+        offGG = 0.0;
+      }
+
+      if (fabs(maxRes) > 1000.0) {
+        LOG << "t_pppClient::cmpOffGG outlier " << maxResPrn.toString() << " " << maxRes << endl;
+        obsVector.erase(obsVector.begin() + maxResIndex);
+      }
+      else {
+        break;
+      }
+    }
+  }
+
+  return offGG;
+}
 
 //
@@ -534,4 +585,6 @@
         return finish(failure,5);
       }
+
+      _offGG = cmpOffGG(_obsRover);
 
       // Prepare Pseudo Observations of the Rover
Index: trunk/BNC/src/PPP/pppClient.h
===================================================================
--- trunk/BNC/src/PPP/pppClient.h	(revision 10001)
+++ trunk/BNC/src/PPP/pppClient.h	(revision 10002)
@@ -38,7 +38,5 @@
   const bncAntex*     antex() const {return _antex;}
   const t_pppStation* staRover() const {return _staRover;}
-  double              offGR() const {return _offGR;}
-  double              offGE() const {return _offGE;}
-  double              offGC() const {return _offGC;}
+  double              offGG() const {return _offGG;}
 
   std::ostringstream& log() {return *_log;}
@@ -63,4 +61,5 @@
   t_irc cmpBancroft(const bncTime& epoTime, std::vector<t_pppSatObs*>& obsVector,
                     ColumnVector& xyzc, bool print);
+  double cmpOffGG(std::vector<t_pppSatObs*>& obsVector);
   t_irc handleRefSatellites(std::vector<t_pppSatObs*>& obsVector);
   void setRefSatellites(std::vector<t_pppSatObs*>& obsVector);
@@ -74,7 +73,5 @@
   bncAntex*                 _antex;
   t_pppFilter*              _filter;
-  double                    _offGR;
-  double                    _offGE;
-  double                    _offGC;
+  double                    _offGG;
   std::vector<t_pppSatObs*> _obsRover;
   QMap<char, t_pppRefSat*>  _refSatMap;
Index: trunk/BNC/src/PPP/pppFilter.cpp
===================================================================
--- trunk/BNC/src/PPP/pppFilter.cpp	(revision 10001)
+++ trunk/BNC/src/PPP/pppFilter.cpp	(revision 10002)
@@ -348,8 +348,5 @@
       }
       if (preProcessing) {
-        // for refSats no ambiguity parameter exists
-        if ((obs->prn() == refPrn)
-            && (t_lc::toString(maxOutlierLC) == "l1" ||
-                t_lc::toString(maxOutlierLC) == "l2")) {
+        if (obs->prn() == refPrn) {
           _obsPool->setRefSatChangeRequired(sys, true);
           LOG << epoTimeStr << " Outlier ("
@@ -357,8 +354,6 @@
               << t_lc::toString(maxOutlierLC) << ' ' << obs->prn().toString()
               << ' ' << setw(8) << setprecision(4) << maxOutlier << endl;
-          break;
-        } else {
-          obs->setOutlier();
-        }
+          //break;
+        } //else {obs->setOutlier(); }
       } else {    // fin-processing
         LOG << epoTimeStr << " Outlier " << t_lc::toString(maxOutlierLC) << ' '
@@ -366,11 +361,13 @@
             << maxOutlier << endl;
         if (par) {
-          //if ( par->ambResetCandidate() || (OPT->_obsModelType == OPT->DCMcodeBias ||    OPT->_obsModelType == OPT->DCMphaseBias) ) {
+          if (par->ambResetCandidate() ||
+              OPT->_obsModelType == OPT->DCMcodeBias ||
+              OPT->_obsModelType == OPT->DCMphaseBias) {
             resetAmb(par->prn(), obsVector, &QSav, &xSav);
-          //}
-          //else {
-          //  par->setAmbResetCandidate();
-          //  obs->setOutlier();
-          //}
+          }
+          else {
+            par->setAmbResetCandidate();
+            obs->setOutlier();
+          }
         }
         else {
@@ -408,5 +405,5 @@
     const vector<t_pppSatObs*> &obsVector, const t_prn &refPrn,
     bool preProcessing) {
-  const double SLIP = 100.0;
+  const double SLIP = 20.0;
   char sys = refPrn.system();
   string epoTimeStr = string(_epoTime);
@@ -462,10 +459,7 @@
           }
         }
-        /* Check Pre-Fit Residuals
+        // Check Pre-Fit Residuals
         // -----------------------
         else {
-          if (refPrn != t_prn()) {
-            return success;
-          }
           ColumnVector AA(nPar);
           for (unsigned iPar = 0; iPar < nPar; iPar++) {
@@ -486,5 +480,5 @@
             }
           }
-        }*/
+        }
       }
     }
@@ -768,5 +762,9 @@
       continue;
     }
-    _datumTrafo->updateIndices(sys, iObs + 1); //LOG << "AA Ncols/Nrows: " << AA.Ncols() << "/" << AA.Nrows() << "  nPar: "  << nPar << endl;    //LOG << "AA.SubMatrix(1 .. " << iObs+1 << " , 1 .. " <<  nPar << ")" << endl;
+    _datumTrafo->updateIndices(sys, iObs + 1);
+#ifdef BNC_DEBUG_PPP
+    LOG << "AA Ncols/Nrows: " << AA.Ncols() << "/" << AA.Nrows() << "  nPar: "  << nPar << endl;
+    LOG << "AA.SubMatrix(1 .. " << iObs+1 << " , 1 .. " <<  nPar << ")" << endl;
+#endif
     if (_datumTrafo->prepareAA(AA.SubMatrix(1, iObs + 1, 1, nPar), 2)
         != success) {
Index: trunk/BNC/src/PPP/pppParlist.cpp
===================================================================
--- trunk/BNC/src/PPP/pppParlist.cpp	(revision 10001)
+++ trunk/BNC/src/PPP/pppParlist.cpp	(revision 10002)
@@ -62,17 +62,5 @@
      _noise   = OPT->_noiseCrd[2];
      break;
-   case rClkG:
-     _epoSpec = true;
-     _sigma0  = OPT->_aprSigClk;
-     break;
-   case rClkR:
-     _epoSpec = true;
-     _sigma0  = OPT->_aprSigClk;
-     break;
-   case rClkE:
-     _epoSpec = true;
-     _sigma0  = OPT->_aprSigClk;
-     break;
-   case rClkC:
+   case clkR:
      _epoSpec = true;
      _sigma0  = OPT->_aprSigClk;
@@ -86,5 +74,9 @@
          const t_pppSatObs* obs = obsVector->at(ii);
          if (obs->prn() == _prn) {
-           _x0 = floor((obs->obsValue(tLC) - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
+           double offGG = 0;
+           if (_prn.system() == 'R' && tLC != t_lc::MW) {
+             offGG = PPP_CLIENT->offGG();
+           }
+           _x0 = floor((obs->obsValue(tLC) - offGG - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
            break;
          }
@@ -92,4 +84,9 @@
      }
      break;
+   case offGG:
+     _epoSpec = true;
+     _sigma0  = OPT->_aprSigClk;
+     _x0      = PPP_CLIENT->offGG();
+     break;     
    case trp:
      _epoSpec = false;
@@ -176,16 +173,10 @@
     if (tLC == t_lc::GIM) {return 0.0;}
     return (sta->xyzApr()[2] - obs->xc()[2]) / rhoV.NormFrobenius();
-  case rClkG:
+  case clkR:
     if (tLC == t_lc::GIM) {return 0.0;}
-    return (obs->prn().system() == 'G') ? 1.0 : 0.0;
-  case rClkR:
+    return 1.0;
+  case offGG:
     if (tLC == t_lc::GIM) {return 0.0;}
     return (obs->prn().system() == 'R') ? 1.0 : 0.0;
-  case rClkE:
-    if (tLC == t_lc::GIM) {return 0.0;}
-    return (obs->prn().system() == 'E') ? 1.0 : 0.0;
-  case rClkC:
-    if (tLC == t_lc::GIM) {return 0.0;}
-    return (obs->prn().system() == 'C') ? 1.0 : 0.0;
   case amb:
     if      (tLC == t_lc::GIM) {return 0.0;}
@@ -310,15 +301,9 @@
     ss << "CRD_Z";
     break;
-  case rClkG:
-    ss << "REC_CLK  G  ";
-    break;
-  case rClkR:
-    ss << "REC_CLK  R  ";
-    break;
-  case rClkE:
-    ss << "REC_CLK  E  ";
-    break;
-  case rClkC:
-    ss << "REC_CLK  C  ";
+  case clkR:
+    ss << "REC_CLK     ";
+    break;
+  case offGG:
+    ss << "OFF_GLO      ";
     break;
   case trp:
@@ -674,20 +659,12 @@
   }
 
-  // GNSS Receiver Clocks
-  // --------------------
-  if (_usedSystems.contains('G')) {
-    required.push_back(new t_pppParam(t_pppParam::rClkG, t_prn(), t_lc::dummy));
-  }
-
-  if (_usedSystems.contains('R')) {
-    required.push_back(new t_pppParam(t_pppParam::rClkR, t_prn(), t_lc::dummy));
-  }
-
-  if (_usedSystems.contains('E')) {
-    required.push_back(new t_pppParam(t_pppParam::rClkE, t_prn(), t_lc::dummy));
-  }
-
-  if (_usedSystems.contains('C')) {
-    required.push_back(new t_pppParam(t_pppParam::rClkC, t_prn(), t_lc::dummy));
+  // Receiver Clock
+  // --------------
+  required.push_back(new t_pppParam(t_pppParam::clkR, t_prn(), t_lc::dummy));
+
+  // GPS-Glonass Clock Offset
+  // ------------------------
+  if (OPT->useSystem('R')) {
+    required.push_back(new t_pppParam(t_pppParam::offGG, t_prn(), t_lc::dummy));
   }
 
Index: trunk/BNC/src/PPP/pppParlist.h
===================================================================
--- trunk/BNC/src/PPP/pppParlist.h	(revision 10001)
+++ trunk/BNC/src/PPP/pppParlist.h	(revision 10002)
@@ -15,5 +15,5 @@
 class t_pppParam {
  public:
-  enum e_type {crdX, crdY, crdZ, rClkG, rClkR, rClkE, rClkC, trp, ion, amb,
+  enum e_type {crdX, crdY, crdZ, clkR, offGG, trp, ion, amb,
                cBiasG1, cBiasR1, cBiasE1, cBiasC1, pBiasG1, pBiasR1, pBiasE1, pBiasC1,
                cBiasG2, cBiasR2, cBiasE2, cBiasC2, pBiasG2, pBiasR2, pBiasE2, pBiasC2};
