HLCC Documentation 2.2.0
Loading...
Searching...
No Matches
config.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2020-2025 European Southern Observatory (ESO)
2//
3// SPDX-License-Identifier: LGPL-3.0-only
4
13#ifndef HLCC_TRKSIM_CONFIG_HPP
14#define HLCC_TRKSIM_CONFIG_HPP
15
16#include <string>
17#include <config-ng/ciiConfigApi.hpp>
18#include <rad/config.hpp>
19#include "trksim/logger.hpp"
20
21namespace hlcc::trksim {
22/*
23 * Struct representing a state variable description
24 * with the state variable name and associated
25 * state variable type script to be used.
26 */
28 std::string sv_name;
29 std::string sv_type;
30};
31
32}// namespace hlcc::trksim
33
34
35namespace elt::configng {
36
37// Implementation of converter between hlcc::trksim::SvDescription and CiiConfigInstanceNode hierarchy
38// Decode method: Extract node values into hlcc::trksim::SvDescription
39// Encode method: construct nodes from values of hlcc::trksim::SvDescription
40template<>
41struct CiiConfigValueConverter<hlcc::trksim::SvDescription, CiiConfigInstanceNode> {
42 static bool Decode(const CiiConfigInstanceNode& node, hlcc::trksim::SvDescription &target) {
43 if (node.GetKind() != CiiConfigNodeKind::MAP || node.GetDataTypeName() != "SvDescription") {
44 std::cerr << "Conversion to SvDescription not possible" << std::endl;
45 return false;
46 }
47 target.sv_name = node["sv_name"].As<std::string>();
48 target.sv_type = node["sv_type"].As<std::string>();
49 return true;
50 }
51
52 static bool Encode(CiiConfigInstanceNode &node, const hlcc::trksim::SvDescription &source) {
53 if (node.GetKind() != elt::configng::CiiConfigNodeKind::MAP) {
54 return false;
55 }
56 node.Set("sv_name", elt::configng::CiiConfigInstanceNode::From(source.sv_name));
57 node.Set("sv_type", elt::configng::CiiConfigInstanceNode::From(source.sv_type));
58 return true;
59 }
60};
61
62} // namespace elt::configng
63
64
65namespace hlcc::trksim {
66
67class ConfigError : public std::runtime_error {
68public:
69 explicit ConfigError(const std::string& message)
70 : std::runtime_error(message)
71 {}
72};
73
74
76// const char KEY_SEPARATOR_CFG = '.';
77// const std::string CONFIG_ROOT_NODE = "app";
78
79/*
80 * Configuration OLDB Attributes.
81 * Note that CII OLDB convert all keys to lowercase.
82 *
83 * The following definitions are handled in rad/cpp/app/src/include/rad/config.hpp
84 * const std::string KEY_CONFIG = "cfg/";
85 * const std::string KEY_CONFIG_VERSION = KEY_CONFIG + "version";
86 * const std::string KEY_CONFIG_PROCNAME = KEY_CONFIG + "procname";
87 * const std::string KEY_CONFIG_FILENAME = KEY_CONFIG + "filename";
88 * const std::string KEY_CONFIG_LOG_LEVEL = KEY_CONFIG + "log_level";
89 * const std::string KEY_CONFIG_LOG_PROPERTIES = KEY_CONFIG + "log_properties";
90 * const std::string KEY_CONFIG_SM_SCXML = KEY_CONFIG + "sm_scxml";
91 * const std::string KEY_CONFIG_SM_APPEND = KEY_CONFIG + "sm_scxml_append";
92 * const std::string KEY_CONFIG_REQ_ENDPOINT = KEY_CONFIG + "req_endpoint";
93 * const std::string KEY_CONFIG_OLDB_URI_PREFIX = KEY_CONFIG + "oldb_uri_prefix";
94 * const std::string KEY_CONFIG_OLDB_CONN_TIMEOUT = KEY_CONFIG + "oldb_conn_timeout";
95 * const std::string KEY_CONFIG_OLDB_ASYNC_PERIOD = KEY_CONFIG + "oldb_async_period";
96 * const std::string KEY_CONFIG_TRS_HEALTH_ENABLED = KEY_CONFIG + "trs_health_enabled";
97 */
98const std::string KEY_CONFIG = rad::KEY_CONFIG;
99const std::string KEY_CONFIG_PUB_DETERM_DEST = KEY_CONFIG + "pub/determ/dest";
100const std::string KEY_CONFIG_PUB_DETERM_NIC = KEY_CONFIG + "pub/determ/nic";
101const std::string KEY_CONFIG_PUB_DETERM_DEST2 = KEY_CONFIG + "pub/determ/dest2";
102const std::string KEY_CONFIG_PUB_DETERM_DEST3 = KEY_CONFIG + "pub/determ/dest3";
103const std::string KEY_CONFIG_PUB_DETERM_DEST4 = KEY_CONFIG + "pub/determ/dest4";
104const std::string KEY_CONFIG_PUB_DETERM_DEST5 = KEY_CONFIG + "pub/determ/dest5";
105const std::string KEY_CONFIG_PUB_DETERM_DEST6 = KEY_CONFIG + "pub/determ/dest6";
106const std::string KEY_CONFIG_PUB_DDS_PROFILE = KEY_CONFIG + "pub/dds/profile";
107const std::string KEY_CONFIG_PUB_DDS_NIC = KEY_CONFIG + "pub/dds/nic";
108const std::string KEY_CONFIG_PUB_DDS_FILE = KEY_CONFIG + "pub/dds/file";
109const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_HLCC = KEY_CONFIG + "pub/dds/domain_id_hlcc";
110const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_CCS_INS = KEY_CONFIG + "pub/dds/domain_id_ccs_ins";
111const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_GENERAL = KEY_CONFIG + "pub/dds/domain_id_general";
112const std::string KEY_CONFIG_PARAMS_MOV_MIN_DELTA = KEY_CONFIG + "params/moving_min_delta";
113const std::string KEY_CONFIG_PARAMS_TRACKING_ERROR = KEY_CONFIG + "params/tracking_error";
114const std::string KEY_CONFIG_PARAMS_ALT_SPEED_DEG_PER_S = KEY_CONFIG + "params/alt_speed_deg_per_s";
115const std::string KEY_CONFIG_PARAMS_AZ_SPEED_DEG_PER_S = KEY_CONFIG + "params/az_speed_deg_per_s";
116const std::string KEY_CONFIG_ALTAZ_ALT_UPPER_LIMIT_OP = KEY_CONFIG + "altaz/alt_upper_limit_op";
117const std::string KEY_CONFIG_ALTAZ_ALT_LOWER_LIMIT_OP = KEY_CONFIG + "altaz/alt_lower_limit_op";
118const std::string KEY_CONFIG_ALTAZ_AZ_UPPER_LIMIT_OP = KEY_CONFIG + "altaz/az_upper_limit_op";
119const std::string KEY_CONFIG_ALTAZ_AZ_LOWER_LIMIT_OP = KEY_CONFIG + "altaz/az_lower_limit_op";
120const std::string KEY_CONFIG_ALTAZ_ALT_UPPER_LIMIT_FCT = KEY_CONFIG + "altaz/alt_upper_limit_fct";
121const std::string KEY_CONFIG_ALTAZ_ALT_LOWER_LIMIT_FCT = KEY_CONFIG + "altaz/alt_lower_limit_fct";
122const std::string KEY_CONFIG_ALTAZ_AZ_UPPER_LIMIT_FCT = KEY_CONFIG + "altaz/az_upper_limit_fct";
123const std::string KEY_CONFIG_ALTAZ_AZ_LOWER_LIMIT_FCT = KEY_CONFIG + "altaz/az_lower_limit_fct";
124const std::string KEY_CONFIG_SITE_INFO_ELEVATION = KEY_CONFIG + "site/info/elevation";
125const std::string KEY_CONFIG_SITE_INFO_LATITUDE = KEY_CONFIG + "site/info/latitude";
126const std::string KEY_CONFIG_SITE_INFO_LONGITUDE = KEY_CONFIG + "site/info/longitude";
127const std::string KEY_CONFIG_SITE_INFO_ID = KEY_CONFIG + "site/info/id";
128const std::string KEY_CONFIG_SV_LIST = KEY_CONFIG + "sv_list";
129const std::string KEY_CONFIG_SV_SPECIFIC_CONFIG = KEY_CONFIG + "sv_specific_config";
130const std::string KEY_CONFIG_SIM_ACTIVITY_PERIOD_MS = KEY_CONFIG + "sim_activity_period_ms";
131
146
164
171
172
176const std::string CONFIG_DEFAULT_VERSION = std::string(VERSION);
177const std::string CONFIG_DEFAULT_MODNAME = "trksim";
178const std::string CONFIG_DEFAULT_PROCNAME = "trksim";
179const std::string CONFIG_DEFAULT_FILENAME = "config/trksim/config.yaml";
180const std::string CONFIG_DEFAULT_SCXML_FILENAME = "config/trksim/sm.xml";
181const std::string CONFIG_DEFAULT_SCXML_APPEND = "";
182const std::string CONFIG_DEFAULT_LOG_LEVEL = "INFO";
183const std::string CONFIG_DEFAULT_LOG_PROPERTIES = "config/trksim/log.properties";
184const std::string CONFIG_DEFAULT_REQ_ENDPOINT = "zpb.rr://127.0.0.1:11006/"; // the potentially unsafe zpb.rr://0.0.0.0:12081/ we use only in the yaml file.
185const std::string CONFIG_DEFAULT_OLDB_URI_PREFIX = "cii.oldb:///elt/tel/";
186const uint32_t CONFIG_DEFAULT_OLDB_CONN_TIMEOUT = 1; // sec
187const uint32_t CONFIG_DEFAULT_OLDB_ASYNC_PERIOD = 0; // ms; we currently do not use RAD async OLDB writes, but still configure all standard attributes.
189
190const std::string CONFIG_DEFAULT_PUB_DETERM_DEST = "239.128.7.1:10000"; // override telif:ccs:deterministic (CCsInsTopics.xml)
191const std::string CONFIG_DEFAULT_PUB_DETERM_NIC = "127.0.0.1"; // iface for mcast
192const std::string CONFIG_DEFAULT_PUB_DETERM_DEST2 = "";
193const std::string CONFIG_DEFAULT_PUB_DETERM_DEST3 = "";
194const std::string CONFIG_DEFAULT_PUB_DETERM_DEST4 = "";
195const std::string CONFIG_DEFAULT_PUB_DETERM_DEST5 = "";
196const std::string CONFIG_DEFAULT_PUB_DETERM_DEST6 = "";
197const std::string CONFIG_DEFAULT_PUB_DDS_PROFILE = "";
198const std::string CONFIG_DEFAULT_PUB_DDS_NIC = "";
199const std::string CONFIG_DEFAULT_PUB_DDS_FILE = "";
203const double CONFIG_DEFAULT_PARAMS_MOV_MIN_DELTA = 0.003; // arcsec/s - double
204const double CONFIG_DEFAULT_PARAMS_TRACKING_ERROR = 0.5; // arcsec - double
205const double CONFIG_DEFAULT_PARAMS_ALT_SPEED_DEG_PER_S = 5.0; // degree - double
206const double CONFIG_DEFAULT_PARAMS_AZ_SPEED_DEG_PER_S = 5.0; // degree - double
207const double CONFIG_DEFAULT_ALTAZ_ALT_UPPER_LIMIT_OP = 1.544616; // radians - double
208const double CONFIG_DEFAULT_ALTAZ_ALT_LOWER_LIMIT_OP = 0.349066; // radians - double
209const double CONFIG_DEFAULT_ALTAZ_AZ_UPPER_LIMIT_OP = 6.283185; // radians - double
210const double CONFIG_DEFAULT_ALTAZ_AZ_LOWER_LIMIT_OP = -3.141593; // radians - double
211const double CONFIG_DEFAULT_ALTAZ_ALT_UPPER_LIMIT_FCT = 1.570796; // radians - double
212const double CONFIG_DEFAULT_ALTAZ_ALT_LOWER_LIMIT_FCT = 0.0; // radians - double
213const double CONFIG_DEFAULT_ALTAZ_AZ_UPPER_LIMIT_FCT = 6.283185; // radians - double
214const double CONFIG_DEFAULT_ALTAZ_AZ_LOWER_LIMIT_FCT = -3.141593; // radians - double
215const double CONFIG_DEFAULT_SITE_INFO_ELEVATION = 3046; // meters - double
216const double CONFIG_DEFAULT_SITE_INFO_LATITUDE = -0.429164; // radians - double
217const double CONFIG_DEFAULT_SITE_INFO_LONGITUDE = 1.225075; // radians - double
218const std::string CONFIG_DEFAULT_SITE_INFO_ID = "ELT"; //
219const std::vector<SvDescription> CONFIG_DEFAULT_SV_LIST = {};
222
223/*
224 * Struct packing all configuration parameters
225 */
227 std::string modname;
228 std::string procname;
229 std::string filename;
230 std::string sm_scxml;
231 std::string sm_append;
232 std::string log_level;
233 std::string log_properties;
234 std::string req_endpoint;
235 std::string oldb_uri_prefix;
238 std::vector<SvDescription> sv_list;
241 std::string pub_dds_profile;
242 std::string pub_dds_nic;
243 std::string pub_dds_file;
247};
248
253class Config : public rad::Config {
254 public:
262 Config();
263
267 virtual ~Config();
268
275
276 Config(const Config&) = delete;
277 Config& operator=(const Config&) = delete;
278
279};
280} // namespace hlcc::trksim
281
282#endif // HLCC_TRKSIM_CONFIG_HPP
Definition config.hpp:67
ConfigError(const std::string &message)
Definition config.hpp:69
Definition config.hpp:253
Config(const Config &)=delete
Config & operator=(const Config &)=delete
Disable copy constructor.
virtual ~Config()
Definition config.cpp:73
Config()
Definition config.cpp:22
ConfigPack GetConfigPack()
Definition config.cpp:77
Definition guideStarHelper.cpp:19
Definition actionMgr.cpp:35
const uint32_t CONFIG_DEFAULT_OLDB_ASYNC_PERIOD
Definition config.hpp:187
const uint32_t CONFIG_DEFAULT_PUB_DDS_DOMAIN_ID_HLCC
Definition config.hpp:200
const std::string KEY_CONFIG_ALTAZ_AZ_LOWER_LIMIT_FCT
Definition config.hpp:123
const std::string KEY_CONFIG_ALTAZ_AZ_UPPER_LIMIT_OP
Definition config.hpp:118
const std::string KEY_CONFIG_SV_SPECIFIC_CONFIG
Definition config.hpp:129
const double CONFIG_DEFAULT_ALTAZ_AZ_UPPER_LIMIT_OP
Definition config.hpp:209
const uint32_t CONFIG_DEFAULT_OLDB_CONN_TIMEOUT
Definition config.hpp:186
const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_CCS_INS
Definition config.hpp:110
const std::vector< SvDescription > CONFIG_DEFAULT_SV_LIST
Definition config.hpp:219
const std::string KEY_CONFIG_ALTAZ_ALT_UPPER_LIMIT_OP
Definition config.hpp:116
const double CONFIG_DEFAULT_SITE_INFO_LONGITUDE
Definition config.hpp:217
const std::string KEY_CONFIG_PUB_DETERM_NIC
Definition config.hpp:100
const std::string CONFIG_DEFAULT_PUB_DDS_PROFILE
Definition config.hpp:197
const std::string KEY_CONFIG_ALTAZ_ALT_LOWER_LIMIT_OP
Definition config.hpp:117
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST3
Definition config.hpp:193
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST
Definition config.hpp:190
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST5
Definition config.hpp:195
const std::string KEY_CONFIG_ALTAZ_ALT_LOWER_LIMIT_FCT
Definition config.hpp:121
const std::vector< std::string > OLDB_CFG_KEYS_STRING
Definition config.hpp:132
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST2
Definition config.hpp:192
const double CONFIG_DEFAULT_ALTAZ_ALT_LOWER_LIMIT_OP
Definition config.hpp:208
const double CONFIG_DEFAULT_SITE_INFO_LATITUDE
Definition config.hpp:216
const std::string KEY_CONFIG_ALTAZ_AZ_LOWER_LIMIT_OP
Definition config.hpp:119
const std::string CONFIG_DEFAULT_PROCNAME
Definition config.hpp:178
const double CONFIG_DEFAULT_ALTAZ_ALT_UPPER_LIMIT_FCT
Definition config.hpp:211
const std::vector< std::string > OLDB_CFG_KEYS_DOUBLE
Definition config.hpp:147
const std::string CONFIG_DEFAULT_FILENAME
Definition config.hpp:179
const std::string KEY_CONFIG_PARAMS_AZ_SPEED_DEG_PER_S
Definition config.hpp:115
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST6
Definition config.hpp:196
const std::string CONFIG_DEFAULT_SITE_INFO_ID
Definition config.hpp:218
const std::string CONFIG_DEFAULT_OLDB_URI_PREFIX
Definition config.hpp:185
const char CONFIG_KEY_SEPARATOR_OLDB
Definition config.hpp:75
const std::string KEY_CONFIG
Definition config.hpp:98
const std::string KEY_CONFIG_PUB_DETERM_DEST
Definition config.hpp:99
const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_HLCC
Definition config.hpp:109
const double CONFIG_DEFAULT_PARAMS_ALT_SPEED_DEG_PER_S
Definition config.hpp:205
const std::string KEY_CONFIG_PUB_DDS_PROFILE
Definition config.hpp:106
const std::string CONFIG_DEFAULT_PUB_DETERM_NIC
Definition config.hpp:191
const std::string CONFIG_DEFAULT_LOG_LEVEL
Definition config.hpp:182
const double CONFIG_DEFAULT_PARAMS_TRACKING_ERROR
Definition config.hpp:204
const std::string KEY_CONFIG_SIM_ACTIVITY_PERIOD_MS
Definition config.hpp:130
const std::string KEY_CONFIG_PUB_DETERM_DEST2
Definition config.hpp:101
const std::vector< std::string > OLDB_CFG_KEYS_UINT32
Definition config.hpp:165
const uint32_t CONFIG_DEFAULT_PUB_DDS_DOMAIN_ID_GENERAL
Definition config.hpp:202
const double CONFIG_DEFAULT_ALTAZ_AZ_LOWER_LIMIT_FCT
Definition config.hpp:214
const bool CONFIG_DEFAULT_TRS_HEALTH_ENABLED
Definition config.hpp:188
const std::string KEY_CONFIG_PARAMS_MOV_MIN_DELTA
Definition config.hpp:112
const double CONFIG_DEFAULT_ALTAZ_ALT_UPPER_LIMIT_OP
Definition config.hpp:207
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST4
Definition config.hpp:194
const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_GENERAL
Definition config.hpp:111
const std::string KEY_CONFIG_SITE_INFO_LATITUDE
Definition config.hpp:125
const double CONFIG_DEFAULT_SITE_INFO_ELEVATION
Definition config.hpp:215
const std::string KEY_CONFIG_PARAMS_TRACKING_ERROR
Definition config.hpp:113
const std::string KEY_CONFIG_SITE_INFO_ID
Definition config.hpp:127
const std::string KEY_CONFIG_PUB_DETERM_DEST3
Definition config.hpp:102
const std::string KEY_CONFIG_SV_LIST
Definition config.hpp:128
const std::string KEY_CONFIG_PUB_DDS_NIC
Definition config.hpp:107
const std::string KEY_CONFIG_PUB_DETERM_DEST6
Definition config.hpp:105
const std::string KEY_CONFIG_ALTAZ_AZ_UPPER_LIMIT_FCT
Definition config.hpp:122
const std::string CONFIG_DEFAULT_REQ_ENDPOINT
Definition config.hpp:184
const std::string CONFIG_DEFAULT_LOG_PROPERTIES
Definition config.hpp:183
const double CONFIG_DEFAULT_ALTAZ_ALT_LOWER_LIMIT_FCT
Definition config.hpp:212
const std::string KEY_CONFIG_PUB_DDS_FILE
Definition config.hpp:108
const double CONFIG_DEFAULT_PARAMS_AZ_SPEED_DEG_PER_S
Definition config.hpp:206
const std::string CONFIG_DEFAULT_PUB_DDS_NIC
Definition config.hpp:198
const std::string CONFIG_DEFAULT_VERSION
Definition config.hpp:176
const std::string KEY_CONFIG_PARAMS_ALT_SPEED_DEG_PER_S
Definition config.hpp:114
const std::string CONFIG_DEFAULT_SCXML_FILENAME
Definition config.hpp:180
const std::string KEY_CONFIG_SITE_INFO_ELEVATION
Definition config.hpp:124
const std::string KEY_CONFIG_SITE_INFO_LONGITUDE
Definition config.hpp:126
const std::string CONFIG_DEFAULT_MODNAME
Definition config.hpp:177
const uint32_t CONFIG_DEFAULT_PUB_DDS_DOMAIN_ID_CCS_INS
Definition config.hpp:201
const double CONFIG_DEFAULT_PARAMS_MOV_MIN_DELTA
Definition config.hpp:203
const uint32_t CONFIG_DEFAULT_SIM_ACTIVITY_PERIOD_MS
Definition config.hpp:221
const std::string CONFIG_DEFAULT_SCXML_APPEND
Definition config.hpp:181
const double CONFIG_DEFAULT_ALTAZ_AZ_UPPER_LIMIT_FCT
Definition config.hpp:213
const std::string CONFIG_DEFAULT_SV_SPECIFIC_CONFIG
Definition config.hpp:220
const std::string KEY_CONFIG_PUB_DETERM_DEST5
Definition config.hpp:104
const std::string KEY_CONFIG_PUB_DETERM_DEST4
Definition config.hpp:103
const std::string CONFIG_DEFAULT_PUB_DDS_FILE
Definition config.hpp:199
const double CONFIG_DEFAULT_ALTAZ_AZ_LOWER_LIMIT_OP
Definition config.hpp:210
const std::string KEY_CONFIG_ALTAZ_ALT_UPPER_LIMIT_FCT
Definition config.hpp:120
Definition ccsinsoldb.hpp:10
static bool Decode(const CiiConfigInstanceNode &node, hlcc::trksim::SvDescription &target)
Definition config.hpp:42
static bool Encode(CiiConfigInstanceNode &node, const hlcc::trksim::SvDescription &source)
Definition config.hpp:52
Definition config.hpp:226
std::string procname
Definition config.hpp:228
std::uint32_t pub_dds_domain_id_ccs_ins
Definition config.hpp:245
std::string pub_dds_nic
Definition config.hpp:242
uint16_t sim_activity_period_ms
Definition config.hpp:239
std::string log_properties
Definition config.hpp:233
std::uint32_t pub_dds_domain_id_hlcc
Definition config.hpp:244
std::uint32_t pub_dds_domain_id_general
Definition config.hpp:246
std::string sm_append
Definition config.hpp:231
std::string log_level
Definition config.hpp:232
std::string filename
Definition config.hpp:229
int conn_timeout
Definition config.hpp:236
std::string sv_specific_config
Definition config.hpp:240
std::string modname
Definition config.hpp:227
int oldb_async_period
Definition config.hpp:237
std::vector< SvDescription > sv_list
Definition config.hpp:238
std::string sm_scxml
Definition config.hpp:230
std::string pub_dds_file
Definition config.hpp:243
std::string req_endpoint
Definition config.hpp:234
std::string oldb_uri_prefix
Definition config.hpp:235
std::string pub_dds_profile
Definition config.hpp:241
Definition config.hpp:27
std::string sv_type
Definition config.hpp:29
std::string sv_name
Definition config.hpp:28
Default logger name.