Index: trunk/BNC/src/ephemeris.h
===================================================================
--- trunk/BNC/src/ephemeris.h	(revision 10580)
+++ trunk/BNC/src/ephemeris.h	(revision 10587)
@@ -13,16 +13,15 @@
 class t_orbCorr;
 class t_clkCorr;
-enum e_navType {EPH, STO, EOP, ION};
 
 class t_eph {
  public:
-  enum e_type {unknown, GPS, QZSS, GLONASS, Galileo, SBAS, BDS, IRNSS};
+  enum e_system {unknown, GPS, QZSS, GLONASS, Galileo, SBAS, BDS, IRNSS};
   enum e_checkState {unchecked, ok, bad, outdated, unhealthy};
-  enum e_ephType {undefined, LNAV, FDMA, FNAV, INAF, D1, D2, SBASL1, CNAV, CNV1, CNV2, CNV3, L1NV, L1OC, L3OC};
+  enum e_type {undefined, LNAV, FDMA, FNAV, INAV, D1, D2, SBASL1, CNAV, CNV1, CNV2, CNV3, L1NV, L1OC, L3OC};
 
   t_eph();
   virtual ~t_eph();
 
-  virtual e_type  type() const = 0;
+  virtual e_system  system() const = 0;
   virtual QString toString(double version) const = 0;
   virtual unsigned int IOD() const = 0;
@@ -43,6 +42,6 @@
     }
   }
-  e_ephType ephType() const {return _ephType;}
-  t_irc setEphType(QString ephTypeStr);
+  e_type type() const {return _type;}
+  void setType(QString typeStr);
 
   t_prn prn() const {return _prn;}
@@ -54,5 +53,5 @@
   static QString rinexDateStr(const bncTime& tt, const t_prn& prn, double version);
   static QString rinexDateStr(const bncTime& tt, const QString& prnStr, double version);
-  static QString ephTypeStr(e_ephType ephType, const t_prn& prn, double version);
+  static QString typeStr(e_type type, const t_prn& prn, double version);
   static bool earlierTime(const t_eph* eph1, const t_eph* eph2) {return eph1->_TOC < eph2->_TOC;}
   static bool prnSort(const t_eph* eph1, const t_eph* eph2) {return eph1->prn() < eph2->prn();}
@@ -65,5 +64,5 @@
   QString          _receptStaID;
   e_checkState     _checkState;
-  e_ephType        _ephType; // defined in RINEX 4
+  e_type           _type; // defined in RINEX 4
   t_orbCorr*       _orbCorr;
   t_clkCorr*       _clkCorr;
@@ -123,8 +122,9 @@
     _ISC_L1P         = 0.0;
     _wnop            = 0.0;
-    _intSF           = -1;
-    _ephSF           = -1;
-    _L2Cphasing      = -1;
-    _alert           = -1;
+    _flags_unknown   = true;
+    _intSF           = 0.0;
+    _ephSF           = 0.0;
+    _L2Cphasing      = 0.0;
+    _alert           = 0.0;
     _receptStaID     = "";
   }
@@ -132,5 +132,5 @@
   virtual ~t_ephGPS() {}
 
