コード例 #1
0
ファイル: CNavUTC.cpp プロジェクト: JC5005/GPSTk
   void CNavUTC::loadData(const PackedNavBits& message33)
      throw(InvalidParameter)
   {
         // First, verify the correct message type is being passed in. 
      long msgType = message33.asUnsignedLong(14,6,1);
      if(msgType!=33)
      {
         char errStr[80];
         sprintf(errStr,"Expected CNAV MsgType 33.  Found MsgType %ld",msgType);
         std::string tstr(errStr);
         InvalidParameter exc(tstr);
         GPSTK_THROW(exc);    
      } 
      obsID     = message33.getobsID();
      satID     = message33.getsatSys();
      ctXmit    = message33.getTransmitTime();
 
      A0 = message33.asSignedDouble(127,16,-35);
      A1 = message33.asSignedDouble(143,13,-51);
      A2 = message33.asSignedDouble(156, 7,-68);

      deltaTls  = message33.asLong(163, 8, 1);
      Tot       = message33.asUnsignedLong(171,16,16);
      WNot      = message33.asUnsignedLong(187,13, 1);
      WNlsf     = message33.asUnsignedLong(200,13, 1);
      DN        = message33.asUnsignedLong(213, 4, 1);
      deltaTlsf = message33.asLong(217, 8, 1);

      ctEpoch   = GPSWeekSecond(WNot, Tot, TimeSystem::GPS);

      dataLoadedFlag = true;   
   } // end of loadData()
コード例 #2
0
ファイル: CNavGGTO.cpp プロジェクト: REC-SPb-ETU/GPSTk
   void CNavGGTO::loadData(const PackedNavBits& message35)
      throw(InvalidParameter)
   {
         // First, verify the correct message type is being passed in. 
      long msgType = message35.asUnsignedLong(14,6,1);
      if(msgType!=35)
      {
         char errStr[80];
         sprintf(errStr,"Expected CNAV MsgType 35.  Found MsgType %ld",msgType);
         std::string tstr(errStr);
         InvalidParameter exc(tstr);
         GPSTK_THROW(exc);    
      } 
      obsID     = message35.getobsID();
      satID     = message35.getsatSys();
      ctXmit    = message35.getTransmitTime();

      TGGTO     = message35.asLong(127,16,16);
      WNGGTO    = message35.asLong(143,13, 1);
      GNSS_ID   = message35.asLong(156, 3, 1); 
      A0GGTO    = message35.asSignedDouble(158,16,-35);
      A1GGTO    = message35.asSignedDouble(175,13,-51);
      A2GGTO    = message35.asSignedDouble(188, 7,-68);

      if (GNSS_ID>0)
         ctEpoch   = GPSWeekSecond(WNGGTO, TGGTO, TimeSystem::GPS);

      dataLoadedFlag = true;   
   } // end of loadData()
コード例 #3
0
ファイル: CNAVEphemeris.cpp プロジェクト: idaohang/GPSTk
void CNAVEphemeris::loadData( const ObsID obsIDArg,
                              const short PRNIDArg,
                              const PackedNavBits message10,
                              const PackedNavBits message11)

