Index: /trunk/BNC/src/PPP/pppClient.cpp
===================================================================
--- /trunk/BNC/src/PPP/pppClient.cpp	(revision 9430)
+++ /trunk/BNC/src/PPP/pppClient.cpp	(revision 9431)
@@ -611,5 +611,7 @@
         else {
           LOG << "_filter->datumTransformation() == success" << endl;
-          _obsPool->saveLastEpoRefSats();
+          if (!_obsPool->refSatChangeRequired()) {
+            _obsPool->saveLastEpoRefSats();
+          }
         }
       }
@@ -644,5 +646,6 @@
             (_opt->_obsModelType == OPT->DCMcodeBias ||
              _opt->_obsModelType == OPT->DCMphaseBias ||
-             _opt->_pseudoObsIono)) {
+             _opt->_pseudoObsIono)
+           ) {
           LOG << "refSatChanged()" << endl;
             epochReProcessing = true;
@@ -685,5 +688,7 @@
         epochReProcessing = false;
       }
+
     } while (epochReProcessing);
+
   }
   catch (Exception& exc) {
@@ -886,5 +891,5 @@
       return failure;
     }
-    QString str;
+    QString str;LOG << prn.toString() << endl;
     if (prn == _obsPool->getRefSatMapElementLastEpoch(sys) ||
                _obsPool->getRefSatMapElementLastEpoch(sys) == t_prn() )  {
Index: /trunk/BNC/src/PPP/pppFilter.cpp
===================================================================
--- /trunk/BNC/src/PPP/pppFilter.cpp	(revision 9430)
+++ /trunk/BNC/src/PPP/pppFilter.cpp	(revision 9431)
@@ -130,7 +130,7 @@
       OPT->_obsModelType == OPT->DCMphaseBias) {
     preProcessing = true;
-    unsigned usableSys = 0;
-    for (unsigned iSys = 0; iSys < OPT->systems().size(); iSys++) {
-      char sys = OPT->systems()[iSys];
+    QList<char>& usedSystems = _parlist->usedSystems();
+    for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
+      char sys = usedSystems[iSys];
       _refPrn = (_obsPool->getRefSatMapElement(sys))->prn();
      vector<t_pppSatObs*> obsVector;
@@ -140,12 +140,6 @@
         }
       }
