[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() {
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | // Write One Epoch
|
---|
| 41 | ////////////////////////////////////////////////////////////////////////////
|
---|
[7570] | 42 | t_irc bncClockRinex::write(int GPSweek, double GPSweeks, const QString& prn,
|
---|
[8484] | 43 | double clkRnx, double clkRnxRate, double clkRnxAcc,
|
---|
| 44 | double clkRnxSig, double clkRnxRateSig, double clkRnxAccSig) {
|
---|
[3175] | 45 |
|
---|
[3184] | 46 | if (reopen(GPSweek, GPSweeks) == success) {
|
---|
[3175] | 47 |
|
---|
| 48 | QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
|
---|
| 49 | double sec = fmod(GPSweeks, 60.0);
|
---|
[7570] | 50 |
|
---|
[8484] | 51 | int numValues = 1;
|
---|
| 52 | if (clkRnxSig && clkRnxRate && clkRnxRateSig) {
|
---|
| 53 | numValues += 3;
|
---|
| 54 | }
|
---|
| 55 | if (clkRnxAcc && clkRnxAccSig) {
|
---|
| 56 | numValues += 2;
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | _out << "AS " << prn.toLatin1().data()
|
---|
| 60 | << datTim.toString(" yyyy MM dd hh mm").toLatin1().data()
|
---|
[7570] | 61 | << fixed << setw(10) << setprecision(6) << sec
|
---|
[8484] | 62 | << " " << numValues << " "
|
---|
| 63 | << fortranFormat(clkRnx, 19, 12).toLatin1().data();
|
---|
[3175] | 64 |
|
---|
[8484] | 65 | if (numValues >=2) {
|
---|
| 66 | _out << " " << fortranFormat(clkRnxSig, 19, 12).toLatin1().data() << endl;
|
---|
| 67 | }
|
---|
| 68 | if (numValues == 4) {
|
---|
| 69 | _out << fortranFormat(clkRnxRate, 19, 12).toLatin1().data() << " ";
|
---|
| 70 | _out << fortranFormat(clkRnxRateSig, 19, 12).toLatin1().data() << " ";
|
---|
| 71 | }
|
---|
| 72 | if (numValues == 6) {
|
---|
| 73 | _out << fortranFormat(clkRnxAcc, 19, 12).toLatin1().data() << " ";
|
---|
| 74 | _out << " " << fortranFormat(clkRnxAccSig, 19, 12).toLatin1().data();
|
---|
| 75 | }
|
---|
| 76 | _out << endl;
|
---|
[3175] | 77 | return success;
|
---|
| 78 | }
|
---|
| 79 | else {
|
---|
| 80 | return failure;
|
---|
| 81 | }
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | // Write Header
|
---|
| 85 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 86 | void bncClockRinex::writeHeader(const QDateTime& datTim) {
|
---|
| 87 |
|
---|
| 88 | _out << " 3.00 C "
|
---|
| 89 | << "RINEX VERSION / TYPE" << endl;
|
---|
| 90 |
|
---|
[7570] | 91 |
|
---|
| 92 | _out << "BNC v" << BNCVERSION << " "
|
---|
[3175] | 93 | << datTim.toString("yyyyMMdd hhmmss").leftJustified(20, ' ', true).toAscii().data()
|
---|
| 94 | << "PGM / RUN BY / DATE" << endl;
|
---|
| 95 |
|
---|
| 96 | _out << " 1 AS "
|
---|
| 97 | << "# / TYPES OF DATA" << endl;
|
---|
| 98 |
|
---|
[4253] | 99 | _out << "unknown "
|
---|
| 100 | << "ANALYSIS CENTER" << endl;
|
---|
| 101 |
|
---|
| 102 | _out << " 54 "
|
---|
| 103 | << "# OF SOLN SATS" << endl;
|
---|
| 104 |
|
---|
| 105 | _out << "G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G11 G12 G13 G14 G15 "
|
---|
| 106 | << "PRN LIST" << endl;
|
---|
| 107 |
|
---|
| 108 | _out << "G16 G17 G18 G19 G20 G21 G22 G23 G25 G26 G27 G28 G29 G30 G31 "
|
---|
| 109 | << "PRN LIST" << endl;
|
---|
| 110 |
|
---|
| 111 | _out << "G32 R01 R02 R03 R05 R06 R07 R08 R09 R10 R11 R12 R13 R14 R15 "
|
---|
| 112 | << "PRN LIST" << endl;
|
---|
| 113 |
|
---|
| 114 | _out << "R16 R17 R18 R19 R20 R21 R22 R23 R24 "
|
---|
| 115 | << "PRN LIST" << endl;
|
---|
| 116 |
|
---|
[8089] | 117 | _out << " 0 IGS14 "
|
---|
[4253] | 118 | << "# OF SOLN STA / TRF" << endl;
|
---|
| 119 |
|
---|
[3175] | 120 | _out << " "
|
---|
| 121 | << "END OF HEADER" << endl;
|
---|
| 122 | }
|
---|
| 123 |
|
---|