From 7ba8f31b06ef737090180a91d761655139eacaa6 Mon Sep 17 00:00:00 2001 From: Gautier Bureau Date: Wed, 9 Nov 2022 10:07:17 +0100 Subject: [PATCH] #133 Fix with rebase. --- nrt/data/IEEE14/CTC/files/fic_MULTIPLE.xml | 2 +- sources/Launcher/DYNCriticalTimeLauncher.cpp | 20 ++++++++++---------- sources/Launcher/DYNCriticalTimeLauncher.h | 4 ++-- util/envDynawoAlgorithms.sh | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/nrt/data/IEEE14/CTC/files/fic_MULTIPLE.xml b/nrt/data/IEEE14/CTC/files/fic_MULTIPLE.xml index 04a0245b..cd0bcc5c 100644 --- a/nrt/data/IEEE14/CTC/files/fic_MULTIPLE.xml +++ b/nrt/data/IEEE14/CTC/files/fic_MULTIPLE.xml @@ -12,5 +12,5 @@ of simulation tools for power systems. --> - + diff --git a/sources/Launcher/DYNCriticalTimeLauncher.cpp b/sources/Launcher/DYNCriticalTimeLauncher.cpp index 1fa0cc66..ab69f1b7 100644 --- a/sources/Launcher/DYNCriticalTimeLauncher.cpp +++ b/sources/Launcher/DYNCriticalTimeLauncher.cpp @@ -36,14 +36,14 @@ using multipleJobs::MultipleJobs; namespace DYNAlgorithms { void -CriticalTimeLauncher::SetParametersAndLaunchSimulation() { - inputs_.readInputs(workingDirectory_, jobsFile_, 1); +CriticalTimeLauncher::setParametersAndLaunchSimulation() { + inputs_.readInputs(workingDirectory_, jobsFile_); boost::shared_ptr job = inputs_.cloneJobEntry(); SimulationParameters params; boost::shared_ptr simulation = createAndInitSimulation(workingDirectory_, job, params, results_, inputs_); if (simulation) { - boost::shared_ptr modelMulti = boost::dynamic_pointer_cast(simulation->model_); + boost::shared_ptr modelMulti = boost::dynamic_pointer_cast(simulation->getModel()); const std::string& dydId = criticalTimeCalculation_->getDydId(); const std::string& endPar = criticalTimeCalculation_->getEndPar(); @@ -78,23 +78,23 @@ CriticalTimeLauncher::launch() { throw DYNAlgorithmsError(CriticalTimeCalculationTaskNotFound); const double accuracy = criticalTimeCalculation_->getAccuracy(); - double curAccuracy = 1; - const double multiplierRound = 1 / accuracy; + double curAccuracy = 1.; + const double multiplierRound = 1. / accuracy; tSup_ = criticalTimeCalculation_->getMaxValue(); jobsFile_ = criticalTimeCalculation_->getJobsFile(); - double tInf = criticalTimeCalculation_->getMinValue(); + const double tInf = criticalTimeCalculation_->getMinValue(); double tPrevious = tSup_; // First simulation case. - SetParametersAndLaunchSimulation(); + setParametersAndLaunchSimulation(); if (results_.getSuccess()) - tSup_ += std::round(((tSup_ - tInf) / 2) * multiplierRound) / multiplierRound; + return; else - tSup_ -= std::round(((tSup_ - tInf) / 2) * multiplierRound) / multiplierRound; + tSup_ -= std::round(((tSup_ - tInf) / 2.) * multiplierRound) / multiplierRound; while (curAccuracy > accuracy) { - SetParametersAndLaunchSimulation(); + setParametersAndLaunchSimulation(); updateIndexes(tPrevious, curAccuracy, multiplierRound); } diff --git a/sources/Launcher/DYNCriticalTimeLauncher.h b/sources/Launcher/DYNCriticalTimeLauncher.h index 95705a34..f2c0a11d 100644 --- a/sources/Launcher/DYNCriticalTimeLauncher.h +++ b/sources/Launcher/DYNCriticalTimeLauncher.h @@ -49,12 +49,12 @@ class CriticalTimeLauncher : public RobustnessAnalysisLauncher { * @brief Launch the simulation with the new value calculted in the critical * time algorithm */ - void SetParametersAndLaunchSimulation(); + void setParametersAndLaunchSimulation(); /** * @brief Update superior born to find the right critical time * and calcul the next time value we want to test. - * + * * @param tPrevious previous value tested * @param curAccuracy current accuracy * @param multiplierRound value used to round results with accuracy diff --git a/util/envDynawoAlgorithms.sh b/util/envDynawoAlgorithms.sh index c6b04f04..682090d1 100755 --- a/util/envDynawoAlgorithms.sh +++ b/util/envDynawoAlgorithms.sh @@ -1198,7 +1198,7 @@ case $MODE in CS-gdb) launch_CS_gdb ${ARGS} || error_exit "Dynawo simulation failed" ;; - + CTC-gdb) launch_CTC_gdb ${ARGS} || error_exit "Critical time calculation failed" ;;