Skip to content

Commit

Permalink
dynawo#133 Fix with rebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
gautierbureau authored and FredericSabot committed Apr 26, 2023
1 parent 7c37c30 commit 7ba8f31
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion nrt/data/IEEE14/CTC/files/fic_MULTIPLE.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
of simulation tools for power systems.
-->
<multipleJobs xmlns="http://www.rte-france.com/dynawo">
<criticalTimeCalculation accuracy="0.001" jobsFile="IEEE14.jobs" dydId="FAULT_GEN_1" endPar="fault_tEnd" minValue="1" maxValue="1.7"/>
<criticalTimeCalculation accuracy="0.001" jobsFile="IEEE14.jobs" dydId="FAULT_GEN_1" endPar="fault_tEnd" minValue="1" maxValue="1.7"/>
</multipleJobs>
20 changes: 10 additions & 10 deletions sources/Launcher/DYNCriticalTimeLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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::JobEntry> job = inputs_.cloneJobEntry();
SimulationParameters params;
boost::shared_ptr<DYN::Simulation> simulation = createAndInitSimulation(workingDirectory_, job, params, results_, inputs_);

if (simulation) {
boost::shared_ptr<DYN::ModelMulti> modelMulti = boost::dynamic_pointer_cast<DYN::ModelMulti>(simulation->model_);
boost::shared_ptr<DYN::ModelMulti> modelMulti = boost::dynamic_pointer_cast<DYN::ModelMulti>(simulation->getModel());

const std::string& dydId = criticalTimeCalculation_->getDydId();
const std::string& endPar = criticalTimeCalculation_->getEndPar();
Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions sources/Launcher/DYNCriticalTimeLauncher.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion util/envDynawoAlgorithms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
;;
Expand Down

0 comments on commit 7ba8f31

Please sign in to comment.