Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove timeseries refresh #2451

Open
wants to merge 26 commits into
base: release/9.3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions src/libs/antares/study/include/antares/study/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@ class Parameters final

void validateOptions(const StudyLoadOptions&);

/*!
** \brief Try to detect then fix refresh intervals
*/
void fixRefreshIntervals();

/*!
** \brief Try to detect then fix TS generation/refresh parameters
* for NTC
Expand Down Expand Up @@ -258,28 +253,6 @@ class Parameters final
uint nbTimeSeriesSolar;
//@}

//! \name Time-series refresh
//@{
/*!
** \brief Time series to refresh on-line
**
** This value is a mask bits for timeSeries
** \see TimeSeries
*/
uint timeSeriesToRefresh;

//! Refresh interval (in years) for timeSeries : Load
uint refreshIntervalLoad;
//! Refresh interval (in years) for timeSeries : Hydro
uint refreshIntervalHydro;
//! Refresh interval (in years) for timeSeries : Wind
uint refreshIntervalWind;
//! Refresh interval (in years) for timeSeries : Thermal
uint refreshIntervalThermal;
//! Refresh interval (in years) for timeSeries : Solar
uint refreshIntervalSolar;
//@}

//! \name Archives
//@{
/*!
Expand Down
18 changes: 4 additions & 14 deletions src/libs/antares/study/load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@ void Study::parameterFiller(const StudyLoadOptions& options)
parameters.synthesis = false;
}

if (options.loadOnlyNeeded && !parameters.timeSeriesToGenerate)
{
// Nothing to refresh
parameters.timeSeriesToRefresh = 0;
}

// We can not run the simulation if the study folder is not in the latest
// version and that we would like to re-importe the generated timeseries
if (usedByTheSolver)
Expand Down Expand Up @@ -235,17 +229,15 @@ bool Study::internalLoadFromFolder(const fs::path& path, const StudyLoadOptions&
bool Study::internalLoadCorrelationMatrices(const StudyLoadOptions& options)
{
// Load
if (!options.loadOnlyNeeded || timeSeriesLoad & parameters.timeSeriesToRefresh
|| timeSeriesLoad & parameters.timeSeriesToGenerate)
if (!options.loadOnlyNeeded || timeSeriesLoad & parameters.timeSeriesToGenerate)
{
buffer.clear() << folderInput << SEP << "load" << SEP << "prepro" << SEP
<< "correlation.ini";
preproLoadCorrelation.loadFromFile(*this, buffer);
}

// Solar
if (!options.loadOnlyNeeded || timeSeriesSolar & parameters.timeSeriesToRefresh
|| timeSeriesSolar & parameters.timeSeriesToGenerate)
if (!options.loadOnlyNeeded || timeSeriesSolar & parameters.timeSeriesToGenerate)
{
buffer.clear() << folderInput << SEP << "solar" << SEP << "prepro" << SEP
<< "correlation.ini";
Expand All @@ -254,8 +246,7 @@ bool Study::internalLoadCorrelationMatrices(const StudyLoadOptions& options)

// Wind
{
if (!options.loadOnlyNeeded || timeSeriesWind & parameters.timeSeriesToRefresh
|| timeSeriesWind & parameters.timeSeriesToGenerate)
if (!options.loadOnlyNeeded || timeSeriesWind & parameters.timeSeriesToGenerate)
{
buffer.clear() << folderInput << SEP << "wind" << SEP << "prepro" << SEP
<< "correlation.ini";
Expand All @@ -265,8 +256,7 @@ bool Study::internalLoadCorrelationMatrices(const StudyLoadOptions& options)

// Hydro
{
if (!options.loadOnlyNeeded || (timeSeriesHydro & parameters.timeSeriesToRefresh)
|| (timeSeriesHydro & parameters.timeSeriesToGenerate))
if (!options.loadOnlyNeeded || timeSeriesHydro & parameters.timeSeriesToGenerate)
{
buffer.clear() << folderInput << SEP << "hydro" << SEP << "prepro" << SEP
<< "correlation.ini";
Expand Down
136 changes: 8 additions & 128 deletions src/libs/antares/study/parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,6 @@ void Parameters::reset()
nbTimeSeriesHydro = 1;
nbTimeSeriesWind = 1;
nbTimeSeriesThermal = 1;
// Time-series refresh
timeSeriesToRefresh = 0; // None
refreshIntervalLoad = 100;
refreshIntervalSolar = 100;
refreshIntervalHydro = 100;
refreshIntervalWind = 100;
refreshIntervalThermal = 100;
// Archive
timeSeriesToArchive = 0; // None
// Pre-Processor
Expand Down Expand Up @@ -534,32 +527,6 @@ static bool SGDIntLoadFamily_General(Parameters& d,
// Only by TS generator. We skip it here (otherwise, we get a reading error).
return true;
}
// Interval values
if (key == "refreshintervalload")
{
return value.to<uint>(d.refreshIntervalLoad);
}
if (key == "refreshintervalhydro")
{
return value.to<uint>(d.refreshIntervalHydro);
}
if (key == "refreshintervalwind")
{
return value.to<uint>(d.refreshIntervalWind);
}
if (key == "refreshintervalthermal")
{
return value.to<uint>(d.refreshIntervalThermal);
}
if (key == "refreshintervalsolar")
{
return value.to<uint>(d.refreshIntervalSolar);
}
// What timeSeries to refresh ?
if (key == "refreshtimeseries")
{
return ConvertCStrToListTimeSeries(value, d.timeSeriesToRefresh);
}
// readonly
if (key == "readonly")
{
Expand Down Expand Up @@ -1139,6 +1106,14 @@ static bool SGDIntLoadFamily_Legacy(Parameters& d,
return true;
}

// ignored since 9.3
if (key == "refreshtimeseries" || key == "refreshintervalload" || key == "refreshintervalhydro"
|| key == "refreshintervalwind" || key == "refreshintervalthermal"
|| key == "refreshintervalsolar")
{
return true;
}

return false;
}

Expand Down Expand Up @@ -1218,8 +1193,6 @@ bool Parameters::loadFromINI(const IniFile& ini, const StudyVersion& version)
}
}

fixRefreshIntervals();

fixGenRefreshForNTC();

// We currently always returns true to not block any loading process
Expand All @@ -1238,29 +1211,6 @@ void Parameters::handleOptimizationOptions(const StudyLoadOptions& options)
optOptions.solverLogs = options.optOptions.solverLogs || optOptions.solverLogs;
}

void Parameters::fixRefreshIntervals()
{
using T = std::tuple<uint& /* refreshInterval */,
enum TimeSeriesType /* ts */,
const std::string /* label */>;
const std::list<T> timeSeriesToCheck = {{refreshIntervalLoad, timeSeriesLoad, "load"},
{refreshIntervalSolar, timeSeriesSolar, "solar"},
{refreshIntervalHydro, timeSeriesHydro, "hydro"},
{refreshIntervalWind, timeSeriesWind, "wind"},
{refreshIntervalThermal, timeSeriesThermal, "thermal"}};

