Index: trunk/BNC/src/PPP/pppClient.cpp
===================================================================
--- trunk/BNC/src/PPP/pppClient.cpp	(revision 10033)
+++ trunk/BNC/src/PPP/pppClient.cpp	(revision 10034)
@@ -20,4 +20,5 @@
 #include <iomanip>
 #include <cmath>
+#include <stdlib.h>
 #include <string.h>
 #include <stdexcept>
@@ -54,5 +55,5 @@
   _obsPool  = new t_pppObsPool();
   _staRover = new t_pppStation();
-  _filter   = new t_pppFilter(_obsPool);
+  _filter   = new t_pppFilter();
   _tides    = new t_tides();
   _antex    = 0;
@@ -65,12 +66,7 @@
     }
   }
-
-  if (_opt->_refSatRequired) {
-    for (unsigned iSys = 0; iSys < _opt->systems().size(); iSys++) {
-      char sys = _opt->systems()[iSys];
-      _refSatMap[sys] = new t_pppRefSat();
-    }
-  }
-
+  _offGlo = 0.0;
+  _offGal = 0.0;
+  _offBds = 0.0;
   CLIENTS.setLocalData(this);  // CLIENTS takes ownership over "this"
 }
@@ -81,5 +77,4 @@
   delete _log;
   delete _opt;
-  delete _filter;
   delete _ephPool;
   delete _obsPool;
@@ -88,12 +83,7 @@
     delete _antex;
   }
+  delete _filter;
   delete _tides;
   clearObs();
-  QMapIterator<char, t_pppRefSat*> it(_refSatMap);
-  while (it.hasNext()) {
-    it.next();
-    delete it.value();
-  }
-  _refSatMap.clear();
 }
 
@@ -165,5 +155,5 @@
   // -------
   epoTime.reset();
-  clearObs();
+  //clearObs();
 
   // Create vector of valid observations
@@ -218,23 +208,15 @@
     while (it != obsVector.end()) {
       t_pppSatObs* satObs = *it;
-      char sys = satObs->prn().system();
-      t_pppRefSat* refSat = _refSatMap[sys];
-      double stecRef = refSat->stecValue();
-      if (stecRef && !satObs->isReference()) {
-        pseudoObsIono = true;
-        satObs->setPseudoObsIono(t_frequency::G1, stecRef);
-      }
+      pseudoObsIono = satObs->setPseudoObsIono(t_frequency::G1);
       it++;
     }
   }
-
-/*
-  vector<t_pppSatObs*>::iterator it = obsVector.begin();
+  /*vector<t_pppSatObs*>::iterator it = obsVector.begin();
       while (it != obsVector.end()) {
         t_pppSatObs* satObs = *it;
         satObs->printObsMinusComputed();
         it++;
-      }
-*/
+      }*/
+
   return pseudoObsIono;
 }
@@ -330,5 +312,5 @@
     }
     if (maxRes < BLUNDER) {
-      if (print && _numEpoProcessing == 1) {
+      if (print) {
         LOG.setf(ios::fixed);
         LOG << "\nPPP of Epoch ";
@@ -354,5 +336,165 @@
   return success;
 }
-
+// Compute A Priori Glonass Receiver Clock Offset
+//////////////////////////////////////////////////////////////////////////////
+double t_pppClient::cmpOffGlo(vector<t_pppSatObs*>& obsVector) {
+
+  t_lc::type tLC   = t_lc::dummy;
+  double     offGlo = 0.0;
+
+  if (OPT->useSystem('R')) {
+
+    while (obsVector.size() > 0) {
+      offGlo = 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;
+            offGlo += ll;
+            if (fabs(ll) > fabs(maxRes)) {
+              maxRes      = ll;
+              maxResIndex = ii;
+              maxResPrn   = satObs->prn();
+            }
+          }
+        }
+      }
+
+      if (nObs > 0) {
+        offGlo = offGlo / nObs;
+      }
+      else {
+        offGlo = 0.0;
+      }
+
+      if (fabs(maxRes) > 1000.0) {
+        LOG << "t_pppClient::cmpOffGlo outlier " << maxResPrn.toString() << " " << maxRes << endl;
+        obsVector.erase(obsVector.begin() + maxResIndex);
+      }
+      else {
+        break;
+      }
+    }
+  }
+
+  return offGlo;
+}
+
+// Compute A Priori Galileo Receiver Clock Offset
+//////////////////////////////////////////////////////////////////////////////
+double t_pppClient::cmpOffGal(vector<t_pppSatObs*>& obsVector) {
+
+  t_lc::type tLC   = t_lc::dummy;
+  double     offGal = 0.0;
+
+  if (OPT->useSystem('E')) {
+
+    while (obsVector.size() > 0) {
+      offGal = 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() == 'E') {
+          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;
+            offGal += ll;
+            if (fabs(ll) > fabs(maxRes)) {
+              maxRes      = ll;
+              maxResIndex = ii;
+              maxResPrn   = satObs->prn();
+            }
+          }
+        }
+      }
+
+      if (nObs > 0) {
+        offGal = offGal / nObs;
+      }
+      else {
+        offGal = 0.0;
+      }
+
+      if (fabs(maxRes) > 1000.0) {
+        LOG << "t_pppClient::cmpOffGal outlier " << maxResPrn.toString() << " " << maxRes << endl;
+        obsVector.erase(obsVector.begin() + maxResIndex);
+      }
+      else {
+        break;
+      }
+    }
+  }
+
+  return offGal;
+}
+
+
+// Compute A Priori BDS Receiver Clock Offset
+//////////////////////////////////////////////////////////////////////////////
+double t_pppClient::cmpOffBds(vector<t_pppSatObs*>& obsVector) {
+
+  t_lc::type tLC   = t_lc::dummy;
+  double     offBds = 0.0;
+
+  if (_opt->useSystem('C')) {
+    while (obsVector.size() > 0) {
+      offBds = 0.0;
+      double   maxRes      = 0.0;
+      int      maxResIndex = -1;
+      t_prn    maxResPrn;
+      unsigned nObs        = 0;
+      for (unsigned ii = 0; ii < obsVector.size(); ii++) {
+        const t_pppSatObs* satObs = obsVector.at(ii);
+        if (satObs->prn().system() == 'C') {
+          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;
+            offBds += ll;
+            if (fabs(ll) > fabs(maxRes)) {
+              maxRes      = ll;
+              maxResIndex = ii;
+              maxResPrn   = satObs->prn();
+            }
+          }
+        }
+      }
+
+      if (nObs > 0) {
+        offBds = offBds / nObs;
+      }
+      else {
+        offBds = 0.0;
+      }
+
+      if (fabs(maxRes) >  1000.0) {
+        LOG << "t_pppClient::cmpOffBds outlier " << maxResPrn.toString() << " " << maxRes << endl;
+        delete obsVector.at(maxResIndex);
+        obsVector.erase(obsVector.begin() + maxResIndex);
+      }
+      else {
+        break;
+      }
+    }
+  }
+  return offBds;
+}
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -403,12 +545,6 @@
   else {
     _output->_error = true;
-    if (OPT->_obsModelType == OPT->DCMcodeBias ||
-        OPT->_obsModelType == OPT->DCMphaseBias) {
-      if (ind == 1 || ind == 6 || ind > 7) {
-        reset();
-      }
-      //else {_filter->restoreState(ind);}
-    }
-  }
+  }
+
   _output->_log = _log->str();
   delete _log; _log = new ostringstream();
@@ -426,4 +562,5 @@
   station->setAntName(_opt->_antNameRover);
   station->setEpochTime(time);
