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

PSSE Exporter Part 1: Add Tests and Formalize Exporter Implementation #42

Merged
merged 31 commits into from
Aug 19, 2024

Conversation

GabrielKS
Copy link
Contributor

This PR picks up the effort to implement a Sienna to PSS/E exporter, an effort started by @HaleyRoss here (see also my cleanup of that code to work with PSY4 here). Very much a draft for now, but I'll be building out a public interface to perform this export in the next few weeks.

@GabrielKS GabrielKS self-assigned this Jul 15, 2024
@GabrielKS GabrielKS mentioned this pull request Jul 15, 2024
@GabrielKS GabrielKS force-pushed the gks/hr/formalize_psse_exporter branch from 443b157 to fb1b917 Compare July 19, 2024 23:19
@GabrielKS GabrielKS changed the base branch from main to hrgks/psse_exporter_psy4 July 25, 2024 19:23
@GabrielKS GabrielKS changed the title Formalize PSSE Exporter PSSE Exporter Part 1: Add Tests and Formalize Exporter Implementation Jul 25, 2024
@GabrielKS
Copy link
Contributor Author

GabrielKS commented Jul 25, 2024

Here's my Git plan:

  • hrgks/psse_exporter_psy4 is a "dev branch"
  • For each major part of this effort (currently we have identified three), I'll submit a PR from a "feature branch" into there
  • We'll avoid merging hrgks/psse_exporter_psy4 into main until I can be more certain that there will be no more breaking interface changes (probably not until the end of part two)

This lets me submit PRs for code review along the way, rather than having one massive code review at the end, while also letting the interface evolve as I discover more requirements of it.

@GabrielKS
Copy link
Contributor Author

GabrielKS commented Jul 25, 2024

The current exporter interface is:

# Initialize an exporter from a Sienna system
PSSEExporter(base_system::System, psse_version::Symbol)

# Whenever you have new data to export, update the exporter with either a `PowerFlowData` or
# a modified `System` (which must be fundamentally the same system, just with some values changed):
update_exporter!(exporter::PSSEExporter, data::PowerFlowData)  # preferred
update_exporter!(exporter::PSSEExporter, data::System)  # less preferred

# Actually perform an export
write_export(exporter::PSSEExporter, scenario_name::AbstractString, year::Int, export_location::AbstractString)

and I expect this will probably stay roughly the same throughout Part 1 — though I may change up the arguments a bit — but will probably change substantially in Part 2.

@GabrielKS
Copy link
Contributor Author

The current status of Part 1 is that the above interface is fully implemented and round-trip tested up to a certain level, but the implementation still relies on old code. I'll now work on a from-scratch reimplementation of the exporter.

PSY.ACBusTypes.ISOLATED => 4,
)

# TODO consider adding this to IS
Copy link
Member

Choose a reason for hiding this comment

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

agree

- `data::PSY.PowerFlowData`: the new data. Must correspond to the `System` with which the
exporter was constructor
"""
function update_exporter!(exporter::PSSEExporter, data::PowerFlowData)
Copy link
Member

Choose a reason for hiding this comment

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

For reference since we discussed it already. Relying on deep copies can be problematic for systems with large time series data sets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes — will change this in Part 2

for original_number in buses
haskey(mapping, original_number) && continue
new_number = original_number
new_number %= 1_000_000
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 consider addressing this in the parser too. I understand the safety logic of never creating a bus number that PSSe can recognize but it makes a mess to write back

CKT = _psse_quote_string(CKT)
R = PSY.get_r(branch)
X = PSY.get_x(branch)
B = 0.0 # TODO iron out the details of B vs. BI, BJ
Copy link
Member

Choose a reason for hiding this comment

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

The summary about this issue is that the line model in PSSe uses a data model with 2 shunt elements per side and this creates a mess in terms of writing back the data since PSY supports only one imaginary shunt per side.

image

@GabrielKS GabrielKS force-pushed the hrgks/psse_exporter_psy4 branch from d5e054a to e60b2d9 Compare August 13, 2024 16:59
@GabrielKS GabrielKS force-pushed the gks/hr/formalize_psse_exporter branch from 63ce16f to 93fd777 Compare August 13, 2024 16:59
@GabrielKS
Copy link
Contributor Author

@jarry7 verifies that PSS/E can read the export as currently written under certain modes but not others. I'm going to merge this into the dev branch now to continue with Part 2 and readdress this later.

@GabrielKS GabrielKS marked this pull request as ready for review August 19, 2024 18:37
@GabrielKS GabrielKS merged commit 67c176e into hrgks/psse_exporter_psy4 Aug 19, 2024
3 of 6 checks passed
@GabrielKS GabrielKS deleted the gks/hr/formalize_psse_exporter branch November 5, 2024 22:00
@GabrielKS GabrielKS mentioned this pull request Nov 5, 2024
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.

2 participants