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 | *
|
---|
14 | * Changes:
|
---|
15 | *
|
---|
16 | * -----------------------------------------------------------------------*/
|
---|
17 |
|
---|
18 | #include <math.h>
|
---|
19 | #include <iomanip>
|
---|
20 |
|
---|
21 | #include "bncclockrinex.h"
|
---|
22 | #include "bncsettings.h"
|
---|
23 | #include "bncversion.h"
|
---|
24 |
|
---|
25 | using namespace std;
|
---|
26 |
|
---|
27 | // Constructor
|
---|
28 | ////////////////////////////////////////////////////////////////////////////
|
---|
29 | bncClockRinex::bncClockRinex(const QString& sklFileName, const QString& intr,
|
---|
30 | int sampl)
|
---|
31 | : bncoutf(sklFileName, intr, sampl) {
|
---|
32 | bncSettings settings;
|
---|
33 | }
|
---|
34 |
|
---|
35 | // Destructor
|
---|
36 | ////////////////////////////////////////////////////////////////////////////
|
---|
37 | bncClockRinex::~bncClockRinex() {
|
---|
38 | bncoutf::closeFile();
|
---|
39 | }
|
---|
40 |
|
---|
41 | // Write One Epoch
|
---|
42 | ////////////////////////////////////////////////////////////////////////////
|
---|
43 | t_irc bncClockRinex::write(int GPSweek, double GPSweeks, const QString& prn,
|
---|
44 | double clkRnx, double clkRnxRate, double clkRnxAcc,
|
---|
45 | double clkRnxSig, double clkRnxRateSig, double clkRnxAccSig) {
|
---|
46 |
|
---|
47 | if (reopen(GPSweek, GPSweeks) == success) {
|
---|
48 |
|
---|
49 | QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
|
---|
50 | double sec = fmod(GPSweeks, 60.0);
|
---|
51 |
|
---|
52 | int numValues = 1;
|
---|
53 | if (clkRnxSig && clkRnxRate && clkRnxRateSig) {
|
---|
54 | numValues += 3;
|
---|
55 | }
|
---|
56 | if (clkRnxAcc && clkRnxAccSig) {
|
---|
57 | numValues += 2;
|
---|
58 | }
|
---|
59 |
|
---|
60 | _out << "AS " << prn.toLatin1().data()
|
---|
61 | << datTim.toString(" yyyy MM dd hh mm").toLatin1().data()
|
---|
62 | << fixed << setw(10) << setprecision(6) << sec
|
---|
63 | << " " << numValues << " "
|
---|
64 | << fortranFormat(clkRnx, 19, 12).toLatin1().data();
|
---|
65 |
|
---|
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 |
|
---|
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 " << "RINEX VERSION / TYPE" << endl;
|
---|
91 | ;
|
---|
92 | _out << QString("BNC v%1").arg(BNCVERSION).leftJustified(40, ' ', true).toLatin1().data()
|
---|
93 | << datTim.toString("yyyyMMdd hhmmss").leftJustified(20, ' ', true).toLatin1().data()
|
---|
94 | << "PGM / RUN BY / DATE" << endl;
|
---|
95 |
|
---|
96 | _out << " 1 AS "
|
---|
97 | << "# / TYPES OF DATA" << endl;
|
---|
98 |
|
---|
99 | _out << "unknown "
|
---|
100 | << "ANALYSIS CENTER" << endl;
|
---|
101 |
|
---|
102 | _out << " 177 "
|
---|
103 | << "# OF SOLN SATS" << endl;
|
---|
104 |
|
---|
105 | _out << "G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G11 G12 G13 G14 G15 PRN LIST" << endl;
|
---|
106 | _out << "G16 G17 G18 G19 G20 G21 G22 G23 G25 G26 G27 G28 G29 G30 G31 PRN LIST" << endl;
|
---|
107 | _out << "G32 R01 R02 R03 R05 R06 R07 R08 R09 R10 R11 R12 R13 R14 R15 PRN LIST" << endl;
|
---|
108 | _out << "R16 R17 R18 R19 R20 R21 R22 R23 R24 R25 R26 E01 E02 E03 E04 PRN LIST" << endl;
|
---|
109 | _out << "R16 R17 R18 R19 R20 R21 R22 R23 R24 R25 R26 E01 E02 E03 E04 PRN LIST" << endl;
|
---|
110 | _out << "E05 E06 E07 E08 E09 E10 E11 E12 E13 E14 E15 E16 E17 E18 E19 PRN LIST" << endl;
|
---|
111 | _out << "E20 E21 E22 E23 E24 E25 E26 E27 E28 E29 E30 E31 E32 E33 E34 PRN LIST" << endl;
|
---|
112 | _out << "E35 E36 C01 C02 C03 C04 C05 C06 C07 C08 C09 C10 C11 C12 C13 PRN LIST" << endl;
|
---|
113 | _out << "C14 C15 C16 C17 C18 C19 C20 C21 C22 C23 C24 C25 C26 C27 C28 PRN LIST" << endl;
|
---|
114 | _out << "C29 C30 C31 C32 C33 C34 C35 C36 C37 C38 C39 C40 C41 C42 C43 PRN LIST" << endl;
|
---|
115 | _out << "C44 C45 C46 C47 C48 C49 C50 C51 C52 C53 C54 C55 C56 C57 C58 PRN LIST" << endl;
|
---|
116 | _out << "C59 C60 C61 C62 C63 J01 J02 J03 J04 I01 I02 I03 I04 I05 I06 PRN LIST" << endl;
|
---|
117 | _out << "I07 S20 S24 S27 S28 S29 S33 S35 S37 S38 PRN LIST" << endl;
|
---|
118 |
|
---|
119 | _out << " 0 IGS14 "
|
---|
120 | << "# OF SOLN STA / TRF" << endl;
|
---|
121 |
|
---|
122 | _out << " "
|
---|
123 | << "END OF HEADER" << endl;
|
---|
124 | }
|
---|
125 |
|
---|