Skip to content

Commit

Permalink
Remove strcat warnings in sap
Browse files Browse the repository at this point in the history
  • Loading branch information
200km committed Oct 5, 2023
1 parent ea99cb9 commit 126fbf1
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/components/real/power/solar_array_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,32 +152,28 @@ SolarArrayPanel InitSAP(ClockGenerator* clock_generator, int sap_id, const std::
const SolarRadiationPressureEnvironment* srp_environment, double component_step_time_s) {
IniAccess sap_conf(file_name);

const std::string st_sap_id = std::to_string(sap_id);
const char* cs = st_sap_id.data();

char Section[30] = "SOLAR_ARRAY_PANEL_";
strcat(Section, cs);
const std::string section_name = "SOLAR_ARRAY_PANEL_" + std::to_string(static_cast<long long>(sap_id));

int prescaler = sap_conf.ReadInt(Section, "prescaler");
int prescaler = sap_conf.ReadInt(section_name.c_str(), "prescaler");
if (prescaler <= 1) prescaler = 1;

int number_of_series;
number_of_series = sap_conf.ReadInt(Section, "number_of_series");
number_of_series = sap_conf.ReadInt(section_name.c_str(), "number_of_series");

int number_of_parallel;
number_of_parallel = sap_conf.ReadInt(Section, "number_of_parallel");
number_of_parallel = sap_conf.ReadInt(section_name.c_str(), "number_of_parallel");

double cell_area_m2;
cell_area_m2 = sap_conf.ReadDouble(Section, "cell_area_m2");
cell_area_m2 = sap_conf.ReadDouble(section_name.c_str(), "cell_area_m2");

libra::Vector<3> normal_vector;
sap_conf.ReadVector(Section, "normal_vector_b", normal_vector);
sap_conf.ReadVector(section_name.c_str(), "normal_vector_b", normal_vector);

double cell_efficiency;
cell_efficiency = sap_conf.ReadDouble(Section, "cell_efficiency");
cell_efficiency = sap_conf.ReadDouble(section_name.c_str(), "cell_efficiency");

double transmission_efficiency;
transmission_efficiency = sap_conf.ReadDouble(Section, "transmission_efficiency");
transmission_efficiency = sap_conf.ReadDouble(section_name.c_str(), "transmission_efficiency");

SolarArrayPanel sap(prescaler, clock_generator, sap_id, number_of_series, number_of_parallel, cell_area_m2, normal_vector, cell_efficiency,
transmission_efficiency, srp_environment, component_step_time_s);
Expand Down

0 comments on commit 126fbf1

Please sign in to comment.