Changeset 11134 in ntrip for trunk/BNC/src/bncantex.cpp


Ignore:
Timestamp:
Oct 28, 2026, 10:05:43 AM (24 hours ago)
Author:
stuerze
Message:

IIF shadow behaviour considerred in GPS attitude model

File:
1 edited

Legend:

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

    r11123 r11134  
    632632      prn.toLatin1().data(), Mjd, beta*180.0/M_PI, mu*180.0/M_PI,
    633633      st.yaw*180.0/M_PI, psiNom*180.0/M_PI, callGap*1440.0);
    634     st.valid  = false;
    635     st.inTurn = false;
     634    st.valid    = false;
     635    st.inTurn   = false;
     636    st.inShadow = false;
     637  }
     638
     639  // Block IIF in the Earth's shadow (cylinder, around midnight for |mu| <
     640  // muShadow): the satellite yaws at a constant rate from its yaw at shadow
     641  // entry to the nominal yaw at shadow exit (Kouba 2009, Dilssner 2010)
     642  // -------------------------------------------------------------------------
     643  if (blockType == "IIF") {
     644    const double RE = 6378137.0;
     645    double cosMuShadow = sqrt(std::max(0.0, 1.0 - RE * RE / (r * r))) / cos(beta);
     646    bool   inShadow    = (cosMuShadow < 1.0 && cos(mu) > cosMuShadow);
     647    if (inShadow) {
     648      double muExit = acos(cosMuShadow);
     649      if (!st.inShadow) {
     650        double psiExit = atan2(-tanBeta, sin(muExit));      // nominal yaw at shadow exit
     651        double tRem    = (muExit - mu) / nRate;              // remaining time in the shadow [s]
     652        st.inShadow   = true;
     653        st.shadowYaw0 = st.valid ? st.yaw : psiNom;
     654        st.shadowRate = (tRem > 0.0) ? remainder(psiExit - st.shadowYaw0, 2.0 * M_PI) / tRem : 0.0;
     655        st.shadowMjd0 = Mjd;
     656        _gpsYawLog += QString().asprintf(
     657          "%s gpsYaw SHADOW-ENTER Mjd=%.6f beta=%6.3f mu=%7.2f yaw=%7.2f exit=%7.2f rate=%6.3f\n",
     658          prn.toLatin1().data(), Mjd, beta*180.0/M_PI, mu*180.0/M_PI, st.shadowYaw0*180.0/M_PI,
     659          psiExit*180.0/M_PI, st.shadowRate*180.0/M_PI);
     660      }
     661      double psiEff = st.shadowYaw0 + st.shadowRate * (Mjd - st.shadowMjd0) * 86400.0;
     662      while (psiEff >  M_PI) psiEff -= 2.0 * M_PI;
     663      while (psiEff < -M_PI) psiEff += 2.0 * M_PI;
     664      st.yaw         = psiEff;
     665      st.lastCallMjd = Mjd;
     666      st.valid       = true;
     667      st.inTurn      = false;
     668      return psiEff;
     669    }
     670    else if (st.inShadow) {
     671      // shadow exit: a remaining difference to the nominal yaw is caught up
     672      // at the maximum rate (catch-up branch below)
     673      st.inShadow = false;
     674      st.inTurn   = true;
     675      st.turnSign = (remainder(psiNom - st.yaw, 2.0 * M_PI) >= 0.0) ? 1.0 : -1.0;
     676      _gpsYawLog += QString().asprintf(
     677        "%s gpsYaw SHADOW-EXIT  Mjd=%.6f beta=%6.3f mu=%7.2f yaw=%7.2f nominal=%7.2f\n",
     678        prn.toLatin1().data(), Mjd, beta*180.0/M_PI, mu*180.0/M_PI, st.yaw*180.0/M_PI, psiNom*180.0/M_PI);
     679    }
    636680  }
    637681
Note: See TracChangeset for help on using the changeset viewer.