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

Link TS generation : splitting into multiple files #2171

Merged
merged 31 commits into from
Jul 10, 2024

Conversation

guilpier-code
Copy link
Contributor

@guilpier-code guilpier-code commented Jun 14, 2024

This PR aims at moving some code about link TS generation, from main program to new source files.
It follows PR #2155

To be done :

  • move headers (*.h) to the right place
  • update this branch with its base branch (@flomnes made a change on base branch)

We may also take advantage of this PR to :

  • Thermal TS generation :
    • avoid loading the whole study when no thermal TS generation is required (this is currently the case)
    • move implementation details about thermal TS generation from main program to new source files
  • Separate loading / extracting data from study and generate the TS

@guilpier-code guilpier-code changed the base branch from feature/thermal-interface to fix/remove-ts-link-from-solver June 14, 2024 16:30
@guilpier-code guilpier-code marked this pull request as ready for review June 17, 2024 12:47
{
for(auto& link : linkList)
{
if (link.namesPair == link_to_find)
Copy link
Contributor

@a-zakir a-zakir Jun 19, 2024

Choose a reason for hiding this comment

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

why don't you re-use pairs_match?

Copy link
Member

Choose a reason for hiding this comment

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

Good point ! pairs_match is a bit less strict than pair<>::operator==, since it returns true if a.first==b.second && a.second == b.first (not the case with pair<>::operator==)

@guilpier-code guilpier-code force-pushed the fix/split-ts-generation-into-files branch from bce0fa7 to 9f3b1ec Compare June 24, 2024 13:13
…iteResultsToDisk which now does exactly what its name says it does
Copy link

sonarcloud bot commented Jun 26, 2024

Base automatically changed from fix/remove-ts-link-from-solver to develop June 28, 2024 08:44
guilpier-code and others added 2 commits June 28, 2024 10:46
This PR addresses [this go-pro
ticket](https://gopro-tickets.rte-france.com/browse/ANT-1852)

What was done : 
- **Cause of the crash** : allocate (give a size to) the storage
containers supposed to receive the thermal TS generation results
- Remove the use of **result writer**, too complicated (for example, it
forces us to use a duration collector we don't need).
- Use of **std::filesystem** whenever possible

See helping **gitHub** comments inserted in sources.
src/libs/antares/utils/utils.cpp Outdated Show resolved Hide resolved
{
for(auto& link : linkList)
{
if (link.namesPair == link_to_find)
Copy link
Member

Choose a reason for hiding this comment

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

Good point ! pairs_match is a bit less strict than pair<>::operator==, since it returns true if a.first==b.second && a.second == b.first (not the case with pair<>::operator==)

flomnes and others added 5 commits June 28, 2024 14:16
Aim of this PR : see the title.

What was done (see helping **gitHub** comments in this PR) : 
- simplifications : 
- [x] Standardizing TS generation with link TS : remove a constructor in
a class containing data for TS generation.
- [x] Remove use of **RuntimeInfos** in **main.cpp** (many code lines
used to be called there, just to get a random generator).
  - [x] Remove check on min stable power, useless.
- [x] Function that actually generates the TS no longer takes the TS to
be generated as argument, but returns it.
- [x] **TS generator** code no longer contains code related to whether
we should skip the TS writing on disk. It writes, that'all. This kind of
code belongs to **solver**, not to **TS generator**.
  - [x] Use **std::filesystem** whenever possible instead of **Yuni**
  
- Unwanted behavior correction : 
- [x] Execute links or thermal TS generation code only depending on user
requirements : indeed, thermal TS generation still needs the whole study
to be loaded, but link TS generation does not (it retrieves from study
only the required data). Being forced to load the study if only link TS
generation is required is a clear performance issue. We avoid that here.
- [x] When data files required to generate TS (modulation files & prepro
files) don't exist, we used to ignore it (this can lead to a crash). We
now raise an error before TS generation time comes.
- Moving code : _to be completed_

---------

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>
@flomnes flomnes merged commit c80109f into develop Jul 10, 2024
6 checks passed
@flomnes flomnes deleted the fix/split-ts-generation-into-files branch July 10, 2024 13:14
meslubi2021 added a commit to meslubi2021/Antares_Simulator that referenced this pull request Jul 17, 2024
* Collect hydro validation errors (AntaresSimulatorTeam#2204)

collect *n* hydro validation errors (10 per area ) before exiting

---------

Co-authored-by: Florian Omnès <florian.omnes@rte-france.com>

* Remove actions dependencies using node js 16 (AntaresSimulatorTeam#2215)

> Node.js 16 actions are deprecated. Please update the following actions
to use Node.js 20: notiz-dev/github-action-json-property@release. For
more information see:
https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

---------

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Move TS number print (AntaresSimulatorTeam#2228)

Purpose : moving the code that prints the TS numbers on disk : due to
recent changes it was moved after the loop through MC years. So, we have
to wait until simulation ends to know which TS numbers where drawn. So
we move that code back.

* Infeability analyzer : renaming (AntaresSimulatorTeam#2225)

Purpose : as the title says

This PR is attached to ticket [ticket
ANT-1825](https://gopro-tickets.rte-france.com/browse/ANT-1825).
Some improvements were made or tried by taking care of the ticket.
The result is this PR.

---------

Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>

* Always run clang-format on PR (AntaresSimulatorTeam#2230)

* Add changelog for minor versions (AntaresSimulatorTeam#2229)

- v8.8.6
- v8.6.8

---------

Co-authored-by: Abdoulbari Zaher <32519851+a-zakir@users.noreply.github.com>
Co-authored-by: Jason Maréchal <45510813+JasonMarechal25@users.noreply.github.com>

* Infeasibility analyzer : small simplifications (AntaresSimulatorTeam#2226)

Purpose : as the title says

This PR is attached to ticket [ticket
ANT-1825](https://gopro-tickets.rte-france.com/browse/ANT-1825).
Some improvements were made or tried by taking care of the ticket.
The result is this PR.

---------

Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>

* Fix compile, add boost header in CMakelists (AntaresSimulatorTeam#2233)

* STS: Withdrawal efficiency [ANT-1862] (AntaresSimulatorTeam#2223)

Add a efficiencywithdrawal property to short term storage
This mimics the already existing efficiency for injection

* Infeasibility analyzer : HydroPower constraint (AntaresSimulatorTeam#2227) [ANT-1825]

Add constraint that can possibily lead to infeasibilities. HydroPower is the constraint on the sum of generated hydro energy over the week for a given area. The provided RHS in some cases makes the problem infeasible.

---------

Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>

* Compilation warnings (AntaresSimulatorTeam#2237)

close  AntaresSimulatorTeam#2236

* Version 9.2 (AntaresSimulatorTeam#2240)

* Fix sonarcloud job (AntaresSimulatorTeam#2246)

* Adequacy Patch regression [ANT-1845] (AntaresSimulatorTeam#2235)

* 9.2 rc 1 (AntaresSimulatorTeam#2247)

* Keep using node js 16 on centos CI (AntaresSimulatorTeam#2248)

* Infeasibility more cleaning (AntaresSimulatorTeam#2231)

We're on the road to make **infeasibility analyzer** more changeable,
more precisely when adding a constraint type to the list of constraints
to be detected in case of infeasibity.
This PR is a step towards this purpose.  
It contains some heterogeneous simplifications and renaming.
In order to ease the review, some comments were added in this PR.

---------

Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>

* Document clang-format (AntaresSimulatorTeam#2243)

Add version number to avoid confusion.

* Link TS generation : splitting into multiple files (AntaresSimulatorTeam#2171)

This PR aims at moving some code about link TS generation, from **main**
program to new source files.
It follows PR AntaresSimulatorTeam#2155 

To be done : 

- [x] move headers (*.h) to the right place
- [x] update this branch with its base branch (@flomnes made a change on
base branch)

We may also take advantage of this PR to : 
- [ ] Thermal TS generation :
- [ ] avoid loading the **whole study** when **no** thermal TS
generation is required (this is currently the case)
- [ ] move implementation details about thermal TS generation from
**main** program to new source files
- [ ] Separate loading / extracting data from study and generate the TS

---------

Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Explain why MPS are named when the problem is infeasible (AntaresSimulatorTeam#2250)

* Add tests in CI for version 9.2 (AntaresSimulatorTeam#2241)

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Rename test-platform to os for windows CI (AntaresSimulatorTeam#2253)

* Fix bug hydro heuristic with mingen (ANT-1825) (AntaresSimulatorTeam#2258)

Removing lines that create infeasibility and that are not necessary.

---------

Co-authored-by: Juliette-Gerbaux <juliette.gerbaux_externe@rte-france.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Remove useless fwd declaration

---------

Co-authored-by: Abdoulbari Zaher <32519851+a-zakir@users.noreply.github.com>
Co-authored-by: Florian Omnès <florian.omnes@rte-france.com>
Co-authored-by: payetvin <113102157+payetvin@users.noreply.github.com>
Co-authored-by: guilpier-code <62292552+guilpier-code@users.noreply.github.com>
Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>
Co-authored-by: Jason Maréchal <45510813+JasonMarechal25@users.noreply.github.com>
Co-authored-by: Juliette-Gerbaux <130555142+Juliette-Gerbaux@users.noreply.github.com>
Co-authored-by: Juliette-Gerbaux <juliette.gerbaux_externe@rte-france.com>
meslubi2021 added a commit to meslubi2021/Antares_Simulator that referenced this pull request Jul 17, 2024
* Collect hydro validation errors (AntaresSimulatorTeam#2204)

collect *n* hydro validation errors (10 per area ) before exiting

---------

Co-authored-by: Florian Omnès <florian.omnes@rte-france.com>

* Remove actions dependencies using node js 16 (AntaresSimulatorTeam#2215)

> Node.js 16 actions are deprecated. Please update the following actions
to use Node.js 20: notiz-dev/github-action-json-property@release. For
more information see:
https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

---------

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Move TS number print (AntaresSimulatorTeam#2228)

Purpose : moving the code that prints the TS numbers on disk : due to
recent changes it was moved after the loop through MC years. So, we have
to wait until simulation ends to know which TS numbers where drawn. So
we move that code back.

* Infeability analyzer : renaming (AntaresSimulatorTeam#2225)

Purpose : as the title says

This PR is attached to ticket [ticket
ANT-1825](https://gopro-tickets.rte-france.com/browse/ANT-1825).
Some improvements were made or tried by taking care of the ticket.
The result is this PR.

---------

Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>

* Always run clang-format on PR (AntaresSimulatorTeam#2230)

* Add changelog for minor versions (AntaresSimulatorTeam#2229)

- v8.8.6
- v8.6.8

---------

Co-authored-by: Abdoulbari Zaher <32519851+a-zakir@users.noreply.github.com>
Co-authored-by: Jason Maréchal <45510813+JasonMarechal25@users.noreply.github.com>

* Infeasibility analyzer : small simplifications (AntaresSimulatorTeam#2226)

Purpose : as the title says

This PR is attached to ticket [ticket
ANT-1825](https://gopro-tickets.rte-france.com/browse/ANT-1825).
Some improvements were made or tried by taking care of the ticket.
The result is this PR.

---------

Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>

* Fix compile, add boost header in CMakelists (AntaresSimulatorTeam#2233)

* STS: Withdrawal efficiency [ANT-1862] (AntaresSimulatorTeam#2223)

Add a efficiencywithdrawal property to short term storage
This mimics the already existing efficiency for injection

* Infeasibility analyzer : HydroPower constraint (AntaresSimulatorTeam#2227) [ANT-1825]

Add constraint that can possibily lead to infeasibilities. HydroPower is the constraint on the sum of generated hydro energy over the week for a given area. The provided RHS in some cases makes the problem infeasible.

---------

Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>

* Compilation warnings (AntaresSimulatorTeam#2237)

close  AntaresSimulatorTeam#2236

* Version 9.2 (AntaresSimulatorTeam#2240)

* Fix sonarcloud job (AntaresSimulatorTeam#2246)

* Adequacy Patch regression [ANT-1845] (AntaresSimulatorTeam#2235)

* 9.2 rc 1 (AntaresSimulatorTeam#2247)

* Keep using node js 16 on centos CI (AntaresSimulatorTeam#2248)

* Infeasibility more cleaning (AntaresSimulatorTeam#2231)

We're on the road to make **infeasibility analyzer** more changeable,
more precisely when adding a constraint type to the list of constraints
to be detected in case of infeasibity.
This PR is a step towards this purpose.  
It contains some heterogeneous simplifications and renaming.
In order to ease the review, some comments were added in this PR.

---------

Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>

* Document clang-format (AntaresSimulatorTeam#2243)

Add version number to avoid confusion.

* Link TS generation : splitting into multiple files (AntaresSimulatorTeam#2171)

This PR aims at moving some code about link TS generation, from **main**
program to new source files.
It follows PR AntaresSimulatorTeam#2155 

To be done : 

- [x] move headers (*.h) to the right place
- [x] update this branch with its base branch (@flomnes made a change on
base branch)

We may also take advantage of this PR to : 
- [ ] Thermal TS generation :
- [ ] avoid loading the **whole study** when **no** thermal TS
generation is required (this is currently the case)
- [ ] move implementation details about thermal TS generation from
**main** program to new source files
- [ ] Separate loading / extracting data from study and generate the TS

---------

Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Explain why MPS are named when the problem is infeasible (AntaresSimulatorTeam#2250)

* Add tests in CI for version 9.2 (AntaresSimulatorTeam#2241)

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Rename test-platform to os for windows CI (AntaresSimulatorTeam#2253)

* Fix bug hydro heuristic with mingen (ANT-1825) (AntaresSimulatorTeam#2258)

Removing lines that create infeasibility and that are not necessary.

---------

Co-authored-by: Juliette-Gerbaux <juliette.gerbaux_externe@rte-france.com>
Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>

* Infeasibility anaylsis : make it more changeable (AntaresSimulatorTeam#2232)

Create classes for each constraint type, with a common interface. Additional tests to come.

---------

Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>
Co-authored-by: Florian Omnès <florian.omnes@rte-france.com>

* Remove manual dynamic memory usage (AntaresSimulatorTeam#2254)

Replaced new[] with vectors
Made RunTimeInfos static

---------

Co-authored-by: Abdoulbari Zaher <32519851+a-zakir@users.noreply.github.com>
Co-authored-by: Florian Omnès <florian.omnes@rte-france.com>
Co-authored-by: payetvin <113102157+payetvin@users.noreply.github.com>
Co-authored-by: guilpier-code <62292552+guilpier-code@users.noreply.github.com>
Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>
Co-authored-by: Jason Maréchal <45510813+JasonMarechal25@users.noreply.github.com>
Co-authored-by: Juliette-Gerbaux <130555142+Juliette-Gerbaux@users.noreply.github.com>
Co-authored-by: Juliette-Gerbaux <juliette.gerbaux_externe@rte-france.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants