Skip to content

Commit

Permalink
Added the option to output the delta in number of active groups by cl…
Browse files Browse the repository at this point in the history
…uster by adding delta-cluster = true in generaldata.ini => outputs
  • Loading branch information
sylvmara committed Oct 30, 2024
1 parent 4128112 commit 9651e22
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/libs/antares/study/include/antares/study/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ class Parameters final
//! Store the sampled timeseries numbers
bool storeTimeseriesNumbers;
//@}

//! \name Delta Cluster
//@{
//! Output the delta of groups inside clusters for each hour of each mode
bool deltaClusterOutput;
//@}

/*!
** \brief Read-only mode
Expand Down
1 change: 1 addition & 0 deletions src/libs/antares/study/load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ void Study::parameterFiller(const StudyLoadOptions& options)
parameters.timeSeriesToArchive = 0;
parameters.storeTimeseriesNumbers = false;
parameters.synthesis = false;
parameters.deltaClusterOutput = false;
}

if (options.loadOnlyNeeded && !parameters.timeSeriesToGenerate)
Expand Down
6 changes: 6 additions & 0 deletions src/libs/antares/study/parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ void Parameters::reset()
// readonly
readonly = false;
synthesis = true;
//Outputing the delta of the number of groups that are on inside each clusters
deltaClusterOutput = false;

// Hydro heuristic policy
hydroHeuristicPolicy.hhPolicy = hhpAccommodateRuleCurves;
Expand Down Expand Up @@ -623,6 +625,10 @@ static bool SGDIntLoadFamily_Output(Parameters& d,
{
return value.to<bool>(d.synthesis);
}
if (key == "delta-cluster")
{
return value.to<bool>(d.deltaClusterOutput);
}
if (key == "hydro-debug")
{
return value.to<bool>(d.hydroDebug);
Expand Down
53 changes: 52 additions & 1 deletion src/solver/optimisation/opt_optimisation_lineaire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,32 @@ bool OPT_OptimisationLineaire(const OptimizationOptions& options,
writer,
PREMIERE_OPTIMISATION,
simulationObserver);
if (problemeHebdo->exportDeltaClusters)
{
int NombreDePasDeTempsProblemeHebdo = problemeHebdo->NombreDePasDeTemps;
for (int pays = 0; pays < problemeHebdo->NombreDePays; pays++)
{
RESULTATS_HORAIRES& ResultatsHoraires = problemeHebdo->ResultatsHoraires[pays];
std::vector<PRODUCTION_THERMIQUE_OPTIMALE>& ProductionThermique = ResultatsHoraires.ProductionThermique;
PALIERS_THERMIQUES& PaliersThermiquesDuPays
= problemeHebdo->PaliersThermiquesDuPays[pays];
const std::string fileName = problemeHebdo->NomsDesPays[pays] + std::string("_week") + std::to_string(problemeHebdo->weekInTheYear) + "_beforeHeuristic.txt";
std::string content;
content += "clusterName_PdtHebdo NombreDeGroupesEnMarcheDuPalier NombreDeGroupesQuiDemarrentDuPalier NombreDeGroupesQuiSArretentDuPalier \r\n";
for (int index = 0; index < PaliersThermiquesDuPays.NombreDePaliersThermiques; index++)
{
for (int pdtHebdo = 0; pdtHebdo < NombreDePasDeTempsProblemeHebdo; pdtHebdo++)
{
content += PaliersThermiquesDuPays.NomsDesPaliersThermiques[index] + "_Pdt" + std::to_string(pdtHebdo) + " ";

content += std::to_string(ProductionThermique[pdtHebdo].NombreDeGroupesEnMarcheDuPalier[index]) + " ";
content += std::to_string(ProductionThermique[pdtHebdo].NombreDeGroupesQuiDemarrentDuPalier[index]) + " ";
content += std::to_string(ProductionThermique[pdtHebdo].NombreDeGroupesQuiSArretentDuPalier[index]) + "\r\n";
}
}
writer.addEntryFromBuffer(fileName, content);
}
}

// We only need the 2nd optimization when NOT solving with integer variables
// We also skip the 2nd optimization in the hidden 'Expansion' mode
Expand All @@ -232,11 +258,36 @@ bool OPT_OptimisationLineaire(const OptimizationOptions& options,
{
// We need to adjust some stuff before running the 2nd optimisation
runThermalHeuristic(problemeHebdo);
return runWeeklyOptimization(options,
ret = runWeeklyOptimization(options,
problemeHebdo,
writer,
DEUXIEME_OPTIMISATION,
simulationObserver);
if (problemeHebdo->exportDeltaClusters)
{
int NombreDePasDeTempsProblemeHebdo = problemeHebdo->NombreDePasDeTemps;
for (int pays = 0; pays < problemeHebdo->NombreDePays; pays++)
{
RESULTATS_HORAIRES& ResultatsHoraires = problemeHebdo->ResultatsHoraires[pays];
std::vector<PRODUCTION_THERMIQUE_OPTIMALE>& ProductionThermique = ResultatsHoraires.ProductionThermique;
PALIERS_THERMIQUES& PaliersThermiquesDuPays
= problemeHebdo->PaliersThermiquesDuPays[pays];
const std::string fileName = problemeHebdo->NomsDesPays[pays] + std::string("_week") + std::to_string(problemeHebdo->weekInTheYear) + "_afterHeuristic.txt";
std::string content;
content += "clusterName_PdtHebdo NombreDeGroupesEnMarcheDuPalier NombreDeGroupesQuiDemarrentDuPalier NombreDeGroupesQuiSArretentDuPalier \r\n";
for (int index = 0; index < PaliersThermiquesDuPays.NombreDePaliersThermiques; index++)
{
for (int pdtHebdo = 0; pdtHebdo < NombreDePasDeTempsProblemeHebdo; pdtHebdo++)
{
content += PaliersThermiquesDuPays.NomsDesPaliersThermiques[index] + "_Pdt" + std::to_string(pdtHebdo) + " ";
content += std::to_string(ProductionThermique[pdtHebdo].NombreDeGroupesEnMarcheDuPalier[index]) + " ";
content += std::to_string(ProductionThermique[pdtHebdo].NombreDeGroupesQuiDemarrentDuPalier[index]) + " ";
content += std::to_string(ProductionThermique[pdtHebdo].NombreDeGroupesQuiSArretentDuPalier[index]) + "\r\n";
}
}
writer.addEntryFromBuffer(fileName, content);
}
}
}
return ret;
}
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ struct PROBLEME_HEBDO
bool exportMPSOnError = false;
bool ExportStructure = false;
bool NamedProblems = false;
bool exportDeltaClusters = false;

uint32_t HeureDansLAnnee = 0;
bool LeProblemeADejaEteInstancie = false;
Expand Down
1 change: 1 addition & 0 deletions src/solver/simulation/sim_calcul_economique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,4 +975,5 @@ void SIM_RenseignementProblemeHebdo(const Study& study,
problem.CaracteristiquesHydrauliques[k].ContrainteDePmaxHydrauliqueHoraireRef
= problem.CaracteristiquesHydrauliques[k].ContrainteDePmaxHydrauliqueHoraire;
}
problem.exportDeltaClusters = parameters.deltaClusterOutput;
}

0 comments on commit 9651e22

Please sign in to comment.