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

feat(ts-gen): add timeseries generation #2112

Merged
merged 25 commits into from
Aug 21, 2024
Merged

Conversation

MartinBelthle
Copy link
Contributor

@MartinBelthle MartinBelthle commented Aug 2, 2024

Here's an exemple of generation duration time with this PR performed after the commit add little tests.
It's clear to see why we need to use tasks.

duree_generation_v1

We'll probably encounter some timeouts during variants safe generation. To avoid that, we'll have to increase this limit which is hard-coded at 60 seconds inside the code

@MartinBelthle MartinBelthle self-assigned this Aug 2, 2024
@MartinBelthle MartinBelthle force-pushed the feat/add-timeseries-generation branch 2 times, most recently from 39e9095 to 027978e Compare August 9, 2024 11:57
Copy link
Member

@sylvlecl sylvlecl left a comment

Choose a reason for hiding this comment

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

Suggestion to use more numpy/pandas for performance reason + question on backup mechanism + a few minor comments.

modulation_matrix = study_data.tree.get(
["input", "thermal", "prepro", area_id, thermal.id.lower(), "modulation"]
)["data"]
modulation_capacity = np.array([row[2] for row in modulation_matrix])
Copy link
Member

Choose a reason for hiding this comment

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

We should use an enum or constants for the various column numbers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used constants

# 8- Generates the UUID for the `get_inner_matrices` method
uuid = study_data.tree.context.matrix.create(generated_matrix)
self._INNER_MATRICES.append(uuid)
# 9- Write the matrix inside the input folder.
Copy link
Member

Choose a reason for hiding this comment

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

It's a shame that we need to:

  1. write the matrix twice, in the matrix store AND as a file here
  2. duplicate here the code that writes a matrix to a file: it's only 1 line but we need to ensure consistency between here and other places where we write matrice, it's error-prone for future evolutions

For 2, we should probably have a small utility method shared at least beween matrix.py and here.
For 1, I have not easy solution, we probaby need to postpone this ... Note that this kind of direct write will be an issue the day we want to store input matrices with a different format.

Copy link
Contributor Author

@MartinBelthle MartinBelthle Aug 21, 2024

Choose a reason for hiding this comment

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

Now that we don't have inner_matrices anymore, the 1. is no longer relevant.
Also for 2. I created a function dump_dataframe inside matrix.py that I reused here

@sylvlecl sylvlecl merged commit bc4f026 into dev Aug 21, 2024
7 of 8 checks passed
@sylvlecl sylvlecl deleted the feat/add-timeseries-generation branch August 21, 2024 13:25
@makdeuneuv makdeuneuv added this to the v2.17.6 milestone Aug 22, 2024
maugde pushed a commit that referenced this pull request Aug 23, 2024
Uses antares-timeseries-generation to perform thermal clusters
timeseries generation.

The generation is performed as a background task on file studies,
since it can take several seconds or more.

Note that generated matrices are not "inner matrices" of the
command since they are generated on each command execution.
Generated matrices that will be stored later in the matrix store will
be saved from garbage collection as all other snaphot matrices.
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