+
   if (_opt->xyzAprRoverSet()) {
     station->setXyzApr(_opt->_xyzAprRover);
@@ -472,125 +609,68 @@
   try {
     initOutput(output);
-    bool epochReProcessing = false;
-    _numEpoProcessing = 0;
-    if (!_historicalRefSats.isEmpty()) {
-      _historicalRefSats.clear();
-    }
-
-    do {
-      if ((_numEpoProcessing++) > 30) {
-        LOG << "t_pppClient::processEpoch:  _numEpoProcessing > 30" << endl;
-        return finish(failure,12);
-      }
-
-      if (_obsPool->refSatChanged()) {
-        if(_filter->datumTransformation(_refSatMap) != success) {
-          LOG << "t_pppFilter::datumTransformation() != success" << endl;
-          return finish(failure,1);
-        }
-        else {
-          LOG << "t_pppFilter::datumTransformation() == success" << endl;
-          _filter->rememberState(1);
-        }
-      }
-
-      // Prepare Observations of the Rover
-      // ---------------------------------
-      if (prepareObs(satObs, _obsRover, _epoTimeRover) != success) {
-        return finish(failure,2);
-      }
-
-      for (int iter = 1; iter <= 2; iter++) {
-        ColumnVector xyzc(4); xyzc = 0.0;
-        bool print = (iter == 2);
-        if (cmpBancroft(_epoTimeRover, _obsRover, xyzc, print) != success) {
-          return finish(failure,3);
-        }
-
-        if (cmpModel(_staRover, xyzc, _obsRover) != success) {
-          return finish(failure,4);
-        }
-      }
-      // use observations only if satellite code biases are available
-      // ------------------------------------------------------------
-      if (!_opt->_corrMount.empty() &&
-          (OPT->_obsModelType == OPT->DCMcodeBias ||
-           OPT->_obsModelType == OPT->DCMphaseBias)) {
+
+    // Prepare Observations of the Rover
+    // ---------------------------------
+    if (prepareObs(satObs, _obsRover, _epoTimeRover) != success) {
+      return finish(failure, 1);
+    }
+
+    for (int iter = 1; iter <= 2; iter++) {
+      ColumnVector xyzc(4); xyzc = 0.0;
+      bool print = (iter == 2);
+      if (cmpBancroft(_epoTimeRover, _obsRover, xyzc, print) != success) {
+        return finish(failure, 2);
+      }
+       if (cmpModel(_staRover, xyzc, _obsRover) != success) {
+        return finish(failure, 3);
+      }
+    }
+    // use observations only if satellite code biases are available
+    /* ------------------------------------------------------------
+    if (!_opt->_corrMount.empty() {
         useObsWithCodeBiasesOnly(_obsRover);
-      }
-
-      if (int(_obsRover.size()) < _opt->_minObs) {
-        LOG << "t_pppClient::processEpoch not enough observations" << endl;
-        return finish(failure,5);
-      }
-
-      if (_opt->_refSatRequired) {
-        if (handleRefSatellites(_obsRover) != success) {
-          return finish(failure,6);
-        }
-        if (_obsPool->refSatChanged()) {
-          epochReProcessing = true;
-          continue;
-        }
-      }
-
-      // Prepare Pseudo Observations of the Rover
-      // ----------------------------------------
-      _pseudoObsIono = preparePseudoObs(_obsRover);
-
-      // Store last epoch of data
-      // ------------------------
-      _obsPool->putEpoch(_epoTimeRover, _obsRover, _pseudoObsIono, _refSatMap);
-#ifdef BNC_DEBUG_PPP
-      LOG << "PUT EPOCH t_pppClient::processEpoch " << _epoTimeRover.timestr().c_str() << endl;
-#endif
-
-      // Process Epoch in Filter
-      // -----------------------
-      if (_filter->processEpoch(_numEpoProcessing) != success) {
-        LOG << "filter->processEpoch() != success" << endl;
-        return finish(failure,7);
-      }
-
-      // Epoch re-processing required?
-      // -----------------------------
-      if (_obsPool->refSatChangeRequired() && //SLIP
-          _opt->_obsModelType  != t_pppOptions::UncombPPP) {
-        LOG << "pppClient: _obsPool->refSatChangeRequired() " << endl;
-        epochReProcessing = true;
-#ifdef BNC_DEBUG_PPP
-        LOG <<  "DELETE EPOCH" << endl;
-#endif
-        _obsPool->deleteLastEpoch();
-        _filter->restoreState(0);
-        setHistoricalRefSats();
-      }
-      else {
-         epochReProcessing = false;
-         if (OPT->_obsModelType == OPT->DCMcodeBias ||
-             OPT->_obsModelType == OPT->DCMphaseBias) {
-           _filter->rememberState(0);
-         }
-      }
-    } while (epochReProcessing);
-
+    }*/
+
+    if (int(_obsRover.size()) < _opt->_minObs) {
+      LOG << "t_pppClient::processEpoch not enough observations" << endl;
+      return finish(failure, 4);
+    }
+    
+      _offGlo = cmpOffGlo(_obsRover);
+      _offGal = cmpOffGal(_obsRover);
+      _offBds = cmpOffBds(_obsRover);
+      
+    // Prepare Pseudo Observations of the Rover
+    // ----------------------------------------
+    _pseudoObsIono = preparePseudoObs(_obsRover);
+
+    // Store last epoch of data
+    // ------------------------
+    _obsPool->putEpoch(_epoTimeRover, _obsRover, _pseudoObsIono);
+
+    // Process Epoch in Filter
+    // -----------------------
+    if (_filter->processEpoch(_obsPool) != success) {
+      LOG << "filter->processEpoch() != success" << endl;
+      return finish(failure, 5);
+    }
   }
   catch (Exception& exc) {
     LOG << exc.what() << endl;
-    return finish(failure,8);
+    return finish(failure, 6);
   }
   catch (t_except msg) {
     LOG << msg.what() << endl;
-    return finish(failure,9);
+    return finish(failure, 7);
   }
   catch (const char* msg) {
     LOG << msg << endl;
-    return finish(failure,10);
+    return finish(failure, 8);
   }
   catch (...) {
     LOG << "unknown exception" << endl;
-    return finish(failure,11);
-  }
-  return finish(success,0);
+    return finish(failure, 9);
+  }
+  return finish(success, 0);
 }
 
@@ -684,139 +764,5 @@
 //
 //////////////////////////////////////////////////////////////////////////////
-void t_pppClient::setRefSatellites(std::vector<t_pppSatObs*>& obsVector) {
-  // reference satellite definition per system
-  for (unsigned iSys = 0; iSys < _opt->systems().size(); iSys++) {
-    t_irc  refSatReDefinition = success;
-    char sys = _opt->systems()[iSys];
-    bool refSatDefined = false;
-    t_pppRefSat* refSat = _refSatMap[sys];
-    for (unsigned ii = 0; ii < obsVector.size(); ii++) {
-      t_pppSatObs* satObs = obsVector.at(ii);
-      if (satObs->eleSat() < _opt->_minEle) {
-        continue;
-      }
-      // reference satellite is unchanged
-      // ================================
-      if (     !_obsPool->refSatChangeRequired(sys) && refSat->prn() == satObs->prn()) {
-        refSatDefined = true;
-        obsVector[ii]->setAsReference();
-      }
-      // reference satellite has changed
-      // ===============================
-      else if ( _obsPool->refSatChangeRequired(sys) && refSat->prn() != satObs->prn()) {
-        if (satObs->prn().system() == sys) {
-          if (!_historicalRefSats[sys].contains(satObs->prn())) {
-            refSatDefined = true;
-            obsVector[ii]->setAsReference();
-            refSat->setPrn(satObs->prn());
-          }
-          else if ( _historicalRefSats[sys].contains(satObs->prn())) {
-            refSatReDefinition = failure;
-          }
-        }
-      }
-      if (refSatDefined) {
-        if (OPT->_pseudoObsIono) {
-          refSat->setStecValue(satObs->getIonoCodeDelay(t_frequency::G1));
-        }
-        break;
-      }
-    }
-
-    // all available satellites were already tried to use
-    if ((!refSatDefined) && (refSatReDefinition == failure)) {
-      refSat->setPrn(t_prn(sys, 99));
-      _obsPool->setRefSatChangeRequired(sys, false);
-      return;
-    }
-
-    // reference satellite has to be initialized
-    // =========================================
-    if (!refSatDefined) {
-      for (unsigned ii = 0; ii < obsVector.size(); ii++) {
-        t_pppSatObs* satObs = obsVector.at(ii);
-        if (satObs->eleSat() < _opt->_minEle) {
-          continue;
-        }
-        if (satObs->prn().system() == sys &&
-            !_historicalRefSats[sys].contains(satObs->prn())) {
-          obsVector[ii]->setAsReference();
-          refSat->setPrn(satObs->prn());
-          if (OPT->_pseudoObsIono) {
-            refSat->setStecValue(satObs->getIonoCodeDelay(t_frequency::G1));
-          }
-          refSatDefined = true;
-          break;
-        }
-      }
-    }
-
-    // no observations for that system
-    // ===============================
-    if (!refSatDefined) {
-      refSat->setPrn(t_prn());
-    }
-    _obsPool->setRefSatChangeRequired(sys, false); // done or impossible
-  }
-
-  return;
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-t_irc t_pppClient::handleRefSatellites(std::vector<t_pppSatObs*>& obsVector) {
-
-  // set refSats in current epoch
-  // ============================
-  setRefSatellites(obsVector); // current epoch
-  LOG.setf(ios::fixed);
-  t_pppObsPool::t_epoch* epoch = _obsPool->lastEpoch();
-  const QMap<char, t_pppRefSat*>& refSatMapLastEpoch = epoch->refSatMap();
-
-  QMapIterator<char, t_pppRefSat*> it(_refSatMap);
-  while (it.hasNext()) {
-    it.next();
-    char  sys = it.key();
-    t_prn prn = it.value()->prn();
-    t_prn refSatLastEpochPrn = t_prn();
-    if (epoch) {
-      refSatLastEpochPrn =  refSatMapLastEpoch[sys]->prn();
-    }
-    if      (prn.number() ==  0) { // no obs for that system available
-      continue;
-    }
-    else if (prn.number() == 99) { // refSat re-definition not possible
-      LOG << " => refSat re-definition impossible: " << sys << endl;
-      return failure;
-    }
-    QString str;
-    if (prn == refSatLastEpochPrn || refSatLastEpochPrn == t_prn() )  {
-      _obsPool->setRefSatChanged(sys, false);
-      str = " SET   ";
-    }
-    else {
-      _obsPool->setRefSatChanged(sys, true);
-      str = " RESET ";
-    }
-    LOG << string(_epoTimeRover) <<  str.toStdString() << " REFSAT  " << sys << ": " << prn.toString() << endl;
-  }
-  return success;
-}
-
-void t_pppClient::setHistoricalRefSats() {
-  QMapIterator<char, t_pppRefSat*> it(_refSatMap);
-  while (it.hasNext()) {
-    it.next();
-    t_prn prn = it.value()->prn();
-    char sys = prn.system();
-    if (_obsPool->refSatChangeRequired(sys)) {
-      _historicalRefSats[sys].append(prn);
-    }
-  }
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-void t_pppClient::reset() {LOG << "t_pppClient::reset()" << endl;
+void t_pppClient::reset() {cout << "t_pppClient::reset()" << endl;
 
   // to delete old orbit and clock corrections
@@ -830,5 +776,5 @@
   // to delete all parameters
   delete _filter;
-  _filter   = new t_pppFilter(_obsPool);
-
-}
+  _filter   = new t_pppFilter();
+
+}
Index: trunk/BNC/src/PPP/pppClient.h
===================================================================
--- trunk/BNC/src/PPP/pppClient.h	(revision 10033)
+++ trunk/BNC/src/PPP/pppClient.h	(revision 10034)
@@ -4,10 +4,8 @@
 #include <sstream>
 #include <vector>
-#include <QMap>
 #include "pppInclude.h"
 #include "ephemeris.h"
 #include "pppOptions.h"
 #include "pppModel.h"
-#include "pppRefSat.h"
 
 class bncAntex;
@@ -38,4 +36,7 @@
   const bncAntex*     antex() const {return _antex;}
   const t_pppStation* staRover() const {return _staRover;}
+  double              offGlo() const {return _offGlo;}
+  double              offGal() const {return _offGal;}
+  double              offBds() const {return _offBds;}
 
   std::ostringstream& log() {return *_log;}
@@ -63,8 +64,5 @@
   double cmpOffGal(std::vector<t_pppSatObs*>& obsVector);
   double cmpOffBds(std::vector<t_pppSatObs*>& obsVector);
-  t_irc handleRefSatellites(std::vector<t_pppSatObs*>& obsVector);
-  void setRefSatellites(std::vector<t_pppSatObs*>& obsVector);
-  void setHistoricalRefSats();
-
+  
   t_output*                 _output;
   t_pppEphPool*             _ephPool;
@@ -74,12 +72,12 @@
   bncAntex*                 _antex;
   t_pppFilter*              _filter;
+  double                    _offGlo;
+  double                    _offGal;
+  double                    _offBds;  
   std::vector<t_pppSatObs*> _obsRover;
-  QMap<char, t_pppRefSat*>  _refSatMap;
   std::ostringstream*       _log;
   t_pppOptions*             _opt;
   t_tides*                  _tides;
   bool                      _pseudoObsIono;
-  int                       _numEpoProcessing;
-  QMap<char, QList<t_prn>>  _historicalRefSats;
 };
 
Index: trunk/BNC/src/PPP/pppFilter.cpp
===================================================================
--- trunk/BNC/src/PPP/pppFilter.cpp	(revision 10033)
+++ trunk/BNC/src/PPP/pppFilter.cpp	(revision 10034)
@@ -27,4 +27,5 @@
 #include "pppObsPool.h"
 #include "pppStation.h"
+#include "pppClient.h"
 
 using namespace BNC_PPP;
@@ -33,9 +34,6 @@
 // Constructor
 ////////////////////////////////////////////////////////////////////////////
-t_pppFilter::t_pppFilter(t_pppObsPool *obsPool) {
-  _numSat = 0;
-  _obsPool = obsPool;
-  _refPrn = t_prn();
-  _datumTrafo = new t_datumTrafo();
+t_pppFilter::t_pppFilter() {
+  _parlist = 0;
 }
 
@@ -43,21 +41,22 @@
 ////////////////////////////////////////////////////////////////////////////
 t_pppFilter::~t_pppFilter() {
-  delete _datumTrafo;
+  delete _parlist;
 }
 
 // Process Single Epoch
 ////////////////////////////////////////////////////////////////////////////
-t_irc t_pppFilter::processEpoch(int num) {
+t_irc t_pppFilter::processEpoch(t_pppObsPool* obsPool) {
+
   _numSat = 0;
   const double maxSolGap = 60.0;
   bool setNeuNoiseToZero = false;
 
-  if (num > 1) {
-    setNeuNoiseToZero = true;
+  if (!_parlist) {
+    _parlist = new t_pppParlist();
   }
 
   // Vector of all Observations
   // --------------------------
-  t_pppObsPool::t_epoch *epoch = _obsPool->lastEpoch();
+  t_pppObsPool::t_epoch *epoch = obsPool->lastEpoch();
   if (!epoch) {
     return failure;
@@ -77,19 +76,11 @@
   string epoTimeStr = string(_epoTime);
 
-  const QMap<char, t_pppRefSat*> &refSatMap = epoch->refSatMap();
-
-  const QList<char> &usedSystems = _parlist.usedSystems();
-  //--
+  const QList<char> &usedSystems = _parlist->usedSystems();
+
   // Set Parameters
-  if (_parlist.set(_epoTime, allObs, refSatMap) != success) {
+  // --------------
+  if (_parlist->set(_epoTime, allObs) != success) {
     return failure;
   }
-
-#ifdef BNC_DEBUG_PPP
-  if (OPT->_obsModelType == OPT->DCMcodeBias ||
-      OPT->_obsModelType == OPT->DCMphaseBias) {
-//    _parlist.printParams(_epoTime);
-  }
-#endif
 
   // Status Vector, Variance-Covariance Matrix
@@ -99,54 +90,8 @@
   setStateVectorAndVarCovMatrix(xFltOld, QFltOld, setNeuNoiseToZero);
 
-  // Pre-Process Satellite Systems separately
-  // ----------------------------------------
-  bool preProcessing = false;
-  if (OPT->_obsModelType == OPT->DCMcodeBias ||
-      OPT->_obsModelType == OPT->DCMphaseBias) {
-    preProcessing = true;
-    for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
-      char sys = usedSystems[iSys];
-      _refPrn.set(sys, 0);
-      if (OPT->_refSatRequired) {
-        _refPrn = refSatMap[sys]->prn();
-      }
-      vector<t_pppSatObs*> obsVector;
-      for (unsigned jj = 0; jj < allObs.size(); jj++) {
-        if (allObs[jj]->prn().system() == sys) {
-          obsVector.push_back(allObs[jj]);
-        }
-      }
-      if (iSys == 0) {
-        _datumTrafo->setFirstSystem(sys);
-      }
-      if (processSystem(OPT->LCs(sys), obsVector, _refPrn,
-          epoch->pseudoObsIono(), preProcessing) != success) {
-        LOG << sys << ": processSystem !=  success (pre-processing)" << endl;
-        _xFlt = xFltOld;
-        _QFlt = QFltOld;
-        restoreState(1);
-        return failure;
-      }
-    }
-    // refSat change required?
-    // -----------------------
-    if (_obsPool->refSatChangeRequired()) {
-      _xFlt = xFltOld;
-      _QFlt = QFltOld;
-      return success;
-    } else if (!_obsPool->refSatChangeRequired()) {
-      initDatumTransformation(allObs, epoch->pseudoObsIono());
-    }
-  }
-
   // Process Satellite Systems separately
   // ------------------------------------
-  preProcessing = false;
   for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
     char sys = usedSystems[iSys];
-    _refPrn.set(sys, 0);
-    if (OPT->_refSatRequired) {
-      _refPrn = refSatMap[sys]->prn();
-    }
     unsigned int num = 0;
     vector<t_pppSatObs*> obsVector;
@@ -154,21 +99,10 @@
       if (allObs[jj]->prn().system() == sys) {
         obsVector.push_back(allObs[jj]);
-        ++num;
-      }
-    }
-    if (iSys == 0 && OPT->_obsModelType == OPT->UncombPPP) {
-      _datumTrafo->setFirstSystem(sys);
-    }
-    LOG << epoTimeStr << " SATNUM " << sys << ' ' << right << setw(2) << num
-        << endl;
-    if (processSystem(OPT->LCs(sys), obsVector, _refPrn,
-        epoch->pseudoObsIono(), preProcessing) != success) {
-      LOG << "processSystem !=  success (fin-processing)" << endl;
-      if (OPT->_obsModelType == OPT->DCMcodeBias ||
-          OPT->_obsModelType == OPT->DCMphaseBias) {
-        _xFlt = xFltOld;
-        _QFlt = QFltOld;
-        restoreState(2);
-      }
+        num++;
+      }
+    }
+    LOG << epoTimeStr << " SATNUM " << sys << ' ' << right << setw(2) << num  << endl;
+    if (processSystem(OPT->LCs(sys), obsVector, epoch->pseudoObsIono()) != success) {
+      LOG << "processSystem !=  success: " << sys << endl;
       return failure;
     }
@@ -177,6 +111,6 @@
   // close epoch processing
   // ----------------------
-  cmpDOP(allObs, refSatMap);
-  _parlist.printResult(_epoTime, _QFlt, _xFlt);
+  cmpDOP(allObs);
+  _parlist->printResult(_epoTime, _QFlt, _xFlt);
   _lastEpoTimeOK = _epoTime; // remember time of last successful epoch processing
   return success;
@@ -186,23 +120,19 @@
 ////////////////////////////////////////////////////////////////////////////
 t_irc t_pppFilter::processSystem(const vector<t_lc::type> &LCs,
-    const vector<t_pppSatObs*> &obsVector, const t_prn &refPrn,
-    bool pseudoObsIonoAvailable, bool preProcessing) {
+                                 const vector<t_pppSatObs*> &obsVector,
+                                 bool pseudoObsIonoAvailable) {
   LOG.setf(ios::fixed);
-  char sys = refPrn.system();
 
   // Detect Cycle Slips
   // ------------------
-  if (detectCycleSlips(LCs, obsVector, refPrn, preProcessing) != success) {
+  if (detectCycleSlips(LCs, obsVector) != success) {
     return failure;
   }
-  if (preProcessing && _obsPool->refSatChangeRequired(sys)) {
-    return success;
-  }
-
-  ColumnVector xSav = _xFlt;
+
+  ColumnVector    xSav = _xFlt;
   SymmetricMatrix QSav = _QFlt;
-  string epoTimeStr = string(_epoTime);
-  const vector<t_pppParam*> &params = _parlist.params();
-  unsigned nPar = _parlist.nPar();
+  string          epoTimeStr = string(_epoTime);
+  const vector<t_pppParam*> &params = _parlist->params();
+  unsigned        nPar = _parlist->nPar();
 
   unsigned usedLCs = LCs.size();
@@ -213,8 +143,4 @@
   unsigned maxObs = obsVector.size() * usedLCs;
 
-  if (OPT->_pseudoObsIono && pseudoObsIonoAvailable) {
-    maxObs -= 1; // pseudo obs iono with respect to refSat
-  }
-
   // Outlier Detection Loop
   // ----------------------
@@ -229,7 +155,6 @@
     // -----------------------------------------------------------
     Matrix AA(maxObs, nPar);
-    ColumnVector ll(maxObs);
-    DiagonalMatrix PP(maxObs);
-    PP = 0.0;
+    ColumnVector ll(maxObs);   ll = 0.0;
+    DiagonalMatrix PP(maxObs); PP = 0.0;
 
     int iObs = -1;
@@ -242,5 +167,5 @@
     for (unsigned ii = 0; ii < obsVector.size(); ii++) {
       t_pppSatObs *obs = obsVector[ii];
-      if (iOutlier == 0 && !preProcessing) {
+      if (iOutlier == 0) {
         obs->resetOutlier();
       }
@@ -257,8 +182,7 @@
           for (unsigned iPar = 0; iPar < nPar; iPar++) {
             const t_pppParam *par = params[iPar];
-            AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn);
+            AA[iObs][iPar] = par->partial(_epoTime, obs, tLC);
           }
-          ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC)
-                   - DotProduct(_x0, AA.Row(iObs + 1));
+          ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs + 1));
           PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC));
         }
@@ -269,13 +193,6 @@
     // ----------------------------
     if ((iObs +1) < OPT->_minObs) {
-      LOG << "t_pppFilter::processSystem not enough observations " << sys << ": " << iObs + 1 << "\n";
+      LOG << "t_pppFilter::processSystem not enough observations " << iObs + 1 << "\n";
       return failure;
-    }
-
-    if ((!iOutlier) &&
-        (OPT->_obsModelType == OPT->DCMcodeBias ||
-         OPT->_obsModelType == OPT->DCMphaseBias) && (!preProcessing)) {
-      _datumTrafo->updateIndices(sys, iObs + 1);
-      _datumTrafo->prepareAA(AA.SubMatrix(1, iObs + 1, 1, _parlist.nPar()), 1);
     }
 
@@ -288,5 +205,5 @@
           for (unsigned jj = 0; jj < usedLCs; jj++) {
             const t_lc::type tLC = LCs[jj];
-            if (tLC == t_lc::GIM && !obs->isReference()) {
+            if (tLC == t_lc::GIM) {
               ++iObs;
             } else {
@@ -297,8 +214,7 @@
             for (unsigned iPar = 0; iPar < nPar; iPar++) {
               const t_pppParam *par = params[iPar];
-              AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn);
+              AA[iObs][iPar] = par->partial(_epoTime, obs, tLC);
             }
-            ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC)
-                     - DotProduct(_x0, AA.Row(iObs + 1));
+            ll[iObs] = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA.Row(iObs + 1));
             PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC));
           }
