source: ntrip/trunk/BNC/src/bncsinextro.cpp@ 6715

Last change on this file since 6715 was 6658, checked in by stuerze, 10 years ago

minor format changes in sinex tro header

  • Property svn:keywords set to Author Date Id Rev URL;svn:eol-style=native
  • Property svn:mime-type set to text/plain
File size: 4.8 KB
Line 
1
2/* -------------------------------------------------------------------------
3 * BKG NTRIP Server
4 * -------------------------------------------------------------------------
5 *
6 * Class: bncSinexTro
7 *
8 * Purpose: writes SINEX TRO files
9 *
10 * Author: A. Stürze
11 *
12 * Created: 19-Feb-2015
13 *
14 * Changes:
15 *
16 * -----------------------------------------------------------------------*/
17
18#include <math.h>
19#include <iomanip>
20
21#include "bncsinextro.h"
22
23using namespace BNC_PPP;
24using namespace std;
25
26// Constructor
27////////////////////////////////////////////////////////////////////////////
28bncSinexTro::bncSinexTro(const t_pppOptions* opt,
29 const QString& sklFileName, const QString& intr,
30 int sampl)
31 : bncoutf(sklFileName, intr, sampl) {
32 _opt = opt;
33 (!sampl) ? _sampl = 1 : _sampl = sampl;
34}
35
36// Destructor
37////////////////////////////////////////////////////////////////////////////
38bncSinexTro::~bncSinexTro() {
39 closeFile();
40}
41
42// Write Header
43////////////////////////////////////////////////////////////////////////////
44void bncSinexTro::writeHeader(const QDateTime& datTim) {
45 int GPSWeek;
46 double GPSWeeks;
47 GPSweekFromDateAndTime(datTim, GPSWeek, GPSWeeks);
48 int daysec = int(fmod(GPSWeeks, 86400.0));
49 int dayOfYear = datTim.date().dayOfYear();
50 QString yy = datTim.toString("yy");
51
52 QString creationTime = QString("%1:%2:%3").arg(yy)
53 .arg(dayOfYear, 3, 10, QLatin1Char('0'))
54 .arg(daysec , 5, 10, QLatin1Char('0'));
55 QString startTime = creationTime;
56 QString endTime = QString("%1:%2:%3").arg(yy)
57 .arg(dayOfYear, 3, 10, QLatin1Char('0'))
58 .arg(84600 , 5, 10);
59
60
61 _out << "%=TRO 0.01 BNC " << creationTime.toStdString() << " BNC "
62 << startTime.toStdString() << " " << endTime.toStdString() << " P "
63 << _opt->_roverName.substr(0,4) << endl;
64
65
66 _out << "+FILE/REFERENCE" << endl;
67 _out << " DESCRIPTION " << "BNC generated SINEX TRO file" << endl;
68 _out << " OUTPUT " << "Total Troposphere Zenith Path Delay Product" << endl;
69 _out << " SOFTWARE " << BNCPGMNAME << endl;
70 _out << " HARDWARE " << BNC_OS << endl;
71 _out << " INPUT " << "Orbit and Clock information used from BRDC and RTCM-SSR streams" << endl;
72 _out << "-FILE/REFERENCE" << endl << endl;
73
74
75 _out << "+TROP/DESCRIPTION" << endl;
76 _out << "*KEYWORD______________________ VALUE(S)______________" << endl;
77 _out << " SAMPLING INTERVAL "
78 << setw(4) << _sampl << endl;
79 _out << " SAMPLING TROP "
80 << setw(4) << _sampl << endl;
81 _out << " ELEVATION CUTOFF ANGLE "
82 << setw(4) << int(_opt->_minEle * 180.0/M_PI) << endl;
83 _out << " TROP MAPPING FUNCTION " << "Saastamoinen" << endl;
84 _out << " SOLUTION_FIELDS_1 " << "TROTOT STDEV" << endl;
85 _out << "-TROP/DESCRIPTION"<< endl << endl;
86
87
88 _out << "+TROP/STA_COORDINATES" << endl;
89 _out << "*SITE PT SOLN T STA_X_______ STA_Y_______ STA_Z_______ SYSTEM REMARK" << endl;
90 _out << " " << _opt->_roverName.substr(0,4) << " A 1 P "
91 << setw(12) << setprecision(3) << _opt->_xyzAprRover(1) << " "
92 << setw(12) << setprecision(3) << _opt->_xyzAprRover(2) << " "
93 << setw(12) << setprecision(3) << _opt->_xyzAprRover(3) << " ITRF08" << endl;
94 _out << "-TROP/STA_COORDINATES" << endl << endl;
95
96
97 _out << "+TROP/SOLUTION" << endl;
98 _out << "*SITE EPOCH_______ TROTOT STDEV" << endl;
99}
100
101// Write One Epoch
102////////////////////////////////////////////////////////////////////////////
103t_irc bncSinexTro::write(QByteArray staID, int GPSWeek, double GPSWeeks,
104 double trotot, double stdev) {
105
106 QDateTime datTim = dateAndTimeFromGPSweek(GPSWeek, GPSWeeks);
107 int daysec = int(fmod(GPSWeeks, 86400.0));
108 int dayOfYear = datTim.date().dayOfYear();
109 QString yy = datTim.toString("yy");
110 QString time = QString("%1:%2:%3").arg(yy)
111 .arg(dayOfYear, 3, 10, QLatin1Char('0'))
112 .arg(daysec , 5, 10, QLatin1Char('0'));
113
114 if ((reopen(GPSWeek, GPSWeeks) == success) &&
115 (fmod(daysec, double(_sampl)) == 0.0)) {
116 _out << ' ' << staID.left(4).data() << ' ' << time.toStdString() << ' '
117 << noshowpos << setw(6) << setprecision(1) << trotot * 1000.0
118 << noshowpos << setw(6) << setprecision(1) << stdev * 1000.0 << endl;
119 _out.flush();
120 return success;
121 } else {
122 return failure;
123 }
124}
125
126// Close File (write last lines)
127////////////////////////////////////////////////////////////////////////////
128void bncSinexTro::closeFile() {
129 _out << "-TROP/SOLUTION" << endl;
130 _out << "%=ENDTROP" << endl;
131 bncoutf::closeFile();
132}
133
134
135
136
Note: See TracBrowser for help on using the repository browser.