source: ntrip/trunk/BNS/bnssp3.cpp@ 1282

Last change on this file since 1282 was 860, checked in by mervart, 17 years ago

* empty log message *

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