@@ -340,43 +256,26 @@
       t_pppSatObs *obs = usedObs[maxOutlierIndex];
       t_pppParam *par = 0;
+      LOG << epoTimeStr << " Outlier " << t_lc::toString(maxOutlierLC) << ' '
+          << obs->prn().toString() << ' ' << setw(8) << setprecision(4)
+          << maxOutlier << endl;
       for (unsigned iPar = 0; iPar < nPar; iPar++) {
         t_pppParam *hlp = params[iPar];
         if (hlp->type() == t_pppParam::amb &&
-            hlp->prn() == obs->prn() &&
-            hlp->tLC() == usedTypes[maxOutlierIndex]) {
+            hlp->prn()  == obs->prn() &&
+            hlp->tLC()  == usedTypes[maxOutlierIndex]) {
           par = hlp;
         }
       }
-      if (preProcessing) {
-        if (obs->prn() == refPrn) {
-            LOG << epoTimeStr << " Outlier ("
-                << ((preProcessing) ? "pre-processing) " : "fin-processing) ")
-                << t_lc::toString(maxOutlierLC) << ' ' << obs->prn().toString()
-                << ' ' << setw(8) << setprecision(4) << maxOutlier << endl;
-            _obsPool->setRefSatChangeRequired(sys, true);
-            break;
+      if (par) {
+        if (par->ambResetCandidate()) {
+          resetAmb(par->prn(), obsVector, maxOutlierLC, &QSav, &xSav);
         }
         else {
+          par->setAmbResetCandidate();
           obs->setOutlier();
         }
       }
-      else {    // fin-processing
-        LOG << epoTimeStr << " Outlier " << t_lc::toString(maxOutlierLC) << ' '
-            << obs->prn().toString() << ' ' << setw(8) << setprecision(4)
-            << maxOutlier << endl;
-        if (par) {
-          if (par->ambResetCandidate() ||
-              OPT->_obsModelType == OPT->DCMcodeBias ||
-              OPT->_obsModelType == OPT->DCMphaseBias) {
-            resetAmb(par->prn(), obsVector, maxOutlierLC, &QSav, &xSav);
-          }
-          else {
-            par->setAmbResetCandidate();
-            obs->setOutlier();
-          }
-        }
-        else {
-          obs->setOutlier();
-        }
+      else {
+        obs->setOutlier();
       }
     }
@@ -384,5 +283,4 @@
     // ---------------
     else {
-      if (!preProcessing) {
         for (unsigned jj = 0; jj < LCs.size(); jj++) {
           for (unsigned ii = 0; ii < usedObs.size(); ii++) {
@@ -393,7 +291,6 @@
               LOG << epoTimeStr << " RES " << left << setw(3)
                   << t_lc::toString(tLC) << right << ' '
-                  << obs->prn().toString();
-              LOG << setw(9) << setprecision(4) << vv[ii] << endl;
-            }
+                  << obs->prn().toString() << ' '
+                  << setw(8) << setprecision(4) << vv[ii] << endl;
           }
         }
@@ -408,11 +305,9 @@
 ////////////////////////////////////////////////////////////////////////////
 t_irc t_pppFilter::detectCycleSlips(const vector<t_lc::type> &LCs,
-    const vector<t_pppSatObs*> &obsVector, const t_prn &refPrn,
-    bool preProcessing) {
-  const double SLIP = 50.0;
-  char sys = refPrn.system();
+                                    const vector<t_pppSatObs*> &obsVector) {
+
+  const double SLIP = 20.0;
   string epoTimeStr = string(_epoTime);
-  const vector<t_pppParam*> &params = _parlist.params();
-  unsigned nPar = _parlist.nPar();
+  const vector<t_pppParam*> &params = _parlist->params();
 
   for (unsigned ii = 0; ii < LCs.size(); ii++) {
@@ -426,65 +321,51 @@
         bool slip = false;
 
-        // in pre-processing only the reference satellite has to be checked
-        if (preProcessing && obs->prn() != refPrn) {
-          continue;
-        }
-
         if (obs->slip()) {
-          LOG << epoTimeStr << "cycle slip set (obs) " << obs->prn().toString()
-              << endl;
+          LOG << epoTimeStr << "cycle slip set (obs) " << obs->prn().toString() << endl;
           slip = true;
         }
 
-        if (_slips[obs->prn()]._obsSlipCounter != -1
-            && _slips[obs->prn()]._obsSlipCounter != obs->slipCounter()) {
-          LOG << epoTimeStr << "cycle slip set (obsSlipCounter) "
-              << obs->prn().toString() << endl;
+        if (_slips[obs->prn()]._obsSlipCounter != -1 &&
+            _slips[obs->prn()]._obsSlipCounter != obs->slipCounter()) {
+          LOG << epoTimeStr  << "cycle slip set (obsSlipCounter) " << obs->prn().toString()  << endl;
           slip = true;
         }
-        if (!preProcessing) {
-          _slips[obs->prn()]._obsSlipCounter = obs->slipCounter();
-        }
-        if (_slips[obs->prn()]._biasJumpCounter != -1
-            && _slips[obs->prn()]._biasJumpCounter != obs->biasJumpCounter()) {
-          LOG << epoTimeStr << "cycle slip set (biasJumpCounter) "
-              << obs->prn().toString() << endl;
+        _slips[obs->prn()]._obsSlipCounter = obs->slipCounter();
+
+        if (_slips[obs->prn()]._biasJumpCounter != -1 &&
+            _slips[obs->prn()]._biasJumpCounter != obs->biasJumpCounter()) {
+          LOG << epoTimeStr  << "cycle slip set (biasJumpCounter) " << obs->prn().toString() << endl;
           slip = true;
         }
-        if (!preProcessing) {
-          _slips[obs->prn()]._biasJumpCounter = obs->biasJumpCounter();
-        }
+        _slips[obs->prn()]._biasJumpCounter = obs->biasJumpCounter();
+
         // Slip Set
         // --------
         if (slip) {
-          if (preProcessing) {
-            _obsPool->setRefSatChangeRequired(sys, true);
-          } else {
+          resetAmb(obs->prn(), obsVector, tLC);
+        }
+
+        // Check Pre-Fit Residuals
+        // -----------------------
+        else {
+          ColumnVector AA(params.size());
+          for (unsigned iPar = 0; iPar < params.size(); iPar++) {
+            const t_pppParam* par = params[iPar];
+            AA[iPar] = par->partial(_epoTime, obs, tLC);
+          }
+
+          double ll = obs->obsValue(tLC) - obs->cmpValue(tLC) - DotProduct(_x0, AA);
+          double vv = DotProduct(AA, _xFlt) - ll;
+
+          if (fabs(vv) > SLIP) {
+            LOG << epoTimeStr << " cycle slip detected " << t_lc::toString(tLC) << ' '
+                << obs->prn().toString() << ' ' << setw(8) << setprecision(4) << vv << endl;
             resetAmb(obs->prn(), obsVector, tLC);
           }
         }
-        // Check Pre-Fit Residuals
-        /* -----------------------
-        else {
-          if (!preProcessing) {
-            ColumnVector AA(nPar);
-            for (unsigned iPar = 0; iPar < nPar; iPar++) {
-              const t_pppParam *par = params[iPar];
-              AA[iPar] = par->partial(_epoTime, obs, tLC, refPrn);
-            }
-            double ll = obs->obsValue(tLC) - obs->cmpValue(tLC)
-                      - DotProduct(_x0, AA);
-            double vv = DotProduct(AA, _xFlt) - ll;
-            if (fabs(vv) > SLIP) {
-              LOG << epoTimeStr << " cycle slip detected " << t_lc::toString(tLC)
-                  << ' ' << obs->prn().toString() << ' ' << setw(8)
-                  << setprecision(4) << vv << endl;
-              resetAmb(obs->prn(), obsVector, tLC);
-            }
-          }
-        }*/
-      }
-    }
-  }
+      }
+    }
+  }
+
   return success;
 }
@@ -496,5 +377,5 @@
 
   t_irc irc = failure;
-  vector<t_pppParam*> &params = _parlist.params();
+  vector<t_pppParam*>& params = _parlist->params();
   for (unsigned iPar = 0; iPar < params.size(); iPar++) {
     t_pppParam *par = params[iPar];
@@ -506,6 +387,5 @@
       }
       LOG << string(_epoTime) << " RESET " << par->toString() << endl;
-      delete par;
-      par = new t_pppParam(t_pppParam::amb, prn, tLC, &obsVector);
+      delete par; par = new t_pppParam(t_pppParam::amb, prn, tLC, &obsVector);
       par->setIndex(ind);
       params[iPar] = par;
@@ -532,27 +412,7 @@
 }
 
