Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
c5a62f3
Introduce new Time-Series that will represent maximum, minimum and av…
nikolaredstork Nov 27, 2024
6bb1351
Intoduction to the new global parameter that will determine from whic…
nikolaredstork Nov 27, 2024
a4d744f
Introduce reservoir levels objects into constructor
nikolaredstork Nov 28, 2024
555b4f0
Add comments
nikolaredstork Nov 28, 2024
9d92b2e
Clang format and hydro reservoir level check
nikolaredstork Nov 28, 2024
30043fb
Reservoir Levels load function
nikolaredstork Nov 28, 2024
3bea9b2
Introduce new function for loading old reservoir levels files
nikolaredstork Nov 29, 2024
ba35f60
Add checks in solver
nikolaredstork Nov 29, 2024
7377d61
Clang format
nikolaredstork Nov 29, 2024
c06853e
Clang format
nikolaredstork Nov 29, 2024
7d04962
Implement new objects to solver
nikolaredstork Nov 29, 2024
ac6a6e2
Bug Fix
nikolaredstork Nov 29, 2024
02a84ef
Refactoring and Unit tests
nikolaredstork Nov 29, 2024
ff11399
Clang format
nikolaredstork Nov 29, 2024
b1f9c24
Merge branch 'develop' into feature/multiple-rule-curve-cr24
nikolaredstork Nov 29, 2024
8338a9b
Reservoir levels check revert
nikolaredstork Nov 30, 2024
29a24d5
Hydro Levels Check Fix
nikolaredstork Nov 30, 2024
ebffd6c
Use getColum function
nikolaredstork Nov 30, 2024
130ece3
Excluding unnecessary code
nikolaredstork Nov 30, 2024
e4fba4f
Refactoring
nikolaredstork Dec 1, 2024
be6c31a
Save useScenarizedReservoirLevels value
nikolaredstork Dec 1, 2024
baa68bd
Clang format
nikolaredstork Dec 1, 2024
26068f7
Change function name
nikolaredstork Dec 2, 2024
2b880c7
Additional check in reservoir levels check function
nikolaredstork Dec 2, 2024
35aea9b
Modification of load function
nikolaredstork Dec 2, 2024
f013a51
Unit tests-Loading scenarized reservoir levels
nikolaredstork Dec 3, 2024
62604fa
clang format
nikolaredstork Dec 3, 2024
25da0ea
Refactor hydro reservoir check
nikolaredstork Dec 4, 2024
b21a8c0
Bug fix
nikolaredstork Dec 4, 2024
b8cd961
Unit tests for hydro inputs checker
nikolaredstork Dec 4, 2024
7a3aae1
Clang format
nikolaredstork Dec 4, 2024
9ceec7f
Exclud unnecessary code from unit tests
nikolaredstork Dec 4, 2024
849020b
Merge branch 'develop' into feature/multiple-rule-curve-cr24
nikolaredstork Dec 4, 2024
71d8786
Use Reservoir Levels enum
nikolaredstork Dec 5, 2024
239bdc9
Save new files. Added for testing
nikolaredstork Dec 5, 2024
ea6b47c
Sonar cloud. To be removed on pushing this branch on RTE repo
nikolaredstork Dec 5, 2024
0ad820c
Add reservoir levels to tsCount function
nikolaredstork Dec 6, 2024
8fed28b
New class for hydro reservoir levels
nikolaredstork Dec 9, 2024
052ae8a
Use new objects
nikolaredstork Dec 9, 2024
c8dc574
Fix unit tests
nikolaredstork Dec 9, 2024
81fefd5
Excluding unnecessary code
nikolaredstork Dec 10, 2024
83a0ca8
Refactoring
nikolaredstork Dec 10, 2024
102d24a
Add comments
nikolaredstork Dec 10, 2024
3f2a5ad
Add copy function
nikolaredstork Dec 10, 2024
595d221
Unit test for load functions
nikolaredstork Dec 10, 2024
ed65b0d
Adding more checks to unit test
nikolaredstork Dec 10, 2024
ed7b02e
Fix folder creation in unit test
nikolaredstork Dec 10, 2024
cd3949c
Refactor loading functions
nikolaredstork Dec 12, 2024
25a317b
Modify unit test
nikolaredstork Dec 12, 2024
064786b
Clang format
nikolaredstork Dec 12, 2024
1a15f3d
UI bugfix
nikolaredstork Dec 13, 2024
0a7550f
Merge branch 'develop' into feature/multiple-rule-curve-cr-24
nikolaredstork Mar 27, 2025
ba385cc
Clang Format
nikolaredstork Mar 27, 2025
f619d10
Move flag to compatibility section
nikolaredstork Mar 28, 2025
cb3e3fb
Naming convention
nikolaredstork Mar 28, 2025
1817c10
Update user-guide
nikolaredstork Mar 28, 2025
3e86435
Clang format
nikolaredstork Mar 28, 2025
099cd2c
Move flag to compatibility section
nikolaredstork Mar 30, 2025
b02aeec
Implement loader classes
nikolaredstork Mar 30, 2025
7b05d79
Merge branch 'develop' into feature/multiple-rule-curve-cr-24
nikolaredstork Mar 30, 2025
9899b72
Exclude depraceted code
nikolaredstork Mar 31, 2025
544270e
Revert sonar workflow
nikolaredstork Mar 31, 2025
754fb1c
Possible fix
nikolaredstork Mar 31, 2025
a16032b
Bugfix
nikolaredstork Mar 31, 2025
f52a1ba
Move flag to compatibility part
nikolaredstork Apr 1, 2025
57c4236
Clang format
nikolaredstork Apr 1, 2025
0396f76
Clang format
nikolaredstork Apr 1, 2025
b3dbcc5
Hydro rule curves compatibility
nikolaredstork Apr 1, 2025
35a9d82
Clang format
nikolaredstork Apr 1, 2025
3ea013b
Documentation update
nikolaredstork Apr 1, 2025
e409e5d
Merge branch 'develop' into feature/multiple-rule-curve-cr-24
nikolaredstork Apr 1, 2025
ee5bd18
Unit tests
nikolaredstork Apr 1, 2025
fa36c6d
Clang format
nikolaredstork Apr 1, 2025
559ffc5
Add study version conversion
nikolaredstork May 14, 2025
897a4ec
Change function name
nikolaredstork May 23, 2025
9cb9428
Swithc places for initialization reasons
nikolaredstork May 29, 2025
c3b8ca4
Change name convention for object that communicate with GUI
nikolaredstork May 30, 2025
99e6860
Clang Format
nikolaredstork May 30, 2025
606d3bc
Name convetion modification
nikolaredstork May 30, 2025
ffc10cb
Naming convention second part
nikolaredstork May 30, 2025
9beb916
Change name of files
nikolaredstork May 30, 2025
3db5592
Move load from folder function to RuleCurvesLoader class
nikolaredstork May 30, 2025
e9c588c
Loader Service Class
nikolaredstork May 30, 2025
5ba5657
Add createRuleCurvesLoader in Service class
nikolaredstork May 30, 2025
9196bd6
Remove unnecessary code and modify unit tests
nikolaredstork May 30, 2025
c0c5944
Merge branch 'develop' into feature/multiple-rule-curve-cr-24
nikolaredstork May 30, 2025
acfe1c2
Code smells
nikolaredstork May 30, 2025
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
21 changes: 21 additions & 0 deletions docs/user-guide/04-migration-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@
This is a list of all recent changes that came with new Antares Simulator features. The main goal of this document is to
lower the costs of changing existing interfaces, both GUI and scripts.

## v9.3.0

### Input

#### New optional feature and compatibility flag for scenarized hydro reservoir levels

In file settings/generaldata.ini, in section `compatibility`, new property `hydro-rule-curves` is added with possible values

- `single` (default)
- `scenarized`.

If flag is set to `scenarized`, user must create for each area in `input/hydro/series/<area id>/` following files:

- `"maxDailyReservoirLevels.txt"`
- `"minDailyReservoirLevels.txt"`
- `"avgDailyReservoirLevels.txt"`

Antares-Simulator will read hydro reservoir levels from mentioned files, data from `input/hydro/common/capacity/reservoir_<area_id>` will be disregarded.

The number of time series for the reservoir levels must match the number of time series used for the other hydro components (run of river, minimum generation etc.), ensuring that scenarized reservoir level data is fully integrated within the same Scenario Builder framework as the rest of the hydro time series. However, number of hydro reservoir levels times series can indeed be 1 for each type, min, avg and max.

## v9.2.0

### Input
Expand Down
2 changes: 2 additions & 0 deletions src/libs/antares/study/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ set(SRC_STUDY_PART_HYDRO
parts/hydro/allocation.cpp
include/antares/study/parts/hydro/hydromaxtimeseriesreader.h
parts/hydro/hydromaxtimeseriesreader.cpp
include/antares/study/parts/hydro/hydrorulecurves.h
parts/hydro/hydrorulecurves.cpp
)
source_group("study\\part\\hydro" FILES ${SRC_STUDY_PART_HYDRO})

