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_PFSSIMHLCC_CONFIG_HPP
14#define HLCC_PFSSIMHLCC_CONFIG_HPP
15
16#include <string>
17#include <rad/config.hpp>
18
19#include "pfssimhlcc/logger.hpp"
20
21
22namespace hlcc::pfssimhlcc {
24 std::string sv_name;
25 std::string sv_type;
26};
27}// namespace hlcc::pfssimhlcc
28
29
30namespace elt::configng {
31
32 // Implementation of converter between hlcc::pfssimhlcc::SvDescription and CiiConfigInstanceNode hierarchy
33 // Decode method: Extract node values into hlcc::pfssimhlcc::SvDescription
34 // Encode method: construct nodes from values of hlcc::pfssimhlcc::SvDescription
35 template<>
36 struct CiiConfigValueConverter<hlcc::pfssimhlcc::SvDescription, CiiConfigInstanceNode> {
37 static bool Decode(const CiiConfigInstanceNode& node, hlcc::pfssimhlcc::SvDescription &target) {
38 if (node.GetKind() != CiiConfigNodeKind::MAP || node.GetDataTypeName() != "SvDescription") {
39 std::cerr << "Conversion to SvDescription not possible" << std::endl;
40 return false;
41 }
42 target.sv_name = node["sv_name"].As<std::string>();
43 target.sv_type = node["sv_type"].As<std::string>();
44 return true;
45 }
46
47 static bool Encode(CiiConfigInstanceNode &node, const hlcc::pfssimhlcc::SvDescription &source) {
48 if (node.GetKind() != elt::configng::CiiConfigNodeKind::MAP) {
49 return false;
50 }
51 node.Set("sv_name", elt::configng::CiiConfigInstanceNode::From(source.sv_name));
52 node.Set("sv_type", elt::configng::CiiConfigInstanceNode::From(source.sv_type));
53 return true;
54 }
55 };
56
57} // namespace elt::configng
58namespace hlcc::pfssimhlcc {
59
60const std::string PREFIX_KEY_CONFIG = rad::KEY_CONFIG;
61const std::string KEY_CONFIG_PUB_DETERM_DEST = PREFIX_KEY_CONFIG + "pub/determ/dest";
62const std::string KEY_CONFIG_PUB_DETERM_NIC = PREFIX_KEY_CONFIG + "pub/determ/nic";
63const std::string KEY_CONFIG_PUB_DETERM_DEST2 = PREFIX_KEY_CONFIG + "pub/determ/dest2";
64const std::string KEY_CONFIG_PUB_DETERM_DEST3 = PREFIX_KEY_CONFIG + "pub/determ/dest3";
65const std::string KEY_CONFIG_PUB_DETERM_DEST4 = PREFIX_KEY_CONFIG + "pub/determ/dest4";
66const std::string KEY_CONFIG_PUB_DETERM_DEST5 = PREFIX_KEY_CONFIG + "pub/determ/dest5";
67const std::string KEY_CONFIG_PUB_DETERM_DEST6 = PREFIX_KEY_CONFIG + "pub/determ/dest6";
68const std::string KEY_CONFIG_PUB_DDS_PROFILE = PREFIX_KEY_CONFIG + "pub/dds/profile";
69const std::string KEY_CONFIG_PUB_DDS_PROFILE_TOPIC = PREFIX_KEY_CONFIG + "pub/dds/profile_topic";
70const std::string KEY_CONFIG_PUB_DDS_PROFILE_PUBLISHER = PREFIX_KEY_CONFIG + "pub/dds/profile_publisher";
71const std::string KEY_CONFIG_PUB_DDS_PROFILE_WRITER = PREFIX_KEY_CONFIG + "pub/dds/profile_writer";
72const std::string KEY_CONFIG_PUB_DDS_PROFILE_SUBSCRIBER = PREFIX_KEY_CONFIG + "pub/dds/profile_subscriber";
73const std::string KEY_CONFIG_PUB_DDS_PROFILE_READER = PREFIX_KEY_CONFIG + "pub/dds/profile_reader";
74const std::string KEY_CONFIG_PUB_DDS_PROFILE_FILE = PREFIX_KEY_CONFIG + "pub/dds/profile_file";
75const std::string KEY_CONFIG_PUB_DDS_NIC = PREFIX_KEY_CONFIG + "pub/dds/nic";
76const std::string KEY_CONFIG_PUB_DDS_FILE = PREFIX_KEY_CONFIG + "pub/dds/file";
77const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_HLCC = PREFIX_KEY_CONFIG + "pub/dds/domain_id_hlcc";
78const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_CCS_INS = PREFIX_KEY_CONFIG + "pub/dds/domain_id_ccs_ins";
79const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_GENERAL = PREFIX_KEY_CONFIG + "pub/dds/domain_id_general";
80const std::string KEY_CONFIG_SV_LIST = PREFIX_KEY_CONFIG + "sv_list";
81const std::string KEY_CONFIG_SV_SPECIFIC_CONFIG = PREFIX_KEY_CONFIG + "sv_specific_config";
82const std::string KEY_CONFIG_SIM_ACTIVITY_PERIOD_MS = PREFIX_KEY_CONFIG + "sim_activity_period_ms";
83
84// const std::string KEY_CONFIG_PARAMS_MOV_MIN_DELTA = PREFIX_KEY_CONFIG + "params/moving_min_delta";
85// const std::string KEY_CONFIG_PARAMS_TRACKING_ERROR = PREFIX_KEY_CONFIG + "params/tracking_error";
86// const std::string KEY_CONFIG_PARAMS_ALT_SPEED_DEG_PER_S = PREFIX_KEY_CONFIG + "params/alt_speed_deg_per_s";
87// const std::string KEY_CONFIG_PARAMS_AZ_SPEED_DEG_PER_S = PREFIX_KEY_CONFIG + "params/az_speed_deg_per_s";
88// const std::string KEY_CONFIG_ALTAZ_ALT_UPPER_LIMIT_OP = PREFIX_KEY_CONFIG + "altaz/alt_upper_limit_op";
89// const std::string KEY_CONFIG_ALTAZ_ALT_LOWER_LIMIT_OP = PREFIX_KEY_CONFIG + "altaz/alt_lower_limit_op";
90// const std::string KEY_CONFIG_ALTAZ_AZ_UPPER_LIMIT_OP = PREFIX_KEY_CONFIG + "altaz/az_upper_limit_op";
91// const std::string KEY_CONFIG_ALTAZ_AZ_LOWER_LIMIT_OP = PREFIX_KEY_CONFIG + "altaz/az_lower_limit_op";
92// const std::string KEY_CONFIG_ALTAZ_ALT_UPPER_LIMIT_FCT = PREFIX_KEY_CONFIG + "altaz/alt_upper_limit_fct";
93// const std::string KEY_CONFIG_ALTAZ_ALT_LOWER_LIMIT_FCT = PREFIX_KEY_CONFIG + "altaz/alt_lower_limit_fct";
94// const std::string KEY_CONFIG_ALTAZ_AZ_UPPER_LIMIT_FCT = PREFIX_KEY_CONFIG + "altaz/az_upper_limit_fct";
95// const std::string KEY_CONFIG_ALTAZ_AZ_LOWER_LIMIT_FCT = PREFIX_KEY_CONFIG + "altaz/az_lower_limit_fct";
96// const std::string KEY_CONFIG_SITE_INFO_ELEVATION = PREFIX_KEY_CONFIG + "site/info/elevation";
97// const std::string KEY_CONFIG_SITE_INFO_LATITUDE = PREFIX_KEY_CONFIG + "site/info/latitude";
98// const std::string KEY_CONFIG_SITE_INFO_LONGITUDE = PREFIX_KEY_CONFIG + "site/info/longitude";
99// const std::string KEY_CONFIG_SITE_INFO_ID = PREFIX_KEY_CONFIG + "site/info/id";
100
115
116const std::vector<std::string> OLDB_CFG_KEYS_DOUBLE = {
117 // KEY_CONFIG_PARAMS_MOV_MIN_DELTA,
118 // KEY_CONFIG_PARAMS_TRACKING_ERROR,
119 // KEY_CONFIG_PARAMS_ALT_SPEED_DEG_PER_S,
120 // KEY_CONFIG_PARAMS_AZ_SPEED_DEG_PER_S,
121 // KEY_CONFIG_ALTAZ_ALT_UPPER_LIMIT_OP,
122 // KEY_CONFIG_ALTAZ_ALT_LOWER_LIMIT_OP,
123 // KEY_CONFIG_ALTAZ_AZ_UPPER_LIMIT_OP,
124 // KEY_CONFIG_ALTAZ_AZ_LOWER_LIMIT_OP,
125 // KEY_CONFIG_ALTAZ_ALT_UPPER_LIMIT_FCT,
126 // KEY_CONFIG_ALTAZ_ALT_LOWER_LIMIT_FCT,
127 // KEY_CONFIG_ALTAZ_AZ_UPPER_LIMIT_FCT,
128 // KEY_CONFIG_ALTAZ_AZ_LOWER_LIMIT_FCT,
129 // KEY_CONFIG_SITE_INFO_ELEVATION,
130 // KEY_CONFIG_SITE_INFO_LATITUDE,
131 // KEY_CONFIG_SITE_INFO_LONGITUDE,
132};
133
143const std::string CONFIG_DEFAULT_VERSION = std::string(VERSION);
144const std::string CONFIG_DEFAULT_MODNAME = "pfssimhlcc";
145const std::string CONFIG_DEFAULT_PROCNAME = "pfssimhlcc";
146const std::string CONFIG_DEFAULT_FILENAME = "config/pfssimhlcc/config.yaml";
147const std::string CONFIG_DEFAULT_SCXML_FILENAME = "config/pfssimhlcc/sm.xml";
148const std::string CONFIG_DEFAULT_SCXML_APPEND = "";
149const std::string CONFIG_DEFAULT_LOG_LEVEL = "INFO";
150const std::string CONFIG_DEFAULT_LOG_PROPERTIES = "config/pfssimhlcc/log.properties";
151const std::string CONFIG_DEFAULT_REQ_ENDPOINT = "zpb.rr://127.0.0.1:11007/"; // the potentially unsafe zpb.rr://0.0.0.0:12081/ we use only in the yaml file.
152const std::string CONFIG_DEFAULT_OLDB_URI_PREFIX = "cii.oldb:///elt/tel/";
153const uint32_t CONFIG_DEFAULT_OLDB_CONN_TIMEOUT = 1; // sec
154const uint32_t CONFIG_DEFAULT_OLDB_ASYNC_PERIOD = 0; // ms; we currently do not use RAD async OLDB writes, but still configure all standard attributes.
156
157const std::string CONFIG_DEFAULT_PUB_DETERM_DEST = "239.128.7.1:10000"; // override telif:ccs:deterministic (CCsInsTopics.xml)
158const std::string CONFIG_DEFAULT_PUB_DETERM_NIC = "127.0.0.1"; // iface for mcast
159const std::string CONFIG_DEFAULT_PUB_DETERM_DEST2 = "";
160const std::string CONFIG_DEFAULT_PUB_DETERM_DEST3 = "";
161const std::string CONFIG_DEFAULT_PUB_DETERM_DEST4 = "";
162const std::string CONFIG_DEFAULT_PUB_DETERM_DEST5 = "";
163const std::string CONFIG_DEFAULT_PUB_DETERM_DEST6 = "";
164const std::string CONFIG_DEFAULT_PUB_DDS_PROFILE = "";
165const std::string CONFIG_DEFAULT_PUB_DDS_FILE = "";
166const std::string CONFIG_DEFAULT_PUB_DDS_NIC = "";
170const double CONFIG_DEFAULT_PARAMS_MOV_MIN_DELTA = 0.003; // arcsec/s - double
171const double CONFIG_DEFAULT_PARAMS_TRACKING_ERROR = 0.5; // arcsec - double
172const double CONFIG_DEFAULT_PARAMS_ALT_SPEED_DEG_PER_S = 5.0; // degree - double
173const double CONFIG_DEFAULT_PARAMS_AZ_SPEED_DEG_PER_S = 5.0; // degree - double
174const double CONFIG_DEFAULT_ALTAZ_ALT_UPPER_LIMIT_OP = 1.544616; // radians - double
175const double CONFIG_DEFAULT_ALTAZ_ALT_LOWER_LIMIT_OP = 0.349066; // radians - double
176const double CONFIG_DEFAULT_ALTAZ_AZ_UPPER_LIMIT_OP = 6.283185; // radians - double
177const double CONFIG_DEFAULT_ALTAZ_AZ_LOWER_LIMIT_OP = -3.141593; // radians - double
178const double CONFIG_DEFAULT_ALTAZ_ALT_UPPER_LIMIT_FCT = 1.570796; // radians - double
179const double CONFIG_DEFAULT_ALTAZ_ALT_LOWER_LIMIT_FCT = 0.0; // radians - double
180const double CONFIG_DEFAULT_ALTAZ_AZ_UPPER_LIMIT_FCT = 6.283185; // radians - double
181const double CONFIG_DEFAULT_ALTAZ_AZ_LOWER_LIMIT_FCT = -3.141593; // radians - double
182const double CONFIG_DEFAULT_SITE_INFO_ELEVATION = 3046; // meters - double
183const double CONFIG_DEFAULT_SITE_INFO_LATITUDE = -0.429164; // radians - double
184const double CONFIG_DEFAULT_SITE_INFO_LONGITUDE = 1.225075; // radians - double
185const std::string CONFIG_DEFAULT_SITE_INFO_ID = "ELT"; //
186const std::vector<SvDescription> CONFIG_DEFAULT_SV_LIST = {};
189
191 std::string modname;
192 std::string procname;
193 std::string filename;
194 std::string sm_scxml;
195 std::string sm_append;
196 std::string log_level;
197 std::string log_properties;
198 std::string req_endpoint;
199 std::string oldb_uri_prefix;
202 std::vector<SvDescription> sv_list;
205 std::string pub_dds_profile;
206 std::string pub_dds_nic;
207 std::string pub_dds_file;
211};
212
213class Config : public rad::Config {
214 public:
222 Config();
223
227 virtual ~Config();
229
230 Config(const Config&) = delete;
231 Config& operator=(const Config&) = delete;
232
233
234};
235} // namespace hlcc::pfssimhlcc
236#endif // HLCC_PFSSIMHLCC_CONFIG_HPP
Definition config.hpp:213
Config & operator=(const Config &)=delete
Disable copy constructor.
ConfigPack GetConfigPack()
Definition config.cpp:73
virtual ~Config()
Definition config.cpp:69
Config(const Config &)=delete
Config()
Definition config.cpp:18
Definition guideStarHelper.cpp:19
Definition actionMgr.cpp:34
const double CONFIG_DEFAULT_ALTAZ_AZ_LOWER_LIMIT_FCT
Definition config.hpp:181
const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_HLCC
Definition config.hpp:77
const std::vector< SvDescription > CONFIG_DEFAULT_SV_LIST
Definition config.hpp:186
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST2
Definition config.hpp:159
const std::string CONFIG_DEFAULT_SCXML_APPEND
Definition config.hpp:148
const std::string KEY_CONFIG_PUB_DETERM_DEST5
Definition config.hpp:66
const std::string KEY_CONFIG_PUB_DDS_PROFILE
Definition config.hpp:68
const std::string CONFIG_DEFAULT_PUB_DDS_FILE
Definition config.hpp:165
const double CONFIG_DEFAULT_ALTAZ_ALT_LOWER_LIMIT_FCT
Definition config.hpp:179
const std::string CONFIG_DEFAULT_MODNAME
Definition config.hpp:144
const std::string KEY_CONFIG_PUB_DETERM_DEST4
Definition config.hpp:65
const double CONFIG_DEFAULT_PUB_DDS_DOMAIN_ID_GENERAL
Definition config.hpp:169
const double CONFIG_DEFAULT_PARAMS_AZ_SPEED_DEG_PER_S
Definition config.hpp:173
const std::string PREFIX_KEY_CONFIG
Definition config.hpp:60
const double CONFIG_DEFAULT_ALTAZ_AZ_UPPER_LIMIT_FCT
Definition config.hpp:180
const std::string KEY_CONFIG_PUB_DDS_FILE
Definition config.hpp:76
const uint32_t CONFIG_DEFAULT_OLDB_ASYNC_PERIOD
Definition config.hpp:154
const std::string KEY_CONFIG_PUB_DETERM_DEST3
Definition config.hpp:64
const double CONFIG_DEFAULT_ALTAZ_AZ_UPPER_LIMIT_OP
Definition config.hpp:176
const std::string KEY_CONFIG_PUB_DDS_PROFILE_FILE
Definition config.hpp:74
const std::string CONFIG_DEFAULT_FILENAME
Definition config.hpp:146
const std::string KEY_CONFIG_PUB_DDS_PROFILE_TOPIC
Definition config.hpp:69
const std::string KEY_CONFIG_PUB_DETERM_DEST2
Definition config.hpp:63
const std::string CONFIG_DEFAULT_PROCNAME
Definition config.hpp:145
const double CONFIG_DEFAULT_PUB_DDS_DOMAIN_ID_CCS_INS
Definition config.hpp:168
const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_GENERAL
Definition config.hpp:79
const std::string CONFIG_DEFAULT_PUB_DETERM_NIC
Definition config.hpp:158
const std::string KEY_CONFIG_SV_LIST
Definition config.hpp:80
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST5
Definition config.hpp:162
const double CONFIG_DEFAULT_SITE_INFO_ELEVATION
Definition config.hpp:182
const std::string CONFIG_DEFAULT_SITE_INFO_ID
Definition config.hpp:185
const std::string KEY_CONFIG_PUB_DDS_NIC
Definition config.hpp:75
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST4
Definition config.hpp:161
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST6
Definition config.hpp:163
const std::vector< std::string > OLDB_CFG_KEYS_DOUBLE
Definition config.hpp:116
const std::string CONFIG_DEFAULT_SV_SPECIFIC_CONFIG
Definition config.hpp:187
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST
Definition config.hpp:157
const uint32_t CONFIG_DEFAULT_SIM_ACTIVITY_PERIOD_MS
Definition config.hpp:188
const double CONFIG_DEFAULT_ALTAZ_ALT_UPPER_LIMIT_OP
Definition config.hpp:174
const std::string KEY_CONFIG_PUB_DDS_PROFILE_READER
Definition config.hpp:73
const std::vector< std::string > OLDB_CFG_KEYS_STRING
Definition config.hpp:101
const std::string CONFIG_DEFAULT_LOG_LEVEL
Definition config.hpp:149
const double CONFIG_DEFAULT_SITE_INFO_LATITUDE
Definition config.hpp:183
const std::vector< std::string > OLDB_CFG_KEYS_UINT32
Definition config.hpp:134
const double CONFIG_DEFAULT_PARAMS_MOV_MIN_DELTA
Definition config.hpp:170
const std::string KEY_CONFIG_SIM_ACTIVITY_PERIOD_MS
Definition config.hpp:82
const std::string CONFIG_DEFAULT_PUB_DETERM_DEST3
Definition config.hpp:160
const std::string KEY_CONFIG_PUB_DETERM_NIC
Definition config.hpp:62
const std::string CONFIG_DEFAULT_VERSION
Definition config.hpp:143
const double CONFIG_DEFAULT_PUB_DDS_DOMAIN_ID_HLCC
Definition config.hpp:167
const uint32_t CONFIG_DEFAULT_OLDB_CONN_TIMEOUT
Definition config.hpp:153
const double CONFIG_DEFAULT_PARAMS_TRACKING_ERROR
Definition config.hpp:171
const std::string CONFIG_DEFAULT_PUB_DDS_NIC
Definition config.hpp:166
const std::string CONFIG_DEFAULT_OLDB_URI_PREFIX
Definition config.hpp:152
const std::string KEY_CONFIG_PUB_DDS_DOMAIN_ID_CCS_INS
Definition config.hpp:78
const std::string CONFIG_DEFAULT_PUB_DDS_PROFILE
Definition config.hpp:164
const std::string CONFIG_DEFAULT_LOG_PROPERTIES
Definition config.hpp:150
const double CONFIG_DEFAULT_ALTAZ_AZ_LOWER_LIMIT_OP
Definition config.hpp:177
const double CONFIG_DEFAULT_SITE_INFO_LONGITUDE
Definition config.hpp:184
const double CONFIG_DEFAULT_PARAMS_ALT_SPEED_DEG_PER_S
Definition config.hpp:172
const std::string KEY_CONFIG_PUB_DDS_PROFILE_WRITER
Definition config.hpp:71
const std::string KEY_CONFIG_PUB_DDS_PROFILE_SUBSCRIBER
Definition config.hpp:72
const std::string CONFIG_DEFAULT_SCXML_FILENAME
Definition config.hpp:147
const std::string CONFIG_DEFAULT_REQ_ENDPOINT
Definition config.hpp:151
const std::string KEY_CONFIG_PUB_DDS_PROFILE_PUBLISHER
Definition config.hpp:70
const double CONFIG_DEFAULT_ALTAZ_ALT_LOWER_LIMIT_OP
Definition config.hpp:175
const bool CONFIG_DEFAULT_TRS_HEALTH_ENABLED
Definition config.hpp:155
const std::string KEY_CONFIG_PUB_DETERM_DEST
Definition config.hpp:61
const std::string KEY_CONFIG_PUB_DETERM_DEST6
Definition config.hpp:67
const double CONFIG_DEFAULT_ALTAZ_ALT_UPPER_LIMIT_FCT
Definition config.hpp:178
const std::string KEY_CONFIG_SV_SPECIFIC_CONFIG
Definition config.hpp:81
Definition ccsinsoldb.hpp:10
Default logger name.
static bool Decode(const CiiConfigInstanceNode &node, hlcc::pfssimhlcc::SvDescription &target)
Definition config.hpp:37
static bool Encode(CiiConfigInstanceNode &node, const hlcc::pfssimhlcc::SvDescription &source)
Definition config.hpp:47
Definition config.hpp:190
std::string sv_specific_config
Definition config.hpp:204
std::string pub_dds_profile
Definition config.hpp:205
std::string modname
Definition config.hpp:191
std::string log_properties
Definition config.hpp:197
std::uint32_t pub_dds_domain_id_ccs_ins
Definition config.hpp:209
std::uint32_t pub_dds_domain_id_hlcc
Definition config.hpp:208
std::string log_level
Definition config.hpp:196
std::string procname
Definition config.hpp:192
uint16_t sim_activity_period_ms
Definition config.hpp:203
int conn_timeout
Definition config.hpp:200
std::string filename
Definition config.hpp:193
std::string sm_scxml
Definition config.hpp:194
std::string oldb_uri_prefix
Definition config.hpp:199
std::string req_endpoint
Definition config.hpp:198
std::string pub_dds_file
Definition config.hpp:207
std::string pub_dds_nic
Definition config.hpp:206
int oldb_async_period
Definition config.hpp:201
std::uint32_t pub_dds_domain_id_general
Definition config.hpp:210
std::string sm_append
Definition config.hpp:195
std::vector< SvDescription > sv_list
Definition config.hpp:202
Definition config.hpp:23
std::string sv_type
Definition config.hpp:25
std::string sv_name
Definition config.hpp:24