Index: /trunk/BNC/src/PPP/pppSatObs.cpp
===================================================================
--- /trunk/BNC/src/PPP/pppSatObs.cpp	(revision 6025)
+++ /trunk/BNC/src/PPP/pppSatObs.cpp	(revision 6026)
@@ -103,4 +103,9 @@
   }
 
+  // Used frequency types
+  // --------------------
+  _fType1 = t_lc::toFreq(_prn.system(),t_lc::l1);
+  _fType2 = t_lc::toFreq(_prn.system(),t_lc::l2);
+
   // Check whether all required frequencies available
   // ------------------------------------------------
@@ -161,40 +166,37 @@
   phaseCoeff.clear();
 
-  t_frequency::type fType1 = t_lc::toFreq(_prn.system(),t_lc::l1);
-  t_frequency::type fType2 = t_lc::toFreq(_prn.system(),t_lc::l2);
-
-  double f1 = t_CST::freq(fType1, _channel);
-  double f2 = t_CST::freq(fType2, _channel);
+  double f1 = t_CST::freq(_fType1, _channel);
+  double f2 = t_CST::freq(_fType2, _channel);
 
   switch (tLC) {
   case t_lc::l1:
-    phaseCoeff[fType1] = 1.0;  
+    phaseCoeff[_fType1] = 1.0;  
     return;
   case t_lc::l2:  
-    phaseCoeff[fType2] = 1.0;  
+    phaseCoeff[_fType2] = 1.0;  
     return;
   case t_lc::lIF: 
-    phaseCoeff[fType1] =  f1 * f1 / (f1 * f1 - f2 * f2);
-    phaseCoeff[fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
+    phaseCoeff[_fType1] =  f1 * f1 / (f1 * f1 - f2 * f2);
+    phaseCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
     return;
   case t_lc::MW:  
-    phaseCoeff[fType1] =  f1 / (f1 - f2);
-    phaseCoeff[fType2] = -f2 / (f1 - f2);
-    codeCoeff[fType1]  = -f1 / (f1 + f2);
-    codeCoeff[fType2]  = -f2 / (f1 + f2);
+    phaseCoeff[_fType1] =  f1 / (f1 - f2);
+    phaseCoeff[_fType2] = -f2 / (f1 - f2);
+    codeCoeff[_fType1]  = -f1 / (f1 + f2);
+    codeCoeff[_fType2]  = -f2 / (f1 + f2);
     return;
   case t_lc::CL:  
-    phaseCoeff[fType1] =  0.5;
-    codeCoeff[fType1]  =  0.5;
+    phaseCoeff[_fType1] =  0.5;
+    codeCoeff[_fType1]  =  0.5;
     return;
   case t_lc::c1:  
-    codeCoeff[fType1] = 1.0;  
+    codeCoeff[_fType1] = 1.0;  
     return;
   case t_lc::c2:  
-    codeCoeff[fType2] = 1.0;  
+    codeCoeff[_fType2] = 1.0;  
     return;
   case t_lc::cIF: 
-    codeCoeff[fType1] =  f1 * f1 / (f1 * f1 - f2 * f2);
-    codeCoeff[fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
+    codeCoeff[_fType1] =  f1 * f1 / (f1 * f1 - f2 * f2);
+    codeCoeff[_fType2] = -f2 * f2 / (f1 * f1 - f2 * f2);
     return;
   case t_lc::dummy: 
@@ -202,4 +204,40 @@
     return;
   }
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+bool t_pppSatObs::isValid(t_lc::type tLC) const {
+
+  map<t_frequency::type, double> codeCoeff;
+  map<t_frequency::type, double> phaseCoeff;
+  lcCoeff(tLC, codeCoeff, phaseCoeff);
+
+  map<t_frequency::type, double>::const_iterator it;
+  for (it = codeCoeff.begin(); it != codeCoeff.end(); it++) {
+    t_frequency::type tFreq = it->first;
+    if (_obs[tFreq] == 0) {
+      return false;
+    }
+  }
+  for (it = phaseCoeff.begin(); it != phaseCoeff.end(); it++) {
+    t_frequency::type tFreq = it->first;
+    if (_obs[tFreq] == 0) {
+      return false;
+    }
+  }
+  
+  return true;  
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+double t_pppSatObs::obsValue(t_lc::type tLC) const {
+
+  if (!_validObs2 && t_lc::need2ndFreq(tLC)) {
+    return 0.0;
+  }
+
+  return this->lc(tLC, _rawL1, _rawL2, _rawC1, _rawC2);
 }
 
@@ -359,15 +397,4 @@
 // 
 ////////////////////////////////////////////////////////////////////////////
-double t_pppSatObs::obsValue(t_lc::type tLC) const {
-
-  if (!_validObs2 && t_lc::need2ndFreq(tLC)) {
-    return 0.0;
-  }
-
-  return this->lc(tLC, _rawL1, _rawL2, _rawC1, _rawC2);
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
 double t_pppSatObs::cmpValueForBanc(t_lc::type tLC) const {
   return cmpValue(tLC) - _model._rho - _model._sagnac - _model._recClkM;
@@ -396,73 +423,4 @@
 
   return this->lc(tLC, L1, L2, C1, C2);
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
-double t_pppSatObs::lc(t_lc::type tLC, 
-                    double L1, double L2, double C1, double C2,
-                    ColumnVector* coeff) const {
-
-  if (coeff) {
-    coeff->ReSize(4);
-    (*coeff) = 0.0;
-  }
-
-  if      (tLC == t_lc::l1) {
-    if (coeff) (*coeff)(1) = 1.0;
-    return L1;
-  }
-  else if (tLC == t_lc::l2) {
-    if (coeff) (*coeff)(2) = 1.0;
-    return L2;
-  }
-  else if (tLC == t_lc::c1) {
-    if (coeff) (*coeff)(3) = 1.0;
-    return C1;
-  }
-  else if (tLC == t_lc::c2) {
-    if (coeff) (*coeff)(4) = 1.0;
-    return C2;
-  }
-  else if (tLC == t_lc::lIF || tLC == t_lc::cIF) {
-    double a1 =  _f1 * _f1 / (_f1 * _f1 - _f2 * _f2);
-    double a2 = -_f2 * _f2 / (_f1 * _f1 - _f2 * _f2);
-    if (tLC == t_lc::lIF) {
-      if (coeff) {
-        (*coeff)(1) = a1;
-        (*coeff)(2) = a2;
-      }
-      return a1 * L1 + a2 * L2;
-    }
-    else {
-      if (coeff) {
-        (*coeff)(3) = a1;
-        (*coeff)(4) = a2;
-      }
-      return a1 * C1 + a2 * C2;
-    }
-  }
-  else if (tLC == t_lc::MW) {
-    double a1 =  _f1 / (_f1 - _f2);
-    double a2 = -_f2 / (_f1 - _f2);
-    double a3 = -_f1 / (_f1 + _f2);
-    double a4 = -_f2 / (_f1 + _f2);
-    if (coeff) {
-      (*coeff)(1) = a1;
-      (*coeff)(2) = a2;
-      (*coeff)(3) = a3;
-      (*coeff)(4) = a4;
-    }
-    return a1 * L1 + a2 * L2 + a3 * C1 + a4 * C2;
-  }
-  else if (tLC == t_lc::CL) {
-    if (coeff) {
-      (*coeff)(1) = 0.5;
-      (*coeff)(3) = 0.5;
-    }
-    return (C1 + L1) / 2.0;
-  }
-
-  return 0.0;
 }
 
Index: /trunk/BNC/src/PPP/pppSatObs.h
===================================================================
--- /trunk/BNC/src/PPP/pppSatObs.h	(revision 6025)
+++ /trunk/BNC/src/PPP/pppSatObs.h	(revision 6026)
@@ -112,4 +112,6 @@
 
   bool                         _valid;
+  t_frequency::type            _fType1;
+  t_frequency::type            _fType2;
   t_prn                        _prn;
   bncTime                      _time;