-  virtual e_type type() const {
+  virtual e_system system() const {
     switch (_prn.system()) {
       case 'J':
@@ -208,8 +208,9 @@
   double _ISC_L1P;          // [s]
 
-  int    _intSF;            // [-] integrity status flag
-  int    _ephSF;            // [-] ephemeris status flag (QZSS)
-  int    _L2Cphasing;       // [-] L2C phasing flag
-  int    _alert;            // [-] alert flag
+  bool   _flags_unknown;    // [-] status flags are unknown => BNK; fitInterval LNAV from QZSS or GPS
+  double _intSF;            // [-] integrity status flag
+  double _ephSF;            // [-] ephemeris status flag (QZSS)
+  double _L2Cphasing;       // [-] L2C phasing flag
+  double _alert;            // [-] alert flag
 
   double _wnop;             // GPS continuous week number with the ambiguity resolved (same as _TOEweek?)
@@ -221,50 +222,74 @@
  public:
   t_ephGlo() {
-    _xv.ReSize(6); _xv = 0.0;
-    _gps_utc          = 0.0;
-    _tau              = 0.0;
-    _gamma            = 0.0;
-    _tki              = 0.0;
-    _x_pos            = 0.0;
-    _x_velocity       = 0.0;
-    _x_acceleration   = 0.0;
-    _health           = 0.0;
-    _y_pos            = 0.0;
-    _y_velocity       = 0.0;
-    _y_acceleration   = 0.0;
-    _frequency_number = 0.0;
-    _z_pos            = 0.0;
-    _z_velocity       = 0.0;
-    _z_acceleration   = 0.0;
-    _E                = 0.0;
-    _almanac_health   = 0.0;
+    _xv.ReSize(6);
+    _xv      = 0.0;
+    _gps_utc = 0.0;
+    _tau     = 0.0;
+    _tau1    = 0.0;
+    _tau2    = 0.0;
+    _tauC    = 0.0;
+    _Tin     = 0.0;
+    _gamma   = 0.0;
+    _tki     = 0.0;
+    _x_pos   = 0.0;
+    _x_vel   = 0.0;
+    _x_acc   = 0.0;
+    _health  = 0.0;
+    _y_pos   = 0.0;
+    _y_vel   = 0.0;
+    _y_acc   = 0.0;
+    _frq_num = 0.0;
+    _z_pos   = 0.0;
+    _z_vel   = 0.0;
+    _z_acc   = 0.0;
+    _E       = 0.0;
+    _EE      = 0.0;
+    _ET      = 0.0;
+    _RE      = 0.0;
+    _RT      = 0.0;
+    _P1      = 0.0;
+    _P2      = 0.0;
+    _P3      = 0.0;
+    _M_M     = 0.0;
+    _M_FE    = 0.0;
+    _M_FT    = 0.0;
+    _M_l3    = 0.0;
+    _M_l5    = 0.0;
+    _M_NA    = 0.0;
+    _M_NT    = 0.0;
+    _M_N4    = 0.0;
+    _M_P     = 0.0;
+    _M_P4    = 0.0;
+    _X_PC    = 0.0;
+    _Y_PC    = 0.0;
+    _Z_PC    = 0.0;
+    _TOT     = 0.0;
+    _yaw     = 0.0;
+    _sn      = 0.0;
+    _sat_type  = 0.0;
+    _TGD_L2OCp = 0.0;
+    _TGD_L3OCp = 0.0;
+    _M_tau_GPS = 0.0;
+    _M_delta_tau  = 0.0;
+    _attitude_P2  = 0.0;
+    _angular_rate = 0.0;
+    _angular_acc  = 0.0;
+    _angular_rate_max = 0.0;
+    _data_validity = 0;
+    _healthflags_unknown = false;
+    _statusflags_unknown = false;
+    _almanac_health = 0.0;
     _almanac_health_availablility_indicator = 0.0;
     _additional_data_availability = 0.0;
-    _tauC             = 0.0;
-    _P1               = 0.0;
-    _P2               = 0.0;
-    _P3               = 0.0;
-    _NA               = 0.0;
-    _M_P              = 0.0;
-    _M_l3             = 0.0;
-    _M_delta_tau      = 0.0;
-    _M_P4             = 0.0;
-    _M_FT             = 0.0;
-    _M_NT             = 0.0;
-    _M_M              = 0.0;
-    _M_N4             = 0.0;
-    _M_tau_GPS        = 0.0;
-    _M_l5             = 0.0;
-    _receptStaID      = "";
-    _flags_unknown    = true;
+
   }
   t_ephGlo(double rnxVersion, const QStringList& lines);
   virtual ~t_ephGlo() {}
 
-  virtual e_type type() const {return t_eph::GLONASS;}
+  virtual e_system system() const {return t_eph::GLONASS;}
   virtual QString toString(double version) const;
   virtual unsigned int  IOD() const;
   virtual unsigned int isUnhealthy() const;
-  virtual int slotNum() const {return int(_frequency_number);}
+  virtual int slotNum() const {return int(_frq_num);}
 
  private:
@@ -272,48 +297,78 @@
   static ColumnVector glo_deriv(double /* tt */, const ColumnVector& xv, double* acc);
 
-  mutable bncTime      _tt;  // time
-  mutable ColumnVector _xv;  // status vector (position, velocity) at time _tt
-
-  double  _gps_utc;
-  double  _tau;              // [s]
-  double  _gamma;            // [-]
-  mutable double  _tki;      // message frame time
-
-  double  _x_pos;            // [km]
-  double  _x_velocity;       // [km/s]
-  double  _x_acceleration;   // [km/s^2]
-  double  _health;           // 0 = O.K. MSB of Bn word
-
-  double  _y_pos;            // [km]
-  double  _y_velocity;       // [km/s]
-  double  _y_acceleration;   // [km/s^2]
-  double  _frequency_number; // ICD-GLONASS data position
-
-  double  _z_pos;            // [km]
-  double  _z_velocity;       // [km/s]
-  double  _z_acceleration;   // [km/s^2]
-  double  _E;                // Age of Information [days]
-
-  double _almanac_health;     // Cn word
-  double _almanac_health_availablility_indicator;
-
-  double _additional_data_availability;  //
-  double _tauC;               // GLONASS time scale correction to UTC(SU) time [sec]
-  double _P1;                 // flag of the immediate data updating [-]
-  double _P2;                 // flag of oddness or evenness of the value of tb for intervals 30 or 60 minutes [-]
-  double _P3;                 // flag indicating a number of satellites for which almanac is transmitted within given frame [-]
-  double _NA;                 // calendar day number within the 4-year period [days]
-
-  double _M_P;                // control segment parameter that indicates the satellite operation mode with respect of time parameters
-  double _M_l3;               // health flag
-  double _M_delta_tau;        // [sec]
-  double _M_P4;               // flag to show that ephemeris parameters are present [-]
-  double _M_FT;               // Indicator for predicted satellite User Range Accuracy (URAI) [-]
-  double _M_NT;               // current date, calendar number of day within 4-year interval [days]
-  double _M_M;                // type of satellite transmitting navigation signal: 0 = GLONASS, 1 = GLONASS-M satellite [-]
-  double _M_N4;               // 4-year interval number starting from 1996
-  double _M_tau_GPS;          // correction to GPS time relative to GLONASS time [days]
-  double _M_l5;               // health flag
-  bool   _flags_unknown;      // status and health flags are unknown (rnx version < 3.05) or known (rnx version >= 3.05)
+  mutable bncTime      _tt;   // time
+  mutable ColumnVector _xv;   // status vector (position, velocity) at time _tt
+
+  double  _gps_utc;            // [s]
+  double  _tau;                // [s]
+  double  _tau1;               // [s]
+  double  _tau2;               // [s]
+  double  _tauC;               // GLONASS time scale correction to UTC(SU) [sec]
+  double  _Tin;                // sec of day UTC(SU) [s]
+
+  double  _gamma;              // [-]
+  mutable double  _tki;        // message frame time
+
+  double  _x_pos;              // [km]
+  double  _x_vel;              // [km/s]
+  double  _x_acc;              // [km/s^2]
+  double  _health;             // 0 = OK. MSB of Bn word
+
+  double  _y_pos;              // [km]
+  double  _y_vel;              // [km/s]
+  double  _y_acc;              // [km/s^2]
+  double  _frq_num;            // ICD-GLONASS data position
+
+  double  _z_pos;              // [km]
+  double  _z_vel;              // [km/s]
+  double  _z_acc;              // [km/s^2]
+
+  double  _E;                  // Age of current Information [days]
+  double  _EE;                 // Age Of Data eph [days]
+  double  _ET;                 // Age Of Data clk [days]
+
+  double  _TGD_L2OCp;          // [sec]
+  double  _TGD_L3OCp;          // [sec]
+
+  double  _almanac_health ;    // almanac health bit; 1 = healthy, 1 = not healthy
+  double  _almanac_health_availablility_indicator; // 1 = reported in eph record, 0 = not reported
+  double  _additional_data_availability;
+
+  double  _sat_type;           // 0 = GLO_SAT, 1 = GLO_SAT_M (M type), 2 = GLO_SAT_K (K type)
+  double  _RE;                 // source flags; 01 = relay; 10 = prediction (propagation), 11 = use of inter-satellite measurements
+  double  _RT;                 // source flags; 01 = relay, 10 = prediction (propagation), 11 = use of inter-satellite measurements
+
+  double  _P1;                 // update and validity interval [-]; 00 = 0 min, 01 = 30 min, 10 ) 45 min, 11 = 60 min
+  double  _P2;                 // flag of oddness or evenness of the value of tb for intervals 30 or 60 minutes [-]
+  double  _P3;                 // flag indicating a number of satellites for which almanac is transmitted within given frame [-]
+
+  double  _M_M;                // type of satellite transmitting navigation signal: 0 = GLONASS, 1 = GLONASS-M/K satellite [-]
+  double  _M_FE;               // Indicator for predicted satellite User Range Accuracy (URAI_orb) [-]
+  double  _M_FT;               // Indicator for predicted satellite User Range Accuracy (URAI_clk) [-]
+  double  _M_l3;               // health bit on string 3 GLO-M/K only
+  double  _M_l5;               // health flag
+  double  _M_NA;               // calendar day number within the 4-year period [days]
+  double  _M_NT;               // current date, calendar number of day within 4-year interval [days]
+  double  _M_N4;               // 4-year interval number starting from 1996
+  double  _M_P;                // control segment parameter that indicates the satellite operation mode with respect of time parameters
+  double  _M_P4;               // flag to show that ephemeris parameters are present [-] GLO-M/K only
+  double  _M_tau_GPS;          // correction to GPS time relative to GLONASS time [days]
+  double  _M_delta_tau;        // [s]
+
+  bool    _statusflags_unknown;// status flags are unknown => BNK in RNX NAV file if message type is FDMA
+  bool    _healthflags_unknown;// health flags are unknown => BNK in RNX NAV file if message type is FDMA
+  int     _data_validity;      // data validity; 0 = valid, 1 = invalid
+
+  double  _attitude_P2;        // 0 = nominal yaw steering, 1 = rate-limited yaw maneuver
+  double  _yaw;                // [rad]
+  double  _sn;                 // sign flag
+  double  _angular_rate;       // [rad/sec]
+  double  _angular_rate_max;   // [rad/sec]
+  double  _angular_acc;        // [rad/sec^2]
+
+  double  _X_PC;               // X PC coord [m] GLO manufacturer coordinate system
+  double  _Y_PC;               // Y PC coord [m] GLO manufacturer coordinate system
+  double  _Z_PC;               // Y PC coord [m] GLO manufacturer coordinate system
+  double  _TOT;                // Time of transmission
 };
 
@@ -345,7 +400,7 @@
     _TOEweek         = 0.0;
     _SISA            = 0.0;
-    _E5aHS           = 0.0;
-    _E5bHS           = 0.0;
-    _E1_bHS          = 0.0;
+    _E5a_HS          = 0.0;
+    _E5b_HS          = 0.0;
+    _E1B_HS          = 0.0;
     _BGD_1_5A        = 0.0;
     _BGD_1_5B        = 0.0;
@@ -353,7 +408,7 @@
     _inav            = false;
     _fnav            = false;
-    _e1DataInvalid   = false;
-    _e5aDataInvalid  = false;
-    _e5bDataInvalid  = false;
+    _E1B_DataInvalid = false;
+    _E5a_DataInvalid = false;
+    _E5b_DataInvalid = false;
     _receptStaID     = "";
   };
@@ -362,5 +417,5 @@
 
   virtual QString toString(double version) const;
-  virtual e_type type() const {return t_eph::Galileo;}
+  virtual e_system system() const {return t_eph::Galileo;}
   virtual unsigned int  IOD() const { return static_cast<unsigned long>(_IODnav); }
   virtual unsigned int  isUnhealthy() const;
@@ -394,11 +449,11 @@
 
   double  _IDOT;             //  [rad/s]
-  double  _TOEweek;
+  double  _TOEweek;          //  [-]
   // spare
 
   mutable double  _SISA;     // Signal In Space Accuracy
-  double  _E5aHS;            //  [0..3] E5a Health Status
-  double  _E5bHS;            //  [0..3] E5b Health Status
-  double  _E1_bHS;           //  [0..3] E1-b Health Status
+  double  _E5a_HS;           //  [0..3] E5a Health Status
+  double  _E5b_HS;           //  [0..3] E5b Health Status
+  double  _E1B_HS;           //  [0..3] E1B Health Status
   double  _BGD_1_5A;         //  group delay [s]
   double  _BGD_1_5B;         //  group delay [s]
@@ -407,7 +462,7 @@
   bool    _inav;             // Data comes from I/NAV when <code>true</code>
   bool    _fnav;             // Data comes from F/NAV when <code>true</code>
-  bool    _e1DataInvalid;    // E1 Data is not valid
-  bool    _e5aDataInvalid;   // E5A Data is not valid
-  bool    _e5bDataInvalid;   // E5B Data is not valid
+  bool    _E1B_DataInvalid;  // E1B Data is not valid
+  bool    _E5a_DataInvalid;  // E5a Data is not valid
+  bool    _E5b_DataInvalid;  // E5b Data is not valid
 };
 