Expand Down
11 changes: 11 additions & 0 deletions src/libs/antares/study/area/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ static bool AreaListSaveToFolderSingleArea(const Area& area,
{
buffer.clear() << folder << SEP << "input" << SEP << "hydro" << SEP << "series";
ret = area.hydro.series->saveToFolder(area.id, buffer, hydroPmax) && ret;

buffer.clear() << folder << SEP << "input" << SEP << "hydro";
ret = area.hydro.series->ruleCurves.saveToFolder(area.id, buffer) && ret;
}
}

Expand Down Expand Up @@ -972,6 +975,14 @@ static bool AreaListLoadFromFolderSingleArea(Study& study,
"Value not supported for study.parameters.compatibility.hydroPmax");
}

RuleCurvesLoaderService ruleCurvesLoaderService(area.hydro.series->ruleCurves);

ret = ruleCurvesLoaderService.LoadFromFolder(area.id,
pathHydro,
study.usedByTheSolver,
study.parameters.compatibility.hydroRuleCurves)
&& ret;

area.hydro.series->resizeTSinDeratedMode(study.parameters.derated,
studyVersion,
study.parameters.compatibility.hydroPmax,
Expand Down
10 changes: 10 additions & 0 deletions src/libs/antares/study/include/antares/study/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@ class Parameters final
Hourly
};
HydroPmax hydroPmax = HydroPmax::Daily;
enum class HydroRuleCurves
{
Single,
Scenarized
};
HydroRuleCurves hydroRuleCurves = HydroRuleCurves::Single;
};

Compatibility compatibility;
Expand Down Expand Up @@ -521,6 +527,10 @@ bool StringToSimulationMode(SimulationMode& mode, Yuni::CString<20, false> text)
const char* CompatibilityHydroPmaxToCString(const Parameters::Compatibility::HydroPmax);
bool StringToCompatibilityHydroPmax(Parameters::Compatibility::HydroPmax&, const std::string& text);

const char* CompatibilityHydroRuleCurvesToCString(
const Parameters::Compatibility::HydroRuleCurves mode);
bool StringToCompatibilityHydroRuleCurves(Parameters::Compatibility::HydroRuleCurves& mode,
const std::string& text);
} // namespace Antares::Data

#endif // __ANTARES_LIBS_STUDY_PARAMETERS_H__
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ class PartHydro
//! Daily Inflow Patern ([default 1, 0<x<dayspermonth]x365)
Matrix<double> inflowPattern;

//! Daily reservoir level ({min,avg,max}x365)
Matrix<double> reservoirLevel;

