Index: trunk/BNC/src/combination/bnccomb.cpp
===================================================================
--- trunk/BNC/src/combination/bnccomb.cpp	(revision 9253)
+++ trunk/BNC/src/combination/bnccomb.cpp	(revision 9258)
@@ -48,10 +48,5 @@
   eph    = 0;
 
-  if      (type == offACgps) {
-    epoSpec = true;
-    sig0    = sig0_offAC;
-    sigP    = sig0;
-  }
-  else if (type == offACglo) {
+  if      (type == offACgnss) {
     epoSpec = true;
     sig0    = sig0_offAC;
@@ -77,13 +72,8 @@
 // Partial
 ////////////////////////////////////////////////////////////////////////////
-double bncComb::cmbParam::partial(const QString& AC_, const QString& prn_) {
-
-  if      (type == offACgps) {
-    if (AC == AC_ && prn_[0] == 'G') {
-      return 1.0;
-    }
-  }
-  else if (type == offACglo) {
-    if (AC == AC_ && prn_[0] == 'R') {
+double bncComb::cmbParam::partial(char sys, const QString& AC_, const QString& prn_) {
+
+  if      (type == offACgnss) {
+    if (AC == AC_ && prn_[0].toLatin1() == sys) {
       return 1.0;
     }
@@ -105,13 +95,10 @@
 //
 ////////////////////////////////////////////////////////////////////////////
-QString bncComb::cmbParam::toString() const {
+QString bncComb::cmbParam::toString(char sys) const {
 
   QString outStr;
 
-  if      (type == offACgps) {
-    outStr = "AC offset GPS " + AC;
-  }
-  else if (type == offACglo) {
-    outStr = "AC offset GLO " + AC;
+  if      (type == offACgnss) {
+    outStr = "AC  Offset " + AC + " " + sys ;
   }
   else if (type == offACSat) {
@@ -145,5 +132,11 @@
   }
 
-  _masterMissingEpochs = 0;
+  _cmbSysPrn['G'] = t_prn::MAXPRN_GPS;     _masterMissingEpochs['G'] = 0;
+  _cmbSysPrn['R'] = t_prn::MAXPRN_GLONASS; _masterMissingEpochs['R'] = 0;
+  _cmbSysPrn['E'] = t_prn::MAXPRN_GALILEO; _masterMissingEpochs['E'] = 0;
+  _cmbSysPrn['C'] = t_prn::MAXPRN_BDS;     _masterMissingEpochs['C'] = 0;/*
+  _cmbSysPrn['J'] = t_prn::MAXPRN_QZSS;    _masterMissingEpochs['J'] = 0;
+  _cmbSysPrn['S'] = t_prn::MAXPRN_SBAS;    _masterMissingEpochs['S'] = 0;
+  */
 
   if (cmbStreams.size() >= 1 && !cmbStreams[0].isEmpty()) {
@@ -155,6 +148,12 @@
       newAC->name       = hlp[1];
       newAC->weight     = hlp[2].toDouble();
-      if (_masterOrbitAC.isEmpty()) {
-        _masterOrbitAC = newAC->name;
+      QMapIterator<char, unsigned> itSys(_cmbSysPrn);
+      // init
+      while (itSys.hasNext()) {
+        itSys.next();
+        char sys = itSys.key();
+        if (_masterOrbitAC.isEmpty()) {
+          _masterOrbitAC[sys] = newAC->name;
+        }
       }
       _ACs.append(newAC);
@@ -163,4 +162,5 @@
 
   QString ssrFormat;
+  _ssrCorr = 0;
   QListIterator<QString> it(settings.value("uploadMountpointsOut").toStringList());
   while (it.hasNext()) {
@@ -170,5 +170,4 @@
     }
   }
-  _ssrCorr = 0;
   if      (ssrFormat == "IGS-SSR") {
     _ssrCorr = new SsrCorrIgs();
@@ -177,5 +176,7 @@
     _ssrCorr = new SsrCorrRtcm();
   }
-
+  else { // default
+    _ssrCorr = new SsrCorrIgs();
+  }
 
   _rtnetDecoder = 0;
@@ -192,4 +193,6 @@
   connect(BNC_CORE, SIGNAL(newClkCorrections(QList<t_clkCorr>)),
           this,     SLOT(slotNewClkCorrections(QList<t_clkCorr>)));
+
+
 
   // Combination Method
@@ -202,53 +205,40 @@
   }
 
-  // Use Glonass
-  // -----------
-  if ( Qt::CheckState(settings.value("cmbUseGlonass").toInt()) == Qt::Checked) {
-    _useGlonass = true;
-  }
-  else {
-    _useGlonass = false;
-  }
-
   // Initialize Parameters (model: Clk_Corr = AC_Offset + Sat_Offset + Clk)
   // ----------------------------------------------------------------------
   if (_method == filter) {
-    int nextPar = 0;
-    QListIterator<cmbAC*> it(_ACs);
-    while (it.hasNext()) {
-      cmbAC* AC = it.next();
-      _params.push_back(new cmbParam(cmbParam::offACgps, ++nextPar, AC->name, ""));
-      for (unsigned iGps = 1; iGps <= t_prn::MAXPRN_GPS; iGps++) {
-        QString prn = QString("G%1_0").arg(iGps, 2, 10, QChar('0'));
-        _params.push_back(new cmbParam(cmbParam::offACSat, ++nextPar,
-                                       AC->name, prn));
-      }
-      if (_useGlonass) {
-        _params.push_back(new cmbParam(cmbParam::offACglo, ++nextPar, AC->name, ""));
-        for (unsigned iGlo = 1; iGlo <= t_prn::MAXPRN_GLONASS; iGlo++) {
-          QString prn = QString("R%1_0").arg(iGlo, 2, 10, QChar('0'));
-          _params.push_back(new cmbParam(cmbParam::offACSat, ++nextPar,
-                                         AC->name, prn));
+    // SYSTEM
+    QMapIterator<char, unsigned> itSys(_cmbSysPrn);
+    while (itSys.hasNext()) {
+      itSys.next();
+      int nextPar = 0;
+      char sys = itSys.key();
+      unsigned maxPrn = itSys.value();
+      unsigned flag = 0;
+      if (sys == 'E') {
+        flag = 1;
+      }
+      // AC
+      QListIterator<cmbAC*> itAc(_ACs);
+      while (itAc.hasNext()) {
+        cmbAC* AC = itAc.next();
+        _params[sys].push_back(new cmbParam(cmbParam::offACgnss, ++nextPar, AC->name, ""));
+        for (unsigned iGnss = 1; iGnss <= maxPrn; iGnss++) {
+          QString prn = QString("%1%2_%3").arg(sys).arg(iGnss, 2, 10, QChar('0')).arg(flag);
+          _params[sys].push_back(new cmbParam(cmbParam::offACSat, ++nextPar, AC->name, prn));
         }
       }
-    }
-    for (unsigned iGps = 1; iGps <= t_prn::MAXPRN_GPS; iGps++) {
-      QString prn = QString("G%1_0").arg(iGps, 2, 10, QChar('0'));
-      _params.push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));
-    }
-    if (_useGlonass) {
-      for (unsigned iGlo = 1; iGlo <= t_prn::MAXPRN_GLONASS; iGlo++) {
-        QString prn = QString("R%1_0").arg(iGlo, 2, 10, QChar('0'));
-        _params.push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));
-      }
-    }
-
-    // Initialize Variance-Covariance Matrix
-    // -------------------------------------
-    _QQ.ReSize(_params.size());
-    _QQ = 0.0;
-    for (int iPar = 1; iPar <= _params.size(); iPar++) {
-      cmbParam* pp = _params[iPar-1];
-      _QQ(iPar,iPar) = pp->sig0 * pp->sig0;
+      for (unsigned iGnss = 1; iGnss <= maxPrn; iGnss++) {
+        QString prn = QString("%1%2_%3").arg(sys).arg(iGnss, 2, 10, QChar('0')).arg(flag);
+        _params[sys].push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));
+      }
+      // Initialize Variance-Covariance Matrix
+      // -------------------------------------
+      _QQ[sys].ReSize(_params[sys].size());
+      _QQ[sys] = 0.0;
+      for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
+        cmbParam* pp = _params[sys][iPar-1];
+        _QQ[sys](iPar,iPar) = pp->sig0 * pp->sig0;
+      }
     }
   }
@@ -287,12 +277,18 @@
   }
   delete _antex;
-  for (int iPar = 1; iPar <= _params.size(); iPar++) {
-    delete _params[iPar-1];
-  }
-  QListIterator<bncTime> itTime(_buffer.keys());
-  while (itTime.hasNext()) {
-    bncTime epoTime = itTime.next();
-    _buffer.remove(epoTime);
-  }
+  QMapIterator<char, unsigned> itSys(_cmbSysPrn);
+  while (itSys.hasNext()) {
+    itSys.next();
+    char sys = itSys.key();
+    for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
+      delete _params[sys][iPar-1];
+    }
+    QListIterator<bncTime> itTime(_buffer[sys].keys());
+    while (itTime.hasNext()) {
+      bncTime epoTime = itTime.next();
+      _buffer[sys].remove(epoTime);
+    }
+  }
+
 }
 
@@ -340,4 +336,5 @@
     QString    staID(clkCorr._staID.c_str());
     QString    prn(clkCorr._prn.toInternalString().c_str());
+    char       sys = clkCorr._prn.system();
 
     // Set the last time
@@ -362,19 +359,4 @@
     }
 
-    // Check GLONASS
-    // -------------
-    if (!_useGlonass && clkCorr._prn.system() == 'R') {
-      continue;
-    }
-
-    if (
-        clkCorr._prn.system() == 'E' ||
-        clkCorr._prn.system() == 'C' ||
-        clkCorr._prn.system() == 'J' ||
-        clkCorr._prn.system() == 'I' ||
-        clkCorr._prn.system() == 'S' )   {
-      continue;
-    }
-
     // Check Modulo Time
     // -----------------
@@ -408,5 +390,6 @@
     else {
       QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName];
-      if (!storage.contains(clkCorr._prn)  || storage[clkCorr._prn]._iod != newCorr->_iod) {
+      if (!storage.contains(clkCorr._prn)  ||
+           storage[clkCorr._prn]._iod != newCorr->_iod) {
         delete newCorr;
         continue;
@@ -422,5 +405,5 @@
     t_eph* ephPrev = _ephUser.ephPrev(prn);
     if (ephLast == 0) {
-      emit newMessage("bncComb: eph not found for "  + prn.mid(0,3).toLatin1(), true);
+      //emit newMessage("bncComb: eph not found for "  + prn.mid(0,3).toLatin1(), true);
       delete newCorr;
       continue;
@@ -435,6 +418,6 @@
       }
       else {
-        emit newMessage("bncComb: eph not found for "  + prn.mid(0,3).toLatin1() +
-                        QString(" with IOD %1").arg(newCorr->_iod).toLatin1(), true);
+        //emit newMessage("bncComb: eph not found for "  + prn.mid(0,3).toLatin1() +
+                        //QString(" with IOD %1").arg(newCorr->_iod).toLatin1(), true);
         delete newCorr;
         continue;
@@ -444,6 +427,8 @@
     // Store correction into the buffer
     // --------------------------------
-    QVector<cmbCorr*>& corrs = _buffer[newCorr->_time].corrs;
+    QVector<cmbCorr*>& corrs = _buffer[sys][newCorr->_time].corrs;
     corrs.push_back(newCorr);
+
+
   }
 
@@ -451,10 +436,15 @@
   // -------------------------
   const double outWait = 1.0 * _cmbSampl;
-  QListIterator<bncTime> itTime(_buffer.keys());
-  while (itTime.hasNext()) {
-    bncTime epoTime = itTime.next();
-    if (epoTime < lastTime - outWait) {
-      _resTime = epoTime;
-      processEpoch();
+  QMapIterator<char, unsigned> itSys(_cmbSysPrn);
+  while (itSys.hasNext()) {
+    itSys.next();
+    char sys = itSys.key();
+    QListIterator<bncTime> itTime(_buffer[sys].keys());
+    while (itTime.hasNext()) {
+      bncTime epoTime = itTime.next();
+      if (epoTime < lastTime - outWait) {
+        _resTime = epoTime;
+        processEpoch(sys);
+      }
     }
   }
@@ -502,5 +492,5 @@
 // Process Epoch
 ////////////////////////////////////////////////////////////////////////////
-void bncComb::processEpoch() {
+void bncComb::processEpoch(char sys) {
 
   _log.clear();
@@ -508,6 +498,6 @@
   QTextStream out(&_log, QIODevice::WriteOnly);
 
-  out << endl <<           "Combination:" << endl
-      << "------------------------------" << endl;
+  out << endl <<           "Combination: " << sys << endl
+      << "--------------------------------" << endl;
 
   // Observation Statistics
@@ -517,16 +507,16 @@
   while (icAC.hasNext()) {
     cmbAC* AC = icAC.next();
-    AC->numObs = 0;
-    QVectorIterator<cmbCorr*> itCorr(corrs());
+    AC->numObs[sys] = 0;
+    QVectorIterator<cmbCorr*> itCorr(corrs(sys));
     while (itCorr.hasNext()) {
       cmbCorr* corr = itCorr.next();
       if (corr->_acName == AC->name) {
-        AC->numObs += 1;
-        if (AC->name == _masterOrbitAC) {
+        AC->numObs[sys] += 1;
+        if (AC->name == _masterOrbitAC[sys]) {
           masterPresent = true;
         }
       }
     }
-    out << AC->name.toLatin1().data() << ": " << AC->numObs << endl;
+    out << AC->name.toLatin1().data() << ": " << AC->numObs[sys] << endl;
   }
 
@@ -535,26 +525,26 @@
   const unsigned switchMasterAfterGap = 1;
   if (masterPresent) {
-    _masterMissingEpochs = 0;
+    _masterMissingEpochs[sys] = 0;
   }
   else {
-    ++_masterMissingEpochs;
-    if (_masterMissingEpochs < switchMasterAfterGap) {
+    ++_masterMissingEpochs[sys];
+    if (_masterMissingEpochs[sys] < switchMasterAfterGap) {
       out << "Missing Master, Epoch skipped" << endl;
-      _buffer.remove(_resTime);
+      _buffer[sys].remove(_resTime);
       emit newMessage(_log, false);
       return;
     }
     else {
-      _masterMissingEpochs = 0;
+      _masterMissingEpochs[sys] = 0;
       QListIterator<cmbAC*> icAC(_ACs);
       while (icAC.hasNext()) {
         cmbAC* AC = icAC.next();
-        if (AC->numObs > 0) {
+        if (AC->numObs[sys] > 0) {
           out << "Switching Master AC "
-              << _masterOrbitAC.toLatin1().data() << " --> "
+              << _masterOrbitAC[sys].toLatin1().data() << " --> "
               << AC->name.toLatin1().data()   << " "
               << _resTime.datestr().c_str()    << " "
               << _resTime.timestr().c_str()    << endl;
-          _masterOrbitAC = AC->name;
+          _masterOrbitAC[sys] = AC->name;
           break;
         }
@@ -570,8 +560,8 @@
   ColumnVector dx;
   if (_method == filter) {
-    irc = processEpoch_filter(out, resCorr, dx);
+    irc = processEpoch_filter(sys, out, resCorr, dx);
   }
   else {
-    irc = processEpoch_singleEpoch(out, resCorr, dx);
+    irc = processEpoch_singleEpoch(sys, out, resCorr, dx);
   }
 
@@ -579,6 +569,6 @@
   // --------------------------------------
   if (irc == success) {
-    for (int iPar = 1; iPar <= _params.size(); iPar++) {
-      cmbParam* pp = _params[iPar-1];
+    for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
+      cmbParam* pp = _params[sys][iPar-1];
       pp->xx += dx(iPar);
       if (pp->type == cmbParam::clkSat) {
@@ -592,6 +582,6 @@
       out.setFieldWidth(8);
       out.setRealNumberPrecision(4);
-      out << pp->toString() << " "
-          << pp->xx << " +- " << sqrt(_QQ(pp->index,pp->index)) << endl;
+      out << pp->toString(sys) << " "
+          << pp->xx << " +- " << sqrt(_QQ[sys](pp->index,pp->index)) << endl;
       out.setFieldWidth(0);
     }
@@ -602,5 +592,5 @@
   // Delete Data, emit Message
   // -------------------------
-  _buffer.remove(_resTime);
+  _buffer[sys].remove(_resTime);
   emit newMessage(_log, false);
 }
@@ -608,5 +598,5 @@
 // Process Epoch - Filter Method
 ////////////////////////////////////////////////////////////////////////////
-t_irc bncComb::processEpoch_filter(QTextStream& out,
+t_irc bncComb::processEpoch_filter(char sys, QTextStream& out,
                                    QMap<QString, cmbCorr*>& resCorr,
                                    ColumnVector& dx) {
@@ -614,16 +604,16 @@
   // Prediction Step
   // ---------------
-  int nPar = _params.size();
+  int nPar = _params[sys].size();
   ColumnVector x0(nPar);
-  for (int iPar = 1; iPar <= _params.size(); iPar++) {
-    cmbParam* pp  = _params[iPar-1];
+  for (int iPar = 1; iPar <= nPar; iPar++) {
+    cmbParam* pp  = _params[sys][iPar-1];
     if (pp->epoSpec) {
       pp->xx = 0.0;
-      _QQ.Row(iPar)    = 0.0;
-      _QQ.Column(iPar) = 0.0;
-      _QQ(iPar,iPar) = pp->sig0 * pp->sig0;
+      _QQ[sys].Row(iPar)    = 0.0;
+      _QQ[sys].Column(iPar) = 0.0;
+      _QQ[sys](iPar,iPar) = pp->sig0 * pp->sig0;
     }
     else {
-      _QQ(iPar,iPar) += pp->sigP * pp->sigP;
+      _QQ[sys](iPar,iPar) += pp->sigP * pp->sigP;
     }
     x0(iPar) = pp->xx;
@@ -632,5 +622,5 @@
   // Check Satellite Positions for Outliers
   // --------------------------------------
-  if (checkOrbits(out) != success) {
+  if (checkOrbits(sys, out) != success) {
     return failure;
   }
@@ -638,5 +628,5 @@
   // Update and outlier detection loop
   // ---------------------------------
-  SymmetricMatrix QQ_sav = _QQ;
+  SymmetricMatrix QQ_sav = _QQ[sys];
   while (true) {
 
@@ -645,10 +635,10 @@
     DiagonalMatrix PP;
 
-    if (createAmat(AA, ll, PP, x0, resCorr) != success) {
+    if (createAmat(sys, AA, ll, PP, x0, resCorr) != success) {
       return failure;
     }
 
     dx.ReSize(nPar); dx = 0.0;
-    kalman(AA, ll, PP, _QQ, dx);
+    kalman(AA, ll, PP, _QQ[sys], dx);
 
     ColumnVector vv = ll - AA * dx;
@@ -660,11 +650,11 @@
     out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()
         << " Maximum Residuum " << maxRes << ' '
-        << corrs()[maxResIndex-1]->_acName << ' ' << corrs()[maxResIndex-1]->_prn.mid(0,3);
+        << corrs(sys)[maxResIndex-1]->_acName << ' ' << corrs(sys)[maxResIndex-1]->_prn.mid(0,3);
     if (maxRes > _MAXRES) {
-      for (int iPar = 1; iPar <= _params.size(); iPar++) {
-        cmbParam* pp = _params[iPar-1];
+      for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
+        cmbParam* pp = _params[sys][iPar-1];
         if (pp->type == cmbParam::offACSat            &&
-            pp->AC   == corrs()[maxResIndex-1]->_acName &&
-            pp->prn  == corrs()[maxResIndex-1]->_prn.mid(0,3)) {
+            pp->AC   == corrs(sys)[maxResIndex-1]->_acName &&
+            pp->prn  == corrs(sys)[maxResIndex-1]->_prn.mid(0,3)) {
           QQ_sav.Row(iPar)    = 0.0;
           QQ_sav.Column(iPar) = 0.0;
@@ -674,6 +664,6 @@
 
       out << "  Outlier" << endl;
-      _QQ = QQ_sav;
-      corrs().remove(maxResIndex-1);
+      _QQ[sys] = QQ_sav;
+      corrs(sys).remove(maxResIndex-1);
     }
     else {
@@ -681,6 +671,6 @@
       out.setRealNumberNotation(QTextStream::FixedNotation);
       out.setRealNumberPrecision(4);
-      for (int ii = 0; ii < corrs().size(); ii++) {
-      const cmbCorr* corr = corrs()[ii];
+      for (int ii = 0; ii < corrs(sys).size(); ii++) {
+      const cmbCorr* corr = corrs(sys)[ii];
         out << _resTime.datestr().c_str() << ' '
             << _resTime.timestr().c_str() << " "
@@ -734,5 +724,4 @@
 
   QString     outLines;
-  //QStringList corrLines;
 
   unsigned year, month, day, hour, minute;
@@ -809,5 +798,4 @@
                  corr->_orbCorr._dotXr[2],
                  0.0);
-    //corrLines << line;
 
     delete corr;
@@ -833,10 +821,9 @@
 // Create First Design Matrix and Vector of Measurements
 ////////////////////////////////////////////////////////////////////////////
-t_irc bncComb::createAmat(Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
-                          const ColumnVector& x0,
-                          QMap<QString, cmbCorr*>& resCorr) {
-
-  unsigned nPar = _params.size();
-  unsigned nObs = corrs().size();
+t_irc bncComb::createAmat(char sys, Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
+                          const ColumnVector& x0, QMap<QString, cmbCorr*>& resCorr) {
+
+  unsigned nPar = _params[sys].size();
+  unsigned nObs = corrs(sys).size();
 
   if (nObs == 0) {
@@ -844,10 +831,7 @@
   }
 
-  int maxSat = t_prn::MAXPRN_GPS;
-//  if (_useGlonass) {
-//    maxSat = t_prn::MAXPRN_GPS + t_prn::MAXPRN_GLONASS;
-//  }
-
-  const int nCon = (_method == filter) ? 1 + maxSat : 0;
+  int maxSat = _cmbSysPrn[sys];
+
+  const int nCon = (_method == filter) ? 1 + maxSat : 0; //(maybe not for GLONASS)
 
   AA.ReSize(nObs+nCon, nPar);  AA = 0.0;
@@ -856,5 +840,5 @@
 
   int iObs = 0;
-  QVectorIterator<cmbCorr*> itCorr(corrs());
+  QVectorIterator<cmbCorr*> itCorr(corrs(sys));
   while (itCorr.hasNext()) {
     cmbCorr* corr = itCorr.next();
@@ -863,11 +847,11 @@
     ++iObs;
 
-    if (corr->_acName == _masterOrbitAC && resCorr.find(prn) == resCorr.end()) {
+    if (corr->_acName == _masterOrbitAC[sys] && resCorr.find(prn) == resCorr.end()) {
       resCorr[prn] = new cmbCorr(*corr);
     }
 
-    for (int iPar = 1; iPar <= _params.size(); iPar++) {
-      cmbParam* pp = _params[iPar-1];
-      AA(iObs, iPar) = pp->partial(corr->_acName, prn);
+    for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
+      cmbParam* pp = _params[sys][iPar-1];
+      AA(iObs, iPar) = pp->partial(sys, corr->_acName, prn);
     }
 
@@ -880,6 +864,6 @@
     const double Ph = 1.e6;
     PP(nObs+1) = Ph;
-    for (int iPar = 1; iPar <= _params.size(); iPar++) {
-      cmbParam* pp = _params[iPar-1];
+    for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
+      cmbParam* pp = _params[sys][iPar-1];
       if ( AA.Column(iPar).maximum_absolute_value() > 0.0 &&
            pp->type == cmbParam::clkSat ) {
@@ -888,10 +872,15 @@
     }
     int iCond = 1;
-    for (unsigned iGps = 1; iGps <= t_prn::MAXPRN_GPS; iGps++) {
-      QString prn = QString("G%1_0").arg(iGps, 2, 10, QChar('0'));
+    unsigned flag = 0;
+    if (sys == 'E') {
+      flag = 1;
+    }
+    // GNSS (maybe not for GLONASS)
+    for (unsigned iGnss = 1; iGnss <= _cmbSysPrn[sys]; iGnss++) {
+      QString prn = QString("%1%2_%3").arg(sys).arg(iGnss, 2, 10, QChar('0')).arg(flag);
       ++iCond;
       PP(nObs+iCond) = Ph;
-      for (int iPar = 1; iPar <= _params.size(); iPar++) {
-        cmbParam* pp = _params[iPar-1];
+      for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
+        cmbParam* pp = _params[sys][iPar-1];
         if ( pp &&
              AA.Column(iPar).maximum_absolute_value() > 0.0 &&
@@ -902,20 +891,4 @@
       }
     }
-//    if (_useGlonass) {// liefert schlechtere Höhenkomponente im PPP
-//      for (unsigned iGlo = 1; iGlo <= t_prn::MAXPRN_GLONASS; iGlo++) {
-//        QString prn = QString("R%1_0").arg(iGlo, 2, 10, QChar('0'));
-//        ++iCond;
-//        PP(nObs+iCond) = Ph;
-//        for (int iPar = 1; iPar <= _params.size(); iPar++) {
-//          cmbParam* pp = _params[iPar-1];
-//          if ( pp &&
-//               AA.Column(iPar).maximum_absolute_value() > 0.0 &&
-//               pp->type == cmbParam::offACSat                 &&
-//               pp->prn == prn) {
-//            AA(nObs+iCond, iPar) = 1.0;
-//          }
-//        }
-//      }
-//    }
   }
 
@@ -925,5 +898,5 @@
 // Process Epoch - Single-Epoch Method
 ////////////////////////////////////////////////////////////////////////////
-t_irc bncComb::processEpoch_singleEpoch(QTextStream& out,
+t_irc bncComb::processEpoch_singleEpoch(char sys, QTextStream& out,
                                         QMap<QString, cmbCorr*>& resCorr,
                                         ColumnVector& dx) {
@@ -931,5 +904,5 @@
   // Check Satellite Positions for Outliers
   // --------------------------------------
-  if (checkOrbits(out) != success) {
+  if (checkOrbits(sys, out) != success) {
     return failure;
   }
@@ -941,15 +914,15 @@
     // Remove Satellites that are not in Master
     // ----------------------------------------
-    QMutableVectorIterator<cmbCorr*> it(corrs());
+    QMutableVectorIterator<cmbCorr*> it(corrs(sys));
     while (it.hasNext()) {
       cmbCorr* corr = it.next();
       QString  prn  = corr->_prn;
       bool foundMaster = false;
-      QVectorIterator<cmbCorr*> itHlp(corrs());
+      QVectorIterator<cmbCorr*> itHlp(corrs(sys));
       while (itHlp.hasNext()) {
         cmbCorr* corrHlp = itHlp.next();
         QString  prnHlp  = corrHlp->_prn;
         QString  ACHlp   = corrHlp->_acName;
-        if (ACHlp == _masterOrbitAC && prn == prnHlp) {
+        if (ACHlp == _masterOrbitAC[sys] && prn == prnHlp) {
           foundMaster = true;
           break;
@@ -966,5 +939,5 @@
     QMap<QString, int> numObsPrn;
     QMap<QString, int> numObsAC;
-    QVectorIterator<cmbCorr*> itCorr(corrs());
+    QVectorIterator<cmbCorr*> itCorr(corrs(sys));
     while (itCorr.hasNext()) {
       cmbCorr* corr = itCorr.next();
@@ -985,10 +958,10 @@
     }
 
-    // Clean-Up the Paramters
-    // ----------------------
-    for (int iPar = 1; iPar <= _params.size(); iPar++) {
-      delete _params[iPar-1];
-    }
-    _params.clear();
+    // Clean-Up the Parameters
+    // -----------------------
+    for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
+      delete _params[sys][iPar-1];
+    }
+    _params[sys].clear();
 
     // Set new Parameters
@@ -1001,9 +974,6 @@
       const QString& AC     = itAC.key();
       int            numObs = itAC.value();
-      if (AC != _masterOrbitAC && numObs > 0) {
-        _params.push_back(new cmbParam(cmbParam::offACgps, ++nextPar, AC, ""));
-        if (_useGlonass) {
-          _params.push_back(new cmbParam(cmbParam::offACglo, ++nextPar, AC, ""));
-        }
+      if (AC != _masterOrbitAC[sys] && numObs > 0) {
+        _params[sys].push_back(new cmbParam(cmbParam::offACgnss, ++nextPar, AC, ""));
       }
     }
@@ -1015,9 +985,9 @@
       int            numObs = itPrn.value();
       if (numObs > 0) {
-        _params.push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));
-      }
-    }
-
-    int nPar = _params.size();
+        _params[sys].push_back(new cmbParam(cmbParam::clkSat, ++nextPar, "", prn));
+      }
+    }
+
+    int nPar = _params[sys].size();
     ColumnVector x0(nPar);
     x0 = 0.0;
@@ -1028,5 +998,5 @@
     ColumnVector   ll;
     DiagonalMatrix PP;
-    if (createAmat(AA, ll, PP, x0, resCorr) != success) {
+    if (createAmat(sys, AA, ll, PP, x0, resCorr) != success) {
       return failure;
     }
@@ -1037,6 +1007,6 @@
       SymmetricMatrix NN; NN << ATP * AA;
       ColumnVector    bb = ATP * ll;
-      _QQ = NN.i();
-      dx  = _QQ * bb;
+      _QQ[sys] = NN.i();
+      dx  = _QQ[sys] * bb;
       vv  = ll - AA * dx;
     }
@@ -1052,10 +1022,10 @@
     out << _resTime.datestr().c_str() << " " << _resTime.timestr().c_str()
         << " Maximum Residuum " << maxRes << ' '
-        << corrs()[maxResIndex-1]->_acName << ' ' << corrs()[maxResIndex-1]->_prn.mid(0,3);
+        << corrs(sys)[maxResIndex-1]->_acName << ' ' << corrs(sys)[maxResIndex-1]->_prn.mid(0,3);
 
     if (maxRes > _MAXRES) {
       out << "  Outlier" << endl;
-      delete corrs()[maxResIndex-1];
-      corrs().remove(maxResIndex-1);
+      delete corrs(sys)[maxResIndex-1];
+      corrs(sys).remove(maxResIndex-1);
     }
     else {
@@ -1064,5 +1034,5 @@
       out.setRealNumberPrecision(3);
       for (int ii = 0; ii < vv.Nrows(); ii++) {
-        const cmbCorr* corr = corrs()[ii];
+        const cmbCorr* corr = corrs(sys)[ii];
         out << _resTime.datestr().c_str() << ' '
             << _resTime.timestr().c_str() << " "
@@ -1082,5 +1052,5 @@
 // Check Satellite Positions for Outliers
 ////////////////////////////////////////////////////////////////////////////
-t_irc bncComb::checkOrbits(QTextStream& out) {
+t_irc bncComb::checkOrbits(char sys, QTextStream& out) {
 
   const double MAX_DISPLACEMENT = 0.20;
@@ -1088,5 +1058,5 @@
   // Switch to last ephemeris (if possible)
   // --------------------------------------
-  QMutableVectorIterator<cmbCorr*> im(corrs());
+  QMutableVectorIterator<cmbCorr*> im(corrs(sys));
   while (im.hasNext()) {
     cmbCorr* corr = im.next();
@@ -1124,5 +1094,5 @@
     QMap<QString, int>          numCorr;
     QMap<QString, ColumnVector> meanRao;
-    QVectorIterator<cmbCorr*> it(corrs());
+    QVectorIterator<cmbCorr*> it(corrs(sys));
     while (it.hasNext()) {
       cmbCorr* corr = it.next();
@@ -1145,6 +1115,6 @@
     }
 
-    // Compute Differences wrt Mean, find Maximum
-    // ------------------------------------------
+    // Compute Differences wrt. Mean, find Maximum
+    // -------------------------------------------
     QMap<QString, cmbCorr*> maxDiff;
     it.toFront();
@@ -1176,5 +1146,5 @@
     // ---------------
     bool removed = false;
-    QMutableVectorIterator<cmbCorr*> im(corrs());
+    QMutableVectorIterator<cmbCorr*> im(corrs(sys));
     while (im.hasNext()) {
       cmbCorr* corr = im.next();
@@ -1233,33 +1203,37 @@
     return;
   }
-
-  // Remove all corrections of the corresponding AC
-  // ----------------------------------------------
-  QListIterator<bncTime> itTime(_buffer.keys());
-  while (itTime.hasNext()) {
-    bncTime epoTime = itTime.next();
-    QVector<cmbCorr*>& corrVec = _buffer[epoTime].corrs;
-    QMutableVectorIterator<cmbCorr*> it(corrVec);
-    while (it.hasNext()) {
-      cmbCorr* corr = it.next();
-      if (acName == corr->_acName) {
-        delete corr;
-        it.remove();
-      }
-    }
-  }
-
-  // Reset Satellite Offsets
-  // -----------------------
-  if (_method == filter) {
-    for (int iPar = 1; iPar <= _params.size(); iPar++) {
-      cmbParam* pp = _params[iPar-1];
-      if (pp->AC == acName && pp->type == cmbParam::offACSat) {
-        pp->xx = 0.0;
-        _QQ.Row(iPar)    = 0.0;
-        _QQ.Column(iPar) = 0.0;
-        _QQ(iPar,iPar) = pp->sig0 * pp->sig0;
-      }
-    }
-  }
-}
+  QMapIterator<char, unsigned> itSys(_cmbSysPrn);
+  while (itSys.hasNext()) {
+    itSys.next();
+    char sys = itSys.key();
+    // Remove all corrections of the corresponding AC
+    // ----------------------------------------------
+    QListIterator<bncTime> itTime(_buffer[sys].keys());
+    while (itTime.hasNext()) {
+      bncTime epoTime = itTime.next();
+      QVector<cmbCorr*>& corrVec = _buffer[sys][epoTime].corrs;
+      QMutableVectorIterator<cmbCorr*> it(corrVec);
+      while (it.hasNext()) {
+        cmbCorr* corr = it.next();
+        if (acName == corr->_acName) {
+          delete corr;
+          it.remove();
+        }
+      }
+    }
+
+    // Reset Satellite Offsets
+    // -----------------------
+    if (_method == filter) {
+      for (int iPar = 1; iPar <= _params[sys].size(); iPar++) {
+        cmbParam* pp = _params[sys][iPar-1];
+        if (pp->AC == acName && pp->type == cmbParam::offACSat) {
+          pp->xx = 0.0;
+          _QQ[sys].Row(iPar)    = 0.0;
+          _QQ[sys].Column(iPar) = 0.0;
+          _QQ[sys](iPar,iPar) = pp->sig0 * pp->sig0;
+        }
+      }
+    }
+  }
+}
Index: trunk/BNC/src/combination/bnccomb.h
===================================================================
--- trunk/BNC/src/combination/bnccomb.h	(revision 9253)
+++ trunk/BNC/src/combination/bnccomb.h	(revision 9258)
@@ -37,9 +37,9 @@
   class cmbParam {
    public:
-    enum parType {offACgps, offACglo, offACSat, clkSat};
+    enum parType {offACgnss, offACSat, clkSat};
     cmbParam(parType type_, int index_, const QString& ac_, const QString& prn_);
     ~cmbParam();
-    double partial(const QString& AC_, const QString& prn_);
-    QString toString() const;
+    double partial(char sys, const QString& AC_, const QString& prn_);
+    QString toString(char sys) const;
     parType type;
     int     index;
@@ -57,5 +57,10 @@
     cmbAC() {
       weight = 0.0;
-      numObs = 0;
+      numObs['G'] = 0;
+      numObs['R'] = 0;
+      numObs['E'] = 0;
+      numObs['C'] = 0;
+      numObs['J'] = 0;
+      numObs['S'] = 0;
     }
     ~cmbAC() {}
@@ -63,5 +68,5 @@
     QString  name;
     double   weight;
-    unsigned numObs;
+    QMap<char, unsigned> numObs;
   };
 
@@ -98,35 +103,35 @@
   };
 
-  void  processEpoch();
-  t_irc processEpoch_filter(QTextStream& out, QMap<QString, cmbCorr*>& resCorr,
+  void  processEpoch(char sys);
+  t_irc processEpoch_filter(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr,
                             ColumnVector& dx);
-  t_irc processEpoch_singleEpoch(QTextStream& out, QMap<QString, cmbCorr*>& resCorr,
+  t_irc processEpoch_singleEpoch(char sys, QTextStream& out, QMap<QString, cmbCorr*>& resCorr,
                                  ColumnVector& dx);
-  t_irc createAmat(Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
+  t_irc createAmat(char sys, Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP,
                    const ColumnVector& x0, QMap<QString, cmbCorr*>& resCorr);
   void  dumpResults(const QMap<QString, cmbCorr*>& resCorr);
   void  printResults(QTextStream& out, const QMap<QString, cmbCorr*>& resCorr);
   void  switchToLastEph(t_eph* lastEph, cmbCorr* corr);
-  t_irc checkOrbits(QTextStream& out);
-  QVector<cmbCorr*>& corrs() {return _buffer[_resTime].corrs;}
+  t_irc checkOrbits(char sys, QTextStream& out);
+  QVector<cmbCorr*>& corrs(char sys) {return _buffer[sys][_resTime].corrs;}
 
   QMutex                                 _mutex;
   QList<cmbAC*>                          _ACs;
   bncTime                                _resTime;
-  QVector<cmbParam*>                     _params;
-  QMap<bncTime, cmbEpoch>                _buffer;
+  QMap<char, QVector<cmbParam*>>         _params;
+  QMap<char, QMap<bncTime, cmbEpoch>>    _buffer;
   bncRtnetDecoder*                       _rtnetDecoder;
-  SymmetricMatrix                        _QQ;
+  QMap<char, SymmetricMatrix>            _QQ;
   QByteArray                             _log;
   bncAntex*                              _antex;
   double                                 _MAXRES;
-  QString                                _masterOrbitAC;
-  unsigned                               _masterMissingEpochs;
+  QMap<char, QString>                    _masterOrbitAC;
+  QMap<char, unsigned>                   _masterMissingEpochs;
   e_method                               _method;
-  bool                                   _useGlonass;
   int                                    _cmbSampl;
   QMap<QString, QMap<t_prn, t_orbCorr> > _orbCorrections;
   bncEphUser                             _ephUser;
   SsrCorr*                               _ssrCorr;
+  QMap<char, unsigned>                   _cmbSysPrn;
 };
 
