[848] | 1 |
|
---|
| 2 | /* -------------------------------------------------------------------------
|
---|
| 3 | * BKG NTRIP Server
|
---|
| 4 | * -------------------------------------------------------------------------
|
---|
| 5 | *
|
---|
| 6 | * Class: bnsSP3
|
---|
| 7 | *
|
---|
| 8 | * Purpose: writes SP3 files
|
---|
| 9 | *
|
---|
| 10 | * Author: L. Mervart
|
---|
| 11 | *
|
---|
| 12 | * Created: 25-Apr-2008
|
---|
| 13 | *
|
---|
| 14 | * Changes:
|
---|
| 15 | *
|
---|
| 16 | * -----------------------------------------------------------------------*/
|
---|
| 17 |
|
---|
| 18 | #include <iomanip>
|
---|
[852] | 19 | #include <math.h>
|
---|
[848] | 20 |
|
---|
| 21 | #include "bnssp3.h"
|
---|
[849] | 22 | #include "bnsutils.h"
|
---|
[848] | 23 |
|
---|
| 24 | using namespace std;
|
---|
[3045] | 25 | using namespace BNS;
|
---|
[848] | 26 |
|
---|
| 27 | // Constructor
|
---|
| 28 | ////////////////////////////////////////////////////////////////////////////
|
---|
[850] | 29 | bnsSP3::bnsSP3(const QString& prep, const QString& ext, const QString& path,
|
---|
| 30 | const QString& intr, int sampl)
|
---|
| 31 | : bnsoutf(prep, ext, path, intr, sampl) {
|
---|
[854] | 32 |
|
---|
| 33 | _lastGPSweek = 0;
|
---|
| 34 | _lastGPSweeks = 0.0;
|
---|
[848] | 35 | }
|
---|
| 36 |
|
---|
| 37 | // Destructor
|
---|
| 38 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 39 | bnsSP3::~bnsSP3() {
|
---|
| 40 | }
|
---|
| 41 |
|
---|
[849] | 42 | // Write One Epoch
|
---|
| 43 | ////////////////////////////////////////////////////////////////////////////
|
---|
[854] | 44 | t_irc bnsSP3::write(int GPSweek, double GPSweeks, const QString& prn,
|
---|
[3041] | 45 | const ColumnVector& xx, bool append) {
|
---|
[849] | 46 |
|
---|
[3041] | 47 | if ( bnsoutf::write(GPSweek, GPSweeks, prn, xx, append) == success) {
|
---|
[849] | 48 |
|
---|
[854] | 49 | if (_lastGPSweek != GPSweek || _lastGPSweeks != GPSweeks) {
|
---|
| 50 | _lastGPSweek = GPSweek;
|
---|
| 51 | _lastGPSweeks = GPSweeks;
|
---|
| 52 |
|
---|
| 53 | QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
|
---|
| 54 | double sec = fmod(GPSweeks, 60.0);
|
---|
| 55 |
|
---|
[855] | 56 | _out << datTim.toString("* yyyy MM dd hh mm").toAscii().data()
|
---|
[854] | 57 | << setw(12) << setprecision(8) << sec << endl;
|
---|
| 58 | }
|
---|
| 59 | _out << "P" << prn.toAscii().data()
|
---|
| 60 | << setw(14) << setprecision(6) << xx(1) / 1000.0
|
---|
| 61 | << setw(14) << setprecision(6) << xx(2) / 1000.0
|
---|
| 62 | << setw(14) << setprecision(6) << xx(3) / 1000.0
|
---|
| 63 | << setw(14) << setprecision(6) << xx(4) * 1e6 << endl;
|
---|
| 64 |
|
---|
| 65 | return success;
|
---|
[852] | 66 | }
|
---|
[854] | 67 | else {
|
---|
| 68 | return failure;
|
---|
| 69 | }
|
---|
[848] | 70 | }
|
---|
[859] | 71 |
|
---|
| 72 | // Close File (write last line)
|
---|
| 73 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 74 | void bnsSP3::closeFile() {
|
---|
| 75 | _out << "EOF" << endl;
|
---|
| 76 | bnsoutf::closeFile();
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | // Write Header
|
---|
| 80 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 81 | void bnsSP3::writeHeader(const QDateTime& datTim) {
|
---|
| 82 |
|
---|
[860] | 83 | int GPSWeek;
|
---|
| 84 | double GPSWeeks;
|
---|
| 85 | GPSweekFromDateAndTime(datTim, GPSWeek, GPSWeeks);
|
---|
| 86 |
|
---|
| 87 | double sec = fmod(GPSWeeks, 60.0);
|
---|
| 88 |
|
---|
| 89 | int mjd;
|
---|
| 90 | double dayfrac;
|
---|
| 91 | mjdFromDateAndTime(datTim, mjd, dayfrac);
|
---|
| 92 |
|
---|
| 93 | _out << "#aP" << datTim.toString("yyyy MM dd hh mm").toAscii().data()
|
---|
| 94 | << setw(12) << setprecision(8) << sec
|
---|
| 95 | << " 96 ORBIT IGS05 HLM IGS" << endl;
|
---|
| 96 |
|
---|
| 97 | _out << "## "
|
---|
| 98 | << setw(4) << GPSWeek
|
---|
| 99 | << setw(16) << setprecision(8) << GPSWeeks
|
---|
| 100 | << setw(15) << setprecision(8) << double(_sampl)
|
---|
| 101 | << setw(6) << mjd
|
---|
| 102 | << setw(16) << setprecision(13) << dayfrac << endl;
|
---|
| 103 |
|
---|
[859] | 104 | _out << "+ 32 G01G02G03G04G05G06G07G08G09G10G11G12G13G14G15G16G17\n"
|
---|
| 105 | << "+ G18G19G20G21G22G23G24G25G26G27G28G29G30G31G32 0 0\n"
|
---|
| 106 | << "+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
| 107 | << "+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
| 108 | << "+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
| 109 | << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
| 110 | << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
| 111 | << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
| 112 | << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
| 113 | << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
| 114 | << "%c cc cc ccc ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc\n"
|
---|
| 115 | << "%c cc cc ccc ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc\n"
|
---|
| 116 | << "%f 0.0000000 0.000000000 0.00000000000 0.000000000000000\n"
|
---|
| 117 | << "%f 0.0000000 0.000000000 0.00000000000 0.000000000000000\n"
|
---|
| 118 | << "%i 0 0 0 0 0 0 0 0 0\n"
|
---|
| 119 | << "%i 0 0 0 0 0 0 0 0 0\n"
|
---|
| 120 | << "/* \n"
|
---|
| 121 | << "/* \n"
|
---|
| 122 | << "/* \n"
|
---|
| 123 | << "/* \n";
|
---|
| 124 | }
|
---|
| 125 |
|
---|