//! Daily water value ({0,1,2%...100%}x365)
Matrix<double> waterValues;

Expand All @@ -234,7 +231,7 @@ class PartHydro
double overflowSpilledCostDifference = 1.;

private:
static bool checkReservoirLevels(const Study& study);
static bool checkInflowPatternAndCredModul(const Study& study);
static bool checkProperties(Study& study);

}; // class PartHydro
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
/*
** Copyright 2007-2024, RTE (https://www.rte-france.com)
** See AUTHORS.txt
** SPDX-License-Identifier: MPL-2.0
** This file is part of Antares-Simulator,
** Adequacy and Performance assessment for interconnected energy networks.
**
** Antares_Simulator is free software: you can redistribute it and/or modify
** it under the terms of the Mozilla Public Licence 2.0 as published by
** the Mozilla Foundation, either version 2 of the License, or
** (at your option) any later version.
**
** Antares_Simulator is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** Mozilla Public Licence 2.0 for more details.
**
** You should have received a copy of the Mozilla Public Licence 2.0
** along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
*/
#ifndef __ANTARES_LIBS_STUDY_PARTS_HYDRO_RESERVOIR_LEVELS_H__
#define __ANTARES_LIBS_STUDY_PARTS_HYDRO_RESERVOIR_LEVELS_H__

#include <antares/array/matrix.h>
#include <antares/series/series.h>
#include <antares/study/parameters.h>
#include <antares/study/version.h>

#include "../../fwd.h"

namespace Antares
{
namespace Data
{

/*!
** \brief Rule Curves class that support reservoir levels data
*/

class RuleCurves
{
public:
enum
{
//! The minimum value
minimum = 0,
//! The average value
average,
//! The maximum value
maximum,
};

//! \name Constructor
//@{
/*!
** \brief Default constructor
*/
explicit RuleCurves(TimeSeriesNumbers& timeseriesNumbers);

bool forceReload(bool reload = false) const;

void markAsModified() const;

bool saveToFolder(const std::string& areaID, const std::string& folder) const;

void averageTimeSeries();

TimeSeriesNumbers& timeseriesNumbers;

/*!
** \brief Maximum Reservoir Levels (%)
**
** Merely a matrix of TimeSeriesCount * DAYS_PER_YEAR values
*/
TimeSeries max;

/*!
** \brief Minimum Reservoir Levels (%)
**
** Merely a matrix of TimeSeriesCount * DAYS_PER_YEAR values
*/
TimeSeries min;

/*!
** \brief Average Reservoir Levels (%)
**
** Merely a matrix of TimeSeriesCount * DAYS_PER_YEAR values
*/
TimeSeries avg;

/*!
** \brief This matrix is used for UI communication
**
** Merely a matrix of 3 * DAYS_PER_YEAR values
*/

// The buffer facilitates communication with the UI.
// This functionality will no longer be required once the UI is fully deprecated.
Matrix<double> standardRuleCurvesGUI;
};

class RuleCurvesLoader
{
public:
RuleCurvesLoader(

const std::filesystem::path& baseFolder,
const std::string& areaID,
TimeSeries& max,
TimeSeries& avg,
TimeSeries& min):
baseFolder_(baseFolder),
areaID_(areaID),
max_(max),
avg_(avg),
min_(min)

{
}

virtual ~RuleCurvesLoader() = default;
virtual bool load() = 0;

protected:
const std::filesystem::path& baseFolder_;
const std::string& areaID_;
TimeSeries& max_;
TimeSeries& avg_;
TimeSeries& min_;
};

class StandardRuleCurvesLoader: public RuleCurvesLoader
{
public:
StandardRuleCurvesLoader(const std::filesystem::path& baseFolder,
const std::string& areaID,
Matrix<double>& standardRuleCurvesGUI,
TimeSeries& max,
TimeSeries& avg,
TimeSeries& min):
RuleCurvesLoader(baseFolder, areaID, max, avg, min),
standardRuleCurvesMatrixGUI_(standardRuleCurvesGUI)

{
}

private:
Matrix<double>& standardRuleCurvesMatrixGUI_;
bool load() final;
void copyRuleCurvesFromBuffer();
};

class ScenarizedRuleCurvesLoader: public RuleCurvesLoader
{
public:
ScenarizedRuleCurvesLoader(const std::filesystem::path& baseFolder,
const std::string& areaID,
TimeSeries& max,
TimeSeries& avg,
TimeSeries& min):
RuleCurvesLoader(baseFolder, areaID, max, avg, min)
{
}

private:
bool load() final;
};

class RuleCurvesLoaderService
{
private:
RuleCurves& ruleCurves_;

public:
explicit RuleCurvesLoaderService(RuleCurves& ruleCurves):
ruleCurves_(ruleCurves)
{
}

bool LoadFromFolder(const std::string& areaID,
const std::filesystem::path& folder,
bool usedBySolver,
Parameters::Compatibility::HydroRuleCurves hydroRuleCurves);

private:
std::unique_ptr<RuleCurvesLoader> createRuleCurvesLoader(
Parameters::Compatibility::HydroRuleCurves hydroRuleCurves,
const std::filesystem::path& filePath,
const std::string& areaID,
Matrix<double>& standardRuleCurvesGUI,
TimeSeries& max,
TimeSeries& avg,
TimeSeries& min);
};
} // namespace Data
} // namespace Antares