for (const auto& [refreshInterval, ts, label]: timeSeriesToCheck)
{
if (ts & timeSeriesToRefresh && 0 == refreshInterval)
{
refreshInterval = 1;
logs.error() << "The " << label
<< " time-series must be refreshed but the interval is equal to 0. "
"Auto-Reset to a safe value (1).";
}
}
}

void Parameters::fixGenRefreshForNTC()
{
if ((timeSeriesTransmissionCapacities & timeSeriesToGenerate) != 0)
Expand All @@ -1269,12 +1219,6 @@ void Parameters::fixGenRefreshForNTC()
logs.error() << "Time-series generation is not available for transmission capacities. It "
"will be automatically disabled.";
}
if ((timeSeriesTransmissionCapacities & timeSeriesToRefresh) != 0)
{
timeSeriesToRefresh &= ~timeSeriesTransmissionCapacities;
logs.error() << "Time-series refresh is not available for transmission capacities. It will "
"be automatically disabled.";
}
if ((timeSeriesTransmissionCapacities & interModal) != 0)
{
interModal &= ~timeSeriesTransmissionCapacities;
Expand Down Expand Up @@ -1592,64 +1536,6 @@ void Parameters::prepareForSimulation(const StudyLoadOptions& options)
interModal = 0;
}

// Preprocessors
if (!timeSeriesToGenerate)
{
// Nothing to refresh
timeSeriesToRefresh = 0;
}
else
{
// Removing `refresh`
if (!(timeSeriesToGenerate & timeSeriesLoad))
{
timeSeriesToRefresh &= ~timeSeriesLoad;
}
if (!(timeSeriesToGenerate & timeSeriesSolar))
{
timeSeriesToRefresh &= ~timeSeriesSolar;
}
if (!(timeSeriesToGenerate & timeSeriesWind))
{
timeSeriesToRefresh &= ~timeSeriesWind;
}
if (!(timeSeriesToGenerate & timeSeriesHydro))
{
timeSeriesToRefresh &= ~timeSeriesHydro;
}
if (!(timeSeriesToGenerate & timeSeriesThermal))
{
timeSeriesToRefresh &= ~timeSeriesThermal;
}

// Force mode refresh if the timeseries must be regenerated
if (timeSeriesToGenerate & timeSeriesLoad && !(timeSeriesToRefresh & timeSeriesLoad))
{
timeSeriesToRefresh |= timeSeriesLoad;
refreshIntervalLoad = UINT_MAX;
}
if (timeSeriesToGenerate & timeSeriesSolar && !(timeSeriesToRefresh & timeSeriesSolar))
{
timeSeriesToRefresh |= timeSeriesSolar;
refreshIntervalSolar = UINT_MAX;
}
if (timeSeriesToGenerate & timeSeriesWind && !(timeSeriesToRefresh & timeSeriesWind))
{
timeSeriesToRefresh |= timeSeriesWind;
refreshIntervalWind = UINT_MAX;
}
if (timeSeriesToGenerate & timeSeriesHydro && !(timeSeriesToRefresh & timeSeriesHydro))
{
timeSeriesToRefresh |= timeSeriesHydro;
refreshIntervalHydro = UINT_MAX;
}
if (timeSeriesToGenerate & timeSeriesThermal && !(timeSeriesToRefresh & timeSeriesThermal))
{
timeSeriesToRefresh |= timeSeriesThermal;
refreshIntervalThermal = UINT_MAX;
}
}

