Index: /trunk/BNC/src/ephemeris.cpp
===================================================================
--- /trunk/BNC/src/ephemeris.cpp	(revision 6212)
+++ /trunk/BNC/src/ephemeris.cpp	(revision 6213)
@@ -44,5 +44,7 @@
   xc.ReSize(4);
   vv.ReSize(3);
-  position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
+  if (position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data()) != success) {
+    return failure;
+  }
   if (useCorr) {
     if (_orbCorr && _clkCorr) {
@@ -128,8 +130,5 @@
 // Compute GPS Satellite Position (virtual)
 ////////////////////////////////////////////////////////////////////////////
-void t_ephGPS::position(int GPSweek, double GPSweeks, 
-                        double* xc,
-                        double* vv) const {
-
+t_irc t_ephGPS::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
 
   static const double omegaEarth = 7292115.1467e-11;
@@ -141,5 +140,5 @@
   double a0 = _sqrt_A * _sqrt_A;
   if (a0 == 0) {
-    return;
+    return failure;
   }
 
@@ -207,4 +206,6 @@
   // -----------------------
   xc[3] -= 2.0 * (xc[0]*vv[0] + xc[1]*vv[1] + xc[2]*vv[2]) / t_CST::c / t_CST::c;
+
+  return success;
 }
 
@@ -248,6 +249,5 @@
 // Compute Glonass Satellite Position (virtual)
 ////////////////////////////////////////////////////////////////////////////
-void t_ephGlo::position(int GPSweek, double GPSweeks, 
-                        double* xc, double* vv) const {
+t_irc t_ephGlo::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
 
   static const double nominalStep = 10.0;
@@ -257,4 +257,8 @@
 
   double dtPos = bncTime(GPSweek, GPSweeks) - _tt;
+
+  if (fabs(dtPos) > 24*3600.0) {
+    return failure;
+  }
 
   int nSteps  = int(fabs(dtPos) / nominalStep) + 1;
@@ -284,4 +288,6 @@
   double dtClk = bncTime(GPSweek, GPSweeks) - _TOC;
   xc[3] = -_tau + _gamma * dtClk;
+
+  return success;
 }
 
@@ -442,7 +448,5 @@
 // Compute Galileo Satellite Position (virtual)
 ////////////////////////////////////////////////////////////////////////////
-void t_ephGal::position(int GPSweek, double GPSweeks, 
-                        double* xc,
-                        double* vv) const {
+t_irc t_ephGal::position(int GPSweek, double GPSweeks, double* xc, double* vv) const {
 
   static const double omegaEarth = 7292115.1467e-11;
@@ -454,5 +458,5 @@
   double a0 = _sqrt_A * _sqrt_A;
   if (a0 == 0) {
-    return;
+    return failure;
   }
 
@@ -521,4 +525,6 @@
   //  xc(4) -= 4.442807633e-10 * _e * sqrt(a0) *sin(E);
   xc[3] -= 2.0 * (xc[0]*vv[0] + xc[1]*vv[1] + xc[2]*vv[2]) / t_CST::c / t_CST::c;
+
+  return success;
 }
 
Index: /trunk/BNC/src/ephemeris.h
===================================================================
--- /trunk/BNC/src/ephemeris.h	(revision 6212)
+++ /trunk/BNC/src/ephemeris.h	(revision 6213)
@@ -41,5 +41,5 @@
 
  protected:  
-  virtual void position(int GPSweek, double GPSweeks, double* xc, double* vv) const = 0;
+  virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const = 0;
   t_prn      _prn;
   bncTime    _TOC;
@@ -65,5 +65,5 @@
 
  private:
-  virtual void position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
+  virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
 
   double  _clock_bias;      // [s]    
@@ -119,5 +119,5 @@
 
  private:
-  virtual void position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
+  virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
   static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv, double* acc);
 
@@ -159,5 +159,5 @@
 
  private:
-  virtual void position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
+  virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
 
   double  _clock_bias;       //  [s]    
Index: /trunk/BNC/src/rinex/reqcanalyze.cpp
===================================================================
--- /trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 6212)
+++ /trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 6213)
@@ -538,12 +538,11 @@
             ColumnVector xc(4);
             ColumnVector vv(3);
-            eph->getCrd(bncTime(oneObs->_GPSWeek, oneObs->_GPSWeeks), xc, vv, false);
-          
-            double rho, eleSat, azSat;
-            topos(xyzSta(1), xyzSta(2), xyzSta(3), xc(1), xc(2), xc(3), rho, eleSat, azSat);
-          
-            aziDeg = azSat * 180.0/M_PI;
-            zenDeg = 90.0 - eleSat * 180.0/M_PI;
-            zenFlag = true;
+            if (eph->getCrd(bncTime(oneObs->_GPSWeek, oneObs->_GPSWeeks), xc, vv, false) == success) {
+              double rho, eleSat, azSat;
+              topos(xyzSta(1), xyzSta(2), xyzSta(3), xc(1), xc(2), xc(3), rho, eleSat, azSat);
+              aziDeg = azSat * 180.0/M_PI;
+              zenDeg = 90.0 - eleSat * 180.0/M_PI;
+              zenFlag = true;
+            }
           }
         }
@@ -742,14 +741,15 @@
     }
     if (eph) {
-      ++nSatUsed;
       ColumnVector xSat(4);
       ColumnVector vv(3);
-      eph->getCrd(_currEpo->tt, xSat, vv, false);
-      ColumnVector dx = xSat.Rows(1,3) - xyzSta;
-      double rho = dx.norm_Frobenius();
-      AA(nSatUsed,1) = dx(1) / rho;
-      AA(nSatUsed,2) = dx(2) / rho;
-      AA(nSatUsed,3) = dx(3) / rho;
-      AA(nSatUsed,4) = 1.0;
+      if (eph->getCrd(_currEpo->tt, xSat, vv, false) == success) {
+        ++nSatUsed;
+        ColumnVector dx = xSat.Rows(1,3) - xyzSta;
+        double rho = dx.norm_Frobenius();
+        AA(nSatUsed,1) = dx(1) / rho;
+        AA(nSatUsed,2) = dx(2) / rho;
+        AA(nSatUsed,3) = dx(3) / rho;
+        AA(nSatUsed,4) = 1.0;
+      }
     }
   }
