1 | // Part of BNC, a utility for retrieving decoding and
|
---|
2 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
3 | //
|
---|
4 | // Copyright (C) 2007
|
---|
5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
---|
6 | // http://www.bkg.bund.de
|
---|
7 | // Czech Technical University Prague, Department of Geodesy
|
---|
8 | // http://www.fsv.cvut.cz
|
---|
9 | //
|
---|
10 | // Email: euref-ip@bkg.bund.de
|
---|
11 | //
|
---|
12 | // This program is free software; you can redistribute it and/or
|
---|
13 | // modify it under the terms of the GNU General Public License
|
---|
14 | // as published by the Free Software Foundation, version 2.
|
---|
15 | //
|
---|
16 | // This program is distributed in the hope that it will be useful,
|
---|
17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | // GNU General Public License for more details.
|
---|
20 | //
|
---|
21 | // You should have received a copy of the GNU General Public License
|
---|
22 | // along with this program; if not, write to the Free Software
|
---|
23 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
24 |
|
---|
25 | #ifndef BNCMODEL_H
|
---|
26 | #define BNCMODEL_H
|
---|
27 |
|
---|
28 | #include <QtCore>
|
---|
29 | #include <QtNetwork>
|
---|
30 | #include <newmat.h>
|
---|
31 |
|
---|
32 | #include "bncconst.h"
|
---|
33 | #include "bnctime.h"
|
---|
34 |
|
---|
35 | class t_epoData;
|
---|
36 | class t_satData;
|
---|
37 | class bncAntex;
|
---|
38 | class t_pppOpt;
|
---|
39 | class bncPPPclient;
|
---|
40 | namespace BNC_PPP {
|
---|
41 | class t_tides;
|
---|
42 | }
|
---|
43 |
|
---|
44 | class bncParam {
|
---|
45 | public:
|
---|
46 | enum parType {CRD_X, CRD_Y, CRD_Z, RECCLK, TROPO, AMB_L3,
|
---|
47 | GLONASS_OFFSET, GALILEO_OFFSET};
|
---|
48 | bncParam(parType typeIn, int indexIn, const QString& prn);
|
---|
49 | ~bncParam();
|
---|
50 | double partial(t_satData* satData, bool phase);
|
---|
51 | bool isCrd() const {
|
---|
52 | return (type == CRD_X || type == CRD_Y || type == CRD_Z);
|
---|
53 | }
|
---|
54 | parType type;
|
---|
55 | double xx;
|
---|
56 | int index;
|
---|
57 | int index_old;
|
---|
58 | int numEpo;
|
---|
59 | QString prn;
|
---|
60 | };
|
---|
61 |
|
---|
62 | class bncModel {
|
---|
63 | public:
|
---|
64 | bncModel(bncPPPclient* pppClient);
|
---|
65 | ~bncModel();
|
---|
66 | t_irc update(t_epoData* epoData);
|
---|
67 | bncTime time() const {return _time;}
|
---|
68 | double x() const {return _params[0]->xx;}
|
---|
69 | double y() const {return _params[1]->xx;}
|
---|
70 | double z() const {return _params[2]->xx;}
|
---|
71 | double clk() const {return _params[3]->xx;}
|
---|
72 | double trp() const {
|
---|
73 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
74 | bncParam* pp = _params[ii];
|
---|
75 | if (pp->type == bncParam::TROPO) {
|
---|
76 | return pp->xx;
|
---|
77 | }
|
---|
78 | }
|
---|
79 | return 0.0;
|
---|
80 | }
|
---|
81 | double Glonass_offset() const {
|
---|
82 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
83 | bncParam* pp = _params[ii];
|
---|
84 | if (pp->type == bncParam::GLONASS_OFFSET) {
|
---|
85 | return pp->xx;
|
---|
86 | }
|
---|
87 | }
|
---|
88 | return 0.0;
|
---|
89 | }
|
---|
90 | double Galileo_offset() const {
|
---|
91 | for (int ii = 0; ii < _params.size(); ++ii) {
|
---|
92 | bncParam* pp = _params[ii];
|
---|
93 | if (pp->type == bncParam::GALILEO_OFFSET) {
|
---|
94 | return pp->xx;
|
---|
95 | }
|
---|
96 | }
|
---|
97 | return 0.0;
|
---|
98 | }
|
---|
99 |
|
---|
100 | private:
|
---|
101 | void reset();
|
---|
102 | t_irc cmpBancroft(t_epoData* epoData);
|
---|
103 | void cmpEle(t_satData* satData);
|
---|
104 | void addAmb(t_satData* satData);
|
---|
105 | void addObs(int iPhase, unsigned& iObs, t_satData* satData,
|
---|
106 | Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP);
|
---|
107 | QByteArray printRes(int iPhase, const ColumnVector& vv,
|
---|
108 | const QMap<QString, t_satData*>& satDataMap);
|
---|
109 | void findMaxRes(const ColumnVector& vv,
|
---|
110 | const QMap<QString, t_satData*>& satData,
|
---|
111 | QString& prnGPS, QString& prnGlo,
|
---|
112 | double& maxResGPS, double& maxResGlo);
|
---|
113 | double cmpValue(t_satData* satData, bool phase);
|
---|
114 | void predict(int iPhase, t_epoData* epoData);
|
---|
115 | t_irc update_p(t_epoData* epoData);
|
---|
116 | QString outlierDetection(int iPhase, const ColumnVector& vv,
|
---|
117 | QMap<QString, t_satData*>& satData);
|
---|
118 | void writeNMEAstr(const QString& nmStr);
|
---|
119 |
|
---|
120 | double windUp(const QString& prn, const ColumnVector& rSat,
|
---|
121 | const ColumnVector& rRec);
|
---|
122 |
|
---|
123 | bncTime _startTime;
|
---|
124 |
|
---|
125 | void rememberState(t_epoData* epoData);
|
---|
126 | void restoreState(t_epoData* epoData);
|
---|
127 |
|
---|
128 | t_irc selectSatellites(const QString& lastOutlierPrn,
|
---|
129 | QMap<QString, t_satData*>& satData);
|
---|
130 |
|
---|
131 | class pppPos {
|
---|
132 | public:
|
---|
133 | pppPos() {
|
---|
134 | for (int ii = 0; ii < 7; ++ii) {
|
---|
135 | xnt[ii] = 0.0;
|
---|
136 | }
|
---|
137 | }
|
---|
138 | bncTime time;
|
---|
139 | double xnt[7];
|
---|
140 | };
|
---|
141 |
|
---|
142 | bncPPPclient* _pppClient;
|
---|
143 | const t_pppOpt* _opt;
|
---|
144 | bncTime _time;
|
---|
145 | bncTime _lastTimeOK;
|
---|
146 | QByteArray _staID;
|
---|
147 | QVector<bncParam*> _params;
|
---|
148 | SymmetricMatrix _QQ;
|
---|
149 | QVector<bncParam*> _params_sav;
|
---|
150 | SymmetricMatrix _QQ_sav;
|
---|
151 | t_epoData* _epoData_sav;
|
---|
152 | ColumnVector _xcBanc;
|
---|
153 | ColumnVector _ellBanc;
|
---|
154 | QByteArray _log;
|
---|
155 | QFile* _nmeaFile;
|
---|
156 | QTextStream* _nmeaStream;
|
---|
157 | QMap<QString, double> _windUpTime;
|
---|
158 | QMap<QString, double> _windUpSum;
|
---|
159 | QVector<pppPos*> _posAverage;
|
---|
160 | QStringList _outlierGPS;
|
---|
161 | QStringList _outlierGlo;
|
---|
162 | bncAntex* _antex;
|
---|
163 | BNC_PPP::t_tides* _tides;
|
---|
164 | };
|
---|
165 |
|
---|
166 | #endif
|
---|