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

Add validation function for Grid objects #481

Closed
1 task
danielolsen opened this issue May 19, 2021 · 2 comments · Fixed by #495
Closed
1 task

Add validation function for Grid objects #481

danielolsen opened this issue May 19, 2021 · 2 comments · Fixed by #495
Assignees
Labels
feature request Request for a new feature. (Only lives in Backlog)

Comments

@danielolsen
Copy link
Contributor

danielolsen commented May 19, 2021

🚀

  • Is your feature request essential for your project?
    Not essential, but would serve to improve the workflow of multiple different projects.

Describe the workflow you want to enable

I wish I could check whether a Grid object that is being loaded from outside of PowerSimData code (e.g. from a matfile, from a set of CSVs, or from another source) is internally consistent and contains all required information. By 'internally consistent', I mean:

  • Every bus is connected to at least one branch or DC line.
  • Every bus ID that is present in the branch, plant, or DC line tables should be present in the bus table.
  • Every bus should be present in the bus2sub table.
  • AC lines should only connect between buses of the same voltage, within the same interconnect.
  • Transformers should only connect between buses within the same substation.
  • Interpreting the AC branches as edges of a graph, there should be exactly one connected component per interconnection.
  • The plant and gencost tables should have identical indices.
  • etc.

Describe your proposed implementation

There should be a new function that takes a Grid object as input, and raises a ValueError if any of the internal consistency checks fails.

Additional context

This project would serve the validation of new grid models (so that we can tell that there is a problem before sending the grid and profiles to the simulation engine) as well as interpreting results from tools besides production cost models (e.g. a capacity expansion model run).

@danielolsen danielolsen added the feature request Request for a new feature. (Only lives in Backlog) label May 19, 2021
@rouille
Copy link
Collaborator

rouille commented May 20, 2021

How far should we go? Do we want to make sure first that the complete set of CSVs is available and that each of them has the right number of columns and the columns have the right name/type? I could see having a module in powersimdata.network that accomplishes this job and a module in powersimdata.input that goes through the consistency check you listed.

@danielolsen
Copy link
Contributor Author

How far should we go? Do we want to make sure first that the complete set of CSVs is available and that each of them has the right number of columns and the columns have the right name/type? I could see having a module in powersimdata.network that accomplishes this job and a module in powersimdata.input that goes through the consistency check you listed.

For this particular feature, I'm envisioning a check on the object itself, which could come from CSVs or elsewhere. I agree that we should also check for the presence of all required attributes and all required columns in each data frame. I think it could also be useful to have a check on a folder of CSVs, to ensure that all the required files are present with the right columns.

I think I remember going through some code recently and thinking that we've got lists of column names scattered throughout the codebase, and I think as part of this effort we could decide on one place to have them, and refactor all other places to point to the single source of truth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature. (Only lives in Backlog)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants