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

Multiple Maximum Generation and Pumping for Hydro (Merging with develop branch) #1723

Merged
merged 152 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
2b03609
Maxgen matrix implemented
nikolaredstork Jul 13, 2023
e25aea9
Maxpump matrix implemented
nikolaredstork Jul 13, 2023
9bbe22e
Scenario Builder GUI
nikolaredstork Jul 22, 2023
ab3085f
DataSeriesHydro-new matrix for max gen and pump TS's
nikolaredstork Jul 22, 2023
f2bd3ac
MC years linked with new hydro MC Scenario Builder Matrix
nikolaredstork Jul 22, 2023
5a80015
Random number feature
nikolaredstork Jul 22, 2023
f602cc6
Replacing daily values for hourly in solver
nikolaredstork Jul 22, 2023
22d74c4
HydroHasMod and PumpHasMod
nikolaredstork Jul 22, 2023
34a314b
Hydro Modulabe
nikolaredstork Jul 22, 2023
0fb26de
GUI for TS management hydro power credits
nikolaredstork Jul 22, 2023
e2e963a
Inter and Intra modal feature backend
nikolaredstork Jul 23, 2023
a4d33db
Auto Transfer function and one comment modification
nikolaredstork Jul 23, 2023
eee6d08
Comment modification
nikolaredstork Jul 23, 2023
a4c1da8
Refactoring checkHourlyMinMaxGeneration function
nikolaredstork Jul 23, 2023
827cfb5
Separate function for checking max gen and pump TS number
nikolaredstork Jul 23, 2023
07ce46b
Excluding unnecessary function parameter
nikolaredstork Jul 23, 2023
4b08e13
Excluding unnecessary reference
nikolaredstork Jul 24, 2023
ede8efc
HydroHasMod and PumpHasMod modification
nikolaredstork Jul 24, 2023
598a474
Change function name
nikolaredstork Jul 24, 2023
4554d23
MD files updated
nikolaredstork Jul 24, 2023
94ca6b7
MD file modification
nikolaredstork Jul 25, 2023
2ab16dc
Merge branch 'develop-new' into feature/maxgen-maxpump-cr23
nikolaredstork Jul 31, 2023
13db210
Modification after merging with develop-new branch
nikolaredstork Jul 31, 2023
04b6104
Fixing build errors due to migration from raw ptrs to stl vectors
nikolaredstork Jul 31, 2023
1820fda
Support for old studies fix
nikolaredstork Aug 2, 2023
94698f1
Separate mingen from maxgen and maxpump
nikolaredstork Aug 3, 2023
75b6263
New Load function for Hydro Power Credits
nikolaredstork Aug 3, 2023
91435e9
fix - random ts number test crash
Milos-RTEi Aug 3, 2023
c672e3a
fix pumpMaxE bug
Milos-RTEi Aug 3, 2023
118db9a
Separate mingen from maxgen and maxpump
nikolaredstork Aug 3, 2023
7ee9ccf
fix - random ts number test crash
Milos-RTEi Aug 3, 2023
4b165d2
fix pumpMaxE bug
Milos-RTEi Aug 3, 2023
6cad434
Bugfix
nikolaredstork Aug 4, 2023
401e21a
Merge branch 'feature/max-hydro-gen-pump-per-h-cr23' into feature/max…
Milos-RTEi Aug 4, 2023
75cb113
Feature/maxgen maxpump cr23 - improvements (#1499)
Milos-RTEi Aug 4, 2023
bcdc18b
Adding pointer check
nikolaredstork Aug 4, 2023
8e35773
Adding pointer check
nikolaredstork Aug 4, 2023
4abc817
New file maxhours_areaID
nikolaredstork Aug 8, 2023
c104436
New class that support old studies
nikolaredstork Aug 9, 2023
0667a39
Two separate files for Gen and Pump hours
nikolaredstork Aug 11, 2023
7138ced
Delete old files
nikolaredstork Aug 14, 2023
cabdc79
Scenario Builder unit tests
nikolaredstork Aug 14, 2023
94784ea
Excluding unnecessary code
nikolaredstork Aug 14, 2023
c8f2050
Keep files for an area
nikolaredstork Aug 14, 2023
a33099d
Excluding unnecessary arrays
nikolaredstork Aug 15, 2023
21cd52e
Fix test
nikolaredstork Aug 16, 2023
7fa96b3
New file maxhours_areaID
nikolaredstork Aug 8, 2023
b5f0573
New class that support old studies
nikolaredstork Aug 9, 2023
aadaa26
Two separate files for Gen and Pump hours
nikolaredstork Aug 11, 2023
8ff8737
Delete old files
nikolaredstork Aug 14, 2023
0d9e8e5
Scenario Builder unit tests
nikolaredstork Aug 14, 2023
a4f00a2
Excluding unnecessary code
nikolaredstork Aug 14, 2023
c142ee9
Keep files for an area
nikolaredstork Aug 14, 2023
644c50b
Excluding unnecessary arrays
nikolaredstork Aug 15, 2023
172d8a9
Fix test
nikolaredstork Aug 16, 2023
68d4299
Merge branch 'develop-new' into feature/maxgen-maxpump-cr23
nikolaredstork Aug 16, 2023
1ec8f3e
Post merge fixs
nikolaredstork Aug 16, 2023
552b48a
Merge branch 'feature/maxgen-maxpump-cr23' into feature/max-hydro-gen…
Milos-RTEi Aug 16, 2023
be21fda
Merge branch 'develop-new' into feature/max-hydro-gen-pump-per-h-cr23
nikolaredstork Aug 16, 2023
578c6e5
Post merge build fix
nikolaredstork Aug 17, 2023
fb0c474
Fix sonar bugs
nikolaredstork Aug 17, 2023
a9e6519
Exclude duplication code
nikolaredstork Aug 17, 2023
b2899d5
Some minor code smells
nikolaredstork Aug 17, 2023
596d9f4
More code smells
nikolaredstork Aug 18, 2023
54bbc79
Resolving Code smells
nikolaredstork Aug 18, 2023
2672405
Unit test datatransfer
nikolaredstork Aug 21, 2023
f78e096
Merge branch 'develop' into feature/max-hydro-gen-pump-per-h-cr23
nikolaredstork Aug 21, 2023
20a4738
Post merge build fix
nikolaredstork Aug 21, 2023
b1874ec
Additional datatransfer unit tests
nikolaredstork Aug 22, 2023
32b56e5
LoadPowerCredits func unit tests
nikolaredstork Aug 22, 2023
c0643bb
Comment correction
nikolaredstork Aug 22, 2023
838c04c
Additional comments
nikolaredstork Aug 22, 2023
376f24d
Refactoring unit tests
nikolaredstork Aug 23, 2023
1eb238c
Refactoring hydro series unit tests
nikolaredstork Aug 23, 2023
fe47970
Help files for unit tests
nikolaredstork Aug 23, 2023
8fa59e9
Exclude unnecessary code
nikolaredstork Aug 23, 2023
25c4b23
MD files
nikolaredstork Aug 23, 2023
426b3c9
Remove function for unit tests
nikolaredstork Aug 24, 2023
9cd3f88
Merge branch 'develop' into feature/max-hydro-gen-pump-per-h-cr23
nikolaredstork Aug 24, 2023
edd5c50
Passing by reference
nikolaredstork Aug 25, 2023
5354e87
Merge branch 'develop' into feature/max-hydro-gen-pump-per-h-cr23
nikolaredstork Aug 25, 2023
867aa5b
Merge branch 'develop' into feature/max-hydro-gen-pump-per-h-cr23
nikolaredstork Aug 25, 2023
81850af
Merge branch 'develop' into feature/max-hydro-gen-pump-per-h-cr23
nikolaredstork Aug 31, 2023
030af42
Merge branch 'develop' into feature/max-hydro-gen-pump-per-h-cr23
nikolaredstork Sep 4, 2023
7c5ddc5
Merge branch 'develop' into feature/max-hydro-gen-pump-per-h-cr23
nikolaredstork Sep 8, 2023
f1c3673
Copy from UI
nikolaredstork Sep 13, 2023
d21f858
Merge branch 'develop' into feature/max-hydro-gen-pump-per-h-cr23
nikolaredstork Sep 13, 2023
6c01298
Post merge build errors
nikolaredstork Sep 15, 2023
fd1e1eb
Merge branch 'develop' into feature/max-hydro-gen-pump-per-h-cr23
nikolaredstork Sep 18, 2023
baa6994
Merge branch 'develop' into feature/max-hydro-gen-pump-per-h-cr23
nikolaredstork Sep 21, 2023
00b8592
Post merge build errors resolved
nikolaredstork Sep 21, 2023
cc82545
Multiple Maximum Generation and Pumping for Hydro (Refactoring) (#1648)
nikolaredstork Oct 26, 2023
0938768
Preparation for merge
nikolaredstork Oct 27, 2023
7707ac3
Merge branch 'develop' into feature/max-hydro-gen-pump-per-h-cr23
nikolaredstork Oct 28, 2023
4b3274e
Refactoring due to merging with develop
nikolaredstork Oct 28, 2023
bf5c1d4
Excluding unnecessary function argument
nikolaredstork Oct 28, 2023
df5b115
Fix build error
nikolaredstork Oct 28, 2023
9cdee5c
update form develop and simplifications on CR 23 (#1728)
guilpier-code Oct 31, 2023
d3bf301
Merge remote-tracking branch 'remotes/origin/develop' into feature/ma…
guilpier-code Oct 31, 2023
7988dde
Simplification on CR23: ResizeTS function (#1729)
nikolaredstork Oct 31, 2023
3da3b13
Small refactoring CR23 - File deletion (#1732)
nikolaredstork Nov 2, 2023
747ca30
[skip ci] : add a TODO regarding scratchpad and hydro max power daily…
guilpier-code Nov 3, 2023
f0056dd
CR23 Modification : Unit tests refactoring (#1740)
nikolaredstork Nov 3, 2023
c562812
[skip ci] : complete a TODO on scratchpad and hydro max power daily T…
guilpier-code Nov 3, 2023
8b4a1a5
[skip ci] CR 23 (hourly max power TS) : just renaming local variables
guilpier-code Nov 3, 2023
af4ad02
CR 23 (new hydro hourly max power TS) : replace useless and unclear s…
guilpier-code Nov 3, 2023
0697e89
CR 23 (new hydro hourly max power TS) : just removing a useless if st…
guilpier-code Nov 6, 2023
4463240
Merge branch 'develop' into feature/max-gen-pump-cr23-develop-merge
nikolaredstork Nov 6, 2023
2a52a46
Declaring class member function as const
nikolaredstork Nov 6, 2023
468bd2e
CR 23 (new hydro hourly max power TS) : changing definition and usage…
guilpier-code Nov 6, 2023
8d62fa9
[skip ci] CR 23 (new hydro hourly max power TS) : just renaming local…
guilpier-code Nov 6, 2023
3eff63d
CR 23 (new hydro hourly max power TS) : renaming hydro daily TS into …
guilpier-code Nov 6, 2023
4232fcc
CR 23 (new hydro hourly max power TS) : improving helper free functio…
guilpier-code Nov 6, 2023
d6c2d13
Indent return statement
nikolaredstork Nov 6, 2023
07e112f
Clang format
nikolaredstork Nov 6, 2023
092abb4
Possible fix
nikolaredstork Nov 6, 2023
b3c9cdb
[skip ci] CR 23 (new hydro hourly max power TS) : a bit cleaning and …
guilpier-code Nov 7, 2023
fe6cbe7
[skip ci] CR 23 (new hydro hourly max power TS) : add a TODO comment
guilpier-code Nov 7, 2023
a8152ed
Remove helper class PairOfIntegers (#1763)
flomnes Nov 10, 2023
3f4530c
remove folder
nikolaredstork Nov 13, 2023
0b50919
Revert "remove folder"
nikolaredstork Nov 13, 2023
8529ed8
Removing compiler warning
nikolaredstork Nov 13, 2023
f7304a0
HydroMaxReader class refactor (#1750)
nikolaredstork Nov 15, 2023
4d0e5a5
update antares-deps
guilpier-code Dec 7, 2023
00c1ba3
Small refactoring CR23 (#1784)
nikolaredstork Dec 7, 2023
e368fe4
Study version literal change from 870 to 890 (#1814)
nikolaredstork Dec 8, 2023
e2b9339
Merge remote-tracking branch 'github/develop' into feature/max-gen-pu…
flomnes Jan 18, 2024
ec9f4dc
Clean out removed function
flomnes Jan 18, 2024
b4b03bc
Remove study.gotFatalError
flomnes Jan 18, 2024
ab4e9b2
One more fix
flomnes Jan 18, 2024
5e5edbf
Add missing dependency
flomnes Jan 19, 2024
6217c8d
Reùove unused fatalError
flomnes Jan 19, 2024
292989a
Fix header for Boost Test
flomnes Jan 22, 2024
a186bad
Merge remote-tracking branch 'github/develop' into feature/max-gen-pu…
flomnes Jan 22, 2024
5582406
Fix size for storage timeSeriesNumbers
flomnes Jan 22, 2024
8ce0cff
Fix changed TS numbers for ROR
flomnes Jan 22, 2024
3415b2e
Remove useless #define
flomnes Jan 22, 2024
bee6e82
Merge remote-tracking branch 'github/develop' into feature/max-gen-pu…
flomnes Jan 25, 2024
5bea0ca
Fix build
flomnes Jan 25, 2024
4392ccc
In-memory tests for CR23 (#1894)
flomnes Feb 5, 2024
016c186
Merge remote-tracking branch 'github/develop' into feature/max-gen-pu…
flomnes Feb 5, 2024
f1e84ed
CR23 Reference Guide Update (#1904)
nikolaredstork Feb 6, 2024
da9e697
Downgrade log (error -> warning)
flomnes Feb 6, 2024
0a2b300
Update docs/reference-guide/13-file-format.md
flomnes Feb 6, 2024
30ce902
Merge commit '008989235d6b470bca1acec56c401e68e6640299' into feature/…
guilpier-code Feb 20, 2024
2bcf620
corrections after merge from develop
guilpier-code Feb 21, 2024
837afbd
Corrections after merge from develop
guilpier-code Feb 21, 2024
acdff1a
Merge branch 'develop' into merge-develop_to-cr23
guilpier-code Feb 21, 2024
f098190
move generated file config.h from repo
guilpier-code Feb 21, 2024
05fe9e6
Merge remote-tracking branch 'origin/develop' into feature/max-gen-pu…
Feb 26, 2024
c06b3b8
ts-numbers/max-power -> ts-numbers/hgp
Feb 26, 2024
6fab9c1
Remove progress ticks
Feb 26, 2024
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
2 changes: 1 addition & 1 deletion docs/reference-guide/03-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ this command allows to state, for each kind of time-series, whether it should be
the available set (be it ready-made or Antares-generated) _**OR**_ should take a user-defined value
(in the former case, the default "rand" value should be kept; in the latter, the value should be the reference number of the time-series to use). Multiple simulation profiles can be defined and archived. The default active profile gives the "rand" status for all time-series in all areas (full probabilistic simulation).

Regarding Hydro time-series, the scenario builder gives, in addition to the assignment of a specific number to use for the inflows time-series, the ability to define the initial reservoir level to use for each MC year.
Regarding Hydro time-series, the scenario builder gives, in addition to the assignment of a specific number to use for the inflows time-series, the ability to define the initial reservoir level to use for each MC year, also hydro max power scenario builder is available to support time-series for Maximum Generation and Maximum Pumping because the number of TS's for ROR, Hydro Storage and Minimum Generation can be different than the number of TS's for Maximum Generation and Maximum Pumping.

- **MC Scenario playlist** For each Monte-Carlo year of the simulation defined in the "Simulation" active window,
this command allows to state whether a MC year prepared for the simulation should be actually simulated or not.
Expand Down
19 changes: 10 additions & 9 deletions docs/reference-guide/04-active_windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ These two parts are detailed hereafter.

### RIGHT PART: Time-series management

For the different kinds of time-series that Antares manages in a non-deterministic way (load, thermal generation, hydro power, wind power, solar power or renewable depending on the option chosen):
For the different kinds of time-series that Antares manages in a non-deterministic way (load, thermal generation, hydro power, hydro max power, wind power, solar power or renewable depending on the option chosen):

1. **Choice of the kind of time-series to use**
Either « ready-made » or «stochastic » (i.e. Antares-generated), defined by setting the value to either "on" or "off". Note that for Thermal time-series, the cluster-wise parameter may overrule this global parameter (see Thermal window description below).
Either « ready-made » or «stochastic » (i.e. Antares-generated), defined by setting the value to either "on" or "off". Exception is hydro max power that can only be « ready-made ». Note that for Thermal time-series, the cluster-wise parameter may overrule this global parameter (see Thermal window description below).

2. **For stochastic TS only**:
- **Number** Number of TS to generate
Expand Down Expand Up @@ -334,11 +334,11 @@ which explains the comparatively long length of this chapter.

In the main Window, the user may pick any area appearing in the list and is then given access to different tabs:

- The "time-series" tab displays the "ready-made" time-series already available for simulation purposes. There are two categories of time-series (displayed in two different subtabs): the Run of River (ROR) time-series on the one hand and the Storage power (SP) time-series on the other hand.
- The "time-series" tab displays the "ready-made" time-series already available for simulation purposes. There are five categories of time-series (displayed in five different subtabs): the Run of River (ROR) time-series, the Storage power (SP) time-series, the Minimum Generation power, the Maximum Generation power and the Maximum Pumping Power.

ROR time-series are defined at the hourly scale; each of the 8760 values represents the ROR power expected at a given hour, expressed in round number and in MW. The SP time-series are defined at the daily scale; each of the 365 values represents an overall SP energy expected in the day, expressed in round number and in MWh. These natural inflows are considered to be storable into a reservoir for later use.
ROR time-series are defined at the hourly scale; each of the 8760 values represents the ROR power expected at a given hour, expressed in round number and in MW. The SP time-series are defined at the daily scale; each of the 365 values represents an overall SP energy expected in the day, expressed in round number and in MWh. These natural inflows are considered to be storable into a reservoir for later use. The Minimum Generation time-series are defined at the hourly scale; each of the 8760 values represents the Minimum Generation power expected at a given hour expressed in round number and in MW. The Maximum Generation time-series are defined at the hourly scale; each of the 8760 values represents the Maximum Generation power expected at a given hour expressed in round number and in MW. The Maximum Pumping time-series are defined at the hourly scale; each of the 8760 values represents the Maximum Pumping power expected at a given hour expressed in round number and in MW.

Both types of data may come from any origin outside Antares, or may have been formerly generated by the Antares time-series stochastic generator and stored as input data on the user's request. Different ways to update data are:
ROR time-series and SP time-series may come from any origin outside Antares, or may have been formerly generated by the Antares time-series stochastic generator and stored as input data on the user's request. Minimum Generation, Maximum Generation and Maximum Pumping may come from any origin outside Antares, but they can not be generated by the Antares time-series stochastic generator. Different ways to update data are:

- direct typing
- copy/paste a selected field to/from the clipboard
Expand All @@ -352,7 +352,8 @@ In the main Window, the user may pick any area appearing in the list and is then

- _Note that:_

- _For a given area, the number of ROR time-series and SP times-series **must** be identical_
- _For a given area, the number of ROR time-series, SP times-series and Minimum Generation **must** be identical_
- _For a given area, the number of Maximum Generation and Maximum Pumping **must** be identical_
- _If the "intra-modal correlated draws" option was not selected in the_ **simulation** _window,
MC adequacy or economy simulations can take place even if the number of hydro time-series is not the same
in all areas (e.g. 2 , 5 , 1 , 45 ,...)_
Expand Down Expand Up @@ -415,10 +416,10 @@ the weekly optimal hydro-thermal unit-commitment and dispatch process.
Standard credits (Bottom part)

The bottom part displays two daily time-series (365 values) defined for energy generation/storage
(hydro turbines or hydro pumps). In each case, the first array defines the maximum power (generated or absorbed),
and the second defines the maximum daily energy (either generated or stored).
(hydro turbines or hydro pumps). Both arrays represents the maximum daily energy (either generated or stored).

For the sake of clarity, maximum daily energies are expressed as a number of hours at maximum power.
For the sake of clarity, maximum daily energies are expressed as a number of hours at maximum power and these values
are used along with the Maximum Generation and Maximum Pumping TS's to calculate daily mean energy.

Credit modulation (Upper part)

Expand Down
12 changes: 12 additions & 0 deletions docs/reference-guide/13-file-format.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Study format changes
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.1.0
### (Input) Hydro Maximum Generation/Pumping Power
* For each area, new files are added **input/hydro/series/<area>/maxHourlyGenPower.txt** and **input/hydro/series/<area>/maxHourlyPumpPower.txt**. These files have one or more columns, and 8760 rows. The number of columns in these two files must be the same if there is more than one column in each file, but if there is just one column for example in maxHourlyGenPower.txt file, maxHourlyPumpPower.txt file can have more than one column and vice versa. Starting from v9.0, file **input/hydro/common/capacity/maxpower_<area>** is no longer used.
### How to upgrade capacity time-series ?
Source file = maxpower_<area>, destination files are maxHourlyGenPower.txt and maxHourlyPumpPower.txt. To upgrade time-series, you need to
1. For generation, multiply 1st and 2nd rows. For pumping, multiply 3rd and 4rd rows.
2. Duplicate values 24 times : source has 365 rows, destination has 365 * 24 = 8760 rows
* Also for each area, new files are added **input/hydro/common/capacity/maxDailyGenEnergy_<area>** and **input/hydro/common/capacity/maxDailyPumpEnergy_<area>**. These files have just one column and 365 rows. For old studies, file **input/hydro/common/capacity/maxpower_<area>** will be deleted after cleaning a study.
* Under `Configure/MC Scenario Builder` new section is added `Hydro Max Power`
* In the existing file **settings/scenariobuilder.dat**, under **<ruleset>** section following properties added: **hgp,<area>,<year> = <hgp-value>**

## v9.0.0
### Input
### Study version
Expand All @@ -13,6 +24,7 @@ version = 9.0
```
Compatibility is kept with versions up to 8.8.0. Starting from version 9.0.0, the new format must be used.


## v8.8.0
### Input
#### Short-term storage
Expand Down
1 change: 0 additions & 1 deletion src/libs/antares/series/series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,4 @@ uint64_t TimeSeries::memoryUsage() const
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR contains console logs. Please review or remove them.

return timeSeries.memoryUsage();
}

} // namespace Antares::Data
4 changes: 4 additions & 0 deletions src/libs/antares/study/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ set(SRC_STUDY_SCENARIO_BUILDER
include/antares/study/scenario-builder/ThermalTSNumberData.h
include/antares/study/scenario-builder/HydroTSNumberData.h
scenario-builder/HydroTSNumberData.cpp
include/antares/study/scenario-builder/HydroMaxPowerTSNumberData.h
scenario-builder/HydroMaxPowerTSNumberData.cpp
scenario-builder/SolarTSNumberData.cpp
include/antares/study/scenario-builder/solarTSNumberData.h
include/antares/study/scenario-builder/WindTSNumberData.h
Expand Down Expand Up @@ -127,6 +129,8 @@ set(SRC_STUDY_PART_HYDRO
include/antares/study/parts/hydro/allocation.h
include/antares/study/parts/hydro/allocation.hxx
parts/hydro/allocation.cpp
include/antares/study/parts/hydro/hydromaxtimeseriesreader.h
parts/hydro/hydromaxtimeseriesreader.cpp
)
source_group("study\\part\\hydro" FILES ${SRC_STUDY_PART_HYDRO})

Expand Down
1 change: 1 addition & 0 deletions src/libs/antares/study/area/area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ void Area::resizeAllTimeseriesNumbers(uint nbYears)
solar.series.timeseriesNumbers.reset(1, nbYears);
wind.series.timeseriesNumbers.reset(1, nbYears);
hydro.series->timeseriesNumbers.reset(1, nbYears);
hydro.series->timeseriesNumbersHydroMaxPower.reset(1, nbYears);
for (auto& namedLink : links)
{
AreaLink* link = namedLink.second;
Expand Down
35 changes: 30 additions & 5 deletions src/libs/antares/study/area/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,11 +874,38 @@ static bool AreaListLoadFromFolderSingleArea(Study& study,
buffer.clear() << study.folderInput << SEP << "hydro" << SEP << "prepro";
ret = area.hydro.prepro->loadFromFolder(study, area.id, buffer.c_str()) && ret;
}
if (area.hydro.series && (!options.loadOnlyNeeded || !area.hydro.prepro)) // Series

auto* hydroSeries = area.hydro.series;
if (!options.loadOnlyNeeded || !area.hydro.prepro) // Series
{
buffer.clear() << study.folderInput << SEP << "hydro" << SEP << "series";
ret = area.hydro.series->loadFromFolder(study, area.id, buffer) && ret;
ret = hydroSeries->loadGenerationTS(area.id, buffer, study.header.version) && ret;

hydroSeries->EqualizeGenerationTSsizes(area, study.usedByTheSolver);
}

if (study.header.version < StudyVersion(9,1))
{
buffer.clear() << study.folderInput << SEP << "hydro";

HydroMaxTimeSeriesReader reader(area.hydro, area.id.to<std::string>(), area.name.to<std::string>());
ret = reader.read(buffer, study.usedByTheSolver) && ret;
}
else
{
buffer.clear() << study.folderInput << SEP << "hydro" << SEP << "series";
ret = hydroSeries->LoadMaxPower(area.id, buffer) && ret;

if (study.usedByTheSolver)
{
hydroSeries->EqualizeMaxPowerTSsizes(area);
}
else
hydroSeries->setHydroModulability(area);
}

hydroSeries->resizeTSinDeratedMode(
study.parameters.derated, study.header.version, study.usedByTheSolver);
}

// Wind
Expand Down Expand Up @@ -1522,9 +1549,7 @@ void AreaList::removeLoadTimeseries()

void AreaList::removeHydroTimeseries()
{
each([](Data::Area& area) {
area.hydro.series->reset();
});
each([](Data::Area& area) { area.hydro.series->reset(); });
}

void AreaList::removeSolarTimeseries()
Expand Down
119 changes: 82 additions & 37 deletions src/libs/antares/study/area/scratchpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,36 @@ using namespace Yuni;
namespace Antares::Data
{

AreaScratchpad::AreaScratchpad(const StudyRuntimeInfos& rinfos, Area& area)
bool doWeHaveOnePositiveMaxDailyEnergy(const Matrix<double>& dailyPower,
const Matrix<double>::ColumnType& nbHoursAtPmaxPerDay)
{
for (uint tsNumber = 0; tsNumber < dailyPower.width; ++tsNumber)
{
for (uint day = 0; day < DAYS_PER_YEAR; ++day)
{
if (dailyPower[tsNumber][day] * nbHoursAtPmaxPerDay[day] > 0.)
return true;
}
}

return false;
}

void CalculateDailyMeanPower(const Matrix<double>::ColumnType& hourlyColumn,
Matrix<double>::ColumnType& dailyColumn)
{
for (uint day = 0; day < DAYS_PER_YEAR; ++day)
{
dailyColumn[day] = std::accumulate(hourlyColumn + day * HOURS_PER_DAY,
hourlyColumn + day * HOURS_PER_DAY + HOURS_PER_DAY,
0)
/ 24.;
}
}

AreaScratchpad::AreaScratchpad(const StudyRuntimeInfos& rinfos, Area& area) :
meanMaxDailyGenPower(area.hydro.series->timeseriesNumbersHydroMaxPower),
meanMaxDailyPumpPower(area.hydro.series->timeseriesNumbersHydroMaxPower)
{
// alias to the simulation mode
auto mode = rinfos.mode;
Expand All @@ -44,12 +73,6 @@ AreaScratchpad::AreaScratchpad(const StudyRuntimeInfos& rinfos, Area& area)
originalMustrunSum[h] = std::numeric_limits<double>::quiet_NaN();
}

for (uint d = 0; d != DAYS_PER_YEAR; ++d)
{
optimalMaxPower[d] = std::numeric_limits<double>::quiet_NaN();
pumpingMaxPower[d] = std::numeric_limits<double>::quiet_NaN();
}

// Fatal hors hydro
{
double sum;
Expand All @@ -71,6 +94,37 @@ AreaScratchpad::AreaScratchpad(const StudyRuntimeInfos& rinfos, Area& area)
}
}

//*******************************************************************************
// TODO : about computing hydro max power daily mean from hourly max power TS.
//*******************************************************************************
// - This computation is done here, but we don't want it here.
// We want Scratchpad to shrink and even disappear.
// So a possible solution to move this computation to some place else is to host
// these means TS in the hydro part of areas, and compute them right after
// their the hourly TS (max power).
// Note that scratchpad instances are duplicated for multi-threading purpose,
// and that moving these TS elsewhere could create concurrency issues.
// But these daily TS, once computed, are then only read (in daily.cpp
// and when building the weekly optimization problem).
// Thus we don't have to fear such issues.
// - Besides, there is a performance problem here : for a given area, we compute
// the max power daily means for each call to scratchpad constructor, that is
// the same computation for each thread.
// This is another reason to move the computation from here.
//*******************************************************************************

// Hourly maximum generation/pumping power matrices and their number of TS's (width of matrices)
auto const& maxHourlyGenPower = area.hydro.series->maxHourlyGenPower.timeSeries;
auto const& maxHourlyPumpPower = area.hydro.series->maxHourlyPumpPower.timeSeries;
uint nbOfMaxPowerTimeSeries = area.hydro.series->maxPowerTScount();

// Setting width and height of daily mean maximum generation/pumping power matrices
meanMaxDailyGenPower.timeSeries.reset(nbOfMaxPowerTimeSeries, DAYS_PER_YEAR);
meanMaxDailyPumpPower.timeSeries.reset(nbOfMaxPowerTimeSeries, DAYS_PER_YEAR);

// Instantiate daily mean maximum generation/pumping power matrices
CalculateMeanDailyMaxPowerMatrices(maxHourlyGenPower, maxHourlyPumpPower, nbOfMaxPowerTimeSeries);

// ===============
// hydroHasMod
// ===============
Expand All @@ -81,20 +135,10 @@ AreaScratchpad::AreaScratchpad(const StudyRuntimeInfos& rinfos, Area& area)
// Useful whether we use a heuristic target or not
bool hydroGenerationPermission = false;

// ... Getting hydro max power
auto const& maxPower = area.hydro.maxPower;
// ... Getting hydro max energy
auto const& dailyNbHoursAtGenPmax = area.hydro.dailyNbHoursAtGenPmax[0];

// ... Hydro max generating power and energy
auto const& maxGenP = maxPower[Data::PartHydro::genMaxP];
auto const& maxGenE = maxPower[Data::PartHydro::genMaxE];

double value = 0.;
for (uint d = 0; d < DAYS_PER_YEAR; ++d)
value += maxGenP[d] * maxGenE[d];

// If generating energy is nil over the whole year, hydroGenerationPermission is false, true
// otherwise.
hydroGenerationPermission = (value > 0.);
hydroGenerationPermission = doWeHaveOnePositiveMaxDailyEnergy(meanMaxDailyGenPower.timeSeries, dailyNbHoursAtGenPmax);

// ---------------------
// Hydro has inflows
Expand Down Expand Up @@ -123,30 +167,31 @@ AreaScratchpad::AreaScratchpad(const StudyRuntimeInfos& rinfos, Area& area)
// --------------------------
hydroHasMod = hydroHasInflows || hydroGenerationPermission;


// ===============
// Pumping
// ===============
// ... Hydro max power

// ... Hydro max pumping power and energy
auto const& maxPumpingP = maxPower[Data::PartHydro::pumpMaxP];
auto const& maxPumpingE = maxPower[Data::PartHydro::pumpMaxE];
// Hydro max pumping energy
auto const& dailyNbHoursAtPumpPmax = area.hydro.dailyNbHoursAtPumpPmax[0];

// ... Pumping max power
for (uint d = 0; d != DAYS_PER_YEAR; ++d)
pumpingMaxPower[d] = maxPumpingP[d];

double valuePumping = 0.;
// ... Computing 'pumpHasMod' parameter
for (uint d = 0; d < DAYS_PER_YEAR; ++d)
valuePumping += maxPumpingP[d] * maxPumpingE[d];

// If pumping energy is nil over the whole year, pumpHasMod is false, true otherwise.
pumpHasMod = (valuePumping > 0.);
// If pumping energy is nil over the whole year, pumpHasMod is false, true otherwise.
pumpHasMod = doWeHaveOnePositiveMaxDailyEnergy(meanMaxDailyPumpPower.timeSeries, dailyNbHoursAtPumpPmax);
}

AreaScratchpad::~AreaScratchpad() = default;
void AreaScratchpad::CalculateMeanDailyMaxPowerMatrices(const Matrix<double>& hourlyMaxGenMatrix,
const Matrix<double>& hourlyMaxPumpMatrix,
uint nbOfMaxPowerTimeSeries)
{
for (uint nbOfTimeSeries = 0; nbOfTimeSeries < nbOfMaxPowerTimeSeries; ++nbOfTimeSeries)
{
auto& hourlyMaxGenColumn = hourlyMaxGenMatrix[nbOfTimeSeries];
auto& hourlyMaxPumpColumn = hourlyMaxPumpMatrix[nbOfTimeSeries];
auto& MeanMaxDailyGenPowerColumn = meanMaxDailyGenPower.timeSeries[nbOfTimeSeries];
auto& MeanMaxDailyPumpPowerColumn = meanMaxDailyPumpPower.timeSeries[nbOfTimeSeries];

CalculateDailyMeanPower(hourlyMaxGenColumn, MeanMaxDailyGenPowerColumn);
CalculateDailyMeanPower(hourlyMaxPumpColumn, MeanMaxDailyPumpPowerColumn);
}
}
} // namespace Antares::Data

Loading
Loading