-// Add infinite noise to iono
-////////////////////////////////////////////////////////////////////////////
-t_irc t_pppFilter::addNoiseToPar(t_pppParam::e_type parType, char sys) {
-  t_irc irc = failure;
-  vector<t_pppParam*> &params = _parlist.params();
-  for (unsigned iPar = 0; iPar < params.size(); iPar++) {
-    t_pppParam *par = params[iPar];
-    if (par->type() == parType && par->prn().system() == sys) {
-      int ind = par->indexNew();
-      LOG << string(_epoTime) << " ADD NOISE TO " << par->toString() << endl;
-      par->setIndex(ind);
-      _QFlt(ind + 1, ind + 1) = par->sigma0() * par->sigma0();
-      irc = success;
-    }
-  }
-
-  return irc;
-}
-
 // Compute various DOP Values
 ////////////////////////////////////////////////////////////////////////////
-void t_pppFilter::cmpDOP(const vector<t_pppSatObs*> &obsVector,
-    const QMap<char, t_pppRefSat*> &refSatMap) {
+void t_pppFilter::cmpDOP(const vector<t_pppSatObs*> &obsVector) {
 
   _dop.reset();
@@ -564,14 +424,9 @@
     for (unsigned ii = 0; ii < obsVector.size(); ii++) {
       t_pppSatObs *obs = obsVector[ii];
-      char sys = obs->prn().system();
-      t_prn refPrn = t_prn();
-      if (OPT->_refSatRequired) {
-        refPrn = refSatMap[sys]->prn();
-      }
       if (obs->isValid() && !obs->outlier()) {
         ++_numSat;
         for (unsigned iPar = 0; iPar < numPar; iPar++) {
-          const t_pppParam *par = _parlist.params()[iPar];
-          AA[_numSat - 1][iPar] = par->partial(_epoTime, obs, t_lc::c1, refPrn);
+          const t_pppParam* par = _parlist->params()[iPar];
+          AA[_numSat - 1][iPar] = par->partial(_epoTime, obs, t_lc::c1);
         }
       }
@@ -581,6 +436,5 @@
     }
     AA = AA.Rows(1, _numSat);
-    SymmetricMatrix NN;
-    NN << AA.t() * AA;
+    SymmetricMatrix NN; NN << AA.t() * AA;
     SymmetricMatrix QQ = NN.i();
 
@@ -590,5 +444,6 @@
     _dop.T = sqrt(QQ(4, 4));
     _dop.G = sqrt(QQ(1, 1) + QQ(2, 2) + QQ(3, 3) + QQ(4, 4));
-  } catch (...) {
+  }
+  catch (...) {
   }
 }