#endif /* __ANTARES_LIBS_STUDY_PARTS_HYDRO_RESERVOIR_LEVELS_H__ */
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <antares/study/version.h>

#include "../../fwd.h"
#include "hydrorulecurves.h"

namespace Antares
{
Expand Down Expand Up @@ -135,6 +136,8 @@ class DataSeriesHydro
*/
TimeSeries maxHourlyPumpPower;

RuleCurves ruleCurves;

// Getters for generation (ror, storage and mingen) and
// max power (generation and pumping) number of TS
uint TScount() const;
Expand Down
41 changes: 41 additions & 0 deletions src/libs/antares/study/parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,40 @@ bool StringToCompatibilityHydroPmax(Parameters::Compatibility::HydroPmax& mode,
return false;
}

const char* CompatibilityHydroRuleCurvesToCString(
const Parameters::Compatibility::HydroRuleCurves mode)
{
switch (mode)
{
case Parameters::Compatibility::HydroRuleCurves::Single:
return "single";
case Parameters::Compatibility::HydroRuleCurves::Scenarized:
return "scenarized";
default:
return "Unknown";
}
}

bool StringToCompatibilityHydroRuleCurves(Parameters::Compatibility::HydroRuleCurves& mode,
const std::string& text)
{
if (text.empty())
{
return false;
}
if (text == "single")
{
mode = Parameters::Compatibility::HydroRuleCurves::Single;
return true;
}
if (text == "scenarized")
{
mode = Parameters::Compatibility::HydroRuleCurves::Scenarized;
return true;
}
return false;
}

bool Parameters::economy() const
{
return mode == SimulationMode::Economy;
Expand Down Expand Up @@ -1099,6 +1133,11 @@ static bool SGDIntLoadFamily_Compatibility(Parameters& d,
return StringToCompatibilityHydroPmax(d.compatibility.hydroPmax, value);
}

if (key == "hydro-rule-curves")
{
return StringToCompatibilityHydroRuleCurves(d.compatibility.hydroRuleCurves, value);
}

return false;
}

Expand Down Expand Up @@ -2012,6 +2051,8 @@ void Parameters::saveToINI(IniFile& ini) const
{
auto* section = ini.addSection("compatibility");
section->add("hydro-pmax", CompatibilityHydroPmaxToCString(compatibility.hydroPmax));
section->add("hydro-rule-curves",
CompatibilityHydroRuleCurvesToCString(compatibility.hydroRuleCurves));
}
}

Expand Down
Loading
Loading