Changeset 10791 in ntrip for trunk/BNC/src/pppOptions.cpp


Ignore:
Timestamp:
Dec 3, 2025, 5:37:16 PM (3 weeks ago)
Author:
mervart
Message:

BNC Multifrequency and PPPAR Client (initial version)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/pppOptions.cpp

    r10251 r10791  
    3939 * -----------------------------------------------------------------------*/
    4040
     41#include <QtCore>
     42#include <set>
    4143#include <newmatio.h>
    4244#include "pppOptions.h"
     
    6163//
    6264//////////////////////////////////////////////////////////////////////////////
    63 const std::vector<t_lc::type>& t_pppOptions::LCs(char system) const {
     65const std::vector<t_lc>& t_pppOptions::LCs(char system) const {
    6466
    6567  if      (system == 'R') {
     
    7476  else {
    7577    return _LCsGPS;
    76   }
    77 }
    78 
    79 //
    80 //////////////////////////////////////////////////////////////////////////////
    81 const std::vector<char>& t_pppOptions::frqBands(char system) const {
    82 
    83   if      (system == 'R') {
    84     return _frqBandsGLONASS;
    85   }
    86   else if (system == 'E') {
    87     return _frqBandsGalileo;
    88   }
    89   else if (system == 'C') {
    90     return  _frqBandsBDS;
    91   }
    92   else {
    93     return _frqBandsGPS;
    9478  }
    9579}
     
    119103//
    120104/////////////////////////////////////////////////////////////////////////////
    121 vector<t_lc::type> t_pppOptions::ambLCs(char system) const {
    122 
    123   const vector<t_lc::type>& allLCs = LCs(system);
    124   vector<t_lc::type>        phaseLCs;
     105vector<t_lc> t_pppOptions::ambLCs(char system) const {
     106
     107  set<t_frequency::type> frqs;
     108
     109  int numPhaseLCs = 0;
     110  const vector<t_lc>& allLCs = LCs(system);
    125111  for (unsigned ii = 0; ii < allLCs.size(); ii++) {
    126     if (t_lc::includesPhase(allLCs[ii])) {
    127       phaseLCs.push_back(allLCs[ii]);
    128     }
    129   }
    130 
    131   vector<t_lc::type> answ;
    132   if      (phaseLCs.size() == 1) {
    133     answ.push_back(phaseLCs[0]);
    134   }
    135   else if (phaseLCs.size() >  1) {
    136     answ.push_back(t_lc::l1);
    137     answ.push_back(t_lc::l2);
     112    const t_lc& LC = allLCs[ii];
     113    if (LC.includesPhase()) {
     114      numPhaseLCs += 1;
     115      frqs.insert(LC._frq1);
     116      if (LC._frq2 != t_frequency::dummy) {
     117        frqs.insert(LC._frq2);
     118      }
     119    }
     120  }
     121
     122  vector<t_lc> answ;
     123  for (auto it = frqs.begin(); it != frqs.end(); ++it) {
     124    answ.push_back(t_lc(t_lc::phase, *it));
     125    if (numPhaseLCs == 1) {
     126      break;
     127    }
    138128  }
    139129
     
    143133//
    144134/////////////////////////////////////////////////////////////////////////////
    145 vector<t_lc::type> t_pppOptions::codeLCs(char system) const {
    146 
    147   const vector<t_lc::type>& allLCs = LCs(system);
    148   vector<t_lc::type>        codeLCs;
    149   for (unsigned ii = 0; ii < allLCs.size(); ii++) {
    150     if (t_lc::includesCode(allLCs[ii])) {
    151       codeLCs.push_back(allLCs[ii]);
    152     }
    153   }
    154 
    155   vector<t_lc::type> answ;
    156   if      (codeLCs.size() == 1) {
    157     answ.push_back(codeLCs[0]);
    158   }
    159   else if (codeLCs.size() >  1) {
    160     answ.push_back(t_lc::c1);
    161     answ.push_back(t_lc::c2);
    162   }
    163 
    164   return answ;
    165 }
    166 
    167 
     135void t_pppOptions::setTrkModes(const std::string& trkStr) {
     136
     137  QStringList priorList = QString::fromStdString(trkStr).split(" ", Qt::SkipEmptyParts);
     138  for (int ii = 0; ii < priorList.size(); ii++) {
     139    if (priorList[ii].indexOf(":") != -1) {
     140      QStringList sysList = priorList[ii].split(":", Qt::SkipEmptyParts);
     141      if (sysList.size() == 2 && sysList[0].length() == 1) {
     142        char sys = sysList[0].toStdString()[0];
     143        SysTrkModes& sysTrkModes = _trkModesMap[sys];
     144        QStringList hlpList = sysList[1].split("&", Qt::SkipEmptyParts);
     145        if (hlpList.size() == 2) {
     146          string frqStr = hlpList[0].toStdString();
     147          string trkStr = hlpList[1].toStdString();
     148          for (unsigned jj = 0; jj < frqStr.length(); jj++) {
     149            char frqChar = frqStr[jj];
     150            t_frequency::type frq = t_frequency::toFreq(sys, frqChar);
     151            sysTrkModes._frqTrkModes.push_back(SysTrkModes::FrqTrkModes(frq, trkStr));
     152          }
     153        }
     154      }
     155    }
     156  }
     157
     158  //// beg test
     159  // for (const auto& [key, value] : _trkModesMap) {
     160  //   cout << "system: " << key << endl;
     161  //   for (const auto& frqTrk : value._frqTrkModes) {
     162  //     cout << "    freq: "  << t_frequency::toString(frqTrk._frq) << ' '
     163  //          << frqTrk._trkModes << endl;
     164  //   }
     165  // }
     166  //// end test
     167}
     168
     169//
     170/////////////////////////////////////////////////////////////////////////////
     171void t_pppOptions::defaultFrqs(char sys, t_frequency::type& frq1, t_frequency::type& frq2) const {
     172
     173  frq1 = t_frequency::dummy;
     174  frq2 = t_frequency::dummy;
     175
     176  const SysTrkModes* sysTrkModes = this->sysTrkModes(sys);
     177
     178  if (sysTrkModes) {
     179    if (sysTrkModes->_frqTrkModes.size() > 0) {
     180      frq1 = sysTrkModes->_frqTrkModes[0]._frq;
     181    }
     182    if (sysTrkModes->_frqTrkModes.size() > 1) {
     183      frq2 = sysTrkModes->_frqTrkModes[1]._frq;
     184    }
     185  }
     186  else {
     187    if      (sys == 'G') {
     188      frq1 = t_frequency::G1;
     189      frq2 = t_frequency::G2;
     190    }
     191    else if (sys == 'R') {
     192      frq1 = t_frequency::R1;
     193      frq2 = t_frequency::R2;
     194    }
     195    else if (sys == 'E') {
     196      frq1 = t_frequency::E1;
     197      frq2 = t_frequency::E5;
     198    }
     199    else if (sys == 'C') {
     200      frq1 = t_frequency::C1;
     201      frq2 = t_frequency::C5;
     202    }
     203  }
     204}
     205
     206//
     207/////////////////////////////////////////////////////////////////////////////
     208void t_pppOptions::setLCs(char sys, const std::string& lcStr) {
     209
     210  std::vector<t_lc>* LCs = 0;
     211  if      (sys == 'G') {
     212    LCs = &_LCsGPS;
     213  }
     214  else if (sys == 'R') {
     215    LCs = &_LCsGLONASS;
     216  }
     217  else if (sys == 'E') {
     218    LCs = &_LCsGalileo;
     219  }
     220  else if (sys == 'C') {
     221    LCs = &_LCsBDS;
     222  }
     223  else {
     224    return;
     225  }
     226
     227  t_frequency::type frq1 = t_frequency::dummy;
     228  t_frequency::type frq2 = t_frequency::dummy;
     229  defaultFrqs(sys, frq1, frq2);
     230
     231  if      (lcStr == "Pi&Li") {
     232    if (frq1 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::code,  frq1));
     233    if (frq2 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::code,  frq2));
     234    if (frq1 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::phase, frq1));
     235    if (frq2 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::phase, frq2));
     236    if (_pseudoObsIono) {
     237      LCs->push_back(t_lc(t_lc::GIM, t_frequency::dummy));
     238    }
     239  }
     240  else if (lcStr == "Pi") {
     241    if (frq1 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::code, frq1));
     242    if (frq2 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::code, frq2));
     243    if (_pseudoObsIono) {
     244      LCs->push_back(t_lc(t_lc::GIM, t_frequency::dummy));
     245    }
     246  }
     247  else if (lcStr == "P1&L1") {
     248    if (frq1 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::code,  frq1));
     249    if (frq1 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::phase, frq1));
     250    if (_pseudoObsIono) {
     251      LCs->push_back(t_lc(t_lc::GIM, t_frequency::dummy));
     252    }
     253  }
     254  else if (lcStr == "P1") {
     255    if (frq1 != t_frequency::dummy) LCs->push_back(t_lc(t_lc::code, frq1));
     256    if (_pseudoObsIono) {
     257      LCs->push_back(t_lc(t_lc::GIM, t_frequency::dummy));
     258    }
     259  }
     260  else if (lcStr == "P3&L3") {
     261    if (frq1 != t_frequency::dummy && frq2 != t_frequency::dummy) {
     262      LCs->push_back(t_lc(t_lc::codeIF,  frq1, frq2));
     263      LCs->push_back(t_lc(t_lc::phaseIF, frq1, frq2));
     264    }
     265  }
     266  else if (lcStr == "P3") {
     267    if (frq1 != t_frequency::dummy && frq2 != t_frequency::dummy) {
     268      LCs->push_back(t_lc(t_lc::codeIF, frq1, frq2));
     269    }
     270  }
     271  else if (lcStr == "L3") {
     272    if (frq1 != t_frequency::dummy && frq2 != t_frequency::dummy) {
     273      LCs->push_back(t_lc(t_lc::phaseIF, frq1, frq2));
     274    }
     275  }
     276  else {
     277    QStringListIterator it(QString(lcStr.c_str()).split("&", Qt::SkipEmptyParts));
     278    while (it.hasNext()) {
     279      string hlp = it.next().toStdString();
     280      for (unsigned ii = 1; ii < hlp.length(); ++ii) {
     281        t_frequency::type frq = t_frequency::toFreq(sys, hlp[ii]);
     282        if (frq != t_frequency::dummy) {
     283          if      (hlp[0] == 'P') {
     284            LCs->push_back(t_lc(t_lc::code, frq));
     285          }
     286          else if (hlp[0] == 'L') {
     287            LCs->push_back(t_lc(t_lc::phase, frq));
     288          }
     289        }
     290      }
     291    }
     292  }
     293}
Note: See TracChangeset for help on using the changeset viewer.