#pragma once /* MOUNT CONTROL COMPONENTS LIBRARY */ /* MCC LIBRARY DEFAULT IMPLEMENTATION OF SOME CLASSES */ // #include #include "mcc_generics.h" namespace mcc { /* DEFAULT TIME POINT CLASS */ typedef std::chrono::system_clock::time_point MccTimePoint; template static constexpr DT mcc_infinite_duration_v = std::floating_point ? DT{std::numeric_limits::infinity()} : DT{std::numeric_limits::max()}; /* DEFAULT JULIAN DAY CLASS */ struct MccJulianDay { static constexpr double MJD0 = 2400000.5; MccJulianDay() = default; MccJulianDay(double jd) : mjd(jd - MJD0) {} constexpr operator double() const { return MccJulianDay::MJD0 + mjd; } MccJulianDay& operator=(double jd) { mjd = jd - MJD0; return *this; } double MJD() const { return mjd; } constexpr auto operator<=>(const MccJulianDay&) const = default; constexpr auto operator<=>(double v) const { return v <=> (MccJulianDay::MJD0 + mjd); }; protected: double mjd{51544.5}; // J2000.0 }; /* DEFAULT CELESTIAL POINT CLASS */ template struct MccGenericCelestialPoint { typedef CoordT coord_t; MccCoordPairKind pair_kind{MccCoordPairKind::COORDS_KIND_RADEC_ICRS}; MccTimePoint time_point{std::chrono::sys_days(std::chrono::year_month_day{std::chrono::January / 1 / 2000}) + std::chrono::hours(12)}; // J2000.0 coord_t X{}, Y{}; }; typedef MccGenericCelestialPoint MccCelestialPoint; template struct MccGenericEqtHrzCoords : MccGenericCelestialPoint { using typename MccGenericCelestialPoint::coord_t; using MccGenericCelestialPoint::time_point; coord_t RA_APP{}, DEC_APP{}, HA{}, AZ{}, ZD{}, ALT{}; }; typedef MccGenericEqtHrzCoords MccEqtHrzCoords; template struct MccGenericPointingTarget : MccGenericEqtHrzCoords { using typename MccGenericEqtHrzCoords::coord_t; coord_t RA_ICRS{}, DEC_ICRS{}; }; typedef MccGenericPointingTarget MccPointingTarget; /* DEFAULT TELEMETRY DATA CLASS */ template struct MccGenericTelemetryData : MccGenericEqtHrzCoords { using typename MccGenericEqtHrzCoords::coord_t; MccJulianDay JD; coord_t LST; // local apparent sideral time MccGenericPointingTarget target{}; coord_t speedX, speedY; coord_t pcmX, pcmY; coord_t refCorr; }; typedef MccGenericTelemetryData MccTelemetryData; /* JUST CHECK FOR CONCEPT CONSISTENCY */ static_assert(mcc_julday_c, ""); static_assert(mcc_celestial_point_c, ""); static_assert(mcc_telemetry_data_c, ""); } // namespace mcc