[3176] | 1 |
|
---|
| 2 | /* -------------------------------------------------------------------------
|
---|
| 3 | * BKG NTRIP Server
|
---|
| 4 | * -------------------------------------------------------------------------
|
---|
| 5 | *
|
---|
| 6 | * Class: bncSP3
|
---|
| 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>
|
---|
| 19 | #include <math.h>
|
---|
| 20 |
|
---|
| 21 | #include "bncsp3.h"
|
---|
| 22 | #include "bncutils.h"
|
---|
| 23 |
|
---|
| 24 | using namespace std;
|
---|
| 25 |
|
---|
| 26 | // Constructor
|
---|
| 27 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3184] | 28 | bncSP3::bncSP3(const QString& sklFileName, const QString& intr, int sampl)
|
---|
| 29 | : bncoutf(sklFileName, intr, sampl) {
|
---|
[3176] | 30 | }
|
---|
| 31 |
|
---|
| 32 | // Destructor
|
---|
| 33 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 34 | bncSP3::~bncSP3() {
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | // Write One Epoch
|
---|
| 38 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 39 | t_irc bncSP3::write(int GPSweek, double GPSweeks, const QString& prn,
|
---|
[3184] | 40 | const ColumnVector& xx) {
|
---|
[3176] | 41 |
|
---|
[3184] | 42 | if (reopen(GPSweek, GPSweeks) == success) {
|
---|
[3176] | 43 |
|
---|
[4296] | 44 | bncTime epoTime(GPSweek, GPSweeks);
|
---|
| 45 |
|
---|
| 46 | if (epoTime != _lastEpoTime) {
|
---|
| 47 |
|
---|
| 48 | // Check the sampling interval (print empty epochs)
|
---|
| 49 | // ------------------------------------------------
|
---|
[4298] | 50 | if (_lastEpoTime.valid() && _sampl > 0) {
|
---|
[4296] | 51 | for (bncTime ep = _lastEpoTime +_sampl; ep < epoTime; ep = ep +_sampl) {
|
---|
[4297] | 52 | _out << "* " << ep.datestr(' ') << ' ' << ep.timestr(8, ' ') << endl;
|
---|
[4296] | 53 | }
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | // Print the new epoch
|
---|
| 57 | // -------------------
|
---|
[4297] | 58 | _out << "* " << epoTime.datestr(' ') << ' ' << epoTime.timestr(8, ' ') << endl;
|
---|
[4296] | 59 |
|
---|
| 60 | _lastEpoTime = epoTime;
|
---|
[3176] | 61 | }
|
---|
[4296] | 62 |
|
---|
[3176] | 63 | _out << "P" << prn.toAscii().data()
|
---|
| 64 | << setw(14) << setprecision(6) << xx(1) / 1000.0
|
---|
| 65 | << setw(14) << setprecision(6) << xx(2) / 1000.0
|
---|
| 66 | << setw(14) << setprecision(6) << xx(3) / 1000.0
|
---|
| 67 | << setw(14) << setprecision(6) << xx(4) * 1e6 << endl;
|
---|
| 68 |
|
---|
| 69 | return success;
|
---|
| 70 | }
|
---|
| 71 | else {
|
---|
| 72 | return failure;
|
---|
| 73 | }
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | // Close File (write last line)
|
---|
| 77 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 78 | void bncSP3::closeFile() {
|
---|
| 79 | _out << "EOF" << endl;
|
---|
| 80 | bncoutf::closeFile();
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | // Write Header
|
---|
| 84 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 85 | void bncSP3::writeHeader(const QDateTime& datTim) {
|
---|
| 86 |
|
---|
| 87 | int GPSWeek;
|
---|
| 88 | double GPSWeeks;
|
---|
| 89 | GPSweekFromDateAndTime(datTim, GPSWeek, GPSWeeks);
|
---|
| 90 |
|
---|
| 91 | double sec = fmod(GPSWeeks, 60.0);
|
---|
| 92 |
|
---|
| 93 | int mjd;
|
---|
| 94 | double dayfrac;
|
---|
| 95 | mjdFromDateAndTime(datTim, mjd, dayfrac);
|
---|
| 96 |
|
---|
| 97 | _out << "#aP" << datTim.toString("yyyy MM dd hh mm").toAscii().data()
|
---|
| 98 | << setw(12) << setprecision(8) << sec
|
---|
[3791] | 99 | << " 96 ORBIT IGS08 HLM IGS" << endl;
|
---|
[3176] | 100 |
|
---|
| 101 | _out << "## "
|
---|
| 102 | << setw(4) << GPSWeek
|
---|
| 103 | << setw(16) << setprecision(8) << GPSWeeks
|
---|
| 104 | << setw(15) << setprecision(8) << double(_sampl)
|
---|
| 105 | << setw(6) << mjd
|
---|
| 106 | << setw(16) << setprecision(13) << dayfrac << endl;
|
---|
| 107 |
|
---|
[3714] | 108 | _out << "+ 56 G01G02G03G04G05G06G07G08G09G10G11G12G13G14G15G16G17\n"
|
---|
| 109 | << "+ G18G19G20G21G22G23G24G25G26G27G28G29G30G31G32R01R02\n"
|
---|
| 110 | << "+ R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19\n"
|
---|
| 111 | << "+ R20R21R22R23R24 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
[3176] | 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 | << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
| 115 | << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
| 116 | << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
| 117 | << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
|
---|
| 118 | << "%c cc cc ccc ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc\n"
|
---|
| 119 | << "%c cc cc ccc ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc\n"
|
---|
| 120 | << "%f 0.0000000 0.000000000 0.00000000000 0.000000000000000\n"
|
---|
| 121 | << "%f 0.0000000 0.000000000 0.00000000000 0.000000000000000\n"
|
---|
| 122 | << "%i 0 0 0 0 0 0 0 0 0\n"
|
---|
| 123 | << "%i 0 0 0 0 0 0 0 0 0\n"
|
---|
| 124 | << "/* \n"
|
---|
| 125 | << "/* \n"
|
---|
| 126 | << "/* \n"
|
---|
| 127 | << "/* \n";
|
---|
| 128 | }
|
---|
| 129 |
|
---|