@@ -598,5 +453,6 @@
 void t_pppFilter::predictCovCrdPart(const SymmetricMatrix &QFltOld, bool setNeuNoiseToZero) {
 
-  const vector<t_pppParam*> &params = _parlist.params();
+  const vector<t_pppParam*>& params = _parlist->params();
+
   if (params.size() < 3) {
     return;
@@ -605,11 +461,11 @@
   bool first = (params[0]->indexOld() < 0);
 
-  SymmetricMatrix Qneu(3);
-  Qneu = 0.0;
+  SymmetricMatrix Qneu(3); Qneu = 0.0;
   for (unsigned ii = 0; ii < 3; ii++) {
     const t_pppParam *par = params[ii];
     if (first) {
       Qneu[ii][ii] = par->sigma0() * par->sigma0();
-    } else {
+    }
+    else {
       Qneu[ii][ii] = par->noise() * par->noise();
     }
@@ -622,9 +478,11 @@
   if (first) {
     _QFlt.SymSubMatrix(1, 3) = Qxyz;
-  } else {
+  }
+  else {
     double dt = _epoTime - _firstEpoTime;
     if (dt < OPT->_seedingTime || setNeuNoiseToZero) {
       _QFlt.SymSubMatrix(1, 3) = QFltOld.SymSubMatrix(1, 3);
-    } else {
+    }
+    else {
       _QFlt.SymSubMatrix(1, 3) = QFltOld.SymSubMatrix(1, 3) + Qxyz;
     }
@@ -637,13 +495,10 @@
     const SymmetricMatrix &QFltOld, bool setNeuNoiseToZero) {
 
-  const vector<t_pppParam*> &params = _parlist.params();
+  const vector<t_pppParam*>& params = _parlist->params();
   unsigned nPar = params.size();
 
-  _QFlt.ReSize(nPar);
-  _QFlt = 0.0;
-  _xFlt.ReSize(nPar);
-  _xFlt = 0.0;
-  _x0.ReSize(nPar);
-  _x0 = 0.0;
+  _QFlt.ReSize(nPar); _QFlt = 0.0;
+  _xFlt.ReSize(nPar); _xFlt = 0.0;
+  _x0.ReSize(nPar);   _x0   = 0.0;
 
   for (unsigned ii = 0; ii < nPar; ii++) {
@@ -671,228 +526,2 @@
 }
 
-// Compute datum transformation
-////////////////////////////////////////////////////////////////////////////
-t_irc t_pppFilter::datumTransformation(
-    const QMap<char, t_pppRefSat*> &refSatMap) {
-
-  // get last epoch
-  t_pppObsPool::t_epoch *epoch = _obsPool->lastEpoch();
-#ifdef BNC_DEBUG_PPP
-    LOG << "GET LAST EPOCH" << endl;
-#endif
-  if (!epoch) {
-    LOG << "t_pppFilter::datumTransformation: !lastEpoch" << endl;
-    return failure;
-  }
-  _epoTime = epoch->epoTime();
-
-  LOG.setf(ios::fixed);
-  LOG  << "DATUM TRANSFORMATION in Epoch  "<<  string(_epoTime) << endl;
-
-  vector<t_pppSatObs*> &allObs = epoch->obsVector();
-
-  const QMap<char, t_pppRefSat*> &refSatMapLastEpoch = epoch->refSatMap();
-
-  bool pseudoObsIono = epoch->pseudoObsIono();
-
-  // reset old and set new refSats in last epoch (ambiguities/GIM)
-  // =============================================================
-  if (resetRefSatellitesLastEpoch(allObs, refSatMap, refSatMapLastEpoch) != true) {
-    LOG << "datumTransformation: resetRefSatellitesLastEpoch != success"  << endl;
-    return failure;
-  }
-
-  if (OPT->_obsModelType == OPT->UncombPPP) {
-    _obsPool->putEpoch(_epoTime, allObs, pseudoObsIono, refSatMap);
-    return success;
-  }
-
-  // set AA2
-  // =======
-  if (_parlist.set(_epoTime, allObs, refSatMap) != success) {
-    return failure;
-  }
-#ifdef BNC_DEBUG_PPP
-  //_parlist.printParams(_epoTime);
-#endif
-
-  const QList<char> &usedSystems = _parlist.usedSystems();
-  for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
-    char sys = usedSystems[iSys];
-    t_prn refPrn = refSatMap[sys]->prn();
-    vector<t_pppSatObs*> obsVector;
-    for (unsigned jj = 0; jj < allObs.size(); jj++) {
-      if (allObs[jj]->prn().system() == sys) {
-        allObs[jj]->resetOutlier();
-        obsVector.push_back(allObs[jj]);
-      }
-    }
-    if (iSys == 0) {
-      _datumTrafo->setFirstSystem(sys);
-    }
-    vector<t_lc::type> LCs = OPT->LCs(sys);
-    unsigned usedLCs = LCs.size();
-    if (OPT->_pseudoObsIono && !pseudoObsIono) {
-      usedLCs -= 1;  // GIM not used
-    }
-    // max Obs
-    unsigned maxObs = obsVector.size() * usedLCs;
-
-    if (OPT->_pseudoObsIono && pseudoObsIono) {
-      maxObs -= 1; // pseudo obs iono with respect to refSat
-    }
-
-    const vector<t_pppParam*> &params = _parlist.params();
-    unsigned nPar = _parlist.nPar();
-
-    Matrix AA(maxObs, nPar); AA = 0.0;
-
-    // Real Observations
-    // -----------------
-    int iObs = -1;
-    for (unsigned ii = 0; ii < obsVector.size(); ii++) {
-      t_pppSatObs *obs = obsVector[ii];
-      for (unsigned jj = 0; jj < usedLCs; jj++) {
-        const t_lc::type tLC = LCs[jj];
-        if (tLC == t_lc::GIM) {
-          continue;
-        }
-        ++iObs;
-        for (unsigned iPar = 0; iPar < nPar; iPar++) {
-          const t_pppParam *par = params[iPar];
-          AA[iObs][iPar] = par->partial(_epoTime, obs, tLC, refPrn);
-        }
-      }
-    }
-
-    if (!(iObs+1)) {
-      continue;
-    }
-    _datumTrafo->updateIndices(sys, iObs + 1);
-
-    if (_datumTrafo->prepareAA(AA.SubMatrix(1, iObs + 1, 1, nPar), 2)  != success) {
-      return failure;
-    }
-  }
-  _datumTrafo->updateNumObs();
-
-  // Datum Transformation
-  // ====================
-  if (_datumTrafo->computeTrafoMatrix() != success) {
-    return failure;
-  }
-
-  ColumnVector    xFltOld = _xFlt;
-  SymmetricMatrix QFltOld = _QFlt;
-
-  _QFlt << _datumTrafo->D21() * QFltOld * _datumTrafo->D21().t();
-  _xFlt = _datumTrafo->D21() * xFltOld;
-
-#ifdef BNC_DEBUG_PPP
-//  LOG << "xFltOld:\n" << xFltOld << endl;
-//  LOG << "xFlt   :\n" << _xFlt   << endl;
-#endif
-
-  // Reset Ambiguities after Datum Transformation
-  // ============================================
-  for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
-    char sys = usedSystems[iSys];
-    vector<t_lc::type> LCs = OPT->LCs(sys);
-    unsigned usedLCs = LCs.size();
-    if (OPT->_pseudoObsIono && !pseudoObsIono) {
-      usedLCs -= 1;  // GIM not used
-    }
-    t_prn refPrnOld = refSatMapLastEpoch[sys]->prn();
-    t_prn refPrnNew = refSatMap[sys]->prn();
-    if (refPrnNew != refPrnOld) {
-      for (unsigned jj = 0; jj < usedLCs; jj++) {
-        const t_lc::type tLC = LCs[jj];
-        if (tLC == t_lc::GIM) {
-          continue;
-        }
-        resetAmb(refPrnOld, allObs, tLC);
-      }
-    }
-  }
-
-  // switch AA2 to AA1
-  // =================
-  _datumTrafo->switchAA();
-
-  _obsPool->putEpoch(_epoTime, allObs, pseudoObsIono, refSatMap);
-#ifdef BNC_DEBUG_PPP
-  LOG << "PUT EPOCH t_pppFilter::datumTransformation " << _epoTime.timestr().c_str() << endl;
-#endif
-
-  return success;
-}
-
-// Init datum transformation
-////////////////////////////////////////////////////////////////////////////
-void t_pppFilter::initDatumTransformation(
-    const std::vector<t_pppSatObs*> &allObs, bool pseudoObsIono) {
-  unsigned trafoObs = 0;
-  const QList<char> &usedSystems = _parlist.usedSystems();
-  for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
-    char sys = usedSystems[iSys];
-    int satNum = 0;
-    for (unsigned jj = 0; jj < allObs.size(); jj++) {
-      if (allObs[jj]->prn().system() == sys) {
-        satNum++;
-      }
-    }
-    // all LCs
-    unsigned realUsedLCs = OPT->LCs(sys).size();
-    // exclude pseudo obs GIM
-    if (OPT->_pseudoObsIono && !pseudoObsIono) {
-      realUsedLCs -= 1;
-    }
-
-    trafoObs += satNum * realUsedLCs;
-
-    if (OPT->_pseudoObsIono && pseudoObsIono) {
-      trafoObs -= 1; // pseudo obs iono with respect to refSat
-    }
-  }
-  _datumTrafo->setNumObs(trafoObs);
-  _datumTrafo->setNumPar(_parlist.nPar());
-  _datumTrafo->initAA();
-}
-
-//
-//////////////////////////////////////////////////////////////////////////////
-bool t_pppFilter::resetRefSatellitesLastEpoch(
-    std::vector<t_pppSatObs*> &obsVector,
-    const QMap<char, t_pppRefSat*> &refSatMap,
-    const QMap<char, t_pppRefSat*> &refSatMapLastEpoch) {
-  bool resetRefSat;
-  // reference satellite definition per system
-  const QList<char> &usedSystems = _parlist.usedSystems();
-  for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
-    resetRefSat = false;
-    char sys = usedSystems[iSys];
-    t_prn newPrn = refSatMap[sys]->prn();
-    t_prn oldPrn = refSatMapLastEpoch[sys]->prn();
-#ifdef BNC_DEBUG_PPP
-    if (oldPrn != newPrn) {
-      LOG << "oldRef: " << oldPrn.toString() << " => newRef " <<  newPrn.toString() << endl;
-    }
-#endif
-    vector<t_pppSatObs*>::iterator it = obsVector.begin();
-    while (it != obsVector.end()) {
-      t_pppSatObs *satObs = *it;
-      if (satObs->prn() == newPrn) {
-        resetRefSat = true;
-        satObs->setAsReference();
-      } else if (satObs->prn() == oldPrn) {
-        satObs->resetReference();
-      }
-      it++;
-    }
-    if (!resetRefSat) {
-      _obsPool->setRefSatChangeRequired(sys, true);
-      return resetRefSat;
-    }
-  }
-  return resetRefSat;
-}
Index: trunk/BNC/src/PPP/pppFilter.h
===================================================================
--- trunk/BNC/src/PPP/pppFilter.h	(revision 10033)
+++ trunk/BNC/src/PPP/pppFilter.h	(revision 10034)
@@ -8,5 +8,4 @@
 #include "bnctime.h"
 #include "t_prn.h"