throw( InvalidParameter)
{
    obsID         = obsIDArg;
    PRNID         = PRNIDArg;
    satSys        = "G";

    // Message Type 10 data
    Alert[0]      = message10.asUnsignedLong(37, 1, 1);
    TOWCount[0]   = message10.asUnsignedLong(20, 17, 300);
    TOWWeek       = message10.asUnsignedLong(38, 13, 1);
    L1Health      = message10.asUnsignedLong(51, 1, 1);
    L2Health      = message10.asUnsignedLong(52, 1, 1);
    L5Health      = message10.asUnsignedLong(53, 1, 1);
    Top           = message10.asUnsignedLong(54, 11, 300);
    short URAoe   = message10.asLong(65, 5, 1);
    double Toe    = message10.asUnsignedLong(70, 11, 300);
    double deltaA = message10.asSignedDouble(81, 26, -9);
    double Adot   = message10.asSignedDouble(107, 25, -21);
    double dn     = message10.asDoubleSemiCircles(132, 17, -44);
    double dndot  = message10.asDoubleSemiCircles(149, 23, -57);
    double M0     = message10.asDoubleSemiCircles(172, 33, -32);
    double ecc    = message10.asUnsignedDouble(205, 33, -34);
    double w      = message10.asDoubleSemiCircles(238, 33, -32);

    // Message Type 11 data
    Alert[1]             = message11.asUnsignedLong(37, 1, 1);
    TOWCount[1]          = message11.asUnsignedLong(20, 17, 300);
    double OMEGA0        = message11.asDoubleSemiCircles(49, 33, -32);
    double i0            = message11.asDoubleSemiCircles(82, 33, -32);
    double deltaOMEGAdot = message11.asDoubleSemiCircles(115, 17, -44);
    double idot          = message11.asDoubleSemiCircles(132, 15, -44);
    double Cis           = message11.asSignedDouble(147, 16, -30);
    double Cic           = message11.asSignedDouble(163, 16, -30);
    double Crs           = message11.asSignedDouble(179, 24, -8);
    double Crc           = message11.asSignedDouble(203, 24, -8);
    double Cus           = message11.asSignedDouble(227, 21, -30);
    double Cuc           = message11.asSignedDouble(248, 21, -30);

    double A        = A_REF_GPS + deltaA;
    double Ahalf    = SQRT(A);
    double OMEGAdot = OMEGADOT_REF_GPS + deltaOMEGAdot;

    bool healthy = false;
    if (obsIDArg.band == ObsID::cbL2 && L2Health == 0) healthy = true;
    if (obsIDArg.band == ObsID::cbL5 && L5Health == 0) healthy = true;

    double timeDiff = Toe - TOWCount[0];
    short epochWeek = TOWWeek;
    if (timeDiff < -HALFWEEK) epochWeek++;
    else if (timeDiff > HALFWEEK) epochWeek--;

    long beginFitSOW = ((TOWCount[0])/7200)*7200;
    long endFitSOW   = beginFitSOW + 10800;
    short beginFitWk = TOWWeek;
    short endFitWk   = TOWWeek;

    CommonTime beginFit = GPSWeekSecond(beginFitWk, beginFitSOW, TimeSystem::GPS);

    if (endFitSOW >= FULLWEEK)
    {
        endFitSOW -= FULLWEEK;
        endFitWk++;
    }
    CommonTime endFit = GPSWeekSecond(endFitWk, endFitSOW, TimeSystem::GPS);

    CommonTime ToeCT = GPSWeekSecond(epochWeek, Toe, TimeSystem::GPS);

    orbit.loadData(satSys, obsID, PRNID, beginFit, endFit, ToeCT,
                   URAoe, healthy, Cuc, Cus, Crc, Crs, Cic, Cis, M0, dn,
                   dndot, ecc, A, Ahalf, Adot, OMEGA0, i0, w, OMEGAdot, idot);
    dataLoaded = true;
}
コード例 #4
0
ファイル: PackedNavBits_T.cpp プロジェクト: REC-SPb-ETU/GPSTk
   // These tests are NOT real data, but are designed to test
   // edge cases and limits.