@@ -417,25 +472,25 @@
  public:
   t_ephSBAS() {
-    _IODN           = 0;
-    _TOT            = 0.0;
-    _agf0           = 0.0;
-    _agf1           = 0.0;
-    _x_pos          = 0.0;
-    _x_velocity     = 0.0;
-    _x_acceleration = 0.0;
-    _y_pos          = 0.0;
-    _y_velocity     = 0.0;
-    _y_acceleration = 0.0;
-    _z_pos          = 0.0;
-    _z_velocity     = 0.0;
-    _z_acceleration = 0.0;
-    _ura            = 0.0;
-    _health         = 0.0;
-    _receptStaID    = "";
+    _IODN   = 0;
+    _TOT    = 0.0;
+    _agf0   = 0.0;
+    _agf1   = 0.0;
+    _x_pos  = 0.0;
+    _x_vel  = 0.0;
+    _x_acc  = 0.0;
+    _y_pos  = 0.0;
+    _y_vel  = 0.0;
+    _y_acc  = 0.0;
+    _z_pos  = 0.0;
+    _z_vel  = 0.0;
+    _z_acc  = 0.0;
+    _ura    = 0.0;
+    _health = 0.0;
+    _receptStaID = "";
   }
   t_ephSBAS(double rnxVersion, const QStringList& lines);
   virtual ~t_ephSBAS() {}
 
