88 #include "../submodules/CoreLibrary/CoreLibrary/xml_parser.h"
94 std::string io_device_;
97 std::string usr_operator_path_;
98 std::string usr_class_path_;
99 std::string source_file_name_;
102 core::uint32 base_period_;
103 core::uint32 reduction_core_count_;
104 core::uint32 time_core_count_;
107 core::float32 mdl_inertia_sr_thr_;
108 core::uint32 mdl_inertia_cnt_thr_;
109 core::float32 tpx_dsr_thr_;
110 core::uint32 min_sim_time_horizon_;
111 core::uint32 max_sim_time_horizon_;
112 core::float32 sim_time_horizon_factor_;
113 core::uint32 tpx_time_horizon_;
114 core::uint32 perf_sampling_period_;
115 core::float32 float_tolerance_;
116 core::uint32 time_tolerance_;
117 core::uint64 primary_thz_;
118 core::uint64 secondary_thz_;
122 core::uint32 ntf_mk_resilience_;
123 core::uint32 goal_pred_success_resilience_;
124 core::uint32 debug_windows_;
125 std::string runtime_output_file_path_;
126 core::uint32 trace_levels_;
128 bool keep_invalidated_objects_;
129 bool decompile_objects_;
130 bool decompile_to_file_;
131 std::string decompilation_file_path_;
132 bool ignore_named_objects_;
134 std::string objects_path_;
138 core::uint32 run_time_;
139 core::uint32 probe_level_;
141 bool decompile_models_;
142 bool ignore_named_models_;
144 std::string models_path_;
148 int number_of_servers_;
149 int number_of_clients_;
150 std::vector<std::pair<std::string, std::string> > server_configurations_;
151 std::vector<std::string> client_configurations_;
153 bool load(
const char *file_name) {
155 core::XMLNode mainNode = core::XMLNode::openFileHelper(file_name,
"AERAConfiguration");
158 std::cerr <<
"> Error: AERAConfiguration is unreadable" << std::endl;
164 io_device_ = mem.getAttribute(
"io_device");
167 std::cerr <<
"> Error: Mem section is unreadable" << std::endl;
174 usr_operator_path_ = load.getAttribute(
"usr_operator_path");
175 usr_class_path_ = load.getAttribute(
"usr_class_path");
176 source_file_name_ = load.getAttribute(
"source_file_name");
179 std::cerr <<
"> Error: Load section is unreadable" << std::endl;
186 const char *base_period = init.getAttribute(
"base_period");
187 const char *reduction_core_count = init.getAttribute(
"reduction_core_count");
188 const char *time_core_count = init.getAttribute(
"time_core_count");
190 base_period_ = atoi(base_period);
191 reduction_core_count_ = atoi(reduction_core_count);
192 time_core_count_ = atoi(time_core_count);
195 std::cerr <<
"> Error: Init section is unreadable" << std::endl;
202 const char *mdl_inertia_sr_thr = system.getAttribute(
"mdl_inertia_sr_thr");
203 const char *mdl_inertia_cnt_thr = system.getAttribute(
"mdl_inertia_cnt_thr");
204 const char *tpx_dsr_thr = system.getAttribute(
"tpx_dsr_thr");
205 const char *min_sim_time_horizon = system.getAttribute(
"min_sim_time_horizon");
206 const char *max_sim_time_horizon = system.getAttribute(
"max_sim_time_horizon");
207 const char *sim_time_horizon_factor = system.getAttribute(
"sim_time_horizon_factor");
208 const char *tpx_time_horizon = system.getAttribute(
"tpx_time_horizon");
209 const char *perf_sampling_period = system.getAttribute(
"perf_sampling_period");
210 const char *float_tolerance = system.getAttribute(
"float_tolerance");
211 const char *time_tolerance = system.getAttribute(
"time_tolerance");
212 const char *primary_thz = system.getAttribute(
"primary_thz");
213 const char *secondary_thz = system.getAttribute(
"secondary_thz");
215 mdl_inertia_sr_thr_ = atof(mdl_inertia_sr_thr);
216 mdl_inertia_cnt_thr_ = atoi(mdl_inertia_cnt_thr);
217 tpx_dsr_thr_ = atof(tpx_dsr_thr);
218 min_sim_time_horizon_ = atoi(min_sim_time_horizon);
219 max_sim_time_horizon_ = atoi(max_sim_time_horizon);
220 sim_time_horizon_factor_ = atof(sim_time_horizon_factor);
221 tpx_time_horizon_ = atoi(tpx_time_horizon);
222 perf_sampling_period_ = atoi(perf_sampling_period);
223 float_tolerance_ = atof(float_tolerance);
224 time_tolerance_ = atoi(time_tolerance);
225 primary_thz_ = atoi(primary_thz);
226 secondary_thz_ = atoi(secondary_thz);
229 std::cerr <<
"> Error: System section is unreadable" << std::endl;
236 const char *debug_string = debug.getAttribute(
"debug");
237 const char *debug_windows = debug.getAttribute(
"debug_windows");
238 const char *runtime_output_file_path = debug.getAttribute(
"runtime_output_file_path");
239 const char *trace_levels = debug.getAttribute(
"trace_levels");
241 debug_ = (strcmp(debug_string,
"yes") == 0);
242 debug_windows_ = atoi(debug_windows);
243 runtime_output_file_path_ = runtime_output_file_path;
244 sscanf(trace_levels,
"%x", &trace_levels_);
249 const char *ntf_mk_resilience = resilience.getAttribute(
"ntf_mk_resilience");
250 const char *goal_pred_success_resilience = resilience.getAttribute(
"goal_pred_success_resilience");
252 ntf_mk_resilience_ = atoi(ntf_mk_resilience);
253 goal_pred_success_resilience_ = atoi(goal_pred_success_resilience);
256 std::cerr <<
"> Error: Debug/Resilience section is unreadable" << std::endl;
262 const char *get_objects = objects.getAttribute(
"get_objects");
263 const char *keep_invalidated_objects = objects.getAttribute(
"keep_invalidated_objects");
264 const char *decompile_objects = objects.getAttribute(
"decompile_objects");
265 const char *decompile_to_file = objects.getAttribute(
"decompile_to_file");
266 decompilation_file_path_ = objects.getAttribute(
"decompilation_file_path");
267 const char *ignore_named_objects = objects.getAttribute(
"ignore_named_objects");
268 const char *write_objects = objects.getAttribute(
"write_objects");
269 const char *test_objects = objects.getAttribute(
"test_objects");
271 get_objects_ = (strcmp(get_objects,
"yes") == 0);
272 keep_invalidated_objects_ = (strcmp(keep_invalidated_objects,
"yes") == 0);
273 decompile_objects_ = (strcmp(decompile_objects,
"yes") == 0);
274 decompile_to_file_ = (strcmp(decompile_to_file,
"yes") == 0);
275 ignore_named_objects_ = (strcmp(ignore_named_objects,
"yes") == 0);
276 write_objects_ = (strcmp(write_objects,
"yes") == 0);
277 if (write_objects_) {
279 objects_path_ = objects.getAttribute(
"objects_path");
280 test_objects_ = (strcmp(test_objects,
"yes") == 0);
284 std::cerr <<
"> Error: Debug/Objects section is unreadable" << std::endl;
289 std::cerr <<
"> Error: Debug section is unreadable" << std::endl;
296 const char *run_time = run.getAttribute(
"run_time");
297 const char *probe_level = run.getAttribute(
"probe_level");
299 run_time_ = atoi(run_time);
300 probe_level_ = atoi(probe_level);
305 const char *get_models = models.getAttribute(
"get_models");
306 const char *decompile_models = models.getAttribute(
"decompile_models");
307 const char *ignore_named_models = models.getAttribute(
"ignore_named_models");
308 const char *write_models = models.getAttribute(
"write_models");
309 const char *test_models = models.getAttribute(
"test_models");
311 get_models_ = (strcmp(get_models,
"yes") == 0);
312 decompile_models_ = (strcmp(decompile_models,
"yes") == 0);
313 ignore_named_models_ = (strcmp(ignore_named_models,
"yes") == 0);
314 write_models_ = (strcmp(write_models,
"yes") == 0);
317 models_path_ = models.getAttribute(
"models_path");
318 test_models_ = (strcmp(test_models,
"yes") == 0);
322 std::cerr <<
"> Error: Run/Models section is unreadable" << std::endl;
327 std::cerr <<
"> Error: Run section is unreadable" << std::endl;
331 core::XMLNode tcpConfiguration = mainNode.getChildNode(
"TCPConfiguration");
333 if (!tcpConfiguration) {
335 if (io_device_.compare(
"tcp_io_device") == 0) {
337 std::cerr <<
"> Error: Using IODevice tcp_io_device without specifying TCPConfiguration in settings.xml" << std::endl;
344 const char* number_of_servers = tcpConfiguration.getAttribute(
"number_of_servers");
345 const char* number_of_clients = tcpConfiguration.getAttribute(
"number_of_clients");
347 number_of_servers_ = atoi(number_of_servers);
348 number_of_clients_ = atoi(number_of_clients);
350 std::string server_configurations = tcpConfiguration.getAttribute(
"server_configurations");
351 std::string client_configurations = tcpConfiguration.getAttribute(
"client_configurations");
354 size_t next = server_configurations.find(
",", last);
358 if (next == std::string::npos) {
359 current = server_configurations.substr(last);
363 current = server_configurations.substr(last, next - last);
365 size_t colon = current.find(
":", 0);
366 std::string ipAdress = current.substr(0, colon);
367 std::string port = current.substr(colon + 1);
368 server_configurations_.push_back(std::make_pair(ipAdress, port));
370 }
while ((next = server_configurations.find(
",", last)) != std::string::npos);
375 next = client_configurations.find(
",", last);
379 if (next == std::string::npos) {
380 port = client_configurations.substr(last);
384 port = client_configurations.substr(last, next - last);
386 client_configurations_.push_back(port);
388 }
while ((next = client_configurations.find(
",", last)) != std::string::npos);