Index: /trunk/BNC/src/PPP/options.h
===================================================================
--- /trunk/BNC/src/PPP/options.h	(revision 5749)
+++ /trunk/BNC/src/PPP/options.h	(revision 5750)
@@ -14,4 +14,5 @@
   ~t_options();
   bool dualFreqRequired();
+  bool biasRequired();
   bool useGlonass();
   bool xyzAprRoverSet();
@@ -47,4 +48,6 @@
   double       _maxResC1;
   double       _maxResL1;
+  bool         _eleWgtCode;
+  bool         _eleWgtPhase;
 };
 
Index: /trunk/BNC/src/PPP/ppp.h
===================================================================
--- /trunk/BNC/src/PPP/ppp.h	(revision 5749)
+++ /trunk/BNC/src/PPP/ppp.h	(revision 5750)
@@ -31,4 +31,17 @@
 class t_obs  {
  public:
+  t_obs() {
+    _code            = 0.0;          
+    _codeValid       = false;     
+    _phase           = 0.0;         
+    _phaseValid      = false;    
+    _doppler         = 0.0;       
+    _dopplerValid    = false;  
+    _snr             = 0.0;           
+    _snrValid        = false;      
+    _slip            = false;          
+    _slipCounter     = 0;   
+    _biasJumpCounter = 0;
+  }
   std::string _rnxType2ch; 
   double      _code;          
Index: /trunk/BNC/src/PPP/satobs.cpp
===================================================================
--- /trunk/BNC/src/PPP/satobs.cpp	(revision 5749)
+++ /trunk/BNC/src/PPP/satobs.cpp	(revision 5750)
@@ -44,11 +44,12 @@
 #include <newmatio.h>
 #include "satobs.h"
-#include "genconst.h"
+#include "bncconst.h"
 #include "ephpool.h"
 #include "station.h"
-#include "utils.h"
-#include "tropo.h"
-#include "antex.h"
+#include "bncutils.h"
+#include "bncantex.h"
 #include "obspool.h"
+#include "pppClient.h"
+#include "bncmodel.h"
 
 using namespace BNC;
@@ -57,27 +58,10 @@
 // Constructor
 ////////////////////////////////////////////////////////////////////////////
-t_satObs::t_obs::t_obs(const t_obs& obs) {
-  _type            = obs._rnxType2ch;
-  _code            = obs._code;           
-  _codeValid       = obs._codeValid;      
-  _phase           = obs._phase;          
-  _phaseValid      = obs._phaseValid;     
-  _doppler         = obs._doppler;        
-  _dopplerValid    = obs._dopplerValid;   
-  _snr             = obs._snr;            
-  _snrValid        = obs._snrValid;       
-  _slip            = obs._slip;           
-  _slipCounter     = obs._slipCounter;    
-  _biasJumpCounter = -1;
-}
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-t_satObs::t_satObs(const t_satObs& satObs) {
-  _prn  = satObs._prn;
-  _time = satObs._time;
+t_satObs::t_satObs(const t_pppSatObs& pppSatObs) {
+  _prn  = pppSatObs._prn;
+  _time = pppSatObs._time;
   _outlier    = false;
-  for (int ii = 0; ii < satObs._numObs; ii++) {
-    const t_obs& obs = satObs._obs[ii];
+  for (unsigned ii = 0; ii < pppSatObs._obs.size(); ii++) {
+    const t_obs& obs = pppSatObs._obs[ii];
     t_obsType obsType = string(obs._rnxType2ch).substr(0,2);
     _allObs[obsType] = new t_obs(obs);
@@ -145,11 +129,11 @@
   // Copy raw observations
   // ---------------------
-  _f1    = t_genConst::f1(_prn.system(), _channel);
+  _f1    = t_CST::f1(_prn.system(), _channel);
   _rawC1 = _validObs1->_code;
-  _rawL1 = _validObs1->_phase * t_genConst::c / _f1;
+  _rawL1 = _validObs1->_phase * t_CST::c / _f1;
   if (dualFreq) {
-    _f2    = t_genConst::f2(_prn.system(), _channel);
+    _f2    = t_CST::f2(_prn.system(), _channel);
     _rawC2 = _validObs2->_code;
-    _rawL2 = _validObs2->_phase * t_genConst::c / _f2;
+    _rawL2 = _validObs2->_phase * t_CST::c / _f2;
   }
   else {
@@ -168,11 +152,11 @@
   double prange = obsValue(tLC);
   for (int ii = 1; ii <= 10; ii++) {
-    bncTime ToT = _time - prange / t_genConst::c - _xcSat[3];
-    if (PPP_CLIENT->ephPool()->getCrd(_prn, ToT, _xcSat, _vvSat) != t_irc::success) {
+    bncTime ToT = _time - prange / t_CST::c - _xcSat[3];
+    if (PPP_CLIENT->ephPool()->getCrd(_prn, ToT, _xcSat, _vvSat) != success) {
       _valid = false;
       return;
     }
     ColumnVector dx = _xcSat - satPosOld;
-    dx[3] *= t_genConst::c;
+    dx[3] *= t_CST::c;
     if (dx.norm_Frobenius() < 1.e-4) {
       totOK = true;
@@ -182,5 +166,5 @@
   }
   if (totOK) {
-    _model._satClkM = _xcSat[3] * t_genConst::c; 
+    _model._satClkM = _xcSat[3] * t_CST::c; 
   }
   else {
@@ -214,9 +198,9 @@
   // Satellite Clocks
   // ----------------
-  _model._satClkM = _xcSat[3] * t_genConst::c;
+  _model._satClkM = _xcSat[3] * t_CST::c;
 
   // Receiver Clocks
   // ---------------
-  _model._recClkM = station->dClk() * t_genConst::c;
+  _model._recClkM = station->dClk() * t_CST::c;
 
   // Sagnac Effect (correction due to Earth rotation)
@@ -225,5 +209,5 @@
   Omega[0] = 0.0;
   Omega[1] = 0.0;
-  Omega[2] = t_genConst::omega / t_genConst::c;
+  Omega[2] = t_CST::omega / t_CST::c;
   _model._sagnac = DotProduct(Omega, crossproduct(rSat, station->xyzApr()));
 
@@ -250,7 +234,5 @@
   // Tropospheric Delay
   // ------------------
-  t_tropo::dtrop(_time, station->ellApr()[0], station->ellApr()[1],
-                 station->ellApr()[2], _model._eleSat, OPT->tropoModel(),
-                 OPT->tropoMF(), false, _model._tropo);
+  _model._tropo = bncModel::delay_saast(station->xyzApr(), station->ellApr()[2]);
 
   // Phase Wind-Up
@@ -264,8 +246,6 @@
   bool biasL1flg = false;
   bool biasL2flg = false;
-  int  nsdfix    =  0;
   const t_satBias* satBias = PPP_CLIENT->obsPool()->satBias(_prn);
   if (satBias) { 
-    nsdfix    = satBias->nx();
     map<t_biasType, double>::const_iterator it;
     for (it = satBias->biases().begin(); it != satBias->biases().end(); it++) {
@@ -273,9 +253,9 @@
       if (_validObs1) {
         _validObs1->_biasJumpCounter = satBias->jumpCount();
-        if      ("C" + _validObs1->_type == biasType) {
+        if      ("C" + _validObs1->_rnxType2ch == biasType) {
           _model._biasC1 = it->second;
           biasC1flg = true;
         }
-        else if ("L" + _validObs1->_type == biasType) {
+        else if ("L" + _validObs1->_rnxType2ch == biasType) {
           _model._biasL1 = it->second;
           biasL1flg = true;
@@ -284,9 +264,9 @@
       if (_validObs2) {
         _validObs2->_biasJumpCounter = satBias->jumpCount();
-        if      ("C" + _validObs2->_type == biasType) {
+        if      ("C" + _validObs2->_rnxType2ch == biasType) {
           _model._biasC2 = it->second;
           biasC2flg = true;
         }
-        else if ("L" + _validObs2->_type == biasType) {
+        else if ("L" + _validObs2->_rnxType2ch == biasType) {
           _model._biasL2 = it->second;
           biasL2flg = true;
@@ -299,7 +279,4 @@
       _valid = false;
     }
-    if (nsdfix < OPT->minSDFix()) {
-      _valid = false;
-    }
   }
 
@@ -320,5 +297,5 @@
   _model._set = true;
 
-  return t_irc::success;
+  return success;
 }
 
@@ -329,6 +306,6 @@
   LOG << "MODEL for Satellite " << _prn.toString() << endl
       << "RHO:    " << setw(12) << setprecision(3) << _model._rho     << endl
-      << "ELE:    " << setw(12) << setprecision(3) << _model._eleSat * t_genConst::rho_deg << endl
-      << "AZI:    " << setw(12) << setprecision(3) << _model._azSat  * t_genConst::rho_deg << endl
+      << "ELE:    " << setw(12) << setprecision(3) << _model._eleSat * 180.0 / M_PI << endl
+      << "AZI:    " << setw(12) << setprecision(3) << _model._azSat  * 180.0 / M_PI << endl
       << "SATCLK: " << setw(12) << setprecision(3) << _model._satClkM << endl
       << "RECCLK: " << setw(12) << setprecision(3) << _model._recClkM << endl
@@ -350,6 +327,6 @@
 
   LOG << "WIND L3:" <<  setw(12) << setprecision(3) 
-      << lc(t_lc::lIF, _model._windUp * t_genConst::c / _f1, 
-                       _model._windUp * t_genConst::c / _f2, 0.0, 0.0) << endl;
+      << lc(t_lc::lIF, _model._windUp * t_CST::c / _f1, 
+                       _model._windUp * t_CST::c / _f2, 0.0, 0.0) << endl;
 
   LOG << "OBS-CMP P3: " << _prn.toString() << " " 
@@ -403,6 +380,6 @@
   // Add Dispersive Part
   // -------------------
-  double L1 = nonDisp + _model._antPco1 - _model._biasL1 + _model._windUp * t_genConst::c / _f1;
-  double L2 = nonDisp + _model._antPco2 - _model._biasL2 + _model._windUp * t_genConst::c / _f2;
+  double L1 = nonDisp + _model._antPco1 - _model._biasL1 + _model._windUp * t_CST::c / _f1;
+  double L2 = nonDisp + _model._antPco2 - _model._biasL2 + _model._windUp * t_CST::c / _f2;
   double C1 = nonDisp + _model._antPco1 - _model._biasC1;
   double C2 = nonDisp + _model._antPco2 - _model._biasC2;
@@ -503,5 +480,5 @@
   _model._biasL2  -= obsBase->_model._biasL2;
 
-  return t_irc::success;
+  return success;
 }
 
@@ -511,17 +488,17 @@
 
   if      (tLC == t_lc::l1) {
-    return t_genConst::c / _f1;
+    return t_CST::c / _f1;
   }
   else if (tLC == t_lc::l2) {
-    return t_genConst::c / _f2;
+    return t_CST::c / _f2;
   }
   else if (tLC == t_lc::lIF) {
-    return t_genConst::c / (_f1 + _f2);
+    return t_CST::c / (_f1 + _f2);
   }
   else if (tLC == t_lc::MW) {
-    return t_genConst::c / (_f1 - _f2);
+    return t_CST::c / (_f1 - _f2);
   }
   else if (tLC == t_lc::CL) {
-    return t_genConst::c / _f1 / 2.0;
+    return t_CST::c / _f1 / 2.0;
   }
 
@@ -534,8 +511,8 @@
 
   ColumnVector sig(4);
-  sig(1) = OPT->sigmaPhase();
-  sig(2) = OPT->sigmaPhase();
-  sig(3) = OPT->sigmaCode();
-  sig(4) = OPT->sigmaCode();
+  sig(1) = OPT->_sigmaL1;
+  sig(2) = OPT->_sigmaL1;
+  sig(3) = OPT->_sigmaC1;
+  sig(4) = OPT->_sigmaC1;
 
   ColumnVector coeff(4);
@@ -547,7 +524,7 @@
   // -----------------------------
   double cEle = 1.0;
-  if ( (OPT->eleWgtCode()  && t_lc::includesCode(tLC)) ||
-       (OPT->eleWgtPhase() && t_lc::includesPhase(tLC)) ) {
-    double eleD = eleSat()*180.0/t_genConst::pi;
+  if ( (OPT->_eleWgtCode  && t_lc::includesCode(tLC)) ||
+       (OPT->_eleWgtPhase && t_lc::includesPhase(tLC)) ) {
+    double eleD = eleSat()*180.0/M_PI;
     double hlp  = fabs(90.0 - eleD);
     cEle = (1.0 + hlp*hlp*hlp*0.000004);
Index: /trunk/BNC/src/bncantex.h
===================================================================
--- /trunk/BNC/src/bncantex.h	(revision 5749)
+++ /trunk/BNC/src/bncantex.h	(revision 5750)
@@ -27,7 +27,9 @@
 
 #include <QtCore>
+#include <string>
 #include <newmat.h>
 #include "bncconst.h"
 #include "bnctime.h"
+#include "PPP/ppp.h"
 
 class bncAntex {
@@ -39,4 +41,6 @@
   void print() const;
   double pco(const QString& antName, double eleSat, bool& found);
+  double rcvCorr(BNC::t_frequency::type frqType, const std::string& antName,
+                 double eleSat, bool& found) const;
   t_irc  satCoMcorrection(const QString& prn, double Mjd, 
                           const ColumnVector& xSat, ColumnVector& dx);
Index: /trunk/BNC/src/bncmodel.cpp
===================================================================
--- /trunk/BNC/src/bncmodel.cpp	(revision 5749)
+++ /trunk/BNC/src/bncmodel.cpp	(revision 5750)
@@ -342,5 +342,5 @@
   satData->rho = (satData->xx - xRec).norm_Frobenius();
 
-  double tropDelay = delay_saast(satData->eleSat) + 
+  double tropDelay = delay_saast(xRec, satData->eleSat) + 
                      trp() / sin(satData->eleSat);
 
@@ -385,14 +385,10 @@
 // Tropospheric Model (Saastamoinen)
 ////////////////////////////////////////////////////////////////////////////
-double bncModel::delay_saast(double Ele) {
+double bncModel::delay_saast(const ColumnVector& xyz, double Ele) {
 
   Tracer tracer("bncModel::delay_saast");
 
-  double xyz[3]; 
-  xyz[0] = x();
-  xyz[1] = y();
-  xyz[2] = z();
   double ell[3]; 
-  xyz2ell(xyz, ell);
+  xyz2ell(xyz.data(), ell);
   double height = ell[2];
 
@@ -649,5 +645,6 @@
     }
     else if (par->type == bncParam::TROPO) {
-      double aprTrp = delay_saast(M_PI/2.0);
+      ColumnVector xyz(3); xyz(1) = x(); xyz(2) = y(); xyz(3) = z();
+      double aprTrp = delay_saast(xyz, M_PI/2.0);
       strB << "\n    trp     = " << par->prn.toAscii().data()
            << setw(7) << setprecision(3) << aprTrp << " "
Index: /trunk/BNC/src/bncmodel.h
===================================================================
--- /trunk/BNC/src/bncmodel.h	(revision 5749)
+++ /trunk/BNC/src/bncmodel.h	(revision 5750)
@@ -99,4 +99,6 @@
                      SymmetricMatrix& QQ, ColumnVector& dx);
 
+  static double delay_saast(const ColumnVector& xyz, double Ele);
+
  private:
   void   reset();
@@ -113,5 +115,4 @@
                     double& maxResGPS, double& maxResGlo); 
   double cmpValue(t_satData* satData, bool phase);
-  double delay_saast(double Ele);
   void   predict(int iPhase, t_epoData* epoData);
   t_irc  update_p(t_epoData* epoData);