-  virtual e_type  type() const {return t_eph::SBAS;}
+  virtual e_system  system() const {return t_eph::SBAS;}
   virtual unsigned int IOD() const;
   virtual unsigned int  isUnhealthy() const;
@@ -446,19 +501,19 @@
 
   int    _IODN;
-  double _TOT;            // not used (set to  0.9999e9)
-  double _agf0;           // [s]    clock correction
-  double _agf1;           // [s/s]  clock correction drift
-
-  double _x_pos;          // [m]
-  double _x_velocity;     // [m/s]
-  double _x_acceleration; // [m/s^2]
-
-  double _y_pos;          // [m]
-  double _y_velocity;     // [m/s]
-  double _y_acceleration; // [m/s^2]
-
-  double _z_pos;          // [m]
-  double _z_velocity;     // [m/s]
-  double _z_acceleration; // [m/s^2]
+  double _TOT;   // not used (set to  0.9999e9)
+  double _agf0;  // [s]    clock correction
+  double _agf1;  // [s/s]  clock correction drift
+
+  double _x_pos; // [m]
+  double _x_vel; // [m/s]
+  double _x_acc; // [m/s^2]
+
+  double _y_pos; // [m]
+  double _y_vel; // [m/s]
+  double _y_acc; // [m/s^2]
+
+  double _z_pos; // [m]
+  double _z_vel; // [m/s]
+  double _z_acc; // [m/s^2]
 
   mutable double _ura;
