This commit is contained in:
Timur A. Fatkhullin
2025-07-15 23:36:40 +03:00
parent 46e4b1e95f
commit 7e8d7eaa6b
2 changed files with 60 additions and 7 deletions

View File

@@ -16,7 +16,7 @@
namespace mcc
{
static constexpr double mcc_UT1_to_sideral_ratio = 1.002737909350795; // UT1/sideral
static constexpr double mcc_sideral_to_UT1_ratio = 1.002737909350795; // sideral/UT1
/* SOME SIMPLE PROHIBITED ZONE IMPLEMENTATIONS */
@@ -86,7 +86,13 @@ public:
return infDuration;
}
return compute(telemetry_data);
if constexpr (KIND ==
MccAltLimitKind::MIN_ALT_LIMIT) { // the closest time point is one after upper culmination
return compute(telemetry_data, false);
} else if constexpr (KIND == MccAltLimitKind::MAX_ALT_LIMIT) { // the closest time point is one before upper
// culmination
return compute(telemetry_data, true);
}
}
// returns a time to exit from the zone
@@ -100,7 +106,13 @@ public:
return zeroDuration;
}
return compute(telemetry_data);
if constexpr (KIND ==
MccAltLimitKind::MIN_ALT_LIMIT) { // the closest time point is one before upper culmination
return compute(telemetry_data, true);
} else if constexpr (KIND == MccAltLimitKind::MAX_ALT_LIMIT) { // the closest time point is one after upper
// culmination
return compute(telemetry_data, false);
}
}
template <std::derived_from<MccAngle> XT, std::derived_from<MccAngle> YT>
@@ -174,7 +186,7 @@ private:
return true;
}
pz_duration_t compute(traits::mcc_mount_telemetry_data_c auto const& telemetry_data)
pz_duration_t compute(traits::mcc_mount_telemetry_data_c auto const& telemetry_data, bool before_upper_culm)
{
double cos_ha = (std::sin(_altLimit) - std::sin(telemetry_data.mntDEC) * std::sin(_latitude)) /
std::cos(telemetry_data.mntDEC) / std::cos(_latitude);
@@ -183,12 +195,31 @@ private:
return infDuration;
}
MccAngle time_ang = std::acos(cos_ha) - telemetry_data.mntHA; // in sideral time scale
if (time_ang < 0.0) { // next day
double ha;
if (before_upper_culm) {
ha = -std::acos(cos_ha); // HA before upper culmination
} else {
ha = std::acos(cos_ha); // HA after upper culmination!!
}
// if constexpr (KIND == MccAltLimitKind::MIN_ALT_LIMIT) { // the closest time moment after upper
// culmination!!!
// ha = std::acos(cos_ha); // HA after upper culmination!!
// } else if constexpr (KIND ==
// MccAltLimitKind::MAX_ALT_LIMIT) { // the closest time moment before upper
// culmination!!!
// ha = -std::acos(cos_ha); // HA before upper culmination
// } else {
// static_assert(false, "UNKNOWN ALTITUDE LIMIT TYPE!");
// }
MccAngle time_ang = ha - telemetry_data.mntHA; // in sideral time scale
if (time_ang < 0.0) { // next day
time_ang += pi2;
}
time_ang *= mcc_UT1_to_sideral_ratio;
time_ang /= mcc_sideral_to_UT1_ratio; // to UT1 time scale
return pz_duration_t{time_ang.seconds()};
}