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

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