@@ -474,9 +529,9 @@
    _AODE              = 0;
    _AODC              = 0;
-   _URAI              = 0;
-   _URA               = 0.0;
+   _ura               = 0.0;
    _clock_bias        = 0.0;
    _clock_drift       = 0.0;
    _clock_driftrate   = 0.0;
+   _ADOT              = 0.0;
    _Crs               = 0.0;
    _Delta_n           = 0.0;
@@ -523,5 +578,5 @@
   virtual ~t_ephBDS() {}
 
-  virtual e_type  type() const {return t_eph::BDS;}
+  virtual e_system  system() const {return t_eph::BDS;}
   virtual unsigned int IOD() const;
   virtual unsigned int isUnhealthy() const;
@@ -535,14 +590,14 @@
   int     _AODE;
   int     _AODC;
-  int     _URAI;             // [0..15] index from RTCM stream
-  mutable double  _URA;      // user range accuracy [m]
+  mutable double  _ura;      // user range accuracy [m]
   double  _clock_bias;       // [s]
   double  _clock_drift;      // [s/s]
   double  _clock_driftrate;  // [s/s^2]
+  double  _ADOT;            // [m/s]
   double  _Crs;              // [m]
   double  _Delta_n;          // [rad/s]
   double  _M0;               // [rad]
   double  _Cuc;              // [rad]
