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

Last change on this file since 6653 was 6653, checked in by stuerze, 9 years ago

sinex tro file support added,
troposphere results in overall ppp logfile added

  • 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 " << _sampl << endl;
78 _out << " SAMPLING TROP " << _sampl << endl;
79 _out << " ELEVATION CUTOFF ANGLE "
80 << setprecision(1) << _opt->_minEle * 180.0/M_PI << endl;
81 _out << " TROP MAPPING FUNCTION " << "Saastamoinen" << endl;
82 _out << " SOLUTION_FIELDS_1 " << "TROTOT STDEV" << endl;
83 _out << "-TROP/DESCRIPTION"<< endl << endl;
84
85
86 _out << "+TROP/STA_COORDINATES" << endl;
87 _out << "*SITE PT SOLN T STA_X_______ STA_Y_______ STA_Z_______ SYSTEM REMARK" << endl;
88 _out << " " << _opt->_roverName.substr(0,4) << " A 1 P "
89 << setw(12) << setprecision(3) << _opt->_xyzAprRover(1) << " "
90 << setw(12) << setprecision(3) << _opt->_xyzAprRover(2) << " "
91 << setw(12) << setprecision(3) << _opt->_xyzAprRover(3) << " ITRF08" << endl;
92 _out << "-TROP/STA_COORDINATES" << endl << endl;
93
94
95 _out << "+TROP/SOLUTION" << endl;
96 _out << "*SITE EPOCH_______ TROTOT STDEV" << endl;
97}
98
99// Write One Epoch
100////////////////////////////////////////////////////////////////////////////
101t_irc bncSinexTro::write(QByteArray staID, int GPSWeek, double GPSWeeks,
102 double trotot, double stdev) {
103
104 QDateTime datTim = dateAndTimeFromGPSweek(GPSWeek, GPSWeeks);
105 int daysec = int(fmod(GPSWeeks, 86400.0));
106 int dayOfYear = datTim.date().dayOfYear();
107 QString yy = datTim.toString("yy");
108 QString time = QString("%1:%2:%3").arg(yy)
109 .arg(dayOfYear, 3, 10, QLatin1Char('0'))
110 .arg(daysec , 5, 10, QLatin1Char('0'));
111
112 if ((reopen(GPSWeek, GPSWeeks) == success) &&
113 (fmod(daysec, double(_sampl)) == 0.0)) {
114 _out << ' ' << staID.left(4).data() << ' ' << time.toStdString() << ' '
115 << noshowpos << setw(6) << setprecision(1) << trotot * 1000.0
116 << noshowpos << setw(6) << setprecision(1) << stdev * 1000.0 << endl;
117 _out.flush();
118 return success;
119 } else {
120 return failure;
121 }
122}
123
124// Close File (write last lines)
125////////////////////////////////////////////////////////////////////////////
126void bncSinexTro::closeFile() {
127 _out << "-TROP/SOLUTION" << endl;
128 _out << "%=ENDTROP" << endl;
129 bncoutf::closeFile();
130}
131
132
133
134
Note: See TracBrowser for help on using the repository browser.