-#include "pppClient.h"
 
 namespace BNC_PPP {
@@ -18,29 +17,11 @@
 class t_pppFilter {
  public:
-  t_pppFilter(t_pppObsPool* obsPool);
+  t_pppFilter();
   ~t_pppFilter();
 
-  t_irc processEpoch(int num);
+  t_irc processEpoch(t_pppObsPool* obsPool);
 
   const ColumnVector&    x() const {return _xFlt;}
   const SymmetricMatrix& Q() const {return _QFlt;}
-
-  t_irc datumTransformation(const QMap<char, t_pppRefSat*>& refSatMap);
-  void initDatumTransformation(const std::vector<t_pppSatObs*>& allObs, bool pseudoObsIono);
-  unsigned setTrafoObs();
-  void restoreState(int num)  {
-#ifdef BNC_DEBUG_PPP
-    LOG << "Restore parameter from last successful epoch: _parlist = _parlist_sav ("<<  num << ")\n";
-#endif
-    _QFlt    = _QFlt_sav;
-    _parlist = _parlist_sav;
-  }
-  void rememberState(int num) {
-#ifdef BNC_DEBUG_PPP
-    LOG << "Remember parameters from successful epoch   : _parlist_sav = _parlist ("<<  num << ")\n";
-#endif
-    _QFlt_sav    = _QFlt;
-    _parlist_sav = _parlist;
-  }
 
   int    numSat() const {return _numSat;}
@@ -50,5 +31,5 @@
   double GDOP() const {return _dop.G;}
   double trp() const {
-    const std::vector<t_pppParam*>& par = _parlist.params();
+    const std::vector<t_pppParam*>& par = _parlist->params();
     for (unsigned ii = 0; ii < par.size(); ++ii) {
       if (par[ii]->type() == t_pppParam::trp) {
@@ -59,5 +40,5 @@
   };
   double trpStdev() const {
-    const std::vector<t_pppParam*>& par = _parlist.params();
+    const std::vector<t_pppParam*>& par = _parlist->params();
     for (unsigned ii = 0; ii < par.size(); ++ii) {
       if (par[ii]->type() == t_pppParam::trp) {
@@ -92,109 +73,15 @@
   };
 
-  class t_datumTrafo {
-  public:
-    t_datumTrafo () {initIndices();}
-    ~t_datumTrafo (){}
-
-    void initIndices() {_firstRow = 1; _lastRow = 0;}
-    void updateIndices(char sys, int maxObsSys) {
-      if (firstSystem(sys)) {
-        initIndices();
-      }
-      else {
-        _firstRow = _lastRow + 1;
-      }
-      _lastRow += maxObsSys;
-
-    };
-
-    void setFirstSystem(char firstSys) { _firstSys = firstSys;}
-    bool firstSystem(char sys) {
-      if (_firstSys == sys) {
-        return true;
-      }
-      return false;
-    }
-    void setNumObs(int maxObs) {_maxObs = maxObs;}
-    void setNumPar(int numPar) {_numPar = numPar;}
-    int numPar() {return _numPar;}
-    int numObs() {return _maxObs;}
-    void updateNumObs() {
-      _maxObs = _lastRow;
-      _AA1 = _AA1.SubMatrix(1, _lastRow, 1, _numPar);
-      _AA2 = _AA2.SubMatrix(1, _lastRow, 1, _numPar);
-    }
-
-    const Matrix& AA1() {return _AA1;}
-    const Matrix& AA2() {return _AA2;}
-    const Matrix& D21() {return _D21;}
-
-    void initAA() {
-      _AA1.ReSize(_maxObs, _numPar); _AA1 = 0.0;
-      _AA2.ReSize(_maxObs, _numPar); _AA2 = 0.0;
-      _D21.ReSize(_numPar, _numPar); _D21 = 0.0;
-    }
-    t_irc prepareAA(const Matrix& AA, int ind) {
-
-      Matrix* Prep = &_AA2;
-      if (ind == 1) {
-        Prep = &_AA1;
-      }
-      if (AA.Ncols() != _numPar) {
-        LOG << "t_pppFilter::prepareAA: AA.Ncols() != _numPar: " << AA.Ncols() << " != " << _numPar << "\n RETURN FAILURE" <<  std::endl;
-        return failure;
-      }
-      Prep->SubMatrix(_firstRow, _lastRow, 1, _numPar) = AA;
-      return success;
-    }
-    void switchAA() {
-      _AA1 = _AA2;
-    }
-    t_irc computeTrafoMatrix() {
-      if (((_AA2.t() * _AA2)).Determinant() == 0.0) {
-        LOG << "t_pppFilter::computeTrafoMatrix: (_AA2.t() * _AA2).inv() is singular" << std::endl;
-        return failure;
-      }
-      _D21 = ((_AA2.t() * _AA2).i()) * _AA2.t() * _AA1;
-      return success;
-    }
-
-    void printMatrix(const Matrix& X, int nRow, int nCol) {
-      for (int rr = 0; rr < nRow; rr++) {
-        for (int cc = 0; cc < nCol; cc++) {
-          LOG << std::setw(6) << std::setprecision(3) << X[rr][cc] << " ;";
-        }
-        LOG << std::endl;
-      }
-      LOG << std::endl;
-    }
-  private:
-    int               _firstRow;
-    int               _lastRow;
-    Matrix            _AA1;
-    Matrix            _AA2;
-    Matrix            _D21;
-    char              _firstSys;
-    int               _maxObs;
-    int               _numPar;
-    QMap<char, t_prn> _refSatMapPseudoObs;
-  };
-
   t_irc processSystem(const std::vector<t_lc::type>& LCs,
                       const std::vector<t_pppSatObs*>& obsVector,
-                      const t_prn& refPrn,
-                      bool pseudoObsIonoAvailable,
-                      bool preProcessing);
+                      bool pseudoObsIonoAvailable);
 
   t_irc detectCycleSlips(const std::vector<t_lc::type>& LCs,
-                         const std::vector<t_pppSatObs*>& obsVector,
-                         const t_prn& refPrn,
-                         bool preProcessing);
+                         const std::vector<t_pppSatObs*>& obsVector);
 
   t_irc resetAmb(t_prn prn, const std::vector<t_pppSatObs*>& obsVector, t_lc::type lc,
                  SymmetricMatrix* QSav = 0, ColumnVector* xSav = 0);
 
-  void cmpDOP(const std::vector<t_pppSatObs*>& obsVector,
-              const QMap<char, t_pppRefSat*>& refSatMap);
+  void cmpDOP(const std::vector<t_pppSatObs*>& obsVector);
 
   void setStateVectorAndVarCovMatrix(const ColumnVector& xFltOld, const SymmetricMatrix& QFltOld,
@@ -203,17 +90,7 @@
   void predictCovCrdPart(const SymmetricMatrix& QFltOld, bool setNeuNoiseToZero);
 
-  t_irc addNoiseToPar(t_pppParam::e_type parType, char sys);
-
-  bool resetRefSatellitesLastEpoch(std::vector<t_pppSatObs*>& obsVector,
-                                   const QMap<char, t_pppRefSat*>& refSatMap,
-                                   const QMap<char, t_pppRefSat*>& refSatMapLastEpoch);
-
   bncTime         _epoTime;
-  t_pppParlist    _parlist;
-  t_pppParlist    _parlist_sav;
-  t_pppObsPool*   _obsPool;
-  t_datumTrafo*   _datumTrafo;
+  t_pppParlist*   _parlist;
   SymmetricMatrix _QFlt;
-  SymmetricMatrix _QFlt_sav;
   ColumnVector    _xFlt;
   ColumnVector    _x0;
@@ -223,5 +100,4 @@
   bncTime         _firstEpoTime;
   bncTime         _lastEpoTimeOK;
-  t_prn           _refPrn;
 };
 
Index: trunk/BNC/src/PPP/pppObsPool.cpp
===================================================================
--- trunk/BNC/src/PPP/pppObsPool.cpp	(revision 10033)
+++ trunk/BNC/src/PPP/pppObsPool.cpp	(revision 10034)
@@ -23,5 +23,5 @@
 /////////////////////////////////////////////////////////////////////////////
 t_pppObsPool::t_epoch::t_epoch(const bncTime& epoTime, vector<t_pppSatObs*>& obsVector,
-                               bool pseudoObsIono, const QMap<char, t_pppRefSat*>& refSatMap) {
+                               bool pseudoObsIono) {
   _epoTime        = epoTime;
   _pseudoObsIono  = pseudoObsIono;
@@ -30,13 +30,4 @@
   }
   obsVector.clear();
-
-  QMapIterator<char, t_pppRefSat*> it(refSatMap);
-  while (it.hasNext()) {
-    it.next();
-    char sys = it.key();
-    t_pppRefSat* refSat = it.value();
-    _refSatMap[sys] = new t_pppRefSat(refSat->prn(), refSat->stecValue());
-  }
-  //refSatMap.clear();
 }
 
@@ -47,11 +38,4 @@
     delete _obsVector[ii];
   }
-
-  QMapIterator<char, t_pppRefSat*> it(_refSatMap);
-  while (it.hasNext()) {
-    it.next();
-    delete it.value();
-  }
-  _refSatMap.clear();
 }
 
@@ -66,9 +50,4 @@
   }
   _vTec = 0;
-  _refSatChangeRequiredMap['G'] = false;
-  _refSatChangeRequiredMap['R'] = false;
-  _refSatChangeRequiredMap['E'] = false;
-  _refSatChangeRequiredMap['C'] = false;
-
 }
 
@@ -116,7 +95,7 @@
 /////////////////////////////////////////////////////////////////////////////
 void t_pppObsPool::putEpoch(const bncTime& epoTime, vector<t_pppSatObs*>& obsVector,
-                            bool pseudoObsIono, const QMap<char, t_pppRefSat*>& refSatMap) {
+                            bool pseudoObsIono) {
   const unsigned MAXSIZE = 2;
-  _epochs.push_back(new t_epoch(epoTime, obsVector, pseudoObsIono, refSatMap));
+  _epochs.push_back(new t_epoch(epoTime, obsVector, pseudoObsIono));
 
   if (_epochs.size() > MAXSIZE) {
@@ -125,13 +104,2 @@
   }
 }
-
-//
-/////////////////////////////////////////////////////////////////////////////
-void t_pppObsPool::deleteLastEpoch() {
-
-  if (!_epochs.empty()) {
-    //LOG << " " << _epochs.back()->epoTime().timestr().c_str() << endl;
-    delete _epochs.back();
-    _epochs.pop_back();
-  }
-}
Index: trunk/BNC/src/PPP/pppObsPool.h
===================================================================
--- trunk/BNC/src/PPP/pppObsPool.h	(revision 10033)
+++ trunk/BNC/src/PPP/pppObsPool.h	(revision 10034)
@@ -4,9 +4,7 @@
 #include <vector>
 #include <deque>
-#include <QMap>
 #include <iostream>
 #include "pppSatObs.h"
 #include "bnctime.h"
-#include "pppRefSat.h"
 
 namespace BNC_PPP {
@@ -18,9 +16,8 @@
    public:
     t_epoch(const bncTime& epoTime, std::vector<t_pppSatObs*>& obsVector,
-            bool pseudoObsIono, const QMap<char, t_pppRefSat*>& refSatMap);
+            bool pseudoObsIono);
     ~t_epoch();
           std::vector<t_pppSatObs*>& obsVector() {return _obsVector;}
     const std::vector<t_pppSatObs*>& obsVector() const {return _obsVector;}
-    const QMap<char, t_pppRefSat*>& refSatMap() const {return _refSatMap;}
     const bncTime& epoTime() const {return _epoTime;}
     bool pseudoObsIono() const {return _pseudoObsIono;}
@@ -29,5 +26,4 @@
     bool                      _pseudoObsIono;
     std::vector<t_pppSatObs*> _obsVector;
-    QMap<char, t_pppRefSat*>  _refSatMap;
   };
 
@@ -39,7 +35,5 @@
 
   void putEpoch(const bncTime& epoTime, std::vector<t_pppSatObs*>& obsVector,
-                bool pseudoObsIono, const QMap<char, t_pppRefSat*>& refSatMap);
-
-  void deleteLastEpoch();
+                bool pseudoObsIono);
 
   const t_satCodeBias* satCodeBias(const t_prn& prn) const {
@@ -60,42 +54,4 @@
   }
 
-  // RefSat change required in current epoch
-  // =======================================
-  void setRefSatChangeRequired(char sys, bool refSatChangeRequired) {
-    _refSatChangeRequiredMap[sys] = refSatChangeRequired;
-  }
-  bool refSatChangeRequired() {
-    QMapIterator<char, bool> it(_refSatChangeRequiredMap);
-      while (it.hasNext()) {
-        it.next();
-        if (it.value() == true) {
-          return true;
-        }
-      }
-    return false;
-  }
-  bool refSatChangeRequired(char sys) {
-    return _refSatChangeRequiredMap[sys];
-  }
-
-  // RefSat changed in current epoch (different from last epoch)
-  // ===========================================================
-  void setRefSatChanged(char sys, bool refSatChanged) {
-    _refSatChangedMap[sys] = refSatChanged;
-  }
-  bool refSatChanged() {
-    QMapIterator<char, bool> it(_refSatChangedMap);
-      while (it.hasNext()) {
-        it.next();
-        if (it.value() == true) {
-          return true;
-        }
-      }
-    return false;
-  }
-  bool refSatChanged(char sys) {
-    return _refSatChangedMap[sys];
-  }
-
  private:
   t_satCodeBias*           _satCodeBiases[t_prn::MAXPRN+1];
@@ -103,6 +59,4 @@
   t_vTec*                  _vTec;
   std::deque<t_epoch*>     _epochs;
-  QMap<char, bool>         _refSatChangeRequiredMap;
-  QMap<char, bool>         _refSatChangedMap;
 };
 
Index: trunk/BNC/src/PPP/pppParlist.cpp
===================================================================
--- trunk/BNC/src/PPP/pppParlist.cpp	(revision 10033)
+++ trunk/BNC/src/PPP/pppParlist.cpp	(revision 10034)
@@ -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,9 +74,36 @@
          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 offGlo = 0;