-  double  _e;                //
+  double  _e;                // [-]
   double  _Cus;              // [rad]
   double  _sqrt_A;           // [m^0.5]
@@ -562,8 +617,8 @@
   double  _top;              // [s]
 
-  double  _SISAI_oe;         // []
-  double  _SISAI_ocb;        // []
-  double  _SISAI_oc1;        // []
-  double  _SISAI_oc2;        // []
+  double  _SISAI_oe;         // [-]
+  double  _SISAI_ocb;        // [-]
+  double  _SISAI_oc1;        // [-]
+  double  _SISAI_oc2;        // [-]
 
   double  _ISC_B1Cd;         // [s]
@@ -576,8 +631,8 @@
   double  _TGD_B2bI;         // [s]
 
-  double  _SISMAI;           // []
-
-  int     _SatH1;            //
-  int     _health;           //
+  double  _SISMAI;           // [-]
+
+  int     _SatH1;            // [-]
+  int     _health;           // [-]
 
   double  _INTEGRITYF_B1C;   // 3 bits word from sf 3
@@ -585,6 +640,6 @@
   double  _INTEGRITYF_B2b;   // 3 bits word from msg 10
 
-  double  _IODC;             // []
-  double  _IODE;             // [] IODE are the same as the 8 LSBs of IODC
+  double  _IODC;             // [-]
+  double  _IODE;             // [-] IODE are the same as the 8 LSBs of IODC
 
 };
