Changeset 6059 in ntrip for trunk/BNC/src/PPP_free
- Timestamp:
- Sep 7, 2014, 9:02:25 AM (10 years ago)
- Location:
- trunk/BNC/src/PPP_free
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/PPP_free/bncmodel.cpp
r6055 r6059 50 50 #include "bancroft.h" 51 51 #include "bncutils.h" 52 #include "bnctides.h"53 52 #include "bncantex.h" 54 #include "ppp opt.h"53 #include "pppOptions.h" 55 54 56 55 using namespace BNC_PPP; … … 156 155 _staID = pppClient->staID(); 157 156 _opt = pppClient->opt(); 158 159 // NMEA Output160 // -----------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 }177 157 178 158 // Antenna Name, ANTEX File … … 201 181 //////////////////////////////////////////////////////////////////////////// 202 182 bncModel::~bncModel() { 203 delete _nmeaStream;204 delete _nmeaFile;205 183 for (int ii = 0; ii < _posAverage.size(); ++ii) { 206 184 delete _posAverage[ii]; … … 786 764 } 787 765 788 // NMEA Output789 // -----------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); // yyyymmdd811 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; // TODO827 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) << ',' << lamCh838 << ",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 844 766 _lastTimeOK = _time; // remember time of last successful update 845 767 return success; … … 880 802 } 881 803 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 = '$' + nmStr894 + 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 904 804 // 905 805 ////////////////////////////////////////////////////////////////////////////// … … 911 811 912 812 int nPar = AA.Ncols(); 913 #if 1914 813 int nObs = AA.Nrows(); 915 814 UpperTriangularMatrix SS = Cholesky(QQ).t(); … … 938 837 dx = KT.t() * ll; 939 838 QQ << (SS.t() * SS); 940 #else941 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 #endif951 839 } 952 840 -
trunk/BNC/src/PPP_free/bncmodel.h
r6055 r6059 33 33 #include "bnctime.h" 34 34 35 class t_epoData;36 class t_satData;37 35 class bncAntex; 38 36 39 37 namespace BNC_PPP { 40 38 39 class bncPPPclient; 41 40 class t_pppOptions; 42 class bncPPPclient; 41 class t_epoData; 42 class t_satData; 43 43 44 44 class bncParam { … … 121 121 QString outlierDetection(int iPhase, const ColumnVector& vv, 122 122 QMap<QString, t_satData*>& satData); 123 void writeNMEAstr(const QString& nmStr);124 123 125 124 double windUp(const QString& prn, const ColumnVector& rSat, … … 158 157 ColumnVector _ellBanc; 159 158 QByteArray _log; 160 QFile* _nmeaFile;161 QTextStream* _nmeaStream;162 159 QMap<QString, double> _windUpTime; 163 160 QMap<QString, double> _windUpSum;
Note:
See TracChangeset
for help on using the changeset viewer.