Changeset 2928 in ntrip for trunk/BNC/combination/bnccomb.cpp


Ignore:
Timestamp:
Jan 29, 2011, 1:51:47 PM (13 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/combination/bnccomb.cpp

    r2927 r2928  
    5959}
    6060
    61 //
     61// Read and store one correction line
    6262////////////////////////////////////////////////////////////////////////////
    6363void bncComb::processCorrLine(const QString& staID, const QString& line) {
     
    147147}
    148148
    149 //
    150 ////////////////////////////////////////////////////////////////////////////
    151 void bncComb::processEpochs(const QList<cmbEpoch*>& epochs) {
    152 
    153   QListIterator<cmbEpoch*> itEpo(epochs);
    154   while (itEpo.hasNext()) {
    155     cmbEpoch* epo = itEpo.next();
    156     QMapIterator<QString, t_corr*> itCorr(epo->corr);
    157     while (itCorr.hasNext()) {
    158       itCorr.next();
    159       t_corr* corr = itCorr.value();
    160       printSingleCorr(epo->acName, corr);
    161     }
    162   }
    163 
    164   cout << "Corrections processed" << endl << endl;
    165 }
    166 
    167 //
     149// Print one correction
    168150////////////////////////////////////////////////////////////////////////////
    169151void bncComb::printSingleCorr(const QString& acName, const t_corr* corr) {
     
    179161}
    180162
    181 // //
    182 // ////////////////////////////////////////////////////////////////////////////
    183 // void bncComb::printResults() const {
    184 //
    185 // //  _caster->open();     
    186 // //
    187 // //  //// beg test
    188 // //  cmbEpoch* resEpoch = 0;
    189 // //  if (_ACs->find("CLK10") != _ACs->end()) {
    190 // //    cmbAC* AC = _ACs["CLK10"];
    191 // //    QMutableListIterator<cmbEpoch*> itEpo(AC->epochs);
    192 // //    while (itEpo.hasNext()) {
    193 // //     
    194 // //
    195 // //  }
    196 // //  //// end test
    197 //
    198 // struct ClockOrbit co;
    199 //
    200 // //  memset(&co, 0, sizeof(co));
    201 // //  co.GPSEpochTime      = (int)_GPSweeks;
    202 // //  co.GLONASSEpochTime  = (int)fmod(_GPSweeks, 86400.0)
    203 // //                       + 3 * 3600 - gnumleap(_year, _month, _day);
    204 // //  co.ClockDataSupplied = 1;
    205 // //  co.OrbitDataSupplied = 1;
    206 // //  co.SatRefDatum       = DATUM_ITRF;
    207 // //
    208 // //  // struct ClockOrbit::SatData* sd = 0;
    209 //   // if      (prn[0] == 'G') {
    210 //   //   sd = co.Sat + co.NumberOfGPSSat;
    211 //   //   ++co.NumberOfGPSSat;
    212 //   // }
    213 //   // else if (prn[0] == 'R') {
    214 //   //   sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
    215 //   //   ++co.NumberOfGLONASSSat;
    216 //   // }
    217 //
    218 //   // sd->ID                    = prn.mid(1).toInt();
    219 //   // sd->IOD                   = ep->IOD();
    220 //   // sd->Clock.DeltaA0         = dClk;
    221 //   // sd->Orbit.DeltaRadial     = rsw(1);
    222 //   // sd->Orbit.DeltaAlongTrack = rsw(2);
    223 //   // sd->Orbit.DeltaCrossTrack = rsw(3);
    224 //   // sd->Orbit.DotDeltaRadial     = (rsw2(1) - rsw(1)) / xx(11);
    225 //   // sd->Orbit.DotDeltaAlongTrack = (rsw2(2) - rsw(2)) / xx(11);
    226 //   // sd->Orbit.DotDeltaCrossTrack = (rsw2(3) - rsw(3)) / xx(11);
    227 //
    228 //   if ( _caster->usedSocket() &&
    229 //        (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
    230 //     char obuffer[CLOCKORBIT_BUFFERSIZE];
    231 //     int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
    232 //     if (len > 0) {
    233 //       _caster->write(obuffer, len);
    234 //     }
    235 //   }
    236 //
    237 //   cout << "Corrections processed" << endl << endl;
    238 //
    239 // }
     163// Send results to caster
     164////////////////////////////////////////////////////////////////////////////
     165void bncComb::dumpResults(const bncTime& resTime,
     166                          const QMap<QString, t_corr*>& resCorr) {
     167
     168  _caster->open();     
     169
     170  unsigned year, month, day;
     171  resTime.civil_date (year, month, day);
     172  double GPSweeks = resTime.gpssec();
     173
     174  struct ClockOrbit co;
     175  memset(&co, 0, sizeof(co));
     176  co.GPSEpochTime      = (int)GPSweeks;
     177  co.GLONASSEpochTime  = (int)fmod(GPSweeks, 86400.0)
     178                       + 3 * 3600 - gnumleap(year, month, day);
     179  co.ClockDataSupplied = 1;
     180  co.OrbitDataSupplied = 1;
     181  co.SatRefDatum       = DATUM_ITRF;
     182
     183  struct ClockOrbit::SatData* sd = 0;
     184
     185  QMapIterator<QString, t_corr*> it(resCorr);
     186  while (it.hasNext()) {
     187    it.next();
     188    t_corr* corr = it.value();
     189
     190    if      (corr->prn[0] == 'G') {
     191      sd = co.Sat + co.NumberOfGPSSat;
     192      ++co.NumberOfGPSSat;
     193    }
     194    else if (corr->prn[0] == 'R') {
     195      sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
     196      ++co.NumberOfGLONASSSat;
     197    }
     198
     199    if (sd != 0) {
     200      sd->ID                       = corr->prn.mid(1).toInt();
     201      sd->IOD                      = corr->iod;
     202      sd->Clock.DeltaA0            = corr->dClk;
     203      sd->Orbit.DeltaRadial        = corr->rao(1);
     204      sd->Orbit.DeltaAlongTrack    = corr->rao(2);
     205      sd->Orbit.DeltaCrossTrack    = corr->rao(3);
     206      sd->Orbit.DotDeltaRadial     = corr->dotRao(1);
     207      sd->Orbit.DotDeltaAlongTrack = corr->dotRao(2);
     208      sd->Orbit.DotDeltaCrossTrack = corr->dotRao(3);
     209    }
     210   
     211    delete corr;
     212  }
     213
     214  if ( _caster->usedSocket() &&
     215       (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
     216    char obuffer[CLOCKORBIT_BUFFERSIZE];
     217    int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
     218    if (len > 0) {
     219      _caster->write(obuffer, len);
     220    }
     221  }
     222}
     223
     224// Process Epochs
     225////////////////////////////////////////////////////////////////////////////
     226void bncComb::processEpochs(const QList<cmbEpoch*>& epochs) {
     227
     228  bncTime                resTime = epochs.first()->time;
     229  QMap<QString, t_corr*> resCorr;
     230
     231  QListIterator<cmbEpoch*> itEpo(epochs);
     232  while (itEpo.hasNext()) {
     233    cmbEpoch* epo = itEpo.next();
     234    QMapIterator<QString, t_corr*> itCorr(epo->corr);
     235
     236    while (itCorr.hasNext()) {
     237      itCorr.next();
     238      t_corr* corr = itCorr.value();
     239
     240      //// beg test
     241      if (epo->acName == "BKG") {
     242        resCorr[corr->prn] = new t_corr(*corr);
     243      }
     244      //// end test
     245
     246      printSingleCorr(epo->acName, corr);
     247      delete corr;
     248    }
     249  }
     250
     251  dumpResults(resTime, resCorr);
     252
     253  cout << "Corrections processed" << endl << endl;
     254}
     255
Note: See TracChangeset for help on using the changeset viewer.