Skip to content

Conversation

@RiteshKarki27
Copy link
Collaborator

Summary:

This PR introduces a new create_chronics hook that processes CSV files containing load and generator power data and converts them into chronics files suitable for power grid simulation tools. The hook reads normalized active and reactive power values from Load and SGen CSV files, maps them to buses using a grid configuration file, and outputs formatted CSV files (optionally compressed with bzip2).

Features:

  • Ability to discover and process multiple Load and SGen CSV files.
  • Modification to node type file to allow multiple files to be read and stored in the buffer.
  • Mapping elements to buses using a grid configuration JSON file.

Changes:

New files:

  • lib/hooks/create_chronics.cpp: Main hook implementation.
  • include/villas/hooks/create_chronics.cpp: Hook header.
  • etc/examples/hooks/create_chronics.conf: Example configuration file.
  • tests/integration/hook-create_chronics.sh: Integration test for hook (current work-in-progress).

Modified files:

  • lib/nodes/file.cpp: Modify file implementation to read and store multiple files.
  • include/villas/nodes/file.hpp: Modified file header.

@al3xa23

Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
…hronics, fix issue raised during cppcheck

Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
…n check fail on CI

Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
…ohmann/json pkg

Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
…nics hook

Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
…mation.

Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
…missing dependencies

Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
@stv0g
Copy link
Contributor

stv0g commented Jan 26, 2026

@JitpanuM Please let me know, once this is ready for review.

A couple of questions ahead:

  • Is this Chronics format somewhere documented / standardized? I could not find any information about it. We need to add some references / URLs to the code to find more details about it.
  • Why does this need to be implemented in a hook? Wouldn't be a custom format (see lib/formats) be more appropriate?
  • Have you used a LLM to create this PR? If so, please clearly state the fact by adding a Co-Authored-by header in the commit decription.

Thanks :)

@RiteshKarki27
Copy link
Collaborator Author

RiteshKarki27 commented Jan 27, 2026

Thank you for your comment. I can answer the second and the third question.

  • The main reason this can be a hook is because it depends on node-type file to read multiple files and transform them into individual CSVs. Implementing it as a custom format would make more complicated to read and aggregate multiple CSV files and map them based on grid topology (here, a grid.json file).
  • I mainly used ChatGPT to get a template for the pull request description and added the individual files names manually. :)

@al3xa23
Copy link
Contributor

al3xa23 commented Jan 28, 2026

Regarding the first question: standardized is maybe too much to say, but grid2op is using chronics which we then later parse to opendss.
Hope this answers your questions :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants