Changeset 11083 in ntrip for trunk/BNC/src/orbComp
- Timestamp:
- Oct 12, 2026, 3:32:43 PM (23 hours ago)
- File:
-
- 1 edited
-
trunk/BNC/src/orbComp/sp3Comp.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/orbComp/sp3Comp.cpp
r11076 r11083 178 178 } 179 179 180 int nPar = epochs.size() + clkSats.size(); 181 SymmetricMatrix NN(nPar); NN = 0.0; 182 ColumnVector bb(nPar); bb = 0.0; 183 184 // Create Matrix A'A and vector b 185 // ------------------------------ 186 for (unsigned ie = 0; ie < epochs.size(); ie++) { 180 // Least-squares adjustment of an epoch-specific offset (common to all 181 // satellites) and a satellite-specific offset (common to all epochs), the 182 // sum of the satellite offsets constrained to zero (weight 1). The normal 183 // equations of the epoch offsets are diagonal, so these offsets are 184 // eliminated (Schur complement) and only the satellite offsets are solved 185 // for; the epoch offsets follow from them. The solution is identical to 186 // that of the full system, but the effort grows only linearly with the 187 // number of epochs (before: cubic). 188 // ----------------------------------------------------------------------- 189 int nEpo = epochs.size(); 190 int nSat = clkSats.size(); 191 int nPar = nEpo + nSat; 192 193 vector<vector<int> > satIdx(nEpo); // satellites (index) of each epoch 194 ColumnVector nEp(nEpo); nEp = 0.0; // number of satellites per epoch 195 ColumnVector bEp(nEpo); bEp = 0.0; // sum of the differences per epoch 196 SymmetricMatrix NS(nSat); NS = 1.0; // regularization: sum of satellite offsets 197 ColumnVector bS(nSat); bS = 0.0; 198 for (int ie = 0; ie < nEpo; ie++) { 187 199 const map<t_prn, double>& dc = epochs[ie]->_dc; 188 Matrix AA(dc.size(), nPar); AA = 0.0; 189 ColumnVector ll(dc.size()); ll = 0.0; 190 map<t_prn, double>::const_iterator it; 191 int ii = -1; 192 for (it = dc.begin(); it != dc.end(); it++) { 193 const t_prn& prn = it->first; 194 if (satIndex(clkSats, prn) != -1) { 195 ++ii; 196 int index = epochs.size() + satIndex(clkSats, prn); 197 AA[ii][ie] = 1.0; // epoch-specfic offset (common for all satellites) 198 AA[ii][index] = 1.0; // satellite-specific offset (common for all epochs) 199 ll[ii] = it->second; 200 } 201 } 202 SymmetricMatrix dN; dN << AA.t() * AA; 203 NN += dN; 204 bb += AA.t() * ll; 205 } 206 207 // Regularize NN 208 // ------------- 209 RowVector HH(nPar); 210 HH.columns(1, epochs.size()) = 0.0; 211 HH.columns(epochs.size()+1, nPar) = 1.0; 212 SymmetricMatrix dN; dN << HH.t() * HH; 213 NN += dN; 214 215 // Estimate Parameters 216 // ------------------- 217 ColumnVector xx = NN.i() * bb; 200 for (map<t_prn, double>::const_iterator it = dc.begin(); it != dc.end(); it++) { 201 int is = satIndex(clkSats, it->first); 202 if (is != -1) { 203 satIdx[ie].push_back(is); 204 nEp[ie] += 1.0; 205 bEp[ie] += it->second; 206 NS(is+1, is+1) += 1.0; 207 bS[is] += it->second; 208 } 209 } 210 } 211 212 // Eliminate the epoch offsets 213 // --------------------------- 214 for (int ie = 0; ie < nEpo; ie++) { 215 const vector<int>& idx = satIdx[ie]; 216 for (unsigned ia = 0; ia < idx.size(); ia++) { 217 bS[idx[ia]] -= bEp[ie] / nEp[ie]; 218 for (unsigned ib = 0; ib <= ia; ib++) { 219 NS(idx[ia]+1, idx[ib]+1) -= 1.0 / nEp[ie]; 220 } 221 } 222 } 223 224 // Estimate Parameters (epoch offsets first, then satellite offsets) 225 // --------------------------------------------------------------- 226 ColumnVector yy = NS.i() * bS; 227 ColumnVector xx(nPar); 228 for (int ie = 0; ie < nEpo; ie++) { 229 double sum = bEp[ie]; 230 for (unsigned ia = 0; ia < satIdx[ie].size(); ia++) { 231 sum -= yy[satIdx[ie][ia]]; 232 } 233 xx[ie] = sum / nEp[ie]; 234 } 235 for (int is = 0; is < nSat; is++) { 236 xx[nEpo + is] = yy[is]; 237 } 218 238 219 239 // Compute clock residuals
Note:
See TracChangeset
for help on using the changeset viewer.