-      if (!obsVector.size()) {
-        continue;
-      }
-      else {
-        ++usableSys;
-        if (usableSys == 1) {
-          _datumTrafo->setFirstSystem(sys);
-        }
+      if (iSys == 0) {
+        _datumTrafo->setFirstSystem(sys);
       }
       if (processSystem(OPT->LCs(sys), obsVector, _refPrn,
@@ -171,7 +165,7 @@
   // ------------------------------------
   preProcessing = false;
-  unsigned usableSys = 0;
-  for (unsigned iSys = 0; iSys < OPT->systems().size(); iSys++) {
-    char sys = OPT->systems()[iSys];
+  QList<char>& usedSystems = _parlist-> usedSystems();
+  for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
+    char sys = usedSystems[iSys];
     if (OPT->_refSatRequired) {
       _refPrn = (_obsPool->getRefSatMapElement(sys))->prn();
@@ -188,13 +182,6 @@
       }
     }
-    if (!num) {
-      continue;
-    }
-    else {
-      ++usableSys;
-      if (usableSys == 1 &&
-          OPT->_obsModelType == OPT->UncombPPP) {
-        _datumTrafo->setFirstSystem(sys);
-      }
+    if (iSys == 0 && OPT->_obsModelType == OPT->UncombPPP) {
+      _datumTrafo->setFirstSystem(sys);
     }
     LOG << epoTimeStr << " SATNUM " << sys << ' ' << right << setw(2) << num << endl;
@@ -299,4 +286,10 @@
           PP[iObs] = 1.0 / (obs->sigma(tLC) * obs->sigma(tLC));
         }
+      }
+    }
+    if (OPT->_obsModelType == OPT->DCMcodeBias ||
+        OPT->_obsModelType == OPT->DCMphaseBias) {
+      if (iObs < 2) { // TODO SATNUM => usableSys has to be removed 
+        return failure;
       }
     }
@@ -394,10 +387,8 @@
       t_pppSatObs* obs = usedObs[maxOutlierIndex];
       t_pppParam* par = 0;
-#ifdef BNC_DEBUG_PPP
       LOG << epoTimeStr << " Outlier ("
           << ((preProcessing) ? "pre-processing) " : "fin-processing) ") << t_lc::toString(maxOutlierLC) << ' '
           << obs->prn().toString()                        << ' '
           << setw(8) << setprecision(4) << maxOutlier << endl;
-#endif
       for (unsigned iPar = 0; iPar < params.size(); iPar++) {
         t_pppParam* hlp = params[iPar];
@@ -710,6 +701,6 @@
   // =============================================================
   if (resetRefSatellitesLastEpoch(allObs) != true) {
-    LOG  << "resetRefSatellitesLastEpoch = failure" << endl;
-    return failure;
+    LOG  << "refsatChange required" << endl;
+    return success;
   }
 
@@ -725,14 +716,14 @@
   }
   vector<t_pppParam*>& params = parlist->params();
+  unsigned nPar = parlist->nPar();
 #ifdef BNC_DEBUG_PPP
   LOG << " parameters of last epoch" << endl;
-  for (unsigned iPar = 0; iPar < params.size(); iPar++) {
+  for (unsigned iPar = 0; iPar < nPar; iPar++) {
     LOG << params[iPar]->toString() << "\t\t" << endl;
   }
 #endif
-  unsigned nPar = parlist->nPar();
-  unsigned usableSys = 0;
-  for (unsigned iSys = 0; iSys < OPT->systems().size(); iSys++) {
-    char sys = OPT->systems()[iSys];
+  QList<char>& usedSystems = _parlist->usedSystems();
+  for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
+    char sys = usedSystems[iSys];
     t_prn refPrn = (_obsPool->getRefSatMapElement(sys))->prn();
     vector<t_pppSatObs*> obsVector;
@@ -742,12 +733,6 @@
       }
     }
-    if (!obsVector.size()) {
-      continue;
-    }
-    else {
-      ++usableSys;
-      if (usableSys == 1) {
-        _datumTrafo->setFirstSystem(sys);
-      }
+    if (iSys == 0) {
+      _datumTrafo->setFirstSystem(sys);
     }
     vector<t_lc::type> LCs = OPT->LCs(sys);
@@ -839,6 +824,6 @@
   // Reset Ambiguities after Datum Transformation
   // ============================================
-  for (unsigned iSys = 0; iSys < OPT->systems().size(); iSys++) {
-    char sys = OPT->systems()[iSys];
+  for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
+    char sys = usedSystems[iSys];
     t_prn refPrnOld = _obsPool->getRefSatMapElementLastEpoch(sys);
     t_prn refPrnNew = (_obsPool->getRefSatMapElement(sys))->prn();
@@ -868,6 +853,7 @@
                                           bool pseudoObsIono) {
   unsigned trafoObs = 0;
-  for (unsigned iSys = 0; iSys < OPT->systems().size(); iSys++) {
-    char sys = OPT->systems()[iSys];
+  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++) {
@@ -875,7 +861,4 @@
         satNum++;
       }
-    }
-    if (!satNum) {
-      continue;
     }
     // all LCs
@@ -905,9 +888,10 @@
 //////////////////////////////////////////////////////////////////////////////
 bool t_pppFilter::resetRefSatellitesLastEpoch(std::vector<t_pppSatObs*>& obsVector) {
-
-  bool resetRefSat = false;
+  bool resetRefSat;
   // reference satellite definition per system
-  for (unsigned iSys = 0; iSys < OPT->systems().size(); iSys++) {
-    char sys = OPT->systems()[iSys];
+  QList<char>& usedSystems = _parlist-> usedSystems();
+  for (int iSys = 0; iSys < usedSystems.size(); iSys++) {
+    resetRefSat = false;
+    char sys = usedSystems[iSys];
     t_pppRefSat* refSat = _obsPool->getRefSatMapElement(sys);
     t_prn newPrn = refSat->prn();
@@ -928,4 +912,8 @@
      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 9430)
+++ /trunk/BNC/src/PPP/pppFilter.h	(revision 9431)
@@ -23,10 +23,10 @@
   t_irc processEpoch();
 
+  const ColumnVector&    x() const {return _xFlt;}
+  const SymmetricMatrix& Q() const {return _QFlt;}
+
   t_irc datumTransformation();
   void initDatumTransformation(const std::vector<t_pppSatObs*>& allObs, bool pseudoObsIono);
   unsigned setTrafoObs();
-
-  const ColumnVector&    x() const {return _xFlt;}
-  const SymmetricMatrix& Q() const {return _QFlt;}
 
   int    numSat() const {return _numSat;}
@@ -80,19 +80,19 @@
   class t_datumTrafo {
   public:
-    t_datumTrafo () {
-      initIndices();
-    }
-    ~t_datumTrafo () {
-
-    }
-
-    void initIndices() {
-      _firstRow = 1; _lastRow = 0;
-    }
-
-    void setFirstSystem(char firstSys) {
-      _firstSys = firstSys;
-    }
-
+    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;//LOG << "updateIndices: lastRow: " << _lastRow << endl;
+    };
+
+    void setFirstSystem(char firstSys) { _firstSys = firstSys;}
     bool firstSystem(char sys) {
       if (_firstSys == sys) {
@@ -101,26 +101,16 @@
       return false;
     }
-
-    void updateIndices(char sys, int maxObsSys) {
-      if (firstSystem(sys)) {
-        initIndices();
-      }
-      else {
-        _firstRow = _lastRow + 1;
-      }
-      _lastRow += maxObsSys;//LOG << "updateIndices: lastRow: " << _lastRow << endl;
-    };
-
     void setNumObs(int maxObs) {_maxObs = maxObs;}
-    void setNumPar(int numPar) { _numPar = numPar;}
+    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);
+    }
+
     void setLastEpoParlist(t_pppParlist* parlist) {_parlist = parlist;}
     t_pppParlist* lastEpoParlist() {return _parlist;}
-    int numPar() {return _numPar;}
-    int numObs() {return _maxObs;}
-    void updateNumObs() {//LOG << "updateObsNum _maxObs " << _maxObs;
-      _maxObs = _lastRow;//LOG << "=>  _maxObs " << _maxObs << " _numPar: " << _numPar << endl;
-      _AA1 = _AA1.SubMatrix(1, _lastRow, 1, _numPar);
-      _AA2 = _AA2.SubMatrix(1, _lastRow, 1, _numPar);
-    }
 
     const Matrix& AA1() {return _AA1;}
@@ -128,10 +118,9 @@
     const Matrix& D21() {return _D21;}
 
-    void initAA() {//LOG << "initAA: _maxObs: " << _maxObs << " _numPar: " << _numPar << endl;
+    void initAA() {
       _AA1.ReSize(_maxObs, _numPar); _AA1 = 0.0;
       _AA2.ReSize(_maxObs, _numPar); _AA2 = 0.0;
       _D21.ReSize(_numPar, _numPar); _D21 = 0.0;
     }
-
     void prepareAA(const Matrix& AA, int ind) {
       Matrix* Prep = &_AA2;
@@ -141,9 +130,7 @@
       Prep->SubMatrix(_firstRow, _lastRow, 1, _numPar) << AA;
     }
-
     void switchAA() {
       _AA1 = _AA2;
     }
-
     t_irc computeTrafoMatrix() {
       if (((_AA2.t() * _AA2)).Determinant() == 0.0) {
Index: /trunk/BNC/src/PPP/pppParlist.h
===================================================================
--- /trunk/BNC/src/PPP/pppParlist.h	(revision 9430)
+++ /trunk/BNC/src/PPP/pppParlist.h	(revision 9431)
@@ -109,4 +109,5 @@
   const std::vector<t_pppParam*>& params() const {return _params;}
         std::vector<t_pppParam*>& params()       {return _params;}
+  QList<char>& usedSystems() {return _usedSystems;}
   void printResult(const bncTime& epoTime, const SymmetricMatrix& QQ,
                    const ColumnVector& xx) const;
