Ignore:
Timestamp:
Mar 20, 2013, 11:18:10 AM (11 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/upload/bncrtnetuploadcaster.cpp

    r4973 r4991  
    301301 
    302302    QString      prn;
    303     ColumnVector xx(14); xx = 0.0;
     303    ColumnVector rtnAPC;
     304    ColumnVector rtnVel;
     305    ColumnVector rtnCoM;
     306    double       rtnClk;
    304307 
    305308    QTextStream in(lines[ii].toAscii());
    306309
    307310    in >> prn;
    308     if (prn[0] == 'P') {
    309       prn.remove(0,1);
    310     }
    311311
    312312    t_eph* eph = 0;
     
    347347    if (eph) {
    348348
    349       in >> xx(1) >> xx(2) >> xx(3) >> xx(4) >> xx(5)
    350          >> xx(6) >> xx(7) >> xx(8) >> xx(9) >> xx(10)
    351          >> xx(11) >> xx(12) >> xx(13) >> xx(14);
    352       xx(1) *= 1e3;          // x-crd
    353       xx(2) *= 1e3;          // y-crd
    354       xx(3) *= 1e3;          // z-crd
    355       xx(4) *= 1e-6;         // clk
    356       xx(5) *= 1e-6;         // rel. corr.
    357                              // xx(6), xx(7), xx(8) ... PhaseCent - CoM
    358                              // xx(9)  ... P1-C1 DCB in meters
    359                              // xx(10) ... P1-P2 DCB in meters
    360                              // xx(11) ... dT
    361       xx(12) *= 1e3;         // x-crd at time + dT
    362       xx(13) *= 1e3;         // y-crd at time + dT
    363       xx(14) *= 1e3;         // z-crd at time + dT
    364  
     349      while (true) {
     350        QString key;
     351        int     numVal = 0;
     352        in >> key >> numVal;
     353        if (in.status() != QTextStream::Ok) {
     354          break;
     355        }
     356        if       (key == "APC") {
     357          rtnAPC.ReSize(3);
     358          in >> rtnAPC[0] >> rtnAPC[1] >> rtnAPC[2];
     359        }
     360        else if (key == "Clk") {
     361          in >> rtnClk;
     362        }
     363        else if (key == "Vel") {
     364          rtnVel.ReSize(3);
     365          in >> rtnVel[0] >> rtnVel[1] >> rtnVel[2];
     366        }
     367        else if (key == "CoM") {
     368          rtnCoM.ReSize(3);
     369          in >> rtnCoM[0] >> rtnCoM[1] >> rtnCoM[2];
     370        }
     371        else {
     372          for (int ii = 0; ii < numVal; ii++) {
     373            double dummy;
     374            in >> dummy;
     375          }
     376        }
     377      } 
    365378      struct ClockOrbit::SatData* sd = 0;
    366379      if      (prn[0] == 'G') {
     
    375388        QString outLine;
    376389        processSatellite(eph, epoTime.gpsw(), epoTime.gpssec(), prn,
    377                          xx, sd, outLine);
     390                         rtnAPC, rtnClk, rtnVel, rtnCoM, sd, outLine);
    378391      }
    379392 
     
    390403      // Coefficient of Ionosphere-Free LC
    391404      // ---------------------------------
    392       const static double a_L1_GPS =  2.54572778;
    393       const static double a_L2_GPS = -1.54572778;
    394       const static double a_L1_Glo =  2.53125000;
    395       const static double a_L2_Glo = -1.53125000;
     405      // const static double a_L1_GPS =  2.54572778;
     406      // const static double a_L2_GPS = -1.54572778;
     407      // const static double a_L1_Glo =  2.53125000;
     408      // const static double a_L2_Glo = -1.53125000;
    396409 
    397410      if (biasSat) {
     
    400413        if      (prn[0] == 'G') {
    401414          biasSat->Biases[0].Type = CODETYPEGPS_L1_Z;
    402           biasSat->Biases[0].Bias = - a_L2_GPS * xx(10);
     415          // biasSat->Biases[0].Bias = - a_L2_GPS * xx(10);
     416          biasSat->Biases[0].Bias = 0.0;
    403417          biasSat->Biases[1].Type = CODETYPEGPS_L1_CA;
    404           biasSat->Biases[1].Bias = - a_L2_GPS * xx(10) + xx(9);
     418          // biasSat->Biases[1].Bias = - a_L2_GPS * xx(10) + xx(9);
     419          biasSat->Biases[1].Bias = 0.0;
    405420          biasSat->Biases[2].Type = CODETYPEGPS_L2_Z;
    406           biasSat->Biases[2].Bias = a_L1_GPS * xx(10);
     421          // biasSat->Biases[2].Bias = a_L1_GPS * xx(10);
     422          biasSat->Biases[2].Bias = 0.0;
    407423        }
    408424        else if (prn[0] == 'R') {
    409425          biasSat->Biases[0].Type = CODETYPEGLONASS_L1_P;
    410           biasSat->Biases[0].Bias = - a_L2_Glo * xx(10);
     426          // biasSat->Biases[0].Bias = - a_L2_Glo * xx(10);
     427          biasSat->Biases[0].Bias = 0.0;
    411428          biasSat->Biases[1].Type = CODETYPEGLONASS_L1_CA;
    412           biasSat->Biases[1].Bias = - a_L2_Glo * xx(10) + xx(9);
     429          // biasSat->Biases[1].Bias = - a_L2_Glo * xx(10) + xx(9);
     430          biasSat->Biases[1].Bias = 0.0;
    413431          biasSat->Biases[2].Type = CODETYPEGLONASS_L2_P;
    414           biasSat->Biases[2].Bias = a_L1_Glo * xx(10);
     432          // biasSat->Biases[2].Bias = a_L1_Glo * xx(10);
     433          biasSat->Biases[2].Bias = 0.0;
    415434        }
    416435      }
     
    485504////////////////////////////////////////////////////////////////////////////
    486505void bncRtnetUploadCaster::processSatellite(t_eph* eph, int GPSweek,
    487                                        double GPSweeks, const QString& prn,
    488                                        const ColumnVector& xx,
    489                                        struct ClockOrbit::SatData* sd,
    490                                        QString& outLine) {
     506                                            double GPSweeks, const QString& prn,
     507                                            const ColumnVector& rtnAPC,
     508                                            double rtnClk,
     509                                            const ColumnVector& rtnVel,
     510                                            const ColumnVector& rtnCoM,
     511                                            struct ClockOrbit::SatData* sd,
     512                                            QString& outLine) {
    491513
    492514  // Broadcast Position and Velocity
     
    496518  eph->position(GPSweek, GPSweeks, xB.data(), vB.data());
    497519 
    498   // Precise Position and Velocity
    499   // -----------------------------
    500   ColumnVector xP = xx.Rows(1,3);
    501   ColumnVector vP = (xx.Rows(12,14) - xx.Rows(1,3)) / xx(11);
    502  
    503   // Correction Center of Mass -> Antenna Phase Center
    504   // -------------------------------------------------
    505   if (! _CoM) {
    506     xP(1) += xx(6);
    507     xP(2) += xx(7);
    508     xP(3) += xx(8);
    509   }
     520  // Precise Position
     521  // ----------------
     522  ColumnVector xP = _CoM ? rtnCoM : rtnAPC;
    510523
    511524  double dc = 0.0;   
     
    517530  // -----------------
    518531  ColumnVector dx = xB.Rows(1,3) - xP;
    519   ColumnVector dv = vB           - vP;
     532  ColumnVector dv = vB           - rtnVel;
    520533 
    521534  // Difference in RSW
     
    529542  // Clock Correction
    530543  // ----------------
    531   double dClk = (xx(4) + xx(5) - xB(4) + dc) * t_CST::c;
     544  double dClk = rtnClk - (xB(4) - dc) * t_CST::c;
    532545
    533546  if (sd) {
     
    547560                  eph->IOD(), dClk, rsw(1), rsw(2), rsw(3));
    548561
     562  double relativity = -2.0 * DotProduct(xP, rtnVel) / t_CST::c;
     563  double sp3Clk = (rtnClk - relativity) / t_CST::c;  // in seconds
     564
    549565  if (_rnx) {
    550     _rnx->write(GPSweek, GPSweeks, prn, xx);
     566    _rnx->write(GPSweek, GPSweeks, prn, sp3Clk);
    551567  }
    552568  if (_sp3) {
    553     _sp3->write(GPSweek, GPSweeks, prn, xx);
     569    _sp3->write(GPSweek, GPSweeks, prn, rtnCoM, sp3Clk);
    554570  }
    555571}
Note: See TracChangeset for help on using the changeset viewer.