1 | /* -------------------------------------------------------------------------
|
---|
2 | * BNC
|
---|
3 | * -------------------------------------------------------------------------
|
---|
4 | *
|
---|
5 | * Class: bncBiasSinex
|
---|
6 | *
|
---|
7 | * Purpose: writes SINEX Bias files
|
---|
8 | *
|
---|
9 | * Author: A. Stuerze
|
---|
10 | *
|
---|
11 | * Created: 01-Mar-2022
|
---|
12 | *
|
---|
13 | * Changes:
|
---|
14 | *
|
---|
15 | * -----------------------------------------------------------------------*/
|
---|
16 |
|
---|
17 |
|
---|
18 |
|
---|
19 | #include "bncbiassinex.h"
|
---|
20 |
|
---|
21 | #include <math.h>
|
---|
22 | #include <iomanip>
|
---|
23 |
|
---|
24 |
|
---|
25 | using namespace BNC_PPP;
|
---|
26 | using namespace std;
|
---|
27 |
|
---|
28 |
|
---|
29 | // Constructor
|
---|
30 | ////////////////////////////////////////////////////////////////////////////
|
---|
31 | bncBiasSinex::bncBiasSinex(const QString& sklFileName, const QString& intr,
|
---|
32 | int sampl)
|
---|
33 | : bncoutf(sklFileName, intr, sampl) {
|
---|
34 | _sampl = sampl;
|
---|
35 |
|
---|
36 | if (!_sampl) {
|
---|
37 | _sampl = 5;
|
---|
38 | }
|
---|
39 |
|
---|
40 | _agency = agencyFromFileName();
|
---|
41 | }
|
---|
42 |
|
---|
43 |
|
---|
44 | // Destructor
|
---|
45 | ////////////////////////////////////////////////////////////////////////////
|
---|
46 | bncBiasSinex::~bncBiasSinex() {
|
---|
47 | bncoutf::closeFile();
|
---|
48 | }
|
---|
49 |
|
---|
50 |
|
---|
51 | t_irc bncBiasSinex::write(int GPSweek, double GPSweeks, const QString& prn, const QString& obsCode, double bias) {
|
---|
52 |
|
---|
53 | if (reopen(GPSweek, GPSweeks) == success) {
|
---|
54 |
|
---|
55 | QDateTime datTimStart = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
|
---|
56 |
|
---|
57 | int daysec = int(fmod(GPSweeks, 86400.0));
|
---|
58 | int dayOfYear = datTimStart.date().dayOfYear();
|
---|
59 | QString yyyy = datTimStart.toString("yyyy");
|
---|
60 | QString timeStrStart = QString(" %1:%2:%3").arg(yyyy)
|
---|
61 | .arg(dayOfYear, 3, 10, QLatin1Char('0'))
|
---|
62 | .arg(daysec , 5, 10, QLatin1Char('0'));
|
---|
63 | QString timeStrEnd = QString(" %1:%2:%3").arg(yyyy)
|
---|
64 | .arg(dayOfYear, 3, 10, QLatin1Char('0'))
|
---|
65 | .arg(daysec+_sampl , 5, 10, QLatin1Char('0'));
|
---|
66 | QString biasStr =QString("%1").arg((bias * 1.e9 / t_CST::c), 21, 'f', 4, QLatin1Char(' '));
|
---|
67 | _out << " OSB " << prn.toLatin1().data()
|
---|
68 | << " " << obsCode.toLatin1().data()
|
---|
69 | << timeStrStart.toLatin1().data()
|
---|
70 | << timeStrEnd.toLatin1().data()
|
---|
71 | << " ns "
|
---|
72 | << biasStr.toLatin1().data()
|
---|
73 | << endl;
|
---|
74 |
|
---|
75 | return success;
|
---|
76 | }
|
---|
77 | else {
|
---|
78 | return failure;
|
---|
79 | }
|
---|
80 | return success;
|
---|
81 | }
|
---|
82 |
|
---|
83 | void bncBiasSinex::writeHeader(const QDateTime& datTim) {
|
---|
84 | int GPSWeek;
|
---|
85 | double GPSWeeks;
|
---|
86 | bncSettings settings;
|
---|
87 | GPSweekFromDateAndTime(datTim, GPSWeek, GPSWeeks);
|
---|
88 | int daysec = int(fmod(GPSWeeks, 86400.0));
|
---|
89 | int dayOfYear = datTim.date().dayOfYear();
|
---|
90 | QString yy = datTim.toString("yy");
|
---|
91 | QString creationTime = QString("%1:%2:%3").arg(yy)
|
---|
92 | .arg(dayOfYear, 3, 10, QLatin1Char('0'))
|
---|
93 | .arg(daysec , 5, 10, QLatin1Char('0'));
|
---|
94 | QString startTime = creationTime;
|
---|
95 | QString intStr = settings.value("uploadIntr").toString();
|
---|
96 | int intr, indHlp = 0;
|
---|
97 | if ((indHlp = intStr.indexOf("min")) != -1) {
|
---|
98 | intr = intStr.left(indHlp-1).toInt();
|
---|
99 | intr *= 60;
|
---|
100 | }
|
---|
101 | else if ((indHlp = intStr.indexOf("hour")) != -1) {
|
---|
102 | intr = intStr.left(indHlp-1).toInt();
|
---|
103 | intr *= 3600;
|
---|
104 | }
|
---|
105 | else if ((indHlp = intStr.indexOf("day")) != -1) {
|
---|
106 | intr = intStr.left(indHlp-1).toInt();
|
---|
107 | intr *= 86400;
|
---|
108 | }
|
---|
109 |
|
---|
110 | int nominalStartSec = daysec - (int(fmod(double(daysec), double(intr))));
|
---|
111 | int nominalEndSec = nominalStartSec + intr - _sampl;
|
---|
112 | QString endTime = QString("%1:%2:%3").arg(yy)
|
---|
113 | .arg(dayOfYear , 3, 10, QLatin1Char('0'))
|
---|
114 | .arg(nominalEndSec , 5, 10, QLatin1Char('0'));
|
---|
115 | int numEpochs = ((nominalEndSec - daysec) / _sampl) +1;
|
---|
116 | QString epo = QString("%1").arg(numEpochs, 5, 10, QLatin1Char('0'));
|
---|
117 |
|
---|
118 | _out << "%=BIA 1.00 " << _agency.toStdString() << " "
|
---|
119 | << creationTime.toStdString() << " " << _agency.toStdString() << " "
|
---|
120 | << startTime.toStdString() << " " << endTime.toStdString() << " A "
|
---|
121 | << epo.toStdString() << endl;
|
---|
122 |
|
---|
123 | _out << "+FILE/REFERENCE" << endl;
|
---|
124 | _out << "*INFO_TYPE_________ INFO________________________________________________________" << endl;
|
---|
125 | _out << " DESCRIPTION " << " GNSS Satellite Code and Phase Biases from SSR stream " << endl;
|
---|
126 | _out << " INPUT " << " SSR satellite biases provided by " << _agency.toStdString() <<endl;
|
---|
127 | _out << " OUTPUT " << " Absolute (observation-specific) bias parameters" << endl;
|
---|
128 | _out << " SOFTWARE " << " " << BNCPGMNAME << endl;
|
---|
129 | _out << "-FILE/REFERENCE" << endl << endl;
|
---|
130 |
|
---|
131 | _out << "+BIAS/DESCRIPTION" << endl;
|
---|
132 | _out << "*KEYWORD________________________________ VALUE(S)_______________________________" << endl;
|
---|
133 | _out << " PARAMETER_SAMPLING " << " " << left << setw(12) << _sampl << endl;
|
---|
134 | _out << " DETERMINATION_METHOD " << " AC SPECIFIC" << endl;
|
---|
135 | _out << " BIAS_MODE " << " ABSOLUTE" << endl;
|
---|
136 | _out << " TIME_SYSTEM " << " G" << endl;
|
---|
137 | _out << "-BIAS/DESCRIPTION" << endl << endl;
|
---|
138 |
|
---|
139 | _out << "+BIAS/SOLUTION" << endl;
|
---|
140 | _out << "*BIAS SVN_ PRN STATION__ OBS1 OBS2 BIAS_START____ BIAS_END______ UNIT __ESTIMATED_VALUE____ _STD_DEV___ __ESTIMATED_SLOPE____ _STD_DEV__" << endl;
|
---|
141 | return;
|
---|
142 | }
|
---|
143 |
|
---|
144 |
|
---|
145 |
|
---|
146 |
|
---|
147 |
|
---|
148 |
|
---|
149 |
|
---|
150 |
|
---|
151 |
|
---|
152 |
|
---|
153 |
|
---|
154 |
|
---|
155 |
|
---|
156 |
|
---|
157 |
|
---|
158 |
|
---|
159 |
|
---|
160 |
|
---|
161 |
|
---|
162 |
|
---|
163 |
|
---|