Changeset 4338 in ntrip for trunk/BNC/src/rinex/reqcanalyze.cpp


Ignore:
Timestamp:
Jun 24, 2012, 12:11:32 PM (12 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.