Index: /trunk/BNC/src/bncantex.cpp
===================================================================
--- /trunk/BNC/src/bncantex.cpp	(revision 6404)
+++ /trunk/BNC/src/bncantex.cpp	(revision 6405)
@@ -71,21 +71,18 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncAntex::print() const {
-  QMapIterator<QString, t_antMap*> it(_maps);
-  while (it.hasNext()) {
-    it.next();
-    t_antMap* map = it.value();
+  QMapIterator<QString, t_antMap*> itAnt(_maps);
+  while (itAnt.hasNext()) {
+    itAnt.next();
+    t_antMap* map = itAnt.value();
     cout << map->antName.toAscii().data() << endl;
     cout << "    " << map->zen1 << " " << map->zen2 << " " << map->dZen << endl;
-    if (map->frqMapL1) {
-      cout << "    " << map->frqMapL1->neu[0] << " "
-                     << map->frqMapL1->neu[1] << " "
-                     << map->frqMapL1->neu[2] << endl;
-      cout << "    " << map->frqMapL1->pattern.t();
-    }
-    if (map->frqMapL2) {
-      cout << "    " << map->frqMapL2->neu[0] << " "
-                     << map->frqMapL2->neu[1] << " "
-                     << map->frqMapL2->neu[2] << endl;
-      cout << "    " << map->frqMapL2->pattern.t();
+    QMapIterator<t_frequency::type, t_frqMap*> itFrq(map->frqMap);
+    while (itFrq.hasNext()) {
+      itFrq.next();
+      const t_frqMap* frqMap = itFrq.value();
+      cout << "    " << frqMap->neu[0] << " "
+                     << frqMap->neu[1] << " "
+                     << frqMap->neu[2] << endl;
+      cout << "    " << frqMap->pattern.t();
     }
     cout << endl;
@@ -171,11 +168,22 @@
       else if (line.indexOf("END OF FREQUENCY") == 60) {
         if (newFrqMap) {
-          if      (line.indexOf("G01") == 3 || line.indexOf("R01") == 3) {
-            delete newAntMap->frqMapL1;
-            newAntMap->frqMapL1 = newFrqMap;
-          }
-          else if (line.indexOf("G02") == 3 || line.indexOf("R02") == 3) {
-            delete newAntMap->frqMapL2;
-            newAntMap->frqMapL2 = newFrqMap;
+          t_frequency::type frqType = t_frequency::dummy;
+          if      (line.indexOf("G01") == 3) {
+            frqType = t_frequency::G1;
+          }
+          else if (line.indexOf("G02") == 3) {
+            frqType = t_frequency::G2;
+          }
+          else if (line.indexOf("R01") == 3) {
+            frqType = t_frequency::R1;
+          }
+          else if (line.indexOf("R02") == 3) {
+            frqType = t_frequency::R2;
+          }
+          if (frqType != t_frequency::dummy) {
+            if (newAntMap->frqMap.find(frqType) != newAntMap->frqMap.end()) {
+              delete newAntMap->frqMap[frqType];
+            }
+            newAntMap->frqMap[frqType] = newFrqMap;
           }
           else {
@@ -226,62 +234,85 @@
                                  const ColumnVector& xSat, ColumnVector& dx) {
 
+  t_frequency::type frqType = t_frequency::dummy;
+  if      (prn[0] == 'G') {
+    frqType = t_frequency::G1;
+  }
+  else if (prn[0] == 'R') {
+    frqType = t_frequency::R1;
+  }
+
   QMap<QString, t_antMap*>::const_iterator it = _maps.find(prn);
   if (it != _maps.end()) {
     t_antMap* map = it.value();
-    double* neu = map->frqMapL1->neu;
-
-    // Unit Vectors sz, sy, sx
-    // -----------------------
-    ColumnVector sz = -xSat;
-    sz /= sqrt(DotProduct(sz,sz));
-
-    ColumnVector xSun = BNC_PPP::t_astro::Sun(Mjd);
-    xSun /= sqrt(DotProduct(xSun,xSun));
+    if (map->frqMap.find(frqType) != map->frqMap.end()) {
+
+      double* neu = map->frqMap[frqType]->neu;
+
+      // Unit Vectors sz, sy, sx
+      // -----------------------
+      ColumnVector sz = -xSat;
+      sz /= sqrt(DotProduct(sz,sz));
+
+      ColumnVector xSun = BNC_PPP::t_astro::Sun(Mjd);
+      xSun /= sqrt(DotProduct(xSun,xSun));
   
-    ColumnVector sy = crossproduct(sz, xSun);
-    sy /= sqrt(DotProduct(sy,sy));
+      ColumnVector sy = crossproduct(sz, xSun);
+      sy /= sqrt(DotProduct(sy,sy));
   
-    ColumnVector sx = crossproduct(sy, sz);
-
-    dx[0] = sx[0] * neu[0] + sy[0] * neu[1] + sz[0] * neu[2];
-    dx[1] = sx[1] * neu[0] + sy[1] * neu[1] + sz[1] * neu[2];
-    dx[2] = sx[2] * neu[0] + sy[2] * neu[1] + sz[2] * neu[2];
-
-    return success;
-  }
-  else {
-    return failure;
-  }
-}
-
-// Phase Center Offset (Receiver Antenna and GPS only)
-////////////////////////////////////////////////////////////////////////////
-double bncAntex::pco(const QString& antName, double eleSat, bool& found) const {
-
-  static const double f1 = t_CST::freq(t_frequency::G1, 0);
-  static const double f2 = t_CST::freq(t_frequency::G2, 0);
-  static const double c1 =   f1 * f1 / (f1 * f1 - f2 * f2);
-  static const double c2 = - f2 * f2 / (f1 * f1 - f2 * f2);
-
-  QMap<QString, t_antMap*>::const_iterator it = _maps.find(antName);
-  if (it != _maps.end()) {
+      ColumnVector sx = crossproduct(sy, sz);
+
+      dx[0] = sx[0] * neu[0] + sy[0] * neu[1] + sz[0] * neu[2];
+      dx[1] = sx[1] * neu[0] + sy[1] * neu[1] + sz[1] * neu[2];
+      dx[2] = sx[2] * neu[0] + sy[2] * neu[1] + sz[2] * neu[2];
+
+      return success;
+    }
+  }
+
+  return failure;
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+double bncAntex::rcvCorr(const string& antName, t_frequency::type frqType,
+                         double eleSat, double /* azSat */, bool& found) const {
+
+  if (antName.find("NULLANTENNA") != string::npos) {
     found = true;
-    t_antMap* map = it.value();
-    if (map->frqMapL1 && map->frqMapL2) {
-      double corr1 = -map->frqMapL1->neu[2] * sin(eleSat);
-      double corr2 = -map->frqMapL2->neu[2] * sin(eleSat);
-      return c1 * corr1 + c2 * corr2;
-    }
-  }
-  else {
+    return 0.0;
+  }
+
+  QString antNameQ = antName.c_str();
+
+  if (_maps.find(antNameQ) == _maps.end()) {
     found = false;
-  }
-
-  return 0.0;
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
-double bncAntex::rcvCorr(const std::string& antName, double eleSat, bool& found) const {
-  return pco(QString(antName.c_str()), eleSat, found);
-}
+    return 0.0;
+  }
+
+  t_antMap* map = _maps[antNameQ];
+
+  if (map->frqMap.find(frqType) == map->frqMap.end()) {
+    found = false;
+    return 0.0;
+  }
+
+  t_frqMap* frqMap = map->frqMap[frqType];
+
+  double var = 0.0;
+  if (frqMap->pattern.ncols() > 0) {
+    double zenDiff = 999.999;
+    double zenSat  = 90.0 - eleSat * 180.0 / M_PI;
+    unsigned iZen = 0;
+    for (double zen = map->zen1; zen <= map->zen2; zen += map->dZen) {
+      iZen += 1;
+      double newZenDiff = fabs(zen - zenSat);
+      if (newZenDiff < zenDiff) {
+        zenDiff = newZenDiff;
+        var = frqMap->pattern(iZen);
+      }
+    }
+  }
+
+  found = true;
+  return var - frqMap->neu[2] * sin(eleSat);
+}
Index: /trunk/BNC/src/bncantex.h
===================================================================
--- /trunk/BNC/src/bncantex.h	(revision 6404)
+++ /trunk/BNC/src/bncantex.h	(revision 6405)
@@ -37,13 +37,12 @@
   bncAntex();
   ~bncAntex();
-  t_irc readFile(const QString& fileName);  
-  void print() const;
-  double pco(const QString& antName, double eleSat, bool& found) const;
-  double rcvCorr(const std::string& antName, double eleSat, bool& found) const;
+  t_irc  readFile(const QString& fileName);  
+  void   print() const;
+  double rcvCorr(const std::string& antName, t_frequency::type frqType,
+                 double eleSat, double azSat, bool& found) const;
   t_irc  satCoMcorrection(const QString& prn, double Mjd, 
                           const ColumnVector& xSat, ColumnVector& dx);
 
  private:
-
   class t_frqMap {
    public:
@@ -54,20 +53,19 @@
   class t_antMap {
    public:
-    t_antMap() {
-      frqMapL1 = 0;
-      frqMapL2 = 0;
+    t_antMap() {}
+    ~t_antMap() {
+      QMapIterator<t_frequency::type, t_frqMap*> it(frqMap);
+      while (it.hasNext()) {
+        it.next();
+        delete it.value();
+      }
     }
-    ~t_antMap() {
-      delete frqMapL1;
-      delete frqMapL2;
-    }
-    QString   antName;
-    double       zen1;
-    double       zen2;
-    double       dZen;
-    t_frqMap* frqMapL1;
-    t_frqMap* frqMapL2;
-    bncTime   validFrom;
-    bncTime   validTo;
+    QString                            antName;
+    double                             zen1;
+    double                             zen2;
+    double                             dZen;
+    QMap<t_frequency::type, t_frqMap*> frqMap;
+    bncTime                            validFrom;
+    bncTime                            validTo;
   };
 
Index: /trunk/BNC/src/bncconst.h
===================================================================
--- /trunk/BNC/src/bncconst.h	(revision 6404)
+++ /trunk/BNC/src/bncconst.h	(revision 6405)
@@ -38,13 +38,13 @@
                         E8, // E5(E5a+E5b) / 1191.795 
                         E6, // E6  / 1278.75
-						J1, // 1575.42
-						J2, // 1227.60
-						J5, // 1176.45
-						J6, // Lex(6) 1278.75
-						S1, // 1575.42
-						S5, // 1176.45
-						C1, // 1561.098
-						C7, // 1207.14
-						C6, // 1268.52
+                        J1, // 1575.42
+                        J2, // 1227.60
+                        J5, // 1176.45
+                        J6, // Lex(6) 1278.75
+                        S1, // 1575.42
+                        S5, // 1176.45
+                        C1, // 1561.098
+                        C7, // 1207.14
+                        C6, // 1268.52
              max};
 
