File: gnssProcessingStep.h

package info (click to toggle)
groops 0%2Bgit20240830%2Bds-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 11,052 kB
  • sloc: cpp: 134,939; fortran: 1,569; makefile: 20
file content (139 lines) | stat: -rw-r--r-- 5,982 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/***********************************************/
/**
* @file gnssProcessingStep.h
*
* @brief Processing steps for GNSS normal equations.
*
* @author Torsten Mayer-Guerr
* @date 2021-09-05
*
*/
/***********************************************/

#ifndef __GROOPS_GNSSPROCESSINGSTEP__
#define __GROOPS_GNSSPROCESSINGSTEP__

// Latex documentation
#ifdef DOCSTRING_GnssProcessingStep
static const char *docstringGnssProcessingStep = R"(
\section{GnssProcessingStep}\label{gnssProcessingStepType}
Processing step in \program{GnssProcessing}.

Processing steps enable a dynamic definition of the consecutive steps performed during any kind of GNSS processing.
The most common steps are \configClass{estimate}{gnssProcessingStepType:estimate}, which performs an iterative least
squares adjustment, and \configClass{writeResults}{gnssProcessingStepType:writeResults}, which writes all output files
defined in \program{GnssProcessing} and is usually the last step.
Some steps such as \configClass{selectParametrizations}{gnssProcessingStepType:selectParametrizations},
\configClass{selectEpochs}{gnssProcessingStepType:selectEpochs},
\configClass{selectNormalsBlockStructure}{gnssProcessingStepType:selectNormalsBlockStructure}, and
\configClass{selectReceivers}{gnssProcessingStepType:selectReceivers} affect all subsequent steps.
In case these steps are used within a \configClass{group}{gnssProcessingStepType:group} or
\configClass{forEachReceiverSeparately}{gnssProcessingStepType:forEachReceiverSeparately} step,
they only affect the steps within this level.

For usage examples see cookbooks on \reference{GNSS satellite orbit determination and network analysis}{cookbook.gnssNetwork:processing}
or \reference{Kinematic orbit determination of LEO satellites}{cookbook.kinematicOrbit}.
)";
#endif

/***********************************************/

#include "base/import.h"
#include "parallel/matrixDistributed.h"
#include "gnss/gnss.h"

/**
* @defgroup gnssProcessingStepGroup GnssProcessingStep
* @brief Processing steps in @ref GnssProcessing.
* @ingroup gnssGroup
* The interface is given by @ref GnssProcessingStep. */
/// @{

/***** TYPES ***********************************/

class Gnss;
class GnssProcessingStep;
class GnssProcessingStepBase;
typedef std::shared_ptr<GnssProcessingStep> GnssProcessingStepPtr;

/***** CLASS ***********************************/

/** @brief Provides a list of receivers.
* An Instance of this class can be created by @ref readConfig. */
class GnssProcessingStep
{
  std::vector<GnssProcessingStepBase*> bases;

public:
  class State
  {
  public:
    GnssPtr                            gnss;
    GnssNormalEquationInfo             normalEquationInfo;
    Bool                               changedNormalEquationInfo;
    MatrixDistributed                  normals;
    std::vector<Matrix>                n;        // at master (after solve)
    Vector                             lPl;      // at master (after solve)
    UInt                               obsCount; // at master (after solve)
    std::vector<std::vector<GnssType>> sigmaType;
    std::vector<std::vector<Double>>   sigmaFactor; // for each receiver and type

    /** @brief Constructor. */
    State(GnssPtr gnss, Parallel::CommunicatorPtr comm);

    void regularizeNotUsedParameters(UInt blockStart, UInt blockCount, const std::vector<ParameterName> &parameterNames);
    void collectNormalsBlocks       (UInt blockStart, UInt blockCount);
    void buildNormals               (Bool constraintsOnly, Bool solveEpochParameters);
    Double estimateSolution         (const std::function<Vector(const_MatrixSliceRef xFloat, MatrixSliceRef W, const_MatrixSliceRef d, Vector &xInt, Double &sigma)> &searchInteger,
                                     const std::vector<Byte> &ambiguityTransmitters, const std::vector<Byte> &ambiguityReceivers,
                                     Bool computeResiduals,  Bool computeWeights, Bool adjustSigma0, Double huber, Double huberPower);
    void residualsStatistics        (UInt idRecv, UInt idTrans,
                                     std::vector<GnssType> &types, std::vector<Double> &ePe, std::vector<Double> &redundancy,
                                     std::vector<UInt> &obsCount, std::vector<UInt> &outlierCount);
  };

  /** @brief Constructor from config. */
  GnssProcessingStep(Config &config, const std::string &name);

  /// Destructor.
 ~GnssProcessingStep();

  /** @brief Perform the processing steps. */
  void process(State &state);

  /** @brief creates an derived instance of this class. */
  static GnssProcessingStepPtr create(Config &config, const std::string &name) {return GnssProcessingStepPtr(new GnssProcessingStep(config, name));}
};

/***** FUNCTIONS *******************************/

/** @brief Creates an instance of the class GnssProcessingStep.
* Search for a node with @a name in the Config node.
* if @a name is not found the function returns FALSE and @a var is untouched.
* @param config The config node which includes the node with the options for this class
* @param name Tag name in the config.
* @param[out] var Created class.
* @param mustSet If is MUSTSET and @a name is not found, this function throws an exception instead of returning with FALSE.
* @param defaultValue Ignored at the moment.
* @param annotation Description of the function of this class.
* @relates GnssProcessingStep */
template<> Bool readConfig(Config &config, const std::string &name, GnssProcessingStepPtr &var, Config::Appearance mustSet, const std::string &defaultValue, const std::string &annotation);

/// @}

/***** CLASS ***********************************/

// Internal class
class GnssProcessingStepBase
{
public:
  virtual ~GnssProcessingStepBase() {}

  /** @brief Execute the processing step. */
  virtual void process(GnssProcessingStep::State &state) = 0;
  virtual Bool expectInitializedParameters() const {return TRUE;}
};

/***********************************************/

#endif /* __GROOPS___ */