From 396882db306dcd5017f5288b13b02144afa06be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cellen=2Eseabrooke=E2=80=9D?= <seabrooke@ifb.uni-stuttgart.de> Date: Wed, 4 Dec 2024 13:33:35 +0100 Subject: [PATCH] Add program mode specific report and plot naming and change plot names to pep8 style --- systems_design/src/standardPlot.cpp | 40 ++++++++++---------- systems_design/src/standardSystemsDesign.cpp | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/systems_design/src/standardPlot.cpp b/systems_design/src/standardPlot.cpp index 64f948b2..9651d280 100644 --- a/systems_design/src/standardPlot.cpp +++ b/systems_design/src/standardPlot.cpp @@ -42,15 +42,15 @@ void standardSystemsDesign::generatePlotData() { } void standardSystemsDesign::generatePlotMassBreakdown() { - Plot MassBreakdownPlot(rtIO_, "SystemsDesign_MassBreakdown"); + Plot MassBreakdownPlot(rtIO_, "systems_design_mass_breakdown"); std::ofstream plot; - std::string plotDataFile(rtIO_->getCsvFilesDir() + "/" + TOOL_NAME + "_MassBreakdown_plot.csv"); + std::string plotDataFile(rtIO_->getCsvFilesDir() + "/" + data_->configuration.theProgramName + "_mass_breakdown_plot.csv"); plot.open(plotDataFile.c_str()); if (!plot) { - myRuntimeInfo->err << std::string(TOOL_NAME) + "_MassBreakdown_plot.csv could not be opened!" << std::endl; + myRuntimeInfo->err << std::string(data_->configuration.theProgramName) + "_mass_breakdown_plot.csv could not be opened!" << std::endl; exit(1); } else { - plot << "# " + win2lin(rtIO_->getCsvFilesDir()) + "/" + TOOL_NAME + "_MassBreakdown_plot.csv" << std::endl; + plot << "# " + win2lin(rtIO_->getCsvFilesDir()) + "/" + data_->configuration.theProgramName + "_mass_breakdown_plot.csv" << std::endl; /* Adjust data structure: **/ plot << "# Mass Breakdown" << std::endl; plot << "# (1)Component; (2) Mass [kg];" << std::endl; @@ -90,19 +90,19 @@ void standardSystemsDesign::generatePlotMassBreakdown() { ax->y_axis().tick_label_format("%1.0f"); // Save the plot - std::string plotFilePath = rtIO_->getPlotDir() + "/" + data_->configuration.theProgramName + "_MassBreakdown_plot.svg"; + std::string plotFilePath = rtIO_->getPlotDir() + "/" + data_->configuration.theProgramName + "_mass_breakdown_plot.svg"; matplot::save(fig, plotFilePath); } void standardSystemsDesign::generatePlotSystemsMass() { std::ofstream plot; - std::string plotDataFile(rtIO_->getCsvFilesDir() + "/" + TOOL_NAME + "_SystemsMass_plot.csv"); + std::string plotDataFile(rtIO_->getCsvFilesDir() + "/" + data_->configuration.theProgramName + "_systems_mass_plot.csv"); plot.open(plotDataFile.c_str()); if (!plot) { - myRuntimeInfo->err << std::string(TOOL_NAME) + "_SystemsMass_plot.csv konnte nicht geoeffnet werden!" << std::endl; + myRuntimeInfo->err << std::string(data_->configuration.theProgramName) + "_systems_mass_plot.csv konnte nicht geoeffnet werden!" << std::endl; exit(1); } else { - plot << "# " + win2lin(rtIO_->getCsvFilesDir()) + "/" + TOOL_NAME + "_SystemsMass_plot.csv" << std::endl; + plot << "# " + win2lin(rtIO_->getCsvFilesDir()) + "/" + data_->configuration.theProgramName + "_systems_mass_plot.csv" << std::endl; /* Adjust data structure: **/ plot << "# Mass of the individual systems" << std::endl; plot << "# (1)ATA; (2) Name; (3) Mass [kg];" << std::endl; @@ -175,19 +175,19 @@ void standardSystemsDesign::generatePlotSystemsMass() { ax->grid(true); // Save the plot - std::string plotFilePath = rtIO_->getPlotDir() + "/" + data_->configuration.theProgramName + "_SystemsMass_plot.svg"; + std::string plotFilePath = rtIO_->getPlotDir() + "/" + data_->configuration.theProgramName + "_systems_mass_plot.svg"; matplot::save(plotFilePath); } void standardSystemsDesign::generatePlotDataMission() { std::ofstream plot; - std::string plotDataFile(rtIO_->getCsvFilesDir() + "/" + TOOL_NAME + "_MissionSteps_plot.csv"); + std::string plotDataFile(rtIO_->getCsvFilesDir() + "/" + data_->configuration.theProgramName + "_mission_steps_plot.csv"); plot.open(plotDataFile.c_str()); if (!plot) { - myRuntimeInfo->err << std::string(TOOL_NAME) + "_MissionSteps_plot.csv could not be opened!" << std::endl; + myRuntimeInfo->err << std::string(data_->configuration.theProgramName) + "_mission_steps_plot.csv could not be opened!" << std::endl; exit(1); } else { - plot << "# " + win2lin(rtIO_->getCsvFilesDir()) + "/" + TOOL_NAME + "_MissionSteps_plot.csv" << std::endl; + plot << "# " + win2lin(rtIO_->getCsvFilesDir()) + "/" + data_->configuration.theProgramName + "_mission_steps_plot.csv" << std::endl; /* Adjust data structure: **/ plot << "# Mission profile from the mission XML file" << std::endl; plot << "# (1)Step; (2)Missionsphase; (3)Missionsmode; (4)endAltitude; (5)endFL; (6)endCAS;" @@ -270,13 +270,13 @@ void standardSystemsDesign::generatePlotDataMission() { matplot::legend(ax2, {"Mach number", "CAS", "TAS"}); ax2->legend()->location(matplot::legend::general_alignment::topright); // Save the plot - std::string plotFilePath = rtIO_->getPlotDir() + "/" + data_->configuration.theProgramName + "_MissionSteps_plot.svg"; + std::string plotFilePath = rtIO_->getPlotDir() + "/" + data_->configuration.theProgramName + "_mission_steps_plot.svg"; matplot::save(plotFilePath); } void standardSystemsDesign::generatePlotMissionEnergy(const aircraftSystem& acftSystem) { std::ofstream plot; - std::string plotDataFile(rtIO_->getCsvFilesDir() + "/" + TOOL_NAME + "_missionPower_" + acftSystem.ATA + "_plot.csv"); + std::string plotDataFile(rtIO_->getCsvFilesDir() + "/" + data_->configuration.theProgramName + "_mission_power_" + acftSystem.ATA + "_plot.csv"); /*aigner: Accumulate the hydraulic power to a total powerProfile*/ powerProfile hydraulicSum(getPowerProfileSum(acftSystem.Hydraulic)); /*aigner: Accumulating the electrical power to a total powerProfile*/ @@ -384,7 +384,7 @@ void standardSystemsDesign::generatePlotMissionEnergy(const aircraftSystem& acft ax->legend()->box(false); // Save the plot - std::string plotFilePath = rtIO_->getPlotDir() + "/" + data_->configuration.theProgramName + "_MissionPower_" + acftSystem.ATA + "_plot.svg"; + std::string plotFilePath = rtIO_->getPlotDir() + "/" + data_->configuration.theProgramName + "_mission_power_" + acftSystem.ATA + "_plot.svg"; matplot::save(fig, plotFilePath); fig->backend()->should_close(); @@ -393,7 +393,7 @@ void standardSystemsDesign::generatePlotMissionEnergy(const aircraftSystem& acft void standardSystemsDesign::generatePlotMissionEnergyAccumulated(const powerProfile& totalBleed, const powerProfile& totalElectric, const powerProfile& totalHydraulic) { std::ofstream plot; - std::string plotDataFile(rtIO_->getCsvFilesDir() + "/" + TOOL_NAME + "_missionPower_" + "accumulatedPower" + "_plot.csv"); + std::string plotDataFile(rtIO_->getCsvFilesDir() + "/" + data_->configuration.theProgramName + "_mission_power_" + "accumulated_power" + "_plot.csv"); plot.open(plotDataFile.c_str()); if (!plot) { myRuntimeInfo->err << plotDataFile + " could not be opened!" << std::endl;; @@ -461,19 +461,19 @@ void standardSystemsDesign::generatePlotMissionEnergyAccumulated(const powerProf ax->legend()->box(false); // Save the plot - std::string plotFilePath = rtIO_->getPlotDir() + "/" + data_->configuration.theProgramName + "_accumulatedPower_plot.svg"; + std::string plotFilePath = rtIO_->getPlotDir() + "/" + data_->configuration.theProgramName + "_accumulated_power_plot.svg"; matplot::save(fig, plotFilePath); } void standardSystemsDesign::generatePlotEnergySinksMaxEnergy() { std::ofstream plot; - std::string plotDataFile(rtIO_->getCsvFilesDir() + "/" + TOOL_NAME + "_EnergySinksMaxEnergy_plot.csv"); + std::string plotDataFile(rtIO_->getCsvFilesDir() + "/" + data_->configuration.theProgramName + "_energy_sinks_max_energy_plot.csv"); plot.open(plotDataFile.c_str()); if (!plot) { myRuntimeInfo->err << plotDataFile << " could not be opened!" << std::endl; exit(1); } else { - plot << "# " + win2lin(rtIO_->getCsvFilesDir()) + "/" + TOOL_NAME + "_EnergySinksMaxEnergy_plot.csv" << std::endl; + plot << "# " + win2lin(rtIO_->getCsvFilesDir()) + "/" + data_->configuration.theProgramName + "_energy_sinks_max_energy_plot.csv" << std::endl; /* Adjust data structure: **/ plot << "# Design Energy of the individual systems" << std::endl; plot << "# (1)System; (2) ATA; (3) Design Bleed Air [kg/s]; (4) Design Electric [W]; (5) Design Hydraulic [W]; "; @@ -614,7 +614,7 @@ void standardSystemsDesign::generatePlotEnergySinksMaxEnergy() { ax3->y_axis().tick_label_format("%4.0f"); // Save the plot - std::string plotFilePath = rtIO_->getPlotDir() + "/" + data_->configuration.theProgramName + "_EnergySinksMaxEnergy_plot.svg"; + std::string plotFilePath = rtIO_->getPlotDir() + "/" + data_->configuration.theProgramName + "_energy_sinks_max_energy_plot.svg"; matplot::save(plotFilePath); ax1->clear(); diff --git a/systems_design/src/standardSystemsDesign.cpp b/systems_design/src/standardSystemsDesign.cpp index 49496f11..910478f1 100644 --- a/systems_design/src/standardSystemsDesign.cpp +++ b/systems_design/src/standardSystemsDesign.cpp @@ -97,7 +97,7 @@ void standardSystemsDesign::report() { myRuntimeInfo->out << "Write reports ..." << std::endl; setHtmlBody(); setTexBody(); - report_.generateReports(); + report_.generateReports(data_->configuration.theProgramName); } void standardSystemsDesign::save() { -- GitLab