source: ntrip/trunk/BNC/src/bncmodel.h@ 5802

Last change on this file since 5802 was 5802, checked in by mervart, 10 years ago
File size: 5.0 KB
Line 
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
35class t_epoData;
36class t_satData;
37class bncAntex;
38class t_pppOpt;
39class bncPPPclient;
40class t_tides;
41
42class bncParam {
43 public:
44 enum parType {CRD_X, CRD_Y, CRD_Z, RECCLK, TROPO, AMB_L3,
45 GLONASS_OFFSET, GALILEO_OFFSET};
46 bncParam(parType typeIn, int indexIn, const QString& prn);
47 ~bncParam();
48 double partial(t_satData* satData, bool phase);
49 bool isCrd() const {
50 return (type == CRD_X || type == CRD_Y || type == CRD_Z);
51 }
52 parType type;
53 double xx;
54 int index;
55 int index_old;
56 int numEpo;
57 QString prn;
58};
59
60class bncModel {
61 public:
62 bncModel(bncPPPclient* pppClient);
63 ~bncModel();
64 t_irc update(t_epoData* epoData);
65 bncTime time() const {return _time;}
66 double x() const {return _params[0]->xx;}
67 double y() const {return _params[1]->xx;}
68 double z() const {return _params[2]->xx;}
69 double clk() const {return _params[3]->xx;}
70 double trp() const {
71 for (int ii = 0; ii < _params.size(); ++ii) {
72 bncParam* pp = _params[ii];
73 if (pp->type == bncParam::TROPO) {
74 return pp->xx;
75 }
76 }
77 return 0.0;
78 }
79 double Glonass_offset() const {
80 for (int ii = 0; ii < _params.size(); ++ii) {
81 bncParam* pp = _params[ii];
82 if (pp->type == bncParam::GLONASS_OFFSET) {
83 return pp->xx;
84 }
85 }
86 return 0.0;
87 }
88 double Galileo_offset() const {
89 for (int ii = 0; ii < _params.size(); ++ii) {
90 bncParam* pp = _params[ii];
91 if (pp->type == bncParam::GALILEO_OFFSET) {
92 return pp->xx;
93 }
94 }
95 return 0.0;
96 }
97
98 static void kalman(const Matrix& AA, const ColumnVector& ll,
99 const DiagonalMatrix& PP,
100 SymmetricMatrix& QQ, ColumnVector& dx);
101
102 static double delay_saast(const ColumnVector& xyz, double Ele);
103
104 private:
105 void reset();
106 t_irc cmpBancroft(t_epoData* epoData);
107 void cmpEle(t_satData* satData);
108 void addAmb(t_satData* satData);
109 void addObs(int iPhase, unsigned& iObs, t_satData* satData,
110 Matrix& AA, ColumnVector& ll, DiagonalMatrix& PP);
111 QByteArray printRes(int iPhase, const ColumnVector& vv,
112 const QMap<QString, t_satData*>& satDataMap);
113 void findMaxRes(const ColumnVector& vv,
114 const QMap<QString, t_satData*>& satData,
115 QString& prnGPS, QString& prnGlo,
116 double& maxResGPS, double& maxResGlo);
117 double cmpValue(t_satData* satData, bool phase);
118 void predict(int iPhase, t_epoData* epoData);
119 t_irc update_p(t_epoData* epoData);
120 QString outlierDetection(int iPhase, const ColumnVector& vv,
121 QMap<QString, t_satData*>& satData);
122 void writeNMEAstr(const QString& nmStr);
123
124 double windUp(const QString& prn, const ColumnVector& rSat,
125 const ColumnVector& rRec);
126
127 bncTime _startTime;
128
129 void rememberState(t_epoData* epoData);
130 void restoreState(t_epoData* epoData);
131
132 t_irc selectSatellites(const QString& lastOutlierPrn,
133 QMap<QString, t_satData*>& satData);
134
135 class pppPos {
136 public:
137 pppPos() {
138 for (int ii = 0; ii < 7; ++ii) {
139 xnt[ii] = 0.0;
140 }
141 }
142 bncTime time;
143 double xnt[7];
144 };
145
146 bncPPPclient* _pppClient;
147 const t_pppOpt* _opt;
148 bncTime _time;
149 bncTime _lastTimeOK;
150 QByteArray _staID;
151 QVector<bncParam*> _params;
152 SymmetricMatrix _QQ;
153 QVector<bncParam*> _params_sav;
154 SymmetricMatrix _QQ_sav;
155 t_epoData* _epoData_sav;
156 ColumnVector _xcBanc;
157 ColumnVector _ellBanc;
158 QByteArray _log;
159 QFile* _nmeaFile;
160 QTextStream* _nmeaStream;
161 QMap<QString, double> _windUpTime;
162 QMap<QString, double> _windUpSum;
163 QVector<pppPos*> _posAverage;
164 QStringList _outlierGPS;
165 QStringList _outlierGlo;
166 bncAntex* _antex;
167 t_tides* _tides;
168};
169
170#endif
Note: See TracBrowser for help on using the repository browser.