source: ntrip/trunk/BNC/src/bncbiassinex.cpp@ 9684

Last change on this file since 9684 was 9684, checked in by stuerze, 3 months ago

minor changes

File size: 5.2 KB
Line 
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
25using namespace BNC_PPP;
26using namespace std;
27
28
29// Constructor
30////////////////////////////////////////////////////////////////////////////
31bncBiasSinex::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////////////////////////////////////////////////////////////////////////////
46bncBiasSinex::~bncBiasSinex() {
47 bncoutf::closeFile();
48}
49
50
51t_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
67 _out << " OSB " << prn.toLatin1().data()
68 << " " << obsCode.toLatin1().data()
69 << timeStrStart.toLatin1().data()
70 << timeStrEnd.toLatin1().data()
71 << " ns "
72 << setw(21) << setprecision(4) << (bias * 1.e9 / t_CST::c)
73 << endl;
74
75 return success;
76 }
77 else {
78 cout << "return failure;" << endl;
79 return failure;
80 }
81 return success;
82}
83
84void bncBiasSinex::writeHeader(const QDateTime& datTim) {
85 int GPSWeek;
86 double GPSWeeks;
87 bncSettings settings;
88 GPSweekFromDateAndTime(datTim, GPSWeek, GPSWeeks);
89 int daysec = int(fmod(GPSWeeks, 86400.0));
90 int dayOfYear = datTim.date().dayOfYear();
91 QString yy = datTim.toString("yy");
92 QString creationTime = QString("%1:%2:%3").arg(yy)
93 .arg(dayOfYear, 3, 10, QLatin1Char('0'))
94 .arg(daysec , 5, 10, QLatin1Char('0'));
95 QString startTime = creationTime;
96 QString intStr = settings.value("uploadIntr").toString();
97 int intr, indHlp = 0;
98 if ((indHlp = intStr.indexOf("min")) != -1) {
99 intr = intStr.left(indHlp-1).toInt();
100 intr *= 60;
101 }
102 else if ((indHlp = intStr.indexOf("hour")) != -1) {
103 intr = intStr.left(indHlp-1).toInt();
104 intr *= 3600;
105 }
106 else if ((indHlp = intStr.indexOf("day")) != -1) {
107 intr = intStr.left(indHlp-1).toInt();
108 intr *= 86400;
109 }
110
111 int nominalStartSec = daysec - (int(fmod(double(daysec), double(intr))));
112 int nominalEndSec = nominalStartSec + intr - _sampl;
113 QString endTime = QString("%1:%2:%3").arg(yy)
114 .arg(dayOfYear , 3, 10, QLatin1Char('0'))
115 .arg(nominalEndSec , 5, 10, QLatin1Char('0'));
116 int numEpochs = ((nominalEndSec - daysec) / _sampl) +1;
117 QString epo = QString("%1").arg(numEpochs, 5, 10, QLatin1Char('0'));
118
119 _out << "%=BIA 1.00 " << _agency.toStdString() << " "
120 << creationTime.toStdString() << " " << _agency.toStdString() << " "
121 << startTime.toStdString() << " " << endTime.toStdString() << " A "
122 << epo.toStdString() << endl;
123
124 _out << "+FILE/REFERENCE" << endl;
125 _out << "*INFO_TYPE_________ INFO________________________________________________________" << endl;
126 _out << " DESCRIPTION " << " GNSS Satellite Code and Phase Biases from SSR stream " << endl;
127 _out << " INPUT " << " SSR satellite biases provided by " << _agency.toStdString() <<endl;
128 _out << " OUTPUT " << " Absolute (observation-specific) bias parameters" << endl;
129 _out << " SOFTWARE " << " " << BNCPGMNAME << endl;
130 _out << "-FILE/REFERENCE" << endl << endl;
131
132 _out << "+BIAS/DESCRIPTION" << endl;
133 _out << "*KEYWORD________________________________ VALUE(S)_______________________________" << endl;
134 _out << " PARAMETER_SAMPLING " << " " << fixed << setw(12) << _sampl << endl;
135 _out << " DETERMINATION_METHOD " << " AC SPECIFIC" << endl;
136 _out << " BIAS_MODE " << " ABSOLUTE" << endl;
137 _out << " TIME_SYSTEM " << " G" << endl;
138 _out << "-BIAS/DESCRIPTION" << endl << endl;
139
140 _out << "+BIAS/SOLUTION" << endl;
141 _out << "*BIAS SVN_ PRN STATION__ OBS1 OBS2 BIAS_START____ BIAS_END______ UNIT __ESTIMATED_VALUE____ _STD_DEV___ __ESTIMATED_SLOPE____ _STD_DEV__" << endl;
142 return;
143}
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
Note: See TracBrowser for help on using the repository browser.