Changeset 2063 in ntrip


Ignore:
Timestamp:
Dec 1, 2009, 1:54:49 PM (14 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncconst.cpp

    r2052 r2063  
    3131const double t_CST::lambda2 = c / freq2;
    3232const double t_CST::omega   = 7292115.1467e-11;
     33const double t_CST::aell    = 6378137.000;
     34const double t_CST::fInv    = 298.2572236;
  • trunk/BNC/bncconst.h

    r2052 r2063  
    3636    static const double lambda2;
    3737    static const double omega;
     38    static const double aell;
     39    static const double fInv;
    3840};
    3941
  • trunk/BNC/bncmodel.cpp

    r2061 r2063  
    4040
    4141#include <iomanip>
     42#include <cmath>
    4243#include <newmatio.h>
    4344
     
    4546#include "bncpppclient.h"
    4647#include "bancroft.h"
     48#include "bncutils.h"
    4749
    4850using namespace std;
     
    138140  }
    139141
     142  // Set Station Height
     143  // ------------------
     144  ColumnVector ell(3);
     145  xyz2ell(_xcBanc.data(), ell.data());
     146  _height = ell(3);
     147
     148  cout << "height = " << _height << endl;
     149
    140150  return success;
    141151}
     
    155165  satData->rho = (satData->xx - xRec).norm_Frobenius();
    156166
    157   double tropDelay = 0.0;
     167  double tropDelay = delay_saast();
     168
     169  cout << "tropDelay " << tropDelay << endl;
    158170
    159171  return satData->rho + _xcBanc(4) - satData->clk + tropDelay;
     172}
     173
     174// Tropospheric Model (Saastamoinen)
     175////////////////////////////////////////////////////////////////////////////
     176double bncModel::delay_saast() {
     177
     178  double Ele = M_PI/2.0;
     179
     180  double pp =  1013.25 * pow(1.0 - 2.26e-5 * _height, 5.225);
     181  double TT =  18.0 - _height * 0.0065 + 273.15;
     182  double hh =  50.0 * exp(-6.396e-4 * _height);
     183  double ee =  hh / 100.0 * exp(-37.2465 + 0.213166*TT - 0.000256908*TT*TT);
     184
     185  double h_km = _height / 1000.0;
     186 
     187  if (h_km < 0.0) h_km = 0.0;
     188  if (h_km > 5.0) h_km = 5.0;
     189  int    ii   = int(h_km + 1);
     190  double href = ii - 1;
     191 
     192  double bCor[6];
     193  bCor[0] = 1.156;
     194  bCor[1] = 1.006;
     195  bCor[2] = 0.874;
     196  bCor[3] = 0.757;
     197  bCor[4] = 0.654;
     198  bCor[5] = 0.563;
     199 
     200  double BB = bCor[ii-1] + (bCor[ii]-bCor[ii-1]) * (h_km - href);
     201 
     202  double zen  = M_PI/2.0 - Ele;
     203
     204  return (0.002277/cos(zen)) * (pp + ((1255.0/TT)+0.05)*ee - BB*(tan(zen)*tan(zen)));
    160205}
    161206
  • trunk/BNC/bncmodel.h

    r2060 r2063  
    5555 private:
    5656  double cmpValueP3(t_satData* satData);
     57  double delay_saast();
     58
    5759  QList<bncParam*> _params;
    5860  SymmetricMatrix  _QQ;
     
    6264  ColumnVector     _xx;
    6365  ColumnVector     _xcBanc;
     66  double           _height;
    6467};
    6568
  • trunk/BNC/bncutils.cpp

    r2043 r2063  
    185185  xyz = RR * rsw;
    186186}
     187
     188// Rectangular Coordinates -> Ellipsoidal Coordinates
     189////////////////////////////////////////////////////////////////////////////
     190t_irc xyz2ell(const double* XYZ, double* Ell) {
     191
     192  const double bell = t_CST::aell*(1.0-1.0/t_CST::fInv) ;
     193  const double e2   = (t_CST::aell*t_CST::aell-bell*bell)/(t_CST::aell*t_CST::aell) ;
     194  const double e2c  = (t_CST::aell*t_CST::aell-bell*bell)/(bell*bell) ;
     195 
     196  double nn, ss, zps, hOld, phiOld, theta, sin3, cos3;
     197
     198  ss    = sqrt(XYZ[0]*XYZ[0]+XYZ[1]*XYZ[1]) ;
     199  zps   = XYZ[2]/ss ;
     200  theta = atan( (XYZ[2]*t_CST::aell) / (ss*bell) );
     201  sin3  = sin(theta) * sin(theta) * sin(theta);
     202  cos3  = cos(theta) * cos(theta) * cos(theta);
     203
     204  // Closed formula
     205  Ell[0] = atan( (XYZ[2] + e2c * bell * sin3) / (ss - e2 * t_CST::aell * cos3) ); 
     206  Ell[1] = atan2(XYZ[1],XYZ[0]) ;
     207  nn = t_CST::aell/sqrt(1.0-e2*sin(Ell[0])*sin(Ell[0])) ;
     208  Ell[2] = ss / cos(Ell[0]) - nn;
     209
     210  const int MAXITER = 100;
     211  for (int ii = 1; ii <= MAXITER; ii++) {
     212    nn     = t_CST::aell/sqrt(1.0-e2*sin(Ell[0])*sin(Ell[0])) ;
     213    hOld   = Ell[2] ;
     214    phiOld = Ell[0] ;
     215    Ell[2] = ss/cos(Ell[0])-nn ;
     216    Ell[0] = atan(zps/(1.0-e2*nn/(nn+Ell[2]))) ;
     217    if ( fabs(phiOld-Ell[0]) <= 1.0e-11 && fabs(hOld-Ell[2]) <= 1.0e-5 ) {
     218      return success;
     219    }
     220  }
     221
     222  return failure;
     223}
  • trunk/BNC/bncutils.h

    r2043 r2063  
    3030
    3131#include <newmat.h>
     32#include <bncconst.h>
    3233
    3334void expandEnvVar(QString& str);
     
    4647                const ColumnVector& rsw, ColumnVector& xyz);
    4748
     49t_irc xyz2ell(const double* XYZ, double* Ell);
     50
    4851#endif
Note: See TracChangeset for help on using the changeset viewer.