+           if (_prn.system() == 'R' && tLC != t_lc::MW) {
+             offGlo = PPP_CLIENT->offGlo();
+           }
+           double offGal = 0;
+           if (_prn.system() == 'E' && tLC != t_lc::MW) {
+             offGal = PPP_CLIENT->offGal();
+           }
+           double offBds = 0;
+           if (_prn.system() == 'C' && tLC != t_lc::MW) {
+             offBds = PPP_CLIENT->offBds();
+           }
+           _x0 = floor((obs->obsValue(tLC) - offGlo - offGal - offBds - obs->cmpValue(tLC)) / obs->lambda(tLC) + 0.5);
            break;
          }
        }
      }
+     break;
+   case offGlo:
+     _epoSpec = true;
+     _sigma0  = OPT->_aprSigClk;
+     _x0      = PPP_CLIENT->offGlo();
+     break;
+   case offGal:
+     _epoSpec = true;
+     _sigma0  = OPT->_aprSigClk;
+     _x0      = PPP_CLIENT->offGal();
+     break;
+   case offBds:
+     _epoSpec = true;
+     _sigma0  = OPT->_aprSigClk;
+     _x0      = PPP_CLIENT->offBds();
      break;
    case trp:
@@ -117,27 +132,4 @@
 }
 
-//
-////////////////////////////////////////////////////////////////////////////
-t_pppParam::t_pppParam(const t_pppParam* old) {
-  _type     = old->type();
-  _prn      = old->prn();
-  _tLC      = old->tLC();
-  _indexOld = old->indexOld();
-  _indexNew = old->indexNew();
-  _noise    = old->noise();
-  _sigma0   = old->sigma0();
-  _epoSpec  = old->epoSpec();
-  _x0       = old->x0();
-  setFirstObsTime(old->firstObsTime());
-  setLastObsTime(old->lastObsTime());
-  _ambInfo  = 0;
-  if (_type == t_pppParam::amb) {
-    _ambInfo  = new t_ambInfo();
-    _ambInfo->_resetCandidate = old->_ambInfo->_resetCandidate;
-    _ambInfo->_eleSat         = old->_ambInfo->_eleSat;
-    _ambInfo->_numEpo         = old->_ambInfo->_numEpo;
-  }
-}
-
 // Destructor
 ////////////////////////////////////////////////////////////////////////////
@@ -150,5 +142,5 @@
 ////////////////////////////////////////////////////////////////////////////
 double t_pppParam::partial(const bncTime& /* epoTime */, const t_pppSatObs* obs,
-                           const t_lc::type& tLC, const t_prn refPrn) const {
+                           const t_lc::type& tLC) const {
 
   // Special Case - Melbourne-Wuebbena
@@ -176,24 +168,21 @@
     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 offGlo:
     if (tLC == t_lc::GIM) {return 0.0;}
     return (obs->prn().system() == 'R') ? 1.0 : 0.0;
-  case rClkE:
+  case offGal:
     if (tLC == t_lc::GIM) {return 0.0;}
     return (obs->prn().system() == 'E') ? 1.0 : 0.0;
-  case rClkC:
+  case offBds:
     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;}
-    else if ((OPT->_obsModelType == OPT->IF)     ||
-             (OPT->_obsModelType == OPT->PPPRTK) ||
-             (OPT->_obsModelType == OPT->UncombPPP) ||
-             (OPT->_obsModelType == OPT->DCMcodeBias  && !obs->isReference()) ||
-             (OPT->_obsModelType == OPT->DCMphaseBias && !obs->isReference())   ) {
-
+    if (tLC == t_lc::GIM) {
+      return 0.0;
+    }
+    else {
       if (obs->prn() == _prn) {
         if      (tLC == _tLC) {
@@ -236,9 +225,6 @@
       }
       else if (tLC == t_lc::GIM) {
-        return -1.0;
-      }
-    }
-    if (tLC == t_lc::GIM && _prn == refPrn) {
-      return 1.0;
+        return 1.0;
+      }
     }
     break;
@@ -310,15 +296,15 @@
     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 offGlo:
+    ss << "OFF_GLO     ";
+    break;
+  case offGal:
+    ss << "OFF_GAL     ";
+    break;
+  case offBds:
+    ss << "OFF_BDS     ";
     break;
   case trp:
@@ -361,9 +347,6 @@
   _usedSystems.clear();
 
-  vector<t_pppParam*>::iterator it = _params.begin();
-  while (it != _params.end()) {
-    t_pppParam* par = *it;
-    delete par;
-    it = _params.erase(it);
+  for (unsigned ii = 0; ii < _params.size(); ii++) {
+    delete _params[ii];
   }
 }
@@ -371,41 +354,5 @@
 //
 ////////////////////////////////////////////////////////////////////////////
-t_pppParlist::t_pppParlist(const t_pppParlist& old) {
-
-  _usedSystems = old._usedSystems;
-
-  vector<t_pppParam*>::const_iterator it = old.params().begin();
-  while (it != old.params().end()) {
-    const t_pppParam* oldParam = *it;
-    _params.push_back(new t_pppParam(oldParam));
-  }
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-const t_pppParlist& t_pppParlist::operator= (const t_pppParlist& p) {
-
-  _usedSystems.clear();
-
-  _usedSystems = p._usedSystems;
-
-  vector<t_pppParam*>::iterator it = _params.begin();
-  while (it != _params.end()) {
-    t_pppParam* par = *it;
-    delete par;
-    it = _params.erase(it);
-  }
-
-  for (unsigned jj = 0; jj < p.params().size(); jj++) {
-    t_pppParam* parFrom = p.params()[jj];
-    _params.push_back(new t_pppParam(parFrom));
-  }
-  return *this;
-}
-
-//
-////////////////////////////////////////////////////////////////////////////
-t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector,
-    const QMap<char, t_pppRefSat*>& refSatMap) {
+t_irc t_pppParlist::set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector) {
 
   // Remove some Parameters
@@ -421,5 +368,7 @@
     }
 
-    else if (par->type() == t_pppParam::crdX ||
+    else if (par->type() == t_pppParam::amb  ||
+             par->type() == t_pppParam::ion  ||
+             par->type() == t_pppParam::crdX ||
              par->type() == t_pppParam::crdY ||
              par->type() == t_pppParam::crdZ) {
@@ -429,23 +378,4 @@
     }
 
-    else if (par->type() == t_pppParam::amb) {
-      if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
-          remove = true;
-      }
-      if (OPT->_obsModelType == OPT->DCMcodeBias ||
-          OPT->_obsModelType == OPT->DCMphaseBias) {
-        char sys = par->prn().system();
-        t_prn refPrn = (refSatMap[sys])->prn();
-        if (par->lastObsTime().valid() && par->prn() == refPrn) {
-            remove = true;
-        }
-      }
-    }
-
-    else if (par->type() == t_pppParam::ion) {
-      if (par->lastObsTime().valid() && (epoTime - par->lastObsTime() > 60.0)) {
-          remove = true;
-      }
-    }
     if (remove) {
 #ifdef BNC_DEBUG_PPP
@@ -495,24 +425,11 @@
   }
 
-  if (OPT->_obsModelType == OPT->DCMcodeBias ||
-      OPT->_obsModelType == OPT->DCMphaseBias) {
-    // Check if ambiguity parameters have observations
-    // -----------------------------------------------
+  if (OPT->_obsModelType == OPT->PPPRTK || OPT->_pseudoObsIono) {
     vector<t_pppParam*>::iterator it = _params.begin();
-    QList<t_prn> lostSats;
     while (it != _params.end()) {
       t_pppParam* par = *it;
-      if ((par->type() == t_pppParam::amb) &&
-          (!par->lastObsTime().valid() || (epoTime - par->lastObsTime() > 0.0))) {
-#ifdef BNC_DEBUG_PPP
-        //LOG << "remove1 " << par->toString() << std::endl;
-#endif
-        lostSats.append(par->prn());
-        delete par;
-        it = _params.erase(it);
-      }
       // Check if systems have to be presented per biases
       // ----------------------------------------------
-      else if ((par->type() == t_pppParam::cBiasG1 ||
+      if ((     par->type() == t_pppParam::cBiasG1 ||
                 par->type() == t_pppParam::cBiasG2 ||
                 par->type() == t_pppParam::pBiasG1 ||
@@ -558,23 +475,5 @@
       }
     }
-    // remove respective iono parameters
-    // ---------------------------------
-    it = _params.begin();
-    while (it != _params.end()) {
-      t_pppParam* par = *it;
-      if ((par->type() == t_pppParam::ion) &&
-          (lostSats.contains(par->prn()) || (epoTime - par->lastObsTime() > 0.0))) {
-#ifdef BNC_DEBUG_PPP
-       //LOG << "remove1 " << par->toString() << std::endl;
-#endif
-        delete par;
-        it = _params.erase(it);
-      }
-      else {
-        ++it;
-      }
-    }
-  }
-
+  }
 
   // Required Set of Parameters
@@ -588,7 +487,54 @@
   required.push_back(new t_pppParam(t_pppParam::crdZ, t_prn(), t_lc::dummy));
 
+  // Receiver Clock
+  // --------------
+  required.push_back(new t_pppParam(t_pppParam::clkR, t_prn(), t_lc::dummy));
+
+  // GLONASS Clock Offset
+  // --------------------
+  if ( _usedSystems.contains('R')  &&
+      (_usedSystems.contains('G') || _usedSystems.contains('E') || _usedSystems.contains('C'))) {
+    required.push_back(new t_pppParam(t_pppParam::offGlo, t_prn(), t_lc::dummy));
+  }
+
+  // Galileo Clock Offset
+  // --------------------
+  if (_usedSystems.contains('E') && _usedSystems.contains('G')) {
+    required.push_back(new t_pppParam(t_pppParam::offGal, t_prn(), t_lc::dummy));
+  }
+
+  // BDS Clock Offset
+  // ----------------
+  if (_usedSystems.contains('C')  && (_usedSystems.contains('G') || _usedSystems.contains('E'))) {
+    required.push_back(new t_pppParam(t_pppParam::offBds, t_prn(), t_lc::dummy));
+  }
+
+  // Troposphere
+  // -----------
+  if (OPT->estTrp()) {
+    required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
+  }
+
+  // Ionosphere
+  // ----------
+  if (OPT->_obsModelType == OPT->UncombPPP) {
+    for (unsigned jj = 0; jj < obsVector.size(); jj++) {
+      const t_pppSatObs* satObs = obsVector[jj];
+      required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
+    }
+  }
+  // Ambiguities
+  // -----------
+  for (unsigned jj = 0; jj < obsVector.size(); jj++) {
+    const t_pppSatObs*  satObs = obsVector[jj];
+    const vector<t_lc::type>& ambLCs = OPT->ambLCs(satObs->prn().system());
+    for (unsigned ii = 0; ii < ambLCs.size(); ii++) {
+      required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector));
+    }
+  }
+
   // Receiver Code Biases
   // --------------------
-  if (OPT->_obsModelType == OPT->DCMcodeBias) {
+  if (OPT->_obsModelType == OPT->PPPRTK) {
     std::vector<t_lc::type> lc;
     if (_usedSystems.contains('G')) {
@@ -629,9 +575,35 @@
     }
   }
+  if (OPT->_pseudoObsIono) {
+    std::vector<t_lc::type> lc;
+    if (_usedSystems.contains('G')) {
+      lc = OPT->LCs('G');
+      if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
+        required.push_back(new t_pppParam(t_pppParam::cBiasG2, t_prn(), t_lc::c2));
+      }
+    }
+    if (_usedSystems.contains('R')) {
+      lc = OPT->LCs('R');
+      if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
+        required.push_back(new t_pppParam(t_pppParam::cBiasR2, t_prn(), t_lc::c2));
+      }
+    }
+    if (_usedSystems.contains('E')) {
+      lc = OPT->LCs('E');
+      if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
+        required.push_back(new t_pppParam(t_pppParam::cBiasE2, t_prn(), t_lc::c2));
+      }
+    }
+    if (_usedSystems.contains('C')) {
+      lc = OPT->LCs('C');
+      if (std::find(lc.begin(), lc.end(), t_lc::c2) != lc.end()) {
+        required.push_back(new t_pppParam(t_pppParam::cBiasC2, t_prn(), t_lc::c2));
+      }
+    }
+  }
 
   // Receiver Phase Biases
   // ---------------------
