1#include "InitializeSimulation.h"
5void InitializeSimulation(
const std::string &xml_input_file,
helios::Context *context_ptr) {
7 pugi::xml_document xmldoc;
9 std::string xml_error_string;
10 if (!
open_xml_file(xml_input_file, xmldoc, xml_error_string)) {
14 pugi::xml_node helios = xmldoc.child(
"helios");
22 node = helios.child(
"latitude");
24 std::cout <<
"WARNING: No value given for 'latitude'. Using default value of " << location.
latitude_deg << std::endl;
27 const char *latitude_str = node.child_value();
36 node = helios.child(
"longitude");
38 std::cout <<
"WARNING: No value given for 'longitude'. Using default value of " << location.
longitude_deg << std::endl;
41 const char *longitude_str = node.child_value();
50 node = helios.child(
"UTC_offset");
52 std::cout <<
"WARNING: No value given for 'UTC_offset'. Using default value of " << location.
UTC_offset << std::endl;
55 const char *UTC_offset_str = node.child_value();
149 std::string weather_data_file;
150 node = helios.child(
"csv_weather_file");
153 const char *weather_data_file_str = node.child_value();
154 weather_data_file =
trim_whitespace(std::string(weather_data_file_str));
156 if (weather_data_file.empty()) {
158 }
else if (!std::filesystem::exists(weather_data_file)) {
165 std::string cimis_data_file;
166 node = helios.child(
"cimis_weather_file");
169 if (!weather_data_file.empty()) {
170 std::cout <<
"WARNING: Both 'csv_weather_file' and 'cimis_weather_file' were given, but only one weather data file can be loaded for the simulation. Using the CSV weather data file." << std::endl;
173 const char *cimis_data_file_str = node.child_value();
176 if (cimis_data_file.empty()) {
178 }
else if (!std::filesystem::exists(cimis_data_file)) {