Index: trunk/BNC/bncmodel.cpp
===================================================================
--- trunk/BNC/bncmodel.cpp	(revision 3312)
+++ trunk/BNC/bncmodel.cpp	(revision 3313)
@@ -959,5 +959,5 @@
     // --------------
     if (irc == 0) {
-      findMaxRes(vv,satDataGPS, prnCode, maxResCode, prnPhase, maxResPhase);
+      findMaxRes(iPhase, vv,satDataGPS, prnCode, maxResCode, prnPhase, maxResPhase);
       if (maxResCode > MAXRES_CODE_GPS) {
         satDataGPS.remove(prnCode);
@@ -971,5 +971,5 @@
     // ------------------
     if (irc == 0) {
-      findMaxRes(vv,satDataGal, prnCode, maxResCode, prnPhase, maxResPhase);
+      findMaxRes(iPhase, vv,satDataGal, prnCode, maxResCode, prnPhase, maxResPhase);
       if (maxResCode > MAXRES_CODE_GAL) {
         satDataGal.remove(prnCode);
@@ -986,5 +986,5 @@
     // -------------------
     if (irc == 0) {
-      findMaxRes(vv,satDataGlo, prnCode, maxResCode, prnPhase, maxResPhase);
+      findMaxRes(iPhase, vv,satDataGlo, prnCode, maxResCode, prnPhase, maxResPhase);
       if (maxResPhase > MAXRES_PHASE_GLO) {
         satDataGlo.remove(prnPhase);
@@ -998,5 +998,5 @@
     // -------------------
     if (irc == 0) {
-      findMaxRes(vv,satDataGal, prnCode, maxResCode, prnPhase, maxResPhase);
+      findMaxRes(iPhase, vv,satDataGal, prnCode, maxResCode, prnPhase, maxResPhase);
       if      (maxResPhase > MAXRES_PHASE_GAL) {
         satDataGal.remove(prnPhase);
@@ -1010,5 +1010,5 @@
     // ---------------
     if (irc == 0) {
-      findMaxRes(vv,satDataGPS, prnCode, maxResCode, prnPhase, maxResPhase);
+      findMaxRes(iPhase, vv,satDataGPS, prnCode, maxResCode, prnPhase, maxResPhase);
       if      (maxResPhase > MAXRES_PHASE_GPS) {
         satDataGPS.remove(prnPhase);
@@ -1264,5 +1264,5 @@
 // 
 ///////////////////////////////////////////////////////////////////////////
-void bncModel::findMaxRes(const ColumnVector& vv,
+void bncModel::findMaxRes(int iPhase, const ColumnVector& vv,
                           const QMap<QString, t_satData*>& satData,
                           QString& prnCode,  double& maxResCode, 
@@ -1276,14 +1276,18 @@
     it.next();
     t_satData* satData = it.value();
-    if (satData->indexCode) {
-      if (fabs(vv(satData->indexCode)) > maxResCode) {
-        maxResCode = fabs(vv(satData->indexCode));
-        prnCode    = satData->prn;
-      }
-    }
-    if (satData->indexPhase) {
-      if (fabs(vv(satData->indexPhase)) > maxResPhase) {
-        maxResPhase = fabs(vv(satData->indexPhase));
-        prnPhase    = satData->prn;
+    if (iPhase == 0) {
+      if (satData->indexCode) {
+        if (fabs(vv(satData->indexCode)) > maxResCode) {
+          maxResCode = fabs(vv(satData->indexCode));
+          prnCode    = satData->prn;
+        }
+      }
+    }
+    else {
+      if (satData->indexPhase) {
+        if (fabs(vv(satData->indexPhase)) > maxResPhase) {
+          maxResPhase = fabs(vv(satData->indexPhase));
+          prnPhase    = satData->prn;
+        }
       }
     }
Index: trunk/BNC/bncmodel.h
===================================================================
--- trunk/BNC/bncmodel.h	(revision 3312)
+++ trunk/BNC/bncmodel.h	(revision 3313)
@@ -100,5 +100,5 @@
   void   printRes(int iPhase, const ColumnVector& vv, 
                   std::ostringstream& str, t_satData* satData);
-  void   findMaxRes(const ColumnVector& vv,
+  void   findMaxRes(int iPhase, const ColumnVector& vv,
                     const QMap<QString, t_satData*>& satData,
                     QString& prnCode,  double& maxResCode, 
