Index: trunk/BNC/bncmodel.cpp
===================================================================
--- trunk/BNC/bncmodel.cpp	(revision 2790)
+++ trunk/BNC/bncmodel.cpp	(revision 2791)
@@ -296,14 +296,14 @@
 
   QMapIterator<QString, t_satData*> it(epoData->satDataGPS);
-  int iObs = 0;
+  int iObsBanc = 0;
   while (it.hasNext()) {
-    ++iObs;
+    ++iObsBanc;
     it.next();
     QString    prn     = it.key();
     t_satData* satData = it.value();
-    BB(iObs, 1) = satData->xx(1);
-    BB(iObs, 2) = satData->xx(2);
-    BB(iObs, 3) = satData->xx(3);
-    BB(iObs, 4) = satData->P3 + satData->clk;
+    BB(iObsBanc, 1) = satData->xx(1);
+    BB(iObsBanc, 2) = satData->xx(2);
+    BB(iObsBanc, 3) = satData->xx(3);
+    BB(iObsBanc, 4) = satData->P3 + satData->clk;
   }
 
@@ -691,52 +691,30 @@
     vv = ll - AA * dx;
 
-    ostringstream strA;
-    strA.setf(ios::fixed);
-    ColumnVector vv_code(epoData->sizeGPS());
-    ColumnVector vv_phase(epoData->sizeGPS());
-    ColumnVector vv_glo(epoData->sizeGlo());
-    ColumnVector vv_gal_code(epoData->sizeGal());
-    ColumnVector vv_gal_phase(epoData->sizeGal());
-
-    for (unsigned iobs = 1; iobs <= epoData->sizeGPS(); ++iobs) {
-      if (_usePhase) {
-        vv_code(iobs)  = vv(2*iobs-1);
-        vv_phase(iobs) = vv(2*iobs);
-      }
-      else {
-        vv_code(iobs)  = vv(iobs);
-      }
-    }
-    if (_useGlonass) {
-      for (unsigned iobs = 1; iobs <= epoData->sizeGlo(); ++iobs) {
-        vv_glo(iobs)  = vv(2*epoData->sizeGPS()+iobs);
-      }
-    }
-    if (_useGalileo) {
-      for (unsigned iobs = 1; iobs <= epoData->sizeGal(); ++iobs) {
-        if (_usePhase) {
-          vv_gal_code(iobs)  = vv(2*iobs-1);
-          vv_gal_phase(iobs) = vv(2*iobs);
-        }
-        else {
-          vv_gal_code(iobs)  = vv(iobs);
-        }
-      }
-    }
-
-    strA   << "residuals code  " << setw(8) << setprecision(3) << vv_code.t(); 
-    if (_usePhase) {
-      strA << "residuals phase " << setw(8) << setprecision(3) << vv_phase.t();
-    }
-    if (_useGlonass) {
-      strA << "residuals glo   " << setw(8) << setprecision(3) << vv_glo.t();
-    }
-    if (_useGalileo) {
-      strA << "Galileo code    " << setw(8) << setprecision(3) << vv_gal_code.t(); 
-      if (_usePhase) {
-        strA << "Galileo phase   " << setw(8) << setprecision(3) << vv_gal_phase.t();
-      }
-    }
-    _log += strA.str().c_str();
+    // Print Residuals
+    // ---------------
+    if (true) {
+      ostringstream str;
+      str.setf(ios::fixed);
+
+      QMapIterator<QString, t_satData*> itGPS(epoData->satDataGPS);
+      while (itGPS.hasNext()) {
+        itGPS.next();
+        t_satData* satData = itGPS.value();
+        printRes(vv, str, satData);
+      }
+      QMapIterator<QString, t_satData*> itGlo(epoData->satDataGlo);
+      while (itGlo.hasNext()) {
+        itGlo.next();
+        t_satData* satData = itGlo.value();
+        printRes(vv, str, satData);
+      }
+      QMapIterator<QString, t_satData*> itGal(epoData->satDataGal);
+      while (itGal.hasNext()) {
+        itGal.next();
+        t_satData* satData = itGal.value();
+        printRes(vv, str, satData);
+      }
+      _log += str.str().c_str();
+    }
 
   } while (outlierDetection(QQsav, vv, epoData->satDataGPS, 
@@ -1297,4 +1275,6 @@
                       Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP) {
 
+  // Code Observations
+  // -----------------
   if (satData->system() != 'R') {
     ++iObs;
@@ -1304,6 +1284,9 @@
       AA(iObs, iPar) = _params[iPar-1]->partial(satData, false);
     }
+    satData->indexCode = iObs;
   }
   
+  // Phase Observations
+  // ------------------
   if (_usePhase) {
     ++iObs;
@@ -1317,4 +1300,19 @@
       AA(iObs, iPar) = _params[iPar-1]->partial(satData, true);
     }
-  }
-}
+    satData->indexPhase = iObs;
+  }
+}
+
+// 
+///////////////////////////////////////////////////////////////////////////
+void bncModel::printRes(const ColumnVector& vv, 
+                        ostringstream& str, t_satData* satData) {
+  if (satData->indexCode) {
+    str << "RES P3 " << satData->prn.toAscii().data() << " "
+        << setw(9) << setprecision(4) << vv(satData->indexCode) << endl;
+  }
+  if (satData->indexPhase) {
+    str << "RES L3 " << satData->prn.toAscii().data() << " "
+        << setw(9) << setprecision(4) << vv(satData->indexPhase) << endl;
+  }
+}
Index: trunk/BNC/bncmodel.h
===================================================================
--- trunk/BNC/bncmodel.h	(revision 2790)
+++ trunk/BNC/bncmodel.h	(revision 2791)
@@ -92,4 +92,6 @@
   void   addObs(unsigned& iObs, t_satData* satData,
                 Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP);
+  void   printRes(const ColumnVector& vv, 
+                  std::ostringstream& str, t_satData* satData);
   double cmpValue(t_satData* satData, bool phase);
   double delay_saast(double Ele);
Index: trunk/BNC/bncpppclient.h
===================================================================
--- trunk/BNC/bncpppclient.h	(revision 2790)
+++ trunk/BNC/bncpppclient.h	(revision 2791)
@@ -39,4 +39,9 @@
 class t_satData {
  public:
+  t_satData() {
+    indexCode  = 0;
+    indexPhase = 0;
+  }
+  ~t_satData() {}
   QString      prn;
   double       P1;
@@ -56,4 +61,6 @@
   bool         slipFlag;
   double       lambda3;
+  unsigned     indexCode;
+  unsigned     indexPhase;
   char system() const {return prn.toAscii()[0];}
 };
