[3175] | 1 |
|
---|
| 2 | /* -------------------------------------------------------------------------
|
---|
| 3 | * BKG NTRIP Server
|
---|
| 4 | * -------------------------------------------------------------------------
|
---|
| 5 | *
|
---|
| 6 | * Class: bncClockRinex
|
---|
| 7 | *
|
---|
| 8 | * Purpose: writes RINEX Clock files
|
---|
| 9 | *
|
---|
| 10 | * Author: L. Mervart
|
---|
| 11 | *
|
---|
| 12 | * Created: 29-Mar-2011
|
---|
| 13 | *
|
---|
[7570] | 14 | * Changes:
|
---|
[3175] | 15 | *
|
---|
| 16 | * -----------------------------------------------------------------------*/
|
---|
| 17 |
|
---|
| 18 | #include <math.h>
|
---|
| 19 | #include <iomanip>
|
---|
| 20 |
|
---|
| 21 | #include "bncclockrinex.h"
|
---|
| 22 | #include "bncsettings.h"
|
---|
[7570] | 23 | #include "bncversion.h"
|
---|
[3175] | 24 |
|
---|
| 25 | using namespace std;
|
---|
| 26 |
|
---|
| 27 | // Constructor
|
---|
| 28 | ////////////////////////////////////////////////////////////////////////////
|
---|
[7570] | 29 | bncClockRinex::bncClockRinex(const QString& sklFileName, const QString& intr,
|
---|
| 30 | int sampl)
|
---|
[3184] | 31 | : bncoutf(sklFileName, intr, sampl) {
|
---|
[3175] | 32 | bncSettings settings;
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | // Destructor
|
---|
| 36 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 37 | bncClockRinex::~bncClockRinex() {
|
---|
[8837] | 38 | bncoutf::closeFile();
|
---|
[3175] | 39 | }
|
---|
| 40 |
|
---|
| 41 | // Write One Epoch
|
---|
| 42 | ////////////////////////////////////////////////////////////////////////////
|
---|
[7570] | 43 | t_irc bncClockRinex::write(int GPSweek, double GPSweeks, const QString& prn,
|
---|
[8483] | 44 | double clkRnx, double clkRnxRate, double clkRnxAcc,
|
---|
| 45 | double clkRnxSig, double clkRnxRateSig, double clkRnxAccSig) {
|
---|
[3175] | 46 |
|
---|
[3184] | 47 | if (reopen(GPSweek, GPSweeks) == success) {
|
---|
[3175] | 48 |
|
---|
| 49 | QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
|
---|
| 50 | double sec = fmod(GPSweeks, 60.0);
|
---|
[7570] | 51 |
|
---|
[8483] | 52 | int numValues = 1;
|
---|
| 53 | if (clkRnxSig && clkRnxRate && clkRnxRateSig) {
|
---|
| 54 | numValues += 3;
|
---|
| 55 | }
|
---|
| 56 | if (clkRnxAcc && clkRnxAccSig) {
|
---|
| 57 | numValues += 2;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
[8204] | 60 | _out << "AS " << prn.toLatin1().data()
|
---|
| 61 | << datTim.toString(" yyyy MM dd hh mm").toLatin1().data()
|
---|
[7570] | 62 | << fixed << setw(10) << setprecision(6) << sec
|
---|
[8483] | 63 | << " " << numValues << " "
|
---|
| 64 | << fortranFormat(clkRnx, 19, 12).toLatin1().data();
|
---|
[3175] | 65 |
|
---|
[8483] | 66 | if (numValues >=2) {
|
---|
| 67 | _out << " " << fortranFormat(clkRnxSig, 19, 12).toLatin1().data() << endl;
|
---|
| 68 | }
|
---|
| 69 | if (numValues == 4) {
|
---|
| 70 | _out << fortranFormat(clkRnxRate, 19, 12).toLatin1().data() << " ";
|
---|
| 71 | _out << fortranFormat(clkRnxRateSig, 19, 12).toLatin1().data() << " ";
|
---|
| 72 | }
|
---|
| 73 | if (numValues == 6) {
|
---|
| 74 | _out << fortranFormat(clkRnxAcc, 19, 12).toLatin1().data() << " ";
|
---|
| 75 | _out << " " << fortranFormat(clkRnxAccSig, 19, 12).toLatin1().data();
|
---|
| 76 | }
|
---|
| 77 | _out << endl;
|
---|
| 78 |
|
---|
[3175] | 79 | return success;
|
---|
| 80 | }
|
---|
| 81 | else {
|
---|
| 82 | return failure;
|
---|
| 83 | }
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | // Write Header
|
---|
| 87 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 88 | void bncClockRinex::writeHeader(const QDateTime& datTim) {
|
---|
| 89 |
|
---|
| 90 | _out << " 3.00 C "
|
---|
| 91 | << "RINEX VERSION / TYPE" << endl;
|
---|
| 92 |
|
---|
[7570] | 93 |
|
---|
| 94 | _out << "BNC v" << BNCVERSION << " "
|
---|
[8204] | 95 | << datTim.toString("yyyyMMdd hhmmss").leftJustified(20, ' ', true).toLatin1().data()
|
---|
[3175] | 96 | << "PGM / RUN BY / DATE" << endl;
|
---|
| 97 |
|
---|
| 98 | _out << " 1 AS "
|
---|
| 99 | << "# / TYPES OF DATA" << endl;
|
---|
| 100 |
|
---|
[4253] | 101 | _out << "unknown "
|
---|
| 102 | << "ANALYSIS CENTER" << endl;
|
---|
| 103 |
|
---|
| 104 | _out << " 54 "
|
---|
| 105 | << "# OF SOLN SATS" << endl;
|
---|
| 106 |
|
---|
| 107 | _out << "G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G11 G12 G13 G14 G15 "
|
---|
| 108 | << "PRN LIST" << endl;
|
---|
| 109 |
|
---|
| 110 | _out << "G16 G17 G18 G19 G20 G21 G22 G23 G25 G26 G27 G28 G29 G30 G31 "
|
---|
| 111 | << "PRN LIST" << endl;
|
---|
| 112 |
|
---|
| 113 | _out << "G32 R01 R02 R03 R05 R06 R07 R08 R09 R10 R11 R12 R13 R14 R15 "
|
---|
| 114 | << "PRN LIST" << endl;
|
---|
| 115 |
|
---|
| 116 | _out << "R16 R17 R18 R19 R20 R21 R22 R23 R24 "
|
---|
| 117 | << "PRN LIST" << endl;
|
---|
| 118 |
|
---|
[8084] | 119 | _out << " 0 IGS14 "
|
---|
[4253] | 120 | << "# OF SOLN STA / TRF" << endl;
|
---|
| 121 |
|
---|
[3175] | 122 | _out << " "
|
---|
| 123 | << "END OF HEADER" << endl;
|
---|
| 124 | }
|
---|
| 125 |
|
---|