-  if ((OPT->_obsModelType == OPT->DCMphaseBias) ||
-      (OPT->_obsModelType == OPT->PPPRTK)     ) {
+  if (OPT->_obsModelType == OPT->PPPRTK) {
     std::vector<t_lc::type> lc;
     if (_usedSystems.contains('G')) {
@@ -669,54 +641,4 @@
       if (std::find(lc.begin(), lc.end(), t_lc::l2) != lc.end()) {
         required.push_back(new t_pppParam(t_pppParam::pBiasC2, t_prn(), t_lc::l2));
-      }
-    }
-  }
-
-  // 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));
-   }
-
-  // Troposphere
-  // -----------
-  if (OPT->estTrp()) {
-    required.push_back(new t_pppParam(t_pppParam::trp, t_prn(), t_lc::dummy));
-  }
-
-  // Ionosphere
-  // ----------
-  if (OPT->_obsModelType == OPT->UncombPPP    ||
-      OPT->_obsModelType == OPT->DCMcodeBias  ||
-      OPT->_obsModelType == OPT->DCMphaseBias   ) {
-    for (unsigned jj = 0; jj < obsVector.size(); jj++) {
-      const t_pppSatObs* satObs = obsVector[jj];
-      required.push_back(new t_pppParam(t_pppParam::ion, satObs->prn(), t_lc::dummy));
-    }
-  }
-  // Ambiguities
-  // -----------
-  for (unsigned jj = 0; jj < obsVector.size(); jj++) {
-    const t_pppSatObs*  satObs = obsVector[jj];
-    if ((OPT->_obsModelType == OPT->IF)        ||
-        (OPT->_obsModelType == OPT->PPPRTK)    ||
-        (OPT->_obsModelType == OPT->UncombPPP) ||
-        (OPT->_obsModelType == OPT->DCMcodeBias  && !satObs->isReference()) ||
-        (OPT->_obsModelType == OPT->DCMphaseBias && !satObs->isReference())   ) {
-      const vector<t_lc::type>& ambLCs = OPT->ambLCs(satObs->prn().system());
-      for (unsigned ii = 0; ii < ambLCs.size(); ii++) {
-        required.push_back(new t_pppParam(t_pppParam::amb, satObs->prn(), ambLCs[ii], &obsVector));
       }
     }
@@ -779,7 +701,6 @@
   t_pppParam* parY = 0;
   t_pppParam* parZ = 0;
-  vector<t_pppParam*>::const_iterator it = _params.begin();
-  while (it != _params.end()) {
-    t_pppParam* par = *it;
+  for (unsigned ii = 0; ii < _params.size(); ii++) {
+    t_pppParam* par = _params[ii];
     if      (par->type() == t_pppParam::crdX) {
       parX = par;
@@ -805,5 +726,4 @@
       LOG << endl;
     }
-    ++it;
   }
 
Index: trunk/BNC/src/PPP/pppParlist.h
===================================================================
--- trunk/BNC/src/PPP/pppParlist.h	(revision 10033)
+++ trunk/BNC/src/PPP/pppParlist.h	(revision 10034)
@@ -7,5 +7,4 @@
 #include "t_prn.h"
 #include "bnctime.h"
-#include "pppRefSat.h"
 
 namespace BNC_PPP {
@@ -15,16 +14,15 @@
 class t_pppParam {
  public:
-  enum e_type {crdX, crdY, crdZ, rClkG, rClkR, rClkE, rClkC, trp, ion, amb,
+  enum e_type {crdX, crdY, crdZ, clkR, offGlo, offGal, offBds, trp, ion, amb,
                cBiasG1, cBiasR1, cBiasE1, cBiasC1, pBiasG1, pBiasR1, pBiasE1, pBiasC1,
                cBiasG2, cBiasR2, cBiasE2, cBiasC2, pBiasG2, pBiasR2, pBiasE2, pBiasC2};
 
   t_pppParam(e_type type, const t_prn& prn, t_lc::type tLC, const std::vector<t_pppSatObs*>* obsVector = 0);
-  t_pppParam(const t_pppParam* old);
   ~t_pppParam();
 
   e_type type() const {return _type;}
   double x0()  const {return _x0;}
-  double partial(const bncTime& epoTime, const t_pppSatObs* obs,
-                 const t_lc::type& tLC, const t_prn refPrn) const;
+  double partial(const bncTime& epoTime, const t_pppSatObs* obs, 
+                 const t_lc::type& tLC) const;
   bool   epoSpec() const {return _epoSpec;}
   bool   isEqual(const t_pppParam* par2) const {
@@ -103,11 +101,8 @@
   t_pppParlist();
   ~t_pppParlist();
-  t_pppParlist(const t_pppParlist& old);
-  const t_pppParlist&operator= (const t_pppParlist& p);
-  t_irc set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector,
-            const QMap<char, t_pppRefSat*>& refSatMap);
+  t_irc set(const bncTime& epoTime, const std::vector<t_pppSatObs*>& obsVector);
   unsigned nPar() const {return _params.size();}
   const std::vector<t_pppParam*>& params() const {return _params;}
-        std::vector<t_pppParam*>& params()       {return _params;}
+  std::vector<t_pppParam*>& params() {return _params;}
   const QList<char>& usedSystems() const {return _usedSystems;}
   void printResult(const bncTime& epoTime, const SymmetricMatrix& QQ,
Index: trunk/BNC/src/PPP/pppRefSat.h
===================================================================
--- trunk/BNC/src/PPP/pppRefSat.h	(revision 10033)
+++ trunk/BNC/src/PPP/pppRefSat.h	(revision 10034)
@@ -9,4 +9,5 @@
 #define PPPREFSAT_H_
 
+#include <vector>
 #include "t_prn.h"
 
@@ -32,4 +33,29 @@
   double   _stecValue;
 };
+
+class t_refSatellites {
+ public:
+  t_refSatellites(std::vector<char> systems) {
+    for (unsigned iSys = 0; iSys < systems.size(); iSys++) {
+      char sys = systems[iSys];
+      _refSatMap[sys] = new t_pppRefSat();
+    }
+  }
+  ~t_refSatellites() {
+    QMapIterator<char, t_pppRefSat*> it(_refSatMap);
+    while (it.hasNext()) {
+      it.next();
+      delete it.value();
+    }
+    _refSatMap.clear();
+  }
+  const QMap<char, t_pppRefSat*>& refSatMap() const {return _refSatMap;}
+
+ private:
+  QMap<char, t_pppRefSat*> _refSatMap;
+
+};
+
+
 }
 
Index: trunk/BNC/src/PPP/pppSatObs.cpp
===================================================================
--- trunk/BNC/src/PPP/pppSatObs.cpp	(revision 10033)
+++ trunk/BNC/src/PPP/pppSatObs.cpp	(revision 10034)
@@ -44,16 +44,8 @@
   _valid      = true;
   _reference  = false;
-  _stecRefSat = 0.0;
   _stecSat    = 0.0;
   _signalPriorities = QString::fromStdString(OPT->_signalPriorities);
   if (!_signalPriorities.size()) {
-    if (OPT->_obsModelType == OPT->DCMcodeBias ||
-        OPT->_obsModelType == OPT->DCMphaseBias) {
-      // at the moment only one code or phase bias per system (G,R,E,C)/modulation considered
-      _signalPriorities = "G:12&CW R:12&CP E:1&CX E:5&QX C:26&I";
-    }
-    else {
-      _signalPriorities = "G:12&CWPSLX R:12&CP E:1&CBX E:5&QIX C:26&IQX";
-    }
+    _signalPriorities = "G:12&CWPSLX R:12&CP E:1&CBX E:5&QIX C:26&IQX";
   }
 
@@ -109,5 +101,6 @@
             if (obs->_rnxType2ch == obsType.toStdString() &&
                 obs->_codeValid && obs->_code &&
-                obs->_phaseValid && obs->_phase) {
+                obs->_phaseValid && obs->_phase &&
+                obs->_lockTimeValid &&  obs->_lockTime > 5.0) {
               _obs[iFreq] = new t_frqObs(*obs); //cout << "================> newObs: " << obs->_rnxType2ch <<endl;
             }
@@ -261,10 +254,10 @@
   // Pseudo observations
   if (tLC == t_lc::GIM) {
-    if (_stecRefSat == 0.0 || _stecSat == 0.0) {
+    if (_stecSat == 0.0) {
       if (valid) *valid = false;
       return 0.0;
     }
     else {
-      return _stecRefSat;
+      return _stecSat;
     }
   }
@@ -339,5 +332,5 @@
 
   if (tLC == t_lc::GIM) {
-    retVal = OPT->_sigmaGIM * OPT->_sigmaGIM + OPT->_sigmaGIM * OPT->_sigmaGIM;
+    retVal = OPT->_sigmaGIM * OPT->_sigmaGIM;
   }
 
@@ -587,5 +580,5 @@
     double f1GPS = t_CST::freq(t_frequency::G1, 0);
     for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
-      if (OPT->_pseudoObsIono) { // DCMcodeBias, DCMphaseBias
+      if (OPT->_pseudoObsIono) {
         // For scaling the slant ionospheric delays the trick is to be consistent with units!
         // The conversion of TECU into meters requires the frequency of the signal.
@@ -737,6 +730,10 @@
 //
 ////////////////////////////////////////////////////////////////////////////
-void  t_pppSatObs::setPseudoObsIono(t_frequency::type freq, double stecRefSat) {
+bool  t_pppSatObs::setPseudoObsIono(t_frequency::type freq) {
+  bool pseudoObsIono = false;
   _stecSat    = _model._ionoCodeDelay[freq];
-  _stecRefSat = stecRefSat;
-}
+  if (_stecSat) {
+    pseudoObsIono = true;
+  }
+  return pseudoObsIono;
+}
Index: trunk/BNC/src/PPP/pppSatObs.h
===================================================================
--- trunk/BNC/src/PPP/pppSatObs.h	(revision 10033)
+++ trunk/BNC/src/PPP/pppSatObs.h	(revision 10034)
@@ -47,5 +47,5 @@
   void                setRes(t_lc::type tLC, double res);
   double              getRes(t_lc::type tLC) const;
-  void                setPseudoObsIono(t_frequency::type freq, double stecRefSat);
+  bool                setPseudoObsIono(t_frequency::type freq);
   double              getIonoCodeDelay(t_frequency::type freq) {return _model._ionoCodeDelay[freq];}
   double              getCodeBias(t_frequency::type freq) {return _model._codeBias[freq];}
@@ -149,5 +149,4 @@
   std::map<t_lc::type, double> _res;
   double                       _signalPropagationTime;
-  double                       _stecRefSat;
   double                       _stecSat;
   double                       _tropo0;