unsigned PackedNavBits_T ::
abstractTest()
{
    // Test Unsigned Integers
   TUDEF("PackedNavBits", "addUnsigned");
   unsigned long u_i1 = 32767;
   int u_n1           = 16;
   int u_s1           = 1;

   unsigned long u_i2 = 1;
   int u_n2           = 8;
   int u_s2           = 1;

   unsigned long u_i3 = 255;
   int u_n3           = 8;
   int u_s3           = 1;

   unsigned long u_i4 = 604500;
   int u_n4           = 11;
   int u_s4           = 300;

      // Pack the data
   PackedNavBits pnb;
   pnb.addUnsignedLong(u_i1, u_n1, u_s1);
   pnb.addUnsignedLong(u_i2, u_n2, u_s2);
   pnb.addUnsignedLong(u_i3, u_n3, u_s3);
   pnb.addUnsignedLong(u_i4, u_n4, u_s4);

      // Unpack the data and see that the round-trip worked.
   int startbit = 0;
   unsigned long ultest = pnb.asUnsignedLong(startbit, u_n1, u_s1);
   TUASSERTE(unsigned long, ultest, u_i1); 
   startbit += u_n1;
   ultest = pnb.asUnsignedLong(startbit, u_n2, u_s2);
   TUASSERTE(unsigned long, ultest, u_i2);
   startbit += u_n2;
   ultest = pnb.asUnsignedLong(startbit, u_n3, u_s3);
   TUASSERTE(unsigned long, ultest, u_i3);
   startbit += u_n3;
   ultest = pnb.asUnsignedLong(startbit, u_n4, u_s4);
   TUASSERTE(unsigned long, ultest, u_i4);
   startbit += u_n4;

    // Test Signed Integers
   TUCSM("addSigned");
   long s_i1 = 15;
   int s_n1  = 5;
   int s_s1  = 1;

   long s_i2 = -16;
   int s_n2  = 5;
   int s_s2  = 1;

   long s_i3 = -1;
   int s_n3  = 5;
   int s_s3  = 1;

   long s_i4 = 0;
   int s_n4  = 6;
   int s_s4  = 1;
   
   long s_i5 = 4194304;
   int s_n5  = 24;
   int s_s5  = 1;

   pnb.addLong(s_i1, s_n1, s_s1);
   pnb.addLong(s_i2, s_n2, s_s2);
   pnb.addLong(s_i3, s_n3, s_s3);
   pnb.addLong(s_i4, s_n4, s_s4);
   pnb.addLong(s_i5, s_n5, s_s5);

   long ltest;
   ltest = pnb.asLong(startbit, s_n1, s_s1);
   TUASSERTE(long, ltest, s_i1);
   startbit += s_n1;
   ltest = pnb.asLong(startbit, s_n2, s_s2);
   TUASSERTE(long, ltest, s_i2);
   startbit += s_n2;
   ltest = pnb.asLong(startbit, s_n3, s_s3);
   TUASSERTE(long, ltest, s_i3);
   startbit += s_n3;
   ltest = pnb.asLong(startbit, s_n4, s_s4);
   TUASSERTE(long, ltest, s_i4);
   startbit += s_n4;
   ltest = pnb.asLong(startbit, s_n5, s_s5);
   TUASSERTE(long, ltest, s_i5);
   startbit += s_n5;

   // Test Signed Doubles
   TUCSM("addDouble");
   double d_i1 = 0.490005493;
   int d_n1    = 16;
   int d_s1    = -16;
   double d_e1 = pow(2.0,d_s1);   // value of lsb

   double d_i2 = -0.5;
   int d_n2    = 16;
   int d_s2    = -16;
   double d_e2 = pow(2.0,d_s2);   // value of lsb

   double d_i3 = 0;
   int d_n3    = 16;
   int d_s3    = -16;
   double d_e3 = pow(2.0,d_s3);   // value of lsb

   // Test Unsigned Doubles
   double d_i4 = 32000.0;
   int d_n4    = 16;
   int d_s4    = 0;
   double d_e4 = pow(2.0,d_s4);   // value of lsb

   pnb.addSignedDouble(d_i1, d_n1, d_s1);
   pnb.addSignedDouble(d_i2, d_n2, d_s2);
   pnb.addSignedDouble(d_i3, d_n3, d_s3);
   pnb.addUnsignedDouble(d_i4, d_n4, d_s4);

   double dtest;
   dtest = pnb.asSignedDouble(startbit, d_n1, d_s1);
   TUASSERTFEPS(dtest, d_i1, d_e1);
   startbit += d_n1;
   dtest = pnb.asSignedDouble(startbit, d_n2, d_s2);
   TUASSERTFEPS(dtest, d_i2, d_e2);
   startbit += d_n2;
   dtest = pnb.asSignedDouble(startbit, d_n3, d_s3);
   TUASSERTFEPS(dtest, d_i3, d_e3);
   startbit += d_n3;
   dtest = pnb.asUnsignedDouble(startbit, d_n4, d_s4);
   TUASSERTFEPS(dtest, d_i4, d_e4);
   startbit += d_n4;

   // Test Semi-Circles
   TUCSM("addSemiCircles");
   double sd_i1 = PI-2*pow(2.0,-31);
   int sd_n1    = 32;
   int sd_s1    = -31;
   double sd_e1 = pow(2.0,sd_s1) * 3.0;   // value of lsb in semi-circles

   double sd_i2 = -PI;
   int sd_n2    = 32;
   int sd_s2    = -31;
   double sd_e2 = pow(2.0,sd_s1) * 3.0;   // value of lsb

   pnb.addDoubleSemiCircles(sd_i1, sd_n1, sd_s1);
   pnb.addDoubleSemiCircles(sd_i2, sd_n2, sd_s2); 

   dtest = pnb.asDoubleSemiCircles(startbit, sd_n1, sd_s1);
   TUASSERTFEPS(dtest, sd_i1, sd_e1);
   startbit += sd_n1;
   dtest = pnb.asDoubleSemiCircles(startbit, sd_n2, sd_s2);
   TUASSERTFEPS(dtest, sd_i2, sd_e2);

   return testFramework.countFails();
}