...
This commit is contained in:
parent
441743ff01
commit
b9ee662850
@ -120,7 +120,7 @@ set(MOUNT_SERVER_APP_SRC mount.h mount_state.h mount_server.cpp comm_server.h co
|
|||||||
set(MOUNT_SERVER_APP mount_server)
|
set(MOUNT_SERVER_APP mount_server)
|
||||||
add_executable(${MOUNT_SERVER_APP} ${MOUNT_SERVER_APP_SRC})
|
add_executable(${MOUNT_SERVER_APP} ${MOUNT_SERVER_APP_SRC})
|
||||||
# target_include_directories(${MOUNT_SERVER_APP} PUBLIC ${ERFA_INCLUDE_DIR})
|
# target_include_directories(${MOUNT_SERVER_APP} PUBLIC ${ERFA_INCLUDE_DIR})
|
||||||
target_link_libraries(${MOUNT_SERVER_APP} ${CNTR_PROTO_LIB} spdlog::spdlog_header_only ${ERFA_LIB})
|
target_link_libraries(${MOUNT_SERVER_APP} ${CNTR_PROTO_LIB} spdlog::spdlog_header_only ERFA_LIB)
|
||||||
|
|
||||||
if (WITH_TESTS)
|
if (WITH_TESTS)
|
||||||
set(CNTR_PROTO_TEST_APP cntr_proto_test)
|
set(CNTR_PROTO_TEST_APP cntr_proto_test)
|
||||||
@ -133,6 +133,6 @@ if (WITH_TESTS)
|
|||||||
add_executable(${CFGFILE_TEST_APP} tests/configfile_test.cpp)
|
add_executable(${CFGFILE_TEST_APP} tests/configfile_test.cpp)
|
||||||
|
|
||||||
set(ASTROM_TEST_APP astrom_test)
|
set(ASTROM_TEST_APP astrom_test)
|
||||||
add_executable(${ASTROM_TEST_APP} tests/astrom_test.cpp
|
add_executable(${ASTROM_TEST_APP} tests/astrom_test.cpp)
|
||||||
mcc_traits.h)
|
target_link_libraries(${ASTROM_TEST_APP} ERFA_LIB)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
52
cxx/mount.h
52
cxx/mount.h
@ -110,6 +110,8 @@ class MccMount : public utils::MccSpdlogLogger
|
|||||||
public:
|
public:
|
||||||
static constexpr MccMountType mountType = MOUNT_TYPE;
|
static constexpr MccMountType mountType = MOUNT_TYPE;
|
||||||
|
|
||||||
|
enum IersDatabaseType { IERS_DB_LEAPSECS, IERS_DB_EARTH_ORIENT };
|
||||||
|
|
||||||
/* mount main-cycle variable quantities (mount orientation) */
|
/* mount main-cycle variable quantities (mount orientation) */
|
||||||
struct mount_orient_t {
|
struct mount_orient_t {
|
||||||
// time-related
|
// time-related
|
||||||
@ -162,23 +164,8 @@ public:
|
|||||||
|
|
||||||
logInfo("Load leap seconds and Earth orientation databases ...");
|
logInfo("Load leap seconds and Earth orientation databases ...");
|
||||||
|
|
||||||
auto time_db_loader = [this](const std::string& filename, std::string_view type, auto& db) {
|
updateIERSDatabase(IERS_DB_LEAPSECS);
|
||||||
if (filename.empty()) {
|
updateIERSDatabase(IERS_DB_EARTH_ORIENT);
|
||||||
logWarn("An empty {} filename! Skip and keep default values!", type);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ok = db.load(filename);
|
|
||||||
if (!ok) {
|
|
||||||
logError("CANNOT parse {} file '{}' or it is not accessible!", type, filename);
|
|
||||||
logWarn("Keep {} database in default state!", type);
|
|
||||||
} else {
|
|
||||||
logInfo("{} database was successfully loaded from '{}' file", type, filename);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
time_db_loader(_mountCurrentConfig.leap_seconds_filename, "leap seconds", _leapSecondsDB);
|
|
||||||
time_db_loader(_mountCurrentConfig.earth_orient_filename, "Earth orientation", _earthOrientDB);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~MccMount()
|
virtual ~MccMount()
|
||||||
@ -211,6 +198,37 @@ public:
|
|||||||
_currentMeteo.store(meteo);
|
_currentMeteo.store(meteo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool updateIERSDatabase(IersDatabaseType type)
|
||||||
|
{
|
||||||
|
auto time_db_loader = [this](const std::string& filename, std::string_view type, auto& db) {
|
||||||
|
if (filename.empty()) {
|
||||||
|
logWarn("An empty {} filename! Skip and keep default values!", type);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ok = db.load(filename);
|
||||||
|
if (!ok) {
|
||||||
|
logError("CANNOT parse {} file '{}' or it is not accessible!", type, filename);
|
||||||
|
logWarn("Keep {} database in default state!", type);
|
||||||
|
} else {
|
||||||
|
logInfo("{} database was successfully loaded from '{}' file", type, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
};
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case IERS_DB_LEAPSECS:
|
||||||
|
return time_db_loader(_mountCurrentConfig.leap_seconds_filename, "leap seconds", _leapSecondsDB);
|
||||||
|
case IERS_DB_EARTH_ORIENT:
|
||||||
|
return time_db_loader(_mountCurrentConfig.earth_orient_filename, "Earth orientation", _earthOrientDB);
|
||||||
|
default:
|
||||||
|
logError("Invalid type for IERS database!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
mount_config_t _mountCurrentConfig;
|
mount_config_t _mountCurrentConfig;
|
||||||
|
|
||||||
|
|||||||
@ -42,9 +42,8 @@ concept mcc_real_or_char_range =
|
|||||||
namespace mcc::astrom
|
namespace mcc::astrom
|
||||||
{
|
{
|
||||||
|
|
||||||
// a time duration represented in radians (the precision is near 1 nanosecond)
|
// a time duration represented in radians (the precision is about 100 nanosecond for 10E8 secs (~1157 days))
|
||||||
// typedef std::chrono::duration<double, std::ratio<134670467, 10000000000000000>> mcc_radsec_duration_t;
|
typedef std::chrono::duration<double, std::ratio<314159265358979, 4320000000000000000>> mcc_chrono_radians;
|
||||||
typedef std::chrono::duration<double, std::ratio<134670467, 10000000000000000>> mcc_chrono_radians;
|
|
||||||
|
|
||||||
|
|
||||||
// https://gssc.esa.int/navipedia/index.php?title=CEP_to_ITRF
|
// https://gssc.esa.int/navipedia/index.php?title=CEP_to_ITRF
|
||||||
|
|||||||
@ -59,6 +59,15 @@ int main(int argc, char* argv[])
|
|||||||
auto st = mcc::astrom::mcc_julday(now, mjd);
|
auto st = mcc::astrom::mcc_julday(now, mjd);
|
||||||
std::cout << "MJD for now: " << std::setprecision(19) << mjd << " (" << now << ")\n";
|
std::cout << "MJD for now: " << std::setprecision(19) << mjd << " (" << now << ")\n";
|
||||||
|
|
||||||
|
// double pres = 786.6;
|
||||||
|
// double temp = 0.0;
|
||||||
|
// double hum = 0.8;
|
||||||
|
// double A, B;
|
||||||
|
|
||||||
|
// erfa::eraRefco(pres, temp, hum, 0.5, &A, &B);
|
||||||
|
// const double rr = 180.0 / std::numbers::pi * 60.0;
|
||||||
|
// std::cout << "A(arcmin) = " << A * rr << "; B(arcmin) = " << B * rr << "\n";
|
||||||
|
|
||||||
|
|
||||||
return ecode;
|
return ecode;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user