Changeset 6059 in ntrip


Ignore:
Timestamp:
Sep 7, 2014, 9:02:25 AM (10 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src/PPP_free
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/PPP_free/bncmodel.cpp

    r6055 r6059  
    5050#include "bancroft.h"
    5151#include "bncutils.h"
    52 #include "bnctides.h"
    5352#include "bncantex.h"
    54 #include "pppopt.h"
     53#include "pppOptions.h"
    5554
    5655using namespace BNC_PPP;
     
    156155  _staID     = pppClient->staID();
    157156  _opt       = pppClient->opt();
    158 
    159   // NMEA Output
    160   // -----------
    161   if (_opt->nmeaFile.isEmpty()) {
    162     _nmeaFile   = 0;
    163     _nmeaStream = 0;
    164   }
    165   else {
    166     QString hlpName = _opt->nmeaFile; expandEnvVar(hlpName);
    167     _nmeaFile = new QFile(hlpName);
    168     if (_opt->rnxAppend) {
    169       _nmeaFile->open(QIODevice::WriteOnly | QIODevice::Append);
    170     }
    171     else {
    172       _nmeaFile->open(QIODevice::WriteOnly);
    173     }
    174     _nmeaStream = new QTextStream();
    175     _nmeaStream->setDevice(_nmeaFile);
    176   }
    177157
    178158  // Antenna Name, ANTEX File
     
    201181////////////////////////////////////////////////////////////////////////////
    202182bncModel::~bncModel() {
    203   delete _nmeaStream;
    204   delete _nmeaFile;
    205183  for (int ii = 0; ii < _posAverage.size(); ++ii) {
    206184    delete _posAverage[ii];
     
    786764  }
    787765
    788   // NMEA Output
    789   // -----------
    790   double xyz[3];
    791   xyz[0] = x();
    792   xyz[1] = y();
    793   xyz[2] = z();
    794   double ell[3];
    795   xyz2ell(xyz, ell);
    796   double phiDeg = ell[0] * 180 / M_PI;
    797   double lamDeg = ell[1] * 180 / M_PI;
    798 
    799   char phiCh = 'N';
    800   if (phiDeg < 0) {
    801     phiDeg = -phiDeg;
    802     phiCh  =  'S';
    803   }   
    804   char lamCh = 'E';
    805   if (lamDeg < 0) {
    806     lamDeg = -lamDeg;
    807     lamCh  =  'W';
    808   }   
    809 
    810   string datestr = epoData->tt.datestr(0); // yyyymmdd
    811   ostringstream strRMC;
    812   strRMC.setf(ios::fixed);
    813   strRMC << "GPRMC,"
    814          << epoData->tt.timestr(0,0) << ",A,"
    815          << setw(2) << setfill('0') << int(phiDeg)
    816          << setw(6) << setprecision(3) << setfill('0')
    817          << fmod(60*phiDeg,60) << ',' << phiCh << ','
    818          << setw(3) << setfill('0') << int(lamDeg)
    819          << setw(6) << setprecision(3) << setfill('0')
    820          << fmod(60*lamDeg,60) << ',' << lamCh << ",,,"
    821          << datestr[6] << datestr[7] << datestr[4] << datestr[5]
    822          << datestr[2] << datestr[3] << ",,";
    823 
    824   writeNMEAstr(QString(strRMC.str().c_str()));
    825 
    826   double dop = 2.0; // TODO
    827 
    828   ostringstream strGGA;
    829   strGGA.setf(ios::fixed);
    830   strGGA << "GPGGA,"
    831          << epoData->tt.timestr(0,0) << ','
    832          << setw(2) << setfill('0') << int(phiDeg)
    833          << setw(10) << setprecision(7) << setfill('0')
    834          << fmod(60*phiDeg,60) << ',' << phiCh << ','
    835          << setw(3) << setfill('0') << int(lamDeg)
    836          << setw(10) << setprecision(7) << setfill('0')
    837          << fmod(60*lamDeg,60) << ',' << lamCh
    838          << ",1," << setw(2) << setfill('0') << epoData->sizeAll() << ','
    839          << setw(3) << setprecision(1) << dop << ','
    840          << setprecision(3) << ell[2] << ",M,0.0,M,,";
    841                  
    842   writeNMEAstr(QString(strGGA.str().c_str()));
    843 
    844766  _lastTimeOK = _time; // remember time of last successful update
    845767  return success;
     
    880802}
    881803
    882 //
    883 ////////////////////////////////////////////////////////////////////////////
    884 void bncModel::writeNMEAstr(const QString& nmStr) {
    885 
    886   Tracer tracer("bncModel::writeNMEAstr");
    887 
    888   unsigned char XOR = 0;
    889   for (int ii = 0; ii < nmStr.length(); ii++) {
    890     XOR ^= (unsigned char) nmStr[ii].toAscii();
    891   }
    892 
    893   QString outStr = '$' + nmStr
    894                        + QString("*%1\n").arg(int(XOR), 0, 16).toUpper();
    895  
    896   if (_nmeaStream) {
    897     *_nmeaStream << outStr;
    898     _nmeaStream->flush();
    899   }
    900 
    901   _pppClient->emitNewNMEAstr(outStr.toAscii());
    902 }
    903 
    904804//
    905805//////////////////////////////////////////////////////////////////////////////
     
    911811
    912812  int nPar = AA.Ncols();
    913 #if 1
    914813  int nObs = AA.Nrows();
    915814  UpperTriangularMatrix SS = Cholesky(QQ).t();
     
    938837  dx = KT.t() * ll;
    939838  QQ << (SS.t() * SS);
    940 #else
    941   DiagonalMatrix        Ql = PP.i();
    942   Matrix                DD = QQ * AA.t();
    943   SymmetricMatrix       SM(nPar); SM << AA * DD + Ql;
    944   UpperTriangularMatrix UU = Cholesky(SM).t();
    945   UpperTriangularMatrix Ui = UU.i();
    946   Matrix                EE = DD * Ui;
    947   Matrix                KK = EE * Ui.t();
    948   QQ << QQ - EE * EE.t();
    949   dx = KK * ll;
    950 #endif
    951839}
    952840
  • trunk/BNC/src/PPP_free/bncmodel.h

    r6055 r6059  
    3333#include "bnctime.h"
    3434
    35 class t_epoData;
    36 class t_satData;
    3735class bncAntex;
    3836
    3937namespace BNC_PPP {
    4038
     39class bncPPPclient;
    4140class t_pppOptions;
    42 class bncPPPclient;
     41class t_epoData;
     42class t_satData;
    4343
    4444class bncParam {
     
    121121  QString outlierDetection(int iPhase, const ColumnVector& vv,
    122122                           QMap<QString, t_satData*>& satData);
    123   void writeNMEAstr(const QString& nmStr);
    124123
    125124  double windUp(const QString& prn, const ColumnVector& rSat,
     
    158157  ColumnVector          _ellBanc;
    159158  QByteArray            _log;
    160   QFile*                _nmeaFile;
    161   QTextStream*          _nmeaStream;
    162159  QMap<QString, double> _windUpTime;
    163160  QMap<QString, double> _windUpSum;
Note: See TracChangeset for help on using the changeset viewer.