Index: trunk/BNC/src/PPP/pppSatObs.cpp
===================================================================
--- trunk/BNC/src/PPP/pppSatObs.cpp	(revision 9596)
+++ trunk/BNC/src/PPP/pppSatObs.cpp	(revision 9598)
@@ -65,23 +65,44 @@
   // Select pseudo-ranges and phase observations
   // -------------------------------------------
-  string preferredAttrib = "G:12&WCPSLX R:12&PC E:1&CBX E:5&QIX C:26&IQX";
+
+  QString preferredAttribList = "G:12&CWPSLX R:12&CP E:1&CBX E:5&QIX C:26&IQX";
   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,
-    preferredAttrib = "G:12&W R:12&P E:1&CX E:5&QX C:26&I";
-  }
-
+    // at the moment only one code or phase bias per system (G,R,E,C)/modulation considered
+    preferredAttribList = "G:12&CW R:12&CP E:1&CX E:5&QX C:26&I";
+  }
+  QStringList priorList = preferredAttribList.split(" ", QString::SkipEmptyParts);
+  string preferredAttrib;
+  char obsSys = pppSatObs._prn.system();  //cout << "SATELLITE: " << pppSatObs._prn.toString() << endl;
   for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
-    string frqNum = t_frequency::toString(t_frequency::type(iFreq)).substr(1);
-    for (unsigned iPref = 0; iPref < preferredAttrib.length(); iPref++) {
-      string obsType = (preferredAttrib[iPref] == '_') ? frqNum : frqNum + preferredAttrib[iPref];
-      if (_obs[iFreq] == 0) {
-        for (unsigned ii = 0; ii < pppSatObs._obs.size(); ii++) {
-          const t_frqObs* obs = pppSatObs._obs[ii];
-          if (obs->_rnxType2ch == obsType &&
-              obs->_codeValid && obs->_code &&
-              obs->_phaseValid && obs->_phase &&
-              obs->_lockTimeValid &&  obs->_lockTime > 5.0)   {
-            _obs[iFreq] = new t_frqObs(*obs);
+    t_frequency::type frqType = static_cast<t_frequency::type>(iFreq);
+    char frqSys = t_frequency::toString(frqType)[0]; //cout << "frqSys: " << frqSys << endl;
+    char frqNum = t_frequency::toString(frqType)[1]; //cout << "frqNum: " << frqNum << endl;
+    if (obsSys != frqSys) {
+      continue;
+    }
+    QStringList hlp;
+    for (int ii = 0; ii < priorList.size(); ii++) {
+      if (priorList[ii].indexOf(":") != -1) {
+        hlp = priorList[ii].split(":", QString::SkipEmptyParts);
+        if (hlp.size() == 2 && hlp[0].length() == 1 && hlp[0][0] == frqSys) {
+          hlp = hlp[1].split("&", QString::SkipEmptyParts);
+        }
+        if (hlp.size() == 2 && hlp[0].indexOf(frqNum) != -1) {
+          preferredAttrib = hlp[1].toStdString(); //cout << "preferredAttrib: " << preferredAttrib << endl;
+        }
+      }
+      for (unsigned iPref = 0; iPref < preferredAttrib.length(); iPref++) {
+        QString obsType = QString("%1").arg(frqNum) + preferredAttrib[iPref];  //cout << "obstype: " << obsType.toStdString().c_str() << endl;
+        if (_obs[iFreq] == 0) {
+          for (unsigned ii = 0; ii < pppSatObs._obs.size(); ii++) {
+            const t_frqObs* obs = pppSatObs._obs[ii];
+            //cout << "observation2char: " << obs->_rnxType2ch << " vs. " << obsType.toStdString().c_str()<< endl;
+            if (obs->_rnxType2ch == obsType.toStdString() &&
+                obs->_codeValid && obs->_code &&
+                obs->_phaseValid && obs->_phase &&
+                obs->_lockTimeValid &&  obs->_lockTime > 5.0) {
+              _obs[iFreq] = new t_frqObs(*obs); //cout << "================> newObs: " << obs->_rnxType2ch <<endl;
+            }
           }
         }
@@ -436,4 +457,6 @@
     for (unsigned ii = 0; ii < t_frequency::max; ii++) {
       t_frequency::type frqType = static_cast<t_frequency::type>(ii);
+      string frqStr = t_frequency::toString(frqType);
+      if (frqStr[0] != _prn.system()) {continue;}
       bool found;
       QString prn(_prn.toString().c_str());
@@ -470,4 +493,8 @@
       const t_frqCodeBias& bias = satCodeBias->_bias[ii];
       for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
+        string frqStr = t_frequency::toString(t_frequency::type(iFreq));
+        if (frqStr[0] != _prn.system()) {
+          continue;
+        }
         const t_frqObs* obs = _obs[iFreq];
         if (obs && obs->_rnxType2ch == bias._rnxType2ch) {
@@ -493,4 +520,8 @@
       const t_frqPhaseBias& bias = satPhaseBias->_bias[ii];
       for (unsigned iFreq = 1; iFreq < t_frequency::max; iFreq++) {
+        string frqStr = t_frequency::toString(t_frequency::type(iFreq));
+        if (frqStr[0] != _prn.system()) {
+          continue;
+        }
         const t_frqObs* obs = _obs[iFreq];
         if (obs && obs->_rnxType2ch == bias._rnxType2ch) {
@@ -561,5 +592,5 @@
   LOG << "\nMODEL for Satellite " << _prn.toString() << (isReference() ? " (Reference Satellite)" : "")
 
-      << "======================= " << endl
+      << "\n======================= " << endl
      << "PPP STRATEGY  : " <<  OPT->_obsmodelTypeStr.at((int)OPT->_obsModelType).toLocal8Bit().constData()
       <<  ((OPT->_pseudoObsIono) ? " with pseudo-observations for STEC" : "")          << endl
@@ -584,6 +615,6 @@
       if (_prn.system() == frqStr[0]) {
       LOG << "PCO           : " << frqStr << setw(12) << setprecision(3) << _model._antPCO[iFreq]       << endl
-          << "BIAS CODE     : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq]     << endl
-          << "BIAS PHASE    : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq]    << endl
+          << "BIAS CODE     : " << frqStr << setw(12) << setprecision(3) << _model._codeBias[iFreq]     << "\t(" << _obs[iFreq]->_rnxType2ch[1] << ") " << endl
+          << "BIAS PHASE    : " << frqStr << setw(12) << setprecision(3) << _model._phaseBias[iFreq]    << "\t(" << _obs[iFreq]->_rnxType2ch[1] << ") " << endl
           << "IONO CODEDELAY: " << frqStr << setw(12) << setprecision(3) << _model._ionoCodeDelay[iFreq]<< endl;
       }
