Changeset 8805 in ntrip for branches/BNC_2.12/src/bncutils.cpp


Ignore:
Timestamp:
Sep 20, 2019, 2:51:58 PM (5 years ago)
Author:
stuerze
Message:

IRNSS support is added in RTCM3 decoder, RTCM signal mapping IDs for GLONASS and BDS are updated/extended

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/BNC_2.12/src/bncutils.cpp

    r8691 r8805  
    173173    }
    174174  }
    175 
    176175}
    177176
     
    463462//
    464463////////////////////////////////////////////////////////////////////////////
    465 int factorial(int n) {
     464double factorial(int n) {
    466465  if (n == 0) {
    467466    return 1;
     
    809808
    810809double accuracyFromIndex(int index, t_eph::e_type type) {
    811 
    812   if (type == t_eph::GPS || type == t_eph::BDS || type == t_eph::SBAS
    813       || type == t_eph::QZSS) {
    814 
     810double accuracy = -1.0;
     811
     812  if (type == t_eph::GPS ||
     813      type == t_eph::BDS ||
     814      type == t_eph::SBAS||
     815      type == t_eph::QZSS) {
    815816    if ((index >= 0) && (index <= 6)) {
    816817      if (index == 3) {
    817         return ceil(10.0 * pow(2.0, (double(index) / 2.0) + 1.0)) / 10.0;
     818        accuracy = ceil(10.0 * pow(2.0, (double(index) / 2.0) + 1.0)) / 10.0;
    818819      }
    819820      else {
    820         return floor(10.0 * pow(2.0, (double(index) / 2.0) + 1.0)) / 10.0;
     821        accuracy = floor(10.0 * pow(2.0, (double(index) / 2.0) + 1.0)) / 10.0;
    821822      }
    822823    }
    823824    else if ((index > 6) && (index <= 15)) {
    824       return (10.0 * pow(2.0, (double(index) - 2.0))) / 10.0;
     825      accuracy = (10.0 * pow(2.0, (double(index) - 2.0))) / 10.0;
    825826    }
    826827    else {
    827       return 8192.0;
    828     }
    829   }
    830 
    831   if (type == t_eph::Galileo) {
    832 
     828      accuracy = 8192.0;
     829    }
     830  }
     831  else if (type == t_eph::Galileo) {
    833832    if ((index >= 0) && (index <= 49)) {
    834       return (double(index) / 100.0);
     833      accuracy = (double(index) / 100.0);
    835834    }
    836835    else if ((index > 49) && (index <= 74)) {
    837       return (50.0 + (double(index) - 50.0) * 2.0) / 100.0;
     836      accuracy = (50.0 + (double(index) - 50.0) * 2.0) / 100.0;
    838837    }
    839838    else if ((index > 74) && (index <= 99)) {
    840       return 1.0 + (double(index) - 75.0) * 0.04;
     839      accuracy = 1.0 + (double(index) - 75.0) * 0.04;
    841840    }
    842841    else if ((index > 99) && (index <= 125)) {
    843       return 2.0 + (double(index) - 100.0) * 0.16;
     842      accuracy = 2.0 + (double(index) - 100.0) * 0.16;
    844843    }
    845844    else {
    846       return -1.0;
    847     }
    848   }
    849 
    850   return double(index);
    851 }
     845      accuracy = -1.0;
     846    }
     847  }
     848  else if (type == t_eph::IRNSS) {
     849    if ((index >= 0) && (index <= 6)) {
     850      if      (index == 1) {
     851        accuracy = 2.8;
     852      }
     853      else if (index == 3) {
     854        accuracy = 5.7;
     855      }
     856      else if (index == 5) {
     857        accuracy = 11.3;
     858      }
     859      else {
     860        accuracy = pow(2, 1 + index / 2);
     861      }
     862    }
     863    else if ((index > 6) && (index <= 15)) {
     864      accuracy = pow(2, index - 2);
     865    }
     866  }
     867  return accuracy;
     868}
     869
    852870
    853871int indexFromAccuracy(double accuracy, t_eph::e_type type) {
Note: See TracChangeset for help on using the changeset viewer.