Index: trunk/BNC/src/ephemeris.cpp
===================================================================
--- trunk/BNC/src/ephemeris.cpp	(revision 7053)
+++ trunk/BNC/src/ephemeris.cpp	(revision 7054)
@@ -645,7 +645,7 @@
 // IOD of Glonass Ephemeris (virtual)
 ////////////////////////////////////////////////////////////////////////////
-int t_ephGlo::IOD() const {
+unsigned long t_ephGlo::IOD() const {
   bncTime tMoscow = _TOC - _gps_utc + 3 * 3600.0;
-  return int(tMoscow.daysec() / 900);
+  return (unsigned long)tMoscow.daysec() / 900;
 }
 
@@ -1130,4 +1130,30 @@
 }
 
+// IOD of SBAS Ephemeris (virtual)
+////////////////////////////////////////////////////////////////////////////
+
+unsigned long t_ephSBAS::IOD() const {
+  unsigned char buffer[80];
+  int size = 0;
+  int numbits = 0;
+  long long bitbuffer = 0;
+  unsigned char *startbuffer = buffer;
+
+  SBASADDBITSFLOAT(30, this->_x_pos, 0.08)
+  SBASADDBITSFLOAT(30, this->_y_pos, 0.08)
+  SBASADDBITSFLOAT(25, this->_z_pos, 0.4)
+  SBASADDBITSFLOAT(17, this->_x_velocity, 0.000625)
+  SBASADDBITSFLOAT(17, this->_y_velocity, 0.000625)
+  SBASADDBITSFLOAT(18, this->_z_velocity, 0.004)
+  SBASADDBITSFLOAT(10, this->_x_acceleration, 0.0000125)
+  SBASADDBITSFLOAT(10, this->_y_acceleration, 0.0000125)
+  SBASADDBITSFLOAT(10, this->_z_acceleration, 0.0000625)
+  SBASADDBITSFLOAT(12, this->_agf0, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
+  SBASADDBITSFLOAT(8, this->_agf1, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<10))
+  SBASADDBITS(5,0); // the last byte is filled by 0-bits to obtain a length of an integer multiple of 8
+
+  return CRC24(size, startbuffer);
+}
+
 // Compute SBAS Satellite Position (virtual)
 ////////////////////////////////////////////////////////////////////////////
@@ -1331,4 +1357,37 @@
   //         but it seems to be unreliable in RINEX files
   //_TOT = _TOC.bdssec();
+}
+
+// IOD of BDS Ephemeris (virtual)
+////////////////////////////////////////////////////////////////////////////
+unsigned long t_ephBDS::IOD() const {
+  unsigned char buffer[80];
+  int size = 0;
+  int numbits = 0;
+  long long bitbuffer = 0;
+  unsigned char *startbuffer = buffer;
+
+  BDSADDBITSFLOAT(14, this->_IDOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
+  BDSADDBITSFLOAT(11, this->_clock_driftrate, 1.0/static_cast<double>(1<<30)
+      /static_cast<double>(1<<30)/static_cast<double>(1<<6))
+  BDSADDBITSFLOAT(22, this->_clock_drift, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<20))
+  BDSADDBITSFLOAT(24, this->_clock_bias, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
+  BDSADDBITSFLOAT(18, this->_Crs, 1.0/static_cast<double>(1<<6))
+  BDSADDBITSFLOAT(16, this->_Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
+  BDSADDBITSFLOAT(32, this->_M0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
+  BDSADDBITSFLOAT(18, this->_Cuc, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
+  BDSADDBITSFLOAT(32, this->_e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
+  BDSADDBITSFLOAT(18, this->_Cus, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
+  BDSADDBITSFLOAT(32, this->_sqrt_A, 1.0/static_cast<double>(1<<19))
+  BDSADDBITSFLOAT(18, this->_Cic, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
+  BDSADDBITSFLOAT(32, this->_OMEGA0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
+  BDSADDBITSFLOAT(18, this->_Cis, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
+  BDSADDBITSFLOAT(32, this->_i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
+  BDSADDBITSFLOAT(18, this->_Crc, 1.0/static_cast<double>(1<<6))
+  BDSADDBITSFLOAT(32, this->_omega, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
+  BDSADDBITSFLOAT(24, this->_OMEGADOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
+  BDSADDBITS(5, 0)  // the last byte is filled by 0-bits to obtain a length of an integer multiple of 8
+
+  return CRC24(size, startbuffer);
 }
 
Index: trunk/BNC/src/ephemeris.h
===================================================================
--- trunk/BNC/src/ephemeris.h	(revision 7053)
+++ trunk/BNC/src/ephemeris.h	(revision 7054)
@@ -11,4 +11,5 @@
 #include "gnss.h"
 
+
 class t_orbCorr;
 class t_clkCorr;
@@ -24,5 +25,5 @@
   virtual e_type  type() const = 0;
   virtual QString toString(double version) const = 0;
-  virtual int     IOD() const = 0;
+  virtual unsigned long IOD() const = 0;
   virtual int     slotNum() const {return 0;}
   bncTime TOC() const {return _TOC;}
@@ -60,5 +61,5 @@
   virtual e_type type() const {return (_prn.system() == 'J' ? t_eph::QZSS : t_eph::GPS); }
   virtual QString toString(double version) const;
-  virtual int  IOD() const { return static_cast<int>(_IODC); }
+  virtual unsigned long  IOD() const { return static_cast<unsigned long>(_IODC); }
   double TGD() const {return _TGD;} // Timing Group Delay (P1-P2 DCB)
 
@@ -114,5 +115,5 @@
   virtual e_type type() const {return t_eph::GLONASS;}
   virtual QString toString(double version) const;
-  virtual int  IOD() const;
+  virtual unsigned long  IOD() const;
   virtual int slotNum() const {return int(_frequency_number);}
 
@@ -155,5 +156,5 @@
   virtual QString toString(double version) const;
   virtual e_type type() const {return t_eph::Galileo;}
-  virtual int  IOD() const { return static_cast<int>(_IODnav); }
+  virtual unsigned long  IOD() const { return static_cast<unsigned long>(_IODnav); }
 
  private:
@@ -217,5 +218,5 @@
 
   virtual e_type  type() const {return t_eph::SBAS;}
-  virtual int     IOD() const {return _IODN;}
+  virtual unsigned long IOD() const;
   virtual QString toString(double version) const;
 
@@ -253,5 +254,5 @@
 
   virtual e_type  type() const {return t_eph::BDS;}
-  virtual int     IOD() const {return _AODC;}
+  virtual unsigned long IOD() const;
   virtual QString toString(double version) const;
 
