source: ntrip/trunk/BNC/bncsp3.cpp@ 3831

Last change on this file since 3831 was 3791, checked in by weber, 13 years ago

Switch from IGS05 to IGS08 in SP3 header

File size: 4.2 KB
Line 
1
2/* -------------------------------------------------------------------------
3 * BKG NTRIP Server
4 * -------------------------------------------------------------------------
5 *
6 * Class: bncSP3
7 *
8 * Purpose: writes SP3 files
9 *
10 * Author: L. Mervart
11 *
12 * Created: 25-Apr-2008
13 *
14 * Changes:
15 *
16 * -----------------------------------------------------------------------*/
17
18#include <iomanip>
19#include <math.h>
20
21#include "bncsp3.h"
22#include "bncutils.h"
23
24using namespace std;
25
26// Constructor
27////////////////////////////////////////////////////////////////////////////
28bncSP3::bncSP3(const QString& sklFileName, const QString& intr, int sampl)
29 : bncoutf(sklFileName, intr, sampl) {
30
31 _lastGPSweek = 0;
32 _lastGPSweeks = 0.0;
33}
34
35// Destructor
36////////////////////////////////////////////////////////////////////////////
37bncSP3::~bncSP3() {
38}
39
40// Write One Epoch
41////////////////////////////////////////////////////////////////////////////
42t_irc bncSP3::write(int GPSweek, double GPSweeks, const QString& prn,
43 const ColumnVector& xx) {
44
45 if (reopen(GPSweek, GPSweeks) == success) {
46
47 if (_lastGPSweek != GPSweek || _lastGPSweeks != GPSweeks) {
48 _lastGPSweek = GPSweek;
49 _lastGPSweeks = GPSweeks;
50
51 QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
52 double sec = fmod(GPSweeks, 60.0);
53
54 _out << datTim.toString("* yyyy MM dd hh mm").toAscii().data()
55 << setw(12) << setprecision(8) << sec << endl;
56 }
57 _out << "P" << prn.toAscii().data()
58 << setw(14) << setprecision(6) << xx(1) / 1000.0
59 << setw(14) << setprecision(6) << xx(2) / 1000.0
60 << setw(14) << setprecision(6) << xx(3) / 1000.0
61 << setw(14) << setprecision(6) << xx(4) * 1e6 << endl;
62
63 return success;
64 }
65 else {
66 return failure;
67 }
68}
69
70// Close File (write last line)
71////////////////////////////////////////////////////////////////////////////
72void bncSP3::closeFile() {
73 _out << "EOF" << endl;
74 bncoutf::closeFile();
75}
76
77// Write Header
78////////////////////////////////////////////////////////////////////////////
79void bncSP3::writeHeader(const QDateTime& datTim) {
80
81 int GPSWeek;
82 double GPSWeeks;
83 GPSweekFromDateAndTime(datTim, GPSWeek, GPSWeeks);
84
85 double sec = fmod(GPSWeeks, 60.0);
86
87 int mjd;
88 double dayfrac;
89 mjdFromDateAndTime(datTim, mjd, dayfrac);
90
91 _out << "#aP" << datTim.toString("yyyy MM dd hh mm").toAscii().data()
92 << setw(12) << setprecision(8) << sec
93 << " 96 ORBIT IGS08 HLM IGS" << endl;
94
95 _out << "## "
96 << setw(4) << GPSWeek
97 << setw(16) << setprecision(8) << GPSWeeks
98 << setw(15) << setprecision(8) << double(_sampl)
99 << setw(6) << mjd
100 << setw(16) << setprecision(13) << dayfrac << endl;
101
102 _out << "+ 56 G01G02G03G04G05G06G07G08G09G10G11G12G13G14G15G16G17\n"
103 << "+ G18G19G20G21G22G23G24G25G26G27G28G29G30G31G32R01R02\n"
104 << "+ R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19\n"
105 << "+ R20R21R22R23R24 0 0 0 0 0 0 0 0 0 0 0 0\n"
106 << "+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
107 << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
108 << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
109 << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
110 << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
111 << "++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
112 << "%c cc cc ccc ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc\n"
113 << "%c cc cc ccc ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc\n"
114 << "%f 0.0000000 0.000000000 0.00000000000 0.000000000000000\n"
115 << "%f 0.0000000 0.000000000 0.00000000000 0.000000000000000\n"
116 << "%i 0 0 0 0 0 0 0 0 0\n"
117 << "%i 0 0 0 0 0 0 0 0 0\n"
118 << "/* \n"
119 << "/* \n"
120 << "/* \n"
121 << "/* \n";
122}
123
Note: See TracBrowser for help on using the repository browser.