...
This commit is contained in:
@@ -21,6 +21,12 @@ namespace mcc::astrom::erfa
|
||||
#include <erfa.h>
|
||||
#include <erfam.h>
|
||||
|
||||
|
||||
/* A concept for ERFA-library compatible type to represent anglular quantities */
|
||||
template <typename T>
|
||||
concept mcc_erfa_angle_t = std::constructible_from<T, double> && std::convertible_to<T, double>;
|
||||
|
||||
template <mcc_erfa_angle_t AngleT = MccAngle>
|
||||
class MccMountAstromEngineERFA
|
||||
{
|
||||
protected:
|
||||
@@ -34,7 +40,7 @@ protected:
|
||||
"unacceptable year"};
|
||||
|
||||
public:
|
||||
enum engine_err_t : size_t {
|
||||
enum error_t : size_t {
|
||||
ERROR_OK = 0,
|
||||
ERROR_INVALID_INPUT_ARG,
|
||||
ERROR_JULDATE_INVALID_YEAR,
|
||||
@@ -62,9 +68,11 @@ public:
|
||||
|
||||
double wavelength = 0.55; // observed wavelength in mkm
|
||||
|
||||
MccAngle lat = "00:00:00"_dms; // site latitude
|
||||
MccAngle lon = "00:00:00"_dms; // site longitude
|
||||
double elev = 0.0; // site elevation (in meters)
|
||||
AngleT lat = "00:00:00"_dms; // site latitude
|
||||
AngleT lon = "00:00:00"_dms; // site longitude
|
||||
// MccAngle lat = "00:00:00"_dms; // site latitude
|
||||
// MccAngle lon = "00:00:00"_dms; // site longitude
|
||||
double elev = 0.0; // site elevation (in meters)
|
||||
|
||||
mcc::astrom::iers::MccLeapSeconds _leapSeconds{};
|
||||
mcc::astrom::iers::MccIersBulletinA _bulletinA{};
|
||||
@@ -77,12 +85,20 @@ public:
|
||||
double mjd{51544.5}; // J2000.0
|
||||
};
|
||||
|
||||
typedef MccAngle coord_t;
|
||||
// typedef MccAngle coord_t;
|
||||
|
||||
typedef MccAngle sideral_time_t;
|
||||
// typedef juldate_t terr_time_t;
|
||||
typedef MccAngle pa_t;
|
||||
typedef MccAngle eo_t;
|
||||
// typedef MccAngle sideral_time_t;
|
||||
// typedef MccAngle pa_t;
|
||||
// typedef MccAngle eo_t;
|
||||
|
||||
|
||||
/* use of the same type fro representation of celestial and geodetic coordinates, celestial angles (e.g. P.A.),
|
||||
* sideral time */
|
||||
typedef AngleT coord_t;
|
||||
|
||||
typedef AngleT sideral_time_t;
|
||||
typedef AngleT pa_t;
|
||||
typedef AngleT eo_t;
|
||||
|
||||
struct refract_result_t {
|
||||
double refa, refb;
|
||||
@@ -110,7 +126,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
std::string errorString(engine_err_t err) const
|
||||
std::string errorString(error_t err) const
|
||||
{
|
||||
return engineErrorString[err];
|
||||
}
|
||||
@@ -119,7 +135,7 @@ public:
|
||||
|
||||
// templated generic version
|
||||
template <mcc::traits::mcc_systime_c TpT>
|
||||
engine_err_t greg2jul(TpT time_point, juldate_t& juldate)
|
||||
error_t greg2jul(TpT time_point, juldate_t& juldate)
|
||||
{
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
@@ -152,13 +168,13 @@ public:
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
engine_err_t greg2jul(time_point_t time_point, juldate_t& juldate)
|
||||
error_t greg2jul(time_point_t time_point, juldate_t& juldate)
|
||||
{
|
||||
return greg2jul<time_point_t>(time_point, juldate);
|
||||
}
|
||||
|
||||
|
||||
engine_err_t terrestrialTime(juldate_t juldate, juldate_t& tt)
|
||||
error_t terrestrialTime(juldate_t juldate, juldate_t& tt)
|
||||
{
|
||||
std::lock_guard lock{_stateMutex};
|
||||
|
||||
@@ -179,7 +195,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
engine_err_t apparentSiderTime(juldate_t juldate, sideral_time_t& gst, bool islocal = false)
|
||||
error_t apparentSiderTime(juldate_t juldate, sideral_time_t& gst, bool islocal = false)
|
||||
{
|
||||
// std::lock_guard lock{_stateMutex};
|
||||
|
||||
@@ -227,7 +243,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
engine_err_t eqOrigins(juldate_t juldate, eo_t& eo)
|
||||
error_t eqOrigins(juldate_t juldate, eo_t& eo)
|
||||
{
|
||||
juldate_t tt;
|
||||
|
||||
@@ -243,7 +259,7 @@ public:
|
||||
|
||||
/* atmospheric refraction-related methods */
|
||||
|
||||
engine_err_t refraction(refract_result_t& refr)
|
||||
error_t refraction(refract_result_t& refr)
|
||||
{
|
||||
std::lock_guard lock{_stateMutex};
|
||||
|
||||
@@ -254,7 +270,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
engine_err_t refractCorrection(const coord_t& alt, const refract_result_t& ref_params, coord_t& corr)
|
||||
error_t refractCorrection(const coord_t& alt, const refract_result_t& ref_params, coord_t& corr)
|
||||
{
|
||||
if (alt <= 0.0) {
|
||||
corr = 35.4 / 60.0 * std::numbers::pi / 180.0; // 35.4 arcminutes
|
||||
@@ -268,14 +284,14 @@ public:
|
||||
|
||||
/* coordinates conversional methods */
|
||||
|
||||
engine_err_t icrs2obs(coord_t ra,
|
||||
coord_t dec,
|
||||
juldate_t juldate,
|
||||
coord_t& ra_app,
|
||||
coord_t& dec_app,
|
||||
coord_t& ha,
|
||||
coord_t& az,
|
||||
coord_t& alt)
|
||||
error_t icrs2obs(coord_t ra,
|
||||
coord_t dec,
|
||||
juldate_t juldate,
|
||||
coord_t& ra_app,
|
||||
coord_t& dec_app,
|
||||
coord_t& ha,
|
||||
coord_t& az,
|
||||
coord_t& alt)
|
||||
{
|
||||
std::lock_guard lock{_stateMutex};
|
||||
|
||||
@@ -316,7 +332,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
engine_err_t hadec2azalt(coord_t ha, coord_t dec, coord_t& az, coord_t& alt)
|
||||
error_t hadec2azalt(coord_t ha, coord_t dec, coord_t& az, coord_t& alt)
|
||||
{
|
||||
std::lock_guard lock{_stateMutex};
|
||||
|
||||
@@ -329,7 +345,7 @@ public:
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
engine_err_t azalt2hadec(coord_t az, coord_t alt, coord_t& ha, coord_t& dec)
|
||||
error_t azalt2hadec(coord_t az, coord_t alt, coord_t& ha, coord_t& dec)
|
||||
{
|
||||
std::lock_guard lock{_stateMutex};
|
||||
|
||||
@@ -344,7 +360,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
engine_err_t hadec2pa(coord_t ha, coord_t dec, pa_t& pa)
|
||||
error_t hadec2pa(coord_t ha, coord_t dec, pa_t& pa)
|
||||
{
|
||||
std::lock_guard lock{_stateMutex};
|
||||
|
||||
@@ -386,4 +402,4 @@ protected:
|
||||
} // namespace mcc::astrom::erfa
|
||||
|
||||
|
||||
static_assert(mcc::traits::mcc_astrom_engine_c<mcc::astrom::erfa::MccMountAstromEngineERFA>, "");
|
||||
static_assert(mcc::traits::mcc_astrom_engine_c<mcc::astrom::erfa::MccMountAstromEngineERFA<>>, "");
|
||||
|
||||
Reference in New Issue
Block a user