Skip to content

Commit

Permalink
#428 dump finalStates for each scenario in a single output folder
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitri Baron <[email protected]>
  • Loading branch information
barondim committed Nov 15, 2024
1 parent 3743b4a commit 3f2fb7c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sources/Launcher/DYNRobustnessAnalysisLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,13 @@ RobustnessAnalysisLauncher::writeOutputs(const SimulationResult& result) const {
std::string lostEquipmentsPath = createAbsolutePath("lostEquipments", workingDirectory_);
if (!is_directory(lostEquipmentsPath))
create_directory(lostEquipmentsPath);
std::string finalStatePath = createAbsolutePath("finalState", workingDirectory_);
if (!is_directory(finalStatePath))
create_directory(finalStatePath);
std::string logPath = createAbsolutePath("logs", workingDirectory_);
if (!is_directory(logPath))
create_directory(logPath);

if (!result.getConstraintsStreamStr().empty()) {
std::ofstream file;
std::string filepath = createAbsolutePath("constraints_" + result.getUniqueScenarioId() + "." + result.getConstraintsFileExtension(), constraintPath);
Expand Down Expand Up @@ -523,6 +527,17 @@ RobustnessAnalysisLauncher::writeOutputs(const SimulationResult& result) const {
file.close();
}

if (!result.getOutputIIDMStreamStr().empty()) {
std::string filepath = createAbsolutePath("outputIIDM_" + result.getUniqueScenarioId() + ".xml", finalStatePath);
std::ofstream file;
file.open(filepath);
if (!file.is_open()) {
throw DYNError(DYN::Error::API, KeyError_t::FileGenerationFailed, filepath);
}
file << result.getOutputIIDMStreamStr();
file.close();
}

if (!result.getLogPath().empty()) {
boost::filesystem::path from(result.getLogPath());
boost::filesystem::path to(createAbsolutePath("log_" + result.getUniqueScenarioId() + ".log", logPath));
Expand Down

0 comments on commit 3f2fb7c

Please sign in to comment.