This commit is contained in:
Timur A. Fatkhullin 2025-07-05 22:37:22 +03:00
parent c9e9115ebc
commit 2b3d8a766b
3 changed files with 42 additions and 33 deletions

View File

@ -61,8 +61,8 @@ public:
double wavelength = 0.55; // observed wavelength in mkm double wavelength = 0.55; // observed wavelength in mkm
MccAngleLAT lat = "00:00:00"_dms; // site latitude MccAngle lat = "00:00:00"_dms; // site latitude
MccAngleLON lon = "00:00:00"_dms; // site longitude MccAngle lon = "00:00:00"_dms; // site longitude
double elev = 0.0; // site elevation (in meters) double elev = 0.0; // site elevation (in meters)
mcc::astrom::iers::MccLeapSeconds _leapSeconds{}; mcc::astrom::iers::MccLeapSeconds _leapSeconds{};
@ -104,7 +104,7 @@ public:
engine_state_t getState() const engine_state_t getState() const
{ {
std::scoped_lock lock{_stateMutex}; std::lock_guard lock{_stateMutex};
return _currentState; return _currentState;
} }
@ -164,7 +164,7 @@ public:
using real_days_t = std::chrono::duration<double, std::ratio<86400>>; using real_days_t = std::chrono::duration<double, std::ratio<86400>>;
double ut1, tt = juldate.mjd; double ut1 = juldate.mjd, tt = juldate.mjd;
auto dut1 = _currentState._bulletinA.DUT1(juldate.mjd); auto dut1 = _currentState._bulletinA.DUT1(juldate.mjd);
@ -234,6 +234,9 @@ public:
if (!pol_pos.has_value()) { if (!pol_pos.has_value()) {
return ERROR_BULLETINA_OUT_OF_RANGE; return ERROR_BULLETINA_OUT_OF_RANGE;
} }
const auto arcsec2rad = std::numbers::pi / 180 / 3600;
pol_pos->x *= arcsec2rad;
pol_pos->y *= arcsec2rad;
double oaz, ozd, oha, odec, ora; double oaz, ozd, oha, odec, ora;
@ -298,7 +301,7 @@ public:
protected: protected:
engine_state_t _currentState{}; engine_state_t _currentState{};
std::mutex _stateMutex; mutable std::mutex _stateMutex;
}; };
} // namespace mcc::astrom::erfa } // namespace mcc::astrom::erfa

View File

@ -84,7 +84,7 @@ public:
// computing ... // computing ...
std::scoped_lock lock{_updateMutex}; std::lock_guard lock{_updateMutex};
_data = current_data; _data = current_data;
}; };
@ -102,7 +102,7 @@ public:
{ {
using self_t = decltype(self); using self_t = decltype(self);
std::scoped_lock lock{std::forward<self_t>(self)._updateMutex}; std::lock_guard lock{std::forward<self_t>(self)._updateMutex};
return std::move(std::forward<self_t>(self)._data); return std::move(std::forward<self_t>(self)._data);
} }

View File

@ -2,30 +2,10 @@
#include <iostream> #include <iostream>
// #include "../mcc_coord.h" // #include "../mcc_coord.h"
#include "../mcc_mount_astro_erfa.h"
#include "../mcc_traits.h" #include "../mcc_traits.h"
#include "../mount_astrom.h" #include "../mount_astrom.h"
template <typename T, typename U>
concept ncr_c =
std::is_lvalue_reference_v<T> && !std::is_const_v<T> && std::constructible_from<std::remove_reference_t<T>, U>;
template <typename T>
concept ae_c = requires(T t) {
requires mcc::traits::mcc_systime_c<mcc::traits::mcc_func_arg1_t<decltype(&T::greg2jul)>>;
requires mcc::traits::mcc_output_arg_c<mcc::traits::mcc_func_argN_t<decltype(&T::greg2jul), 2>>;
// requires ncr_c<mcc::traits::mcc_func_argN_t<decltype(&T::greg2jul), 2>, double>;
// requires std::constructible_from<mcc::traits::mcc_func_argN_t<decltype(&T::greg2jul), 2>, double>;
};
struct AE {
// int greg2jul(mcc::traits::mcc_systime_c auto t, double f) {}
int greg2jul(std::chrono::sys_time<std::chrono::nanoseconds> t, double& f)
{
return 0;
}
};
// BTA coords from maps.yandex.ru: 43.646711, 41.440732 // BTA coords from maps.yandex.ru: 43.646711, 41.440732
@ -136,8 +116,10 @@ int main(int argc, char* argv[])
now = std::chrono::system_clock::now(); now = std::chrono::system_clock::now();
for (auto& el : mjds) { for (auto& el : mjds) {
st = erfa::eraAtco13(1.343523, 0.32352345, 0.0, 0.0, 0.0, 0.0, ERFA_DJM0, el, 0.041, elong, phi, 2100.0, 0.0, st = mcc::astrom::erfa::eraAtco13(1.343523, 0.32352345, 0.0, 0.0, 0.0, 0.0, ERFA_DJM0, el, 0.041, elong, phi,
0.0, 700.0, 10.0, 0.8, 0.5, &aob, &zob, &hob, &dob, &rob, &eo); 2100.0, 0.0, 0.0, 700.0, 10.0, 0.8, 0.5, &aob, &zob, &hob, &dob, &rob, &eo);
// st = erfa::eraAtco13(1.343523, 0.32352345, 0.0, 0.0, 0.0, 0.0, ERFA_DJM0, el, 0.041, elong, phi, 2100.0, 0.0,
// 0.0, 700.0, 10.0, 0.8, 0.5, &aob, &zob, &hob, &dob, &rob, &eo);
} }
std::cout << std::format( std::cout << std::format(
"comp time for {} coordinate transf = {}\n", N, "comp time for {} coordinate transf = {}\n", N,
@ -161,8 +143,32 @@ int main(int argc, char* argv[])
std::cout << ra.sexagesimal(false, 4) << "\n"; std::cout << ra.sexagesimal(false, 4) << "\n";
std::cout << "\n\n\n";
std::cout << "ae_c = " << std::boolalpha << ae_c<AE> << "\n"; std::cout << "\n\n\n\n";
mcc::astrom::erfa::MccMountAstromEngineERFA::engine_state_t state;
state.lon = 41.440732_degs;
state.lat = 43.646711_degs;
state.elev = 2100.0;
state.meteo = {10.0, 0.5, 1010.0};
mcc::astrom::erfa::MccMountAstromEngineERFA erfa(state);
mcc::astrom::erfa::MccMountAstromEngineERFA::juldate_t jd{60861.72};
now = std::chrono::system_clock::now();
erfa.greg2jul(now, jd);
std::cout << "MJD(" << now << ") = " << jd.mjd << "\n";
mcc::MccAngle ra1{"10:00:00", mcc::mcc_hms}, dec1{"68:25:10.43"}, ra_o, dec_o, ha1, az1, alt1;
std::cout << "RA = " << ra1.sexagesimal(true) << ", DEC = " << dec1.sexagesimal() << "\n";
auto res = erfa.icrs2obs(ra1, dec1, 0, 0, 0, jd, ra_o, dec_o, ha1, az1, alt1, eo);
std::cout << "ret code (icrs2obs) = " << erfa.errorString(res) << "\n";
std::cout << "alt = " << alt1.sexagesimal() << "\n";
std::cout << "az = " << az1.sexagesimal() << "\n";
return ecode; return ecode;
} }