Changeset 4338 in ntrip


Ignore:
Timestamp:
Jun 24, 2012, 12:11:32 PM (12 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncutils.cpp

    r4278 r4338  
    408408  return ok ? 0 : 1;
    409409}
     410
     411// Topocentrical Distance and Elevation
     412////////////////////////////////////////////////////////////////////////////
     413void topos(double xRec, double yRec, double zRec,
     414           double xSat, double ySat, double zSat,
     415           double& rho, double& eleSat, double& azSat) {
     416
     417  double dx[3];
     418  dx[0] = xSat-xRec;
     419  dx[1] = ySat-yRec;
     420  dx[2] = zSat-zRec;
     421
     422  rho =  sqrt( dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2] );
     423
     424  double xyzRec[3];
     425  xyzRec[0] = xRec;
     426  xyzRec[1] = yRec;
     427  xyzRec[2] = zRec;
     428
     429  double Ell[3];
     430  double neu[3];
     431  xyz2ell(xyzRec, Ell);
     432  xyz2neu(Ell, dx, neu);
     433
     434  eleSat = acos( sqrt(neu[0]*neu[0] + neu[1]*neu[1]) / rho );
     435  if (neu[2] < 0) {
     436    eleSat *= -1.0;
     437  }
     438
     439  azSat  = atan2(neu[1], neu[0]);
     440}
  • trunk/BNC/src/bncutils.h

    r4278 r4338  
    7676int readDbl(const QString& str, int pos, int len, double& value);
    7777
     78void topos(double xRec, double yRec, double zRec,
     79           double xSat, double ySat, double zSat,
     80           double& rho, double& eleSat, double& azSat);
     81
    7882#endif
  • trunk/BNC/src/rinex/reqcanalyze.cpp

    r4334 r4338  
    6464
    6565  _currEpo = 0;
     66  _dataMP1 = 0;
     67  _dataMP2 = 0;
    6668
    6769  connect(this, SIGNAL(displayGraph()), this, SLOT(slotDisplayGraph()));
     
    8688  if (((bncApp*) qApp)->mode() == bncApp::interactive) {
    8789
    88     QVector<t_polarPoint*>* data1 = new QVector<t_polarPoint*>;
    89 
    90     //// beg test
    91     {   
    92       const QwtInterval zenithInterval(0.0, 90.0);
    93       const QwtInterval azimuthInterval(0.0, 360.0 );
    94       const int    numPoints = 1000;
    95       const double stepA     = 4 * azimuthInterval.width() / numPoints;
    96       const double stepR     = zenithInterval.width() / numPoints;
    97       for (int ii = 0; ii < numPoints; ii++) {
    98         double aa = azimuthInterval.minValue() + ii * stepA;
    99         double rr = zenithInterval.minValue() + ii * stepR;
    100         double vv = static_cast<double>(ii) / numPoints;
    101         (*data1) << (new t_polarPoint(aa, rr, vv));
    102       }
    103     }
    104     //// end test
    105 
    10690    t_polarPlot* plotMP1 = new t_polarPlot(0);
    107     plotMP1->addCurve(data1);
    108 
    109     QVector<t_polarPoint*>* data2 = new QVector<t_polarPoint*>;
    110 
    111     //// beg test
    112     {   
    113       const QwtInterval zenithInterval(0.0, 90.0);
    114       const QwtInterval azimuthInterval(0.0, 360.0 );
    115       const int    numPoints = 1000;
    116       const double stepA     = 4 * azimuthInterval.width() / numPoints;
    117       const double stepR     = zenithInterval.width() / numPoints;
    118       for (int ii = 0; ii < numPoints; ii++) {
    119         double aa = azimuthInterval.minValue() + ii * stepA;
    120         double rr = zenithInterval.minValue() + ii * stepR;
    121         double vv = static_cast<double>(ii) / numPoints;
    122         (*data2) << (new t_polarPoint(aa, rr, vv));
    123       }
    124     }
    125     //// end test
     91    plotMP1->addCurve(_dataMP1);
     92    _dataMP1 = 0;
    12693
    12794    t_polarPlot* plotMP2 = new t_polarPlot(0);
    128     plotMP2->addCurve(data2);
     95    plotMP2->addCurve(_dataMP2);
     96    _dataMP2 = 0;
    12997   
    13098    QVector<QWidget*> plots;
     
    201169                                   .arg(obs.satNum, 2, 10, QChar('0'));
    202170
     171      t_eph* eph = 0;
     172      for (int ie = 0; ie < _ephs.size(); ie++) {
     173        if (_ephs[ie]->prn() == prn) {
     174          eph = _ephs[ie];
     175          break;
     176        }
     177      }
     178
    203179      t_satStat& satStat = _satStat[prn];
    204       satStat.addObs(obs);
     180
     181      satStat.addObs(eph, obs);
    205182    }
    206183
     
    211188  _log->setRealNumberNotation(QTextStream::FixedNotation);
    212189  _log->setRealNumberPrecision(2);
     190
     191  delete _dataMP1; _dataMP1 = new QVector<t_polarPoint*>;
     192  delete _dataMP2; _dataMP2 = new QVector<t_polarPoint*>;
    213193
    214194  QMapIterator<QString, t_satStat> it(_satStat);
     
    218198    const t_satStat& satStat = it.value();
    219199 
    220     for (int im = 1; im <= 2; im++) {
    221       const QVector<double>& MP = (im == 1) ? satStat.MP1 : satStat.MP2;
    222       if (MP.size() > 1) {
    223         double mean = 0.0;
    224         for (int ii = 0; ii < MP.size(); ii++) {
    225           mean += MP[ii];
    226         }
    227         mean /= MP.size();
    228         double stddev = 0.0;
    229         for (int ii = 0; ii < MP.size(); ii++) {
    230           double diff = MP[ii] - mean;
    231           stddev += diff * diff;
    232         }
    233         double multipath = sqrt(stddev / (MP.size()-1));
    234      
    235         *_log << "MP" << im << " " << prn << " " << multipath << endl;
    236       }
    237     }
    238 
     200    int numVal = satStat.anaObs.size();
     201    if (numVal > 1) {
     202      double mean1 = 0.0;
     203      double mean2 = 0.0;
     204      for (int ii = 0; ii < numVal; ii++) {
     205        const t_anaObs* anaObs = satStat.anaObs[ii];
     206        mean1 += anaObs->MP1;
     207        mean2 += anaObs->MP2;
     208      }
     209      mean1 /= numVal;
     210      mean2 /= numVal;
     211      double stddev1 = 0.0;
     212      double stddev2 = 0.0;
     213      for (int ii = 0; ii < numVal; ii++) {
     214        const t_anaObs* anaObs = satStat.anaObs[ii];
     215        double diff1 = anaObs->MP1 - mean1;
     216        double diff2 = anaObs->MP2 - mean2;
     217        stddev1 += diff1 * diff1;
     218        stddev2 += diff2 * diff2;
     219        //// beg test
     220        (*_dataMP1) << (new t_polarPoint(anaObs->az, anaObs->zen, 0.5));
     221        (*_dataMP2) << (new t_polarPoint(anaObs->az, anaObs->zen, 1.0));
     222        //// end test
     223      }
     224      double MP1 = sqrt(stddev1 / (numVal-1));
     225      double MP2 = sqrt(stddev2 / (numVal-1));
     226       
     227      *_log << "MP1 " << prn << " " << MP1 << endl;
     228      *_log << "MP2 " << prn << " " << MP2 << endl;
     229    }
    239230  }
    240231
     
    246237// 
    247238////////////////////////////////////////////////////////////////////////////
    248 void t_reqcAnalyze::t_satStat::addObs(const t_obs& obs) {
    249   if (currObs) {
    250     delete prevObs;
    251     prevObs = currObs;
    252   }
    253   currObs = new t_anaObs(obs);
     239void t_reqcAnalyze::t_satStat::addObs(const t_eph* eph, const t_obs& obs) {
     240
     241  t_anaObs* newObs = new t_anaObs(obs);
     242  anaObs << newObs;
    254243
    255244  // Compute the Multipath
     
    263252
    264253    if (obs.p1() != 0.0) {
    265       currObs->M1 = obs.p1() - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2);
    266       MP1 << currObs->M1;
     254      newObs->MP1 = obs.p1() - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2);
    267255    }
    268256    if (obs.p2() != 0.0) {
    269       currObs->M2 = obs.p2() - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2);
    270       MP2 << currObs->M2;
    271     }
    272   }
    273 }
     257      newObs->MP2 = obs.p2() - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2);
     258    }
     259  }
     260
     261  // Compute the Azimuth and Zenith Distance
     262  // ---------------------------------------
     263  if (eph) {
     264    double xx, yy, zz, cc;
     265    eph->position(obs.GPSWeek, obs.GPSWeeks, xx, yy, zz, cc);
     266  }
     267}
  • trunk/BNC/src/rinex/reqcanalyze.h

    r4300 r4338  
    3232#include "RTCM3/ephemeris.h"
    3333
     34class t_polarPoint;
     35
    3436class t_reqcAnalyze : public QThread {
    3537Q_OBJECT
     
    5456  class t_anaObs {
    5557   public:
    56     t_anaObs(const t_obs& obsIn) {
    57       obs = obsIn;
    58       M1  = 0.0;
    59       M2  = 0.0;
    60     }
     58    t_anaObs(const t_obs& obsIn) :
     59      obs(obsIn), az(0.0), zen(0.0), MP1(0.0), MP2(0.0) {}
    6160    t_obs  obs;
    62     double M1;
    63     double M2;
     61    double az;
     62    double zen;
     63    double MP1;
     64    double MP2;
    6465  };
    6566
    6667  class t_satStat {
    6768   public:
    68     t_satStat() {
    69       currObs = 0;
    70       prevObs = 0;
     69    t_satStat() {}
     70    ~t_satStat() {
     71      for (int ii = 0; ii < anaObs.size(); ii++) {
     72        delete anaObs[ii];
     73      }
    7174    }
    72     ~t_satStat() {
    73       delete currObs;
    74       delete prevObs;
    75     }
    76     void addObs(const t_obs& obs);
    77     QVector<double> MP1;
    78     QVector<double> MP2;
    79     t_anaObs* currObs;
    80     t_anaObs* prevObs;
     75    void addObs(const t_eph* eph, const t_obs& obs);
     76    QVector<t_anaObs*> anaObs;
    8177  };
    8278
     
    9288  QMap<QString, t_satStat> _satStat;
    9389  t_rnxObsFile::t_rnxEpo*  _currEpo;
     90  QVector<t_polarPoint*>*  _dataMP1;
     91  QVector<t_polarPoint*>*  _dataMP2;
    9492};
    9593
Note: See TracChangeset for help on using the changeset viewer.