if (options.noTimeseriesImportIntoInput && timeSeriesToArchive != 0)
{
logs.info() << " :: ignoring timeseries importation to input";
Expand Down Expand Up @@ -1792,14 +1678,8 @@ void Parameters::saveToINI(IniFile& ini) const
section->add("nbTimeSeriesSolar", nbTimeSeriesSolar);

// Refresh
ParametersSaveTimeSeries(section, "refreshTimeSeries", timeSeriesToRefresh);
ParametersSaveTimeSeries(section, "intra-modal", intraModal);
ParametersSaveTimeSeries(section, "inter-modal", interModal);
section->add("refreshIntervalLoad", refreshIntervalLoad);
section->add("refreshIntervalHydro", refreshIntervalHydro);
section->add("refreshIntervalWind", refreshIntervalWind);
section->add("refreshIntervalThermal", refreshIntervalThermal);
section->add("refreshIntervalSolar", refreshIntervalSolar);

// Readonly
section->add("readonly", readonly);
Expand Down
5 changes: 1 addition & 4 deletions src/libs/antares/study/runtime/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ static void StudyRuntimeInfosInitializeAllAreas(Study& study, StudyRuntimeInfos&
}

// Spinning - Economic Only - If no prepro
if (!(timeSeriesThermal & study.parameters.timeSeriesToRefresh))
{
area.thermal.list.calculationOfSpinning();
}
area.thermal.list.calculationOfSpinning();

area.scratchpad.reserve(nbYearsInParallel);
for (uint numSpace = 0; numSpace < nbYearsInParallel; numSpace++)
Expand Down
Loading
Loading