Changeset 661 in ntrip


Ignore:
Timestamp:
Jan 29, 2008, 3:53:43 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM3/rtcm3torinex.h

    r512 r661  
    44/*
    55  Converter for RTCM3 data to RINEX.
    6   $Id: rtcm3torinex.h,v 1.7 2007/10/08 12:51:24 stoecker Exp $
     6  $Id: rtcm3torinex.h,v 1.9 2007/10/17 06:12:00 mervart Exp $
    77  Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@alberding.eu>
    88
     
    115115#define GPSEPHF_VALIDATED      (1<<3) /* data is completely valid */
    116116
    117 #define PI          3.1415926535898
     117#ifndef PI
     118        #define PI          3.1415926535898
     119#endif
    118120
    119121struct gpsephemeris {
  • trunk/BNC/RTIGS/RTIGSDecoder.cpp

    r652 r661  
    4141#include "RTIGSDecoder.h"
    4242#include "bncconst.h"
     43#include "bncapp.h"
    4344
    4445using namespace std;
     
    4647#undef L1
    4748#undef L2
     49
     50//
     51////////////////////////////////////////////////////////////////////////////
     52ephSenderRTIGS::ephSenderRTIGS() {
     53  connect(this, SIGNAL(newGPSEph(gpsephemeris*)),
     54          (bncApp*) qApp, SLOT(slotNewGPSEph(gpsephemeris*)));
     55  //connect(this, SIGNAL(newGlonassEph(glonassephemeris*)),
     56  //        (bncApp*) qApp, SLOT(slotNewGlonassEph(glonassephemeris*)));
     57}
    4858
    4959// Constructor
     
    7484      SwitchBytes( (char*) &xx, sizeof(xx) );
    7585    }
    76     if (xx == 200) {
     86    if (xx == 200 || xx == 300 ) { // 2/1/2008 SPG
    7787      _buffer = _buffer.substr(ii);
    7888      found = true;
     
    97107  }
    98108
     109  // 2/1/2008 SPG Start
    99110  // Decode the epoch
    100111  // ----------------
    101112  if (messType == 200) {
     113  // Decode Obs
    102114    RTIGSO_T  rtigs_obs;
    103115    short numObs = _GPSTrans.Decode_RTIGS_Obs(p_buf, numbytes, rtigs_obs);
     
    121133    }
    122134  }
     135  if(messType==300){
     136  // Decode Ephemeris
     137    RTIGSE_T rtigs_eph;
     138    BEPH_T new_eph;
     139    short PRN;
     140    // To TNAV_T
     141    // ---------
     142    short retval = _GPSTrans.Decode_RTIGS_Eph(p_buf, numbytes , rtigs_eph, PRN);
     143    // Ensure it was decoded ok.
     144    // ------------------------
     145    if(retval==1){     
     146    // TNAV To BEPH (decodes subframes)
     147    // --------------------------------
     148      _GPSTrans.TNAV_To_BEPH(&_GPSTrans.TNAV_Eph.Eph[PRN-1],&new_eph);
     149      gpsephemeris* ep = new gpsephemeris();
     150      // Match datatypes
     151      // ---------------
     152      ep->flags            = (int)new_eph.l2pflag;
     153      ep->satellite        = (int)new_eph.satellite;
     154      ep->IODE             = (int)new_eph.issue_of_eph;
     155      ep->URAindex         = (int)new_eph.user_range_acc;
     156      ep->SVhealth         = (int)new_eph.sat_health;
     157      ep->GPSweek          = (int)new_eph.gps_week;
     158      ep->IODC             = (int)new_eph.issue_of_clock;
     159      ep->TOW              = (int)new_eph.transmit_time;
     160      ep->TOC              = (int)new_eph.clock_ref_time;
     161      ep->TOE              = (int)new_eph.eph_ref_time;
     162      ep->clock_bias       = new_eph.a0;
     163      ep->clock_drift      = new_eph.a1;
     164      ep->clock_driftrate  = new_eph.a2;
     165      ep->Crs              = new_eph.orbit_sin_corr;
     166      ep->Delta_n          = new_eph.mean_mot_diff ;
     167      ep->M0               = new_eph.ref_mean_anmly;
     168      ep->Cuc              = new_eph.lat_cos_corr;
     169      ep->e                = new_eph.orbit_ecc;
     170      ep->Cus              = new_eph.lat_sin_corr;
     171      ep->sqrt_A           = new_eph.orbit_semimaj;
     172      ep->Cic              = new_eph.incl_cos_corr;
     173      ep->OMEGA0           = new_eph.right_asc;
     174      ep->Cis              = new_eph.incl_sin_corr;
     175      ep->i0               = new_eph.orbit_incl;
     176      ep->Crc              = new_eph.orbit_cos_corr;
     177      ep->omega            = new_eph.arg_of_perigee;
     178      ep->OMEGADOT         = new_eph.right_asc_rate;
     179      ep->IDOT             = new_eph.incl_rate;
     180      ep->TGD              = new_eph.group_delay;
     181
     182      // Pass back to parent class
     183      // --------------------
     184      emit _ephSender.newGPSEph(ep);
     185    }   
     186  }
     187
     188  // 2/1/2008 SPG End
    123189
    124190  // Unprocessed bytes remain in buffer
    125191  // ----------------------------------
    126192  _buffer = _buffer.substr(numbytes);
    127 
    128193  return success;
    129194}
  • trunk/BNC/RTIGS/RTIGSDecoder.h

    r649 r661  
    2727
    2828#include <string>
     29#include <QtCore>   // 2/1/2008 SPG
    2930#include "../RTCM/GPSDecoder.h"
    3031#include "cgps_transform.h"
     32
     33// 2/1/2008 SPG Start
     34extern "C" {
     35        #include "../RTCM3/rtcm3torinex.h"
     36}
     37
     38class ephSenderRTIGS : public QObject {
     39Q_OBJECT
     40public:
     41  ephSenderRTIGS();
     42  friend class RTIGSDecoder;
     43signals:
     44  void newGPSEph(gpsephemeris* gpseph);
     45 //void newGlonassEph(glonassephemeris* glonasseph);
     46} ;
     47// 2/1/2008 SPG End
    3148
    3249class RTIGSDecoder : public GPSDecoder {
     
    3855  CGPS_Transform _GPSTrans;
    3956  std::string    _buffer;
     57  ephSenderRTIGS _ephSender;
    4058} ;
    4159
  • trunk/BNC/RTIGS/cgps_transform.cpp

    r305 r661  
    760760}
    761761
     762// 2/1/2008 SPG Start
     763
     764//*****************************************************************************************
     765//
     766
     767// Function/Method : CGPS_Transform::SwitchEphBytes()
     768//
     769// Purpose :
     770//
     771// Returns :
     772//
     773// Author  :    Created By KML 2002/06
     774//
     775// Description:
     776//
     777//
     778
     779//
     780// Parameters: 
     781
     782//
     783//
     784//
     785//
     786//
     787//
     788// Revision :
     789
     790//*****************************************************************************************
     791
     792void CGPS_Transform::SwitchEphBytes( TNAV_T *rnav )
     793
     794{
     795   unsigned long *word;
     796   int i, j;
     797        SwitchBytes( (char *)&rnav->GPSCollectedTime, sizeof(long) );
     798        SwitchBytes( (char *)&rnav->Satellite, sizeof(long) );
     799
     800      word = (unsigned long *)rnav->SubFrame1;
     801
     802      for( i = 0; i < 3; i++ ) {
     803         for( j = 1; j <= 6; j++, word++ ) {
     804
     805            SwitchBytes( (char *)word, sizeof(long) );
     806         }
     807      }
     808}
     809//*****************************************************************************************
     810//
     811
     812// Function/Method : CGPS_Transform::TNAV_To_BEPH
     813//
     814// Purpose :
     815//
     816// Returns :
     817//
     818// Author  :    Created By Mark Caissy Modified and put in class by KML 2002/06
     819//
     820// Description:
     821//
     822//
     823//
     824// Parameters: 
     825
     826//
     827//
     828//
     829
     830//
     831//
     832//
     833// Revision : KML June 9/2005 added check for PRN num, switch bytes and return
     834//*****************************************************************************************
     835
     836
     837short  CGPS_Transform::TNAV_To_BEPH( TNAV_T *rtcurrent_eph, BEPH_T *new_eph)
     838{
     839      TNAV_T temp_eph,
     840             *tnav_t_ptr;
     841
     842      long word,
     843           tmp_word1,
     844           tmp_word2;
     845
     846
     847      double issue_of_data_clock,
     848             issue_of_data_eph1,
     849             issue_of_data_eph2,
     850             clock_ref_time;
     851
     852      double svacrcy[] = { 2.0, 2.8, 4.0, 5.7, 8.0, 11.3, 1.6e01, 3.2e01,
     853         6.4e01, 1.28e02, 2.56e02, 5.12e02, 1.024e03, 2.048e03, 4.096e03, -1.0 };
     854
     855        short retval = 1;
     856
     857                                //copy into local variable KML
     858      memcpy( &temp_eph, rtcurrent_eph, sizeof(TNAV_T) );
     859
     860
     861      tnav_t_ptr = &temp_eph;
     862
     863        if (f_IsLittleEndian)                                                           //KML   Added June 9/2005
     864        {                                                                                                                               //KML   
     865                SwitchEphBytes( tnav_t_ptr );           //KML
     866        }                                                                                                                               //KML   
     867
     868                                        //****************************************
     869                                        // Verify that prn of in expected range
     870                                        //****************************************
     871        if (((short)tnav_t_ptr->Satellite > 0) && ((short)tnav_t_ptr->Satellite <= 32))         //KML June 9/2005
     872        {
     873
     874                new_eph->transmit_time = GPSEC_UNROLL((tnav_t_ptr->GPSCollectedTime - 18L));
     875               /* 18L is used since each subframe takes 6
     876                                 * seconds and there are 3 of them.
     877                                */
     878                                        /*
     879                                        c     process subframe 1
     880                                        c
     881                                        c     new_eph[1] = satellite prn number
     882                                        c     new_eph[2] = gps week of navigation mesage
     883                                        c     new_eph[3] = l2 codes, bits 11-12, + l2pflag*256
     884                                        c     new_eph[4] = user range accuracy b13-16 (m)
     885
     886                                        c     new_eph[5] = navigation health, bit 1
     887                                        c     new_eph[6] = l1, l2 correction term (s), scale 2^-31
     888                                        c     new_eph->clock_ref_time = aodc (age of data clock)
     889                                        c     new_eph[8] = clock reference time
     890                                        c     new_eph[9] = clock acceleration (s^-1),  scale 2^-55
     891                                        c     new_eph[10]= clock  rate, (s/s),     scale 2^-43
     892                                        c     new_eph[11]= clock offset (s)        scale 2^-31
     893                                        */
     894                tnav_t_ptr->SubFrame1[5] >>= 2; /* shift off 2 lsbs of 6th word */
     895                word =  tnav_t_ptr->SubFrame1[5] & 0x3fffff; /* 22 bits for Af0 */
     896                if( word & 0x200000 ) word -= 0x400000; /* 2's complement */
     897                new_eph->a0 = (double)word / 2.147483648e9;  /* apply scale factor */
     898
     899                tnav_t_ptr->SubFrame1[5] >>= 22; /* shift off Af0 bits */
     900                tmp_word1 =  tnav_t_ptr->SubFrame1[5] & 0xff;/*  Af1's 8 LSB's */
     901                word = tnav_t_ptr->SubFrame1[4] & 0xff; /* Af1's 8 MSB's */
     902                word <<= 8; /* shift for proper alignment of bits */
     903                word += tmp_word1;
     904                if( word & 0x8000 ) word -= 0x010000; /* 2's complement */
     905                new_eph->a1 = (double)word/8.796093022208e12;  /* apply scale factor */
     906
     907
     908                tnav_t_ptr->SubFrame1[4] >>= 8; /* shift off Af1's MSB's */
     909                word =  tnav_t_ptr->SubFrame1[4] & 0xff; /* 8 bits for Af2 */
     910
     911                if (word & 0x80) word -= 0x0100; /* 2's compliment */
     912                new_eph->a2 = (double)word/3.6028797018963968e16;  /* apply scale factor */
     913
     914                tnav_t_ptr->SubFrame1[4]>>= 8; /* shift off Af2 bits */
     915
     916
     917                word = tnav_t_ptr->SubFrame1[4] & 0xffff; /* Toc bits */
     918                clock_ref_time = (double)word*16; /* apply scale factor */
     919                new_eph->clock_ref_time = clock_ref_time;
     920
     921                tmp_word1 = tnav_t_ptr->SubFrame1[3] & 0xff; /* LSB's for IODC */
     922                tnav_t_ptr->SubFrame1[3] >>= 8; /* shift off IODC LSB's */
     923
     924                word = tnav_t_ptr->SubFrame1[3] & 0xff; /* next 8 are TGD */
     925                if (word & 0x80) word -= 0x0100; /* 2's compliment */
     926                new_eph->group_delay = (double)word/2.147483648e9; /* apply scale factor */
     927
     928                tnav_t_ptr->SubFrame1[0] >>= 7; /* shift off spare bits */
     929                tmp_word2 = tnav_t_ptr->SubFrame1[0] & 0x01; /* L2PFlag bit */
     930
     931
     932                new_eph->l2pflag = (double)tmp_word2;
     933                tnav_t_ptr->SubFrame1[0] >>= 1; /* shift off L2PFlag bit */
     934                word = tnav_t_ptr->SubFrame1[0] & 0x03; /* 2 MSB's for IODC */
     935                word <<= 8; /* shift MSB's for proper alignment */
     936                issue_of_data_clock = (double)(word + tmp_word1);  /* combine 2 + 8 bits */
     937                new_eph->issue_of_clock = issue_of_data_clock;
     938
     939                tnav_t_ptr->SubFrame1[0] >>= 2; /* shift off IODC MSB's */
     940                word = tnav_t_ptr->SubFrame1[0] & 0x3f; /* 6 health bits */
     941
     942
     943                    /* set only the MSB of the 6 health bits */
     944                new_eph->sat_health = (double) ( (word & 0x20) >> 5 );
     945
     946                tnav_t_ptr->SubFrame1[0] >>= 6; /* shift off the health bits */
     947                word = tnav_t_ptr->SubFrame1[0] & 0x0f; /* next 4 are URA bits */
     948                new_eph->user_range_acc = (double)svacrcy[ (int)word ];
     949
     950                tnav_t_ptr->SubFrame1[0] >>= 4; /* shift off URA bits */
     951                word = tnav_t_ptr->SubFrame1[0] & 0x03; /* 2 bits for L2code */
     952                new_eph->l2code = (double)word; /* L2code */
     953
     954                tmp_word2 = tmp_word1; /* LSB's of IODC for comparison with IODE */
     955
     956                tnav_t_ptr->SubFrame1[0] >>= 2; /* shift off L2code bits */
     957                                    /* 10 bits for week number */
     958                new_eph->gps_week = GPSWK_UNROLL((double)(tnav_t_ptr->SubFrame1[0] & 0x3ff));
     959
     960                new_eph->satellite = (double)(tnav_t_ptr->Satellite & 0xff);
     961
     962                                        /*
     963                                        c     process subframe 2
     964                                        c
     965                                        c     new_eph[12)  = issue of new_ephemeris data
     966                                        c     new_eph[13)  = crs (meters), scale  2^-5
     967                                        c     new_eph[14)  = offset rate (rad/s), scale 2^-43
     968                                        c     new_eph[15)  = mean anomaly at ref. time (rad), scale 2^-31
     969                                        c     new_eph[16)  = cuc (rad), scale 2^-29
     970                                        c     new_eph[17)  = eccentricity, scale 2^-33
     971                                        c     new_eph[18)  = cus (rad), scale 2^-29
     972                                        c     new_eph[19)  = sqrt of sma (m^0.5), scale 2^-19
     973                                        c     new_eph[20)  = new_eph. ref. time ~ start gps week (s), scale 2^4
     974
     975                                        c     new_eph[21)  = curve fit interval (in hrs)
     976                                        */
     977
     978                tnav_t_ptr->SubFrame2[5] >>= 7; /* shift off 7 lsbs of 6th word */
     979                word =  tnav_t_ptr->SubFrame2[5] & 0x01; /*fit interval 1 bit */
     980                new_eph->fit_interval = (double)word;  /* see below for further processing */
     981
     982
     983
     984                tnav_t_ptr->SubFrame2[5] >>= 1; /* shift off fit bit */
     985                word = tnav_t_ptr->SubFrame2[5] & 0xffff; /* toe 16 bits */
     986                new_eph->eph_ref_time = (double)word * 16.0; /* scale toe */
     987
     988                                /*      if ( new_eph->eph_ref_time != clock_ref_time ) return(-1);  */
     989
     990                tnav_t_ptr->SubFrame2[5] >>= 16; /* shift off toe bits */
     991
     992                tmp_word1 = tnav_t_ptr->SubFrame2[5] & 0xff; /* 8 LSB's for semi-axis */
     993                word = tnav_t_ptr->SubFrame2[4] & 0xffffff; /* 24 MSB's for semi-axis*/
     994                word <<= 8; /* shift left 8 for proper alignment */
     995                word += tmp_word1; /* assemble the 32 bits */
     996
     997                new_eph->orbit_semimaj = (double)word/5.24288e5; /* scale the semimajor axis */
     998                if (new_eph->orbit_semimaj < 0.0e0)  new_eph->orbit_semimaj += 8192.0e0;
     999
     1000
     1001                tnav_t_ptr->SubFrame2[4] >>= 24; /* shift off semi axis MSB's */
     1002                tmp_word1 = tnav_t_ptr->SubFrame2[4] & 0xff; /* 8 LsB's for Cus */
     1003                word = tnav_t_ptr->SubFrame2[3] & 0xff; /* 8 MSB's for Cus */
     1004                word <<= 8; /* shift left 8 for proper alignment */
     1005                word += tmp_word1; /* assemble the 16 bits */
     1006                if( word & 0x8000 ) word -= 0x010000; /* apply 2's complement */
     1007                new_eph->lat_sin_corr = (double)word/5.36870912e8;
     1008
     1009                tnav_t_ptr->SubFrame2[3] >>= 8; /* shift off Cus MSB's */
     1010                tmp_word1 = tnav_t_ptr->SubFrame2[3] & 0xffffff; /* 24 LsB's for Ecc */
     1011                word = tnav_t_ptr->SubFrame2[2] & 0xff; /* 8 MSB's for Ecc */
     1012                word <<= 24; /* shift left 24 for proper alignment */
     1013                word += tmp_word1; /* assemble the 32 bits */
     1014                new_eph->orbit_ecc = (double)word/8.589934592e9;
     1015                if(new_eph->orbit_ecc < 0.0) new_eph->orbit_ecc += 0.5;
     1016
     1017                tnav_t_ptr->SubFrame2[2] >>= 8; /* shift off Ecc MSB's */
     1018                word = tnav_t_ptr->SubFrame2[2] & 0xffff; /* 16 Cuc bits */
     1019                if( word & 0x8000 ) word -= 0x010000; /* apply 2's complement */
     1020                new_eph->lat_cos_corr = (double)word/5.36870912e8;
     1021
     1022                tnav_t_ptr->SubFrame2[2] >>= 16; /* shift off Cuc bits*/
     1023                tmp_word1 = tnav_t_ptr->SubFrame2[2] & 0xff; /* 8 LsB's for MO */
     1024                word = tnav_t_ptr->SubFrame2[1] & 0xffffff; /* 24 MSB's for MO */
     1025                word <<= 8; /* shift left 8 for proper alignment */
     1026                word += tmp_word1; /* assemble the 32 bits */
     1027                new_eph->ref_mean_anmly = (double)word*(PI/2.147483648e9);
     1028
     1029                tnav_t_ptr->SubFrame2[1] >>= 24; /* shift off MO MSB's */
     1030                tmp_word1 = tnav_t_ptr->SubFrame2[1] & 0xff; /* 8 LsB's for dN */
     1031                word = tnav_t_ptr->SubFrame2[0] & 0xff; /* 8 MSB's for dN */
     1032
     1033                word <<= 8; /* shift left 8 for proper alignment */
     1034                word += tmp_word1; /* assemble the 16 bits */
     1035
     1036                if( word & 0x8000 ) word -= 0x010000; /* apply 2's complement */
     1037                new_eph->mean_mot_diff = (double)word*(PI/8.796093022208e12);
     1038
     1039                tnav_t_ptr->SubFrame2[0] >>= 8; /* shift off dN MSB's */
     1040                word = tnav_t_ptr->SubFrame2[0] & 0xffff; /* 16 bit for Crs */
     1041                if( word & 0x8000 ) word -= 0x010000; /* apply 2's complement */
     1042                new_eph->orbit_sin_corr = (double)word / 32.0;
     1043
     1044                tnav_t_ptr->SubFrame2[0] >>= 16; /* shift off Crs bits */
     1045                issue_of_data_eph1 = tnav_t_ptr->SubFrame2[0] & 0xff;/*8 bits for IODE1*/
     1046                                       /* compare IODC with IODE1 */
     1047
     1048                                        /*      if( issue_of_data_eph1 != tmp_word2 ) return(-2);  */
     1049
     1050                if (issue_of_data_eph1 < 240.0) {
     1051                        if (new_eph->fit_interval == 0.0) new_eph->fit_interval = 4.e0;
     1052                        if (new_eph->fit_interval == 1.0) new_eph->fit_interval = 6.e0;
     1053                }
     1054                else  if (issue_of_data_clock < 248.e0)
     1055                {
     1056                        new_eph->fit_interval = 8.e0;
     1057                }
     1058                else  if (issue_of_data_clock < 497.e0)
     1059                {
     1060                        new_eph->fit_interval = 14.e0;
     1061                }
     1062                else  if (issue_of_data_clock < 504.e0)
     1063                {
     1064                        new_eph->fit_interval = 26.e0;
     1065                }
     1066                else  if (issue_of_data_clock < 511.e0)
     1067                {
     1068                        new_eph->fit_interval = 50.e0;
     1069                }
     1070                else  if (issue_of_data_clock < 757.e0)
     1071                {
     1072                        new_eph->fit_interval = 74.e0;
     1073                }
     1074                else if (issue_of_data_clock < 764.e0)
     1075                {
     1076                        new_eph->fit_interval = 98.e0;
     1077                }
     1078                else if (issue_of_data_clock < 1011.e0)
     1079                {
     1080                        new_eph->fit_interval = 122.e0;
     1081                }
     1082                else if (issue_of_data_clock < 1021.e0)
     1083                {
     1084                        new_eph->fit_interval = 146.e0;
     1085                }
     1086                                                /*
     1087
     1088                                                c     process subframe 3
     1089                                                c
     1090                                                c     new_eph[22)  = cic (rad), scale 2^-29
     1091                                                c     new_eph[23)  = right ascension at ref. time (rad), 2^-31
     1092                                                c     new_eph[24)  = cis (rad), scale 2^-29
     1093                                                c     new_eph[25)  = inclination (rad), scale 2^-31
     1094                                                c     new_eph[26)  = crc (m), scale 2^-5
     1095                                                c     new_eph[27)  = argument of perigee (rad), scale 2^-31
     1096                                                c     new_eph[28)  = rate of right ascension (rad/s) scale 2^-43
     1097                                                c     new_eph[29)  = issue of new_ephemeris data
     1098                                                c     new_eph[30)  = inclination rate (rad/s) scale 2^-43
     1099                                                */
     1100                tnav_t_ptr->SubFrame3[5] >>= 2; /* shift off 2 lsbs of 6th word */
     1101                word =  tnav_t_ptr->SubFrame3[5] & 0x3fff; /*IDOT 14 bits */
     1102
     1103                if( word & 0x2000 ) word -= 0x4000; /* apply 2's complement */
     1104                new_eph->incl_rate = (double)word*(PI/8.796093022208e12);
     1105
     1106                tnav_t_ptr->SubFrame3[5] >>= 14; /* shift off 14 IDOT bits */
     1107                word =  tnav_t_ptr->SubFrame3[5] & 0xff; /*IODE2 bits */
     1108
     1109                issue_of_data_eph2 = (double)word;
     1110
     1111                tnav_t_ptr->SubFrame3[5] >>= 8; /* shift off IODE2 bits */
     1112                tmp_word1 = tnav_t_ptr->SubFrame3[5] & 0xff; /* 8 LsB's for DOmega */
     1113                word = tnav_t_ptr->SubFrame3[4] & 0xffff; /* 16 MSB's for DOmega */
     1114                word <<= 8; /* shift left 8 for proper alignment */
     1115                word += tmp_word1; /* assemble the 24 bits */
     1116
     1117                if( word & 0x800000 ) word -= 0x01000000; /* apply 2's complement */
     1118                        new_eph->right_asc_rate = (double)word*(PI/8.796093022208e12);
     1119
     1120                tnav_t_ptr->SubFrame3[4] >>= 16; /* shift off DOmega MSB's */
     1121                tmp_word1 = tnav_t_ptr->SubFrame3[4] & 0xffff; /* 16 LsB's for w */
     1122                word = tnav_t_ptr->SubFrame3[3] & 0xffff; /* 16 MSB's for w */
     1123                word <<= 16; /* shift left 16 for proper alignment */
     1124
     1125                word += tmp_word1; /* assemble the 32 bits */
     1126                new_eph->arg_of_perigee = (double)word*(PI/2.147483648e9);
     1127
     1128                tnav_t_ptr->SubFrame3[3] >>= 16; /* shift off w MSB's */
     1129                word = tnav_t_ptr->SubFrame3[3] & 0xffff; /* 16 Crc bits */
     1130                if( word & 0x8000 ) word -= 0x010000; /* apply 2's complement */
     1131
     1132                new_eph->orbit_cos_corr = (double)word/32.0e0;
     1133                                            /* IO 32 bits */
     1134                new_eph->orbit_incl = (double)tnav_t_ptr->SubFrame3[2] * (PI/2.147483648e9);
     1135
     1136
     1137
     1138
     1139                word = tnav_t_ptr->SubFrame3[1] & 0xffff; /* 16 Cis bits */
     1140                if( word & 0x8000 ) word -= 0x010000; /* apply 2's complement */
     1141                new_eph->incl_sin_corr = (double)word/5.36870912e8;
     1142
     1143                tnav_t_ptr->SubFrame3[1] >>= 16; /* shift off Cis bits */
     1144                tmp_word1 = tnav_t_ptr->SubFrame3[1] & 0xffff; /* 16 LsB's for OmegaO */
     1145                word = tnav_t_ptr->SubFrame3[0] & 0xffff; /* 16 MSB's for OmegaO*/
     1146                word <<= 16; /* shift left 16 for proper alignment */
     1147
     1148                word += tmp_word1; /* assemble the 32 bits */
     1149                new_eph->right_asc = (double)word*(PI/2.147483648e9);
     1150
     1151                tnav_t_ptr->SubFrame3[0] >>= 16; /* shift off OmegaO bits */
     1152                word = tnav_t_ptr->SubFrame3[0] & 0xffff; /* 16 Cic bits */
     1153                if( word & 0x8000 ) word -= 0x010000; /* apply 2's complement */
     1154
     1155
     1156                new_eph->incl_cos_corr = (double)word/5.36870912e8;
     1157                                                /*
     1158                                                c     issue of clock data (subframe 1) & the 2 versions
     1159                                                c     of the issue of new_ephemeris data (subframes 2 & 3)
     1160                                                c     are not consistent: return error code -2
     1161                                                */
     1162                                /*      if( issue_of_data_eph1   != issue_of_data_eph2 ) return( -3 );  */
     1163                new_eph->issue_of_eph = issue_of_data_eph2;
     1164
     1165
     1166                                                /*
     1167                                                c     correct GPS week value when validity interval crosses end of week
     1168                                                c     in this case the week decoded is the week of transmission and the
     1169                                                c     reference time could be in the subsequent week
     1170                                                c     the condition tested is:
     1171                                                c            sec_of_week(transmit) - sec_of week(eph_reference) > +302400
     1172                                                */
     1173                if( ((long)new_eph->transmit_time)%604800 - new_eph->eph_ref_time > 302400. )
     1174                new_eph->gps_week += 1.0;
     1175        }                                                       //KML June 9/2005
     1176        else                                            //KML June 9/2005
     1177        {                                                       //KML June 9/2005
     1178                retval = -1;            //KML June 9/2005
     1179        }                                                       //KML June 9/2005
     1180return retval;                  //KML June 9/2005
     1181}
     1182// 2/1/2008 SPG End
     1183
  • trunk/BNC/RTIGS/cgps_transform.h

    r306 r661  
    1414#include "rtstruct.h"
    1515#include "rtigs_records.h"
     16#include "gpswro.h"
    1617
    1718#define MAXCHANNELS_FOR_SOCKETS_TYPE1 12
     
    123124  short          Decode_RTIGS_Eph(unsigned char *RTIGS_Str,  unsigned  short RTIGS_Bytes, RTIGSE_T &rtigs_eph, short &PRN); //stors in class and returns prn
    124125  short          Decode_RTIGS_Met(unsigned char *RTIGS_Str,   unsigned short RTIGS_Bytes, RTIGSM_T *rtigs_met);    // contents of record contain all info.
     126  short TNAV_To_BEPH( TNAV_T *rtcurrent_eph, BEPH_T *new_eph); // 2/1/2008 SPG
     127  void SwitchEphBytes( TNAV_T *rnav ); // 2/1/2008 SPG
    125128};
    126129
     130
    127131#endif
  • trunk/BNC/bnc.pro

    r658 r661  
    2929          RTCM3/RTCM3Decoder.h RTCM3/rtcm3torinex.h                   \
    3030          RTIGS/RTIGSDecoder.h RTIGS/rtigs_records.h                  \
    31           RTIGS/cgps_transform.h RTIGS/rtstruct.h RTIGS/rtacp.h
     31          RTIGS/cgps_transform.h RTIGS/rtstruct.h RTIGS/rtacp.h RTIGS/gpswro.h
    3232
    3333SOURCES = bncmain.cpp bncgetthread.cpp  bncwindow.cpp bnctabledlg.cpp \
Note: See TracChangeset for help on using the changeset viewer.