1 //==============================================================================
2 //
3 //  This file is part of GPSTk, the GPS Toolkit.
4 //
5 //  The GPSTk is free software; you can redistribute it and/or modify
6 //  it under the terms of the GNU Lesser General Public License as published
7 //  by the Free Software Foundation; either version 3.0 of the License, or
8 //  any later version.
9 //
10 //  The GPSTk is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU Lesser General Public License for more details.
14 //
15 //  You should have received a copy of the GNU Lesser General Public
16 //  License along with GPSTk; if not, write to the Free Software Foundation,
17 //  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 //  This software was developed by Applied Research Laboratories at the
20 //  University of Texas at Austin.
21 //  Copyright 2004-2020, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 //  This software was developed by Applied Research Laboratories at the
28 //  University of Texas at Austin, under contract to an agency or agencies
29 //  within the U.S. Department of Defense. The U.S. Government retains all
30 //  rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 //  Pursuant to DoD Directive 523024
33 //
34 //  DISTRIBUTION STATEMENT A: This software has been approved for public
35 //                            release, distribution is unlimited.
36 //
37 //==============================================================================
38 
39 /**
40  * @file DataStructures.hpp
41  * Include file defining the data containers for program DDBase.
42  */
43 
44 #ifndef CLASS_DDBASE_DATA_STRUCT_INCLUDE
45 #define CLASS_DDBASE_DATA_STRUCT_INCLUDE
46 
47 //------------------------------------------------------------------------------------
48 // system includes
49 #include <string>
50 #include <vector>
51 
52 // GPSTk
53 #include "PRSolutionLegacy.hpp"
54 #include "Stats.hpp"
55 
56 // DDBase
57 #include "DDBase.hpp"
58 
59 //------------------------------------------------------------------------------------
60 // Data structures
61 
62 // structure for raw data
63 typedef struct data_structure {
64    double L1;     // cycles
65    double L2;     // cycles
66    double P1;     // m
67    double P2;     // m
68    double D1;     // Hz  optional when fit to phase used in synchronization
69    double D2;     // Hz
70    double S1;     // dB-Hz
71    double S2;     // dB-Hz
72    double ER;     // m
73    double elev;   // degrees
74    double az;     // degrees
75 } DataStruct;
76 
77 // structure for buffered raw good data
78 class RawData {
79 public:
80    std::vector<double> L1;      // cycles
81    std::vector<double> L2;      // cycles
82    std::vector<double> P1;      // m
83    std::vector<double> P2;      // m
84    std::vector<double> S1;      // db-Hz
85    std::vector<double> S2;      // db-Hz
86    std::vector<double> ER;      // m
87    std::vector<double> elev;    // deg
88    std::vector<double> az;      // deg
89    std::vector<int> count;      // epoch count since FirstEpoch
90 };
91 
92 // structure for computing single differences -- just counts and min,max elevation
93 class SDData {
94 public:
95    double elevmin,elevmax;
96    std::vector<int> count;
97 };
98 
99 // structure for buffered DDs with biases
100 class DDData {
101 public:
102    double L1bias,L2bias;
103    double prevL1,prevL2;
104    // these vectors and count must remain parallel
105    std::vector<double> DDL1,DDL2,DDP1,DDP2,DDER;   // data for each point
106    std::vector<int> count;                         // count for each point
107    std::vector<int> resets;                        // collection of indexes into
108                                                    //    count[] where bias is reset
109    //DDData(void) : last_buffer_index(0) {};
110 };
111 
112 // both reference and unknown positions
113 class Station {
114 public:
115    bool fixed;                      // if true, hold position fixed, else solve for it
116    bool usePRS;                     // if true, use ave. PR solution as position
117    gpstk::Position pos;             // either known or solution or apriori
118    gpstk::PRSolutionLegacy PRS;     // pseudorange solution, includes clock bias
119    gpstk::Stats<double> PRSXstats;  // stats on pseudorange solution
120    gpstk::Stats<double> PRSYstats;  // stats on pseudorange solution
121    gpstk::Stats<double> PRSZstats;  // stats on pseudorange solution
122 
123    double ant_azimuth;              // (relative) orientation of the antenna dipole
124 
125    std::map<gpstk::GSatID,DataStruct> RawDataMap;
126                                     // cleaned, raw data at current epoch
127    gpstk::CommonTime time;             // timetag (SolutionEpoch) of RawDataMap
128 
129       // these buffers must remain parallel
130    std::map<gpstk::GSatID,RawData> RawDataBuffers;
131                                     // buffers of good raw data
132    std::vector<double> ClockBuffer; // buffer of clock solution (m)
133    std::vector<double> ClkSigBuffer;// buffer of clock solution sigma (m)
134    std::vector<double> RxTimeOffset;// SolutionEpoch minus RxTimetag (sec)
135       // TD not used? used in OutputClockData
136    std::vector<int> CountBuffer;    // epoch count since FirstEpoch - if data exists
137 
138    std::string TropType;            // label from input giving type of trop model
139    gpstk::TropModel *pTropModel;    // chosen trop model (defined in CommandInput)
140    double temp;                     // temperature in degrees Celsius
141    double press;                    // pressure in mbars at sealevel
142    double rhumid;                   // relative humidity in % (0-100)
143 
144    Station(void) throw();           // empty and only constructor
145    ~Station(void) throw();          // destructor - free trop model
146 };
147 
148 /**
149  * @throw Exception
150  */
151 Station& findStationInList(std::map<std::string,Station>& SL, std::string& label);
152 
153 // Rinex observation input files
154 class ObsFile {
155 public:
156    std::string name;           // file name, not including path
157    std::string label;          // Station label to which this obs file belongs
158    gpstk::RinexObsStream ins;  // streams for reading RINEX
159       // TD use pointer -- operator= does not work for RinexObsStream,
160       // yet operator= necessary to form vector<RinexObsStream>
161    gpstk::RinexObsHeader Rhead;// RINEX header record (for reading)
162    gpstk::RinexObsData Robs;   // RINEX observation record (for reading)
163 
164    double dt;                  // nominal time step <= reading past header
165    gpstk::CommonTime firstTime;   // first good epoch
166 
167    int nread;                  // number of records read (-1=unopened, 0=header read)
168    bool valid;                 // set false if unopened or at EOF
169    bool getNext;               // flag used by ReadNextObs to synchronize reading
170    int inC1,inP1,inP2;         // indexes in RINEX header for pseudorange
171    int inL1,inL2;              // indexes in RINEX header for carrier phase
172    int inD1,inD2,inS1,inS2;    // needed or used ??
173 
174    ObsFile(void) throw();                          // empty constructor
175    ObsFile(const ObsFile& of) throw();             // copy constructor
176                                                    // (need for vector<ObsFile>)
177    ~ObsFile(void);                                 // destructor
178    ObsFile& operator=(const ObsFile& of) throw();  // assignment operator
179                                                    // (need for copy c'tor)
180 };
181 
182 #endif
183 // nothing below this
184 //------------------------------------------------------------------------------------
185