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

Code Duplication Throughout PowerSimulations #1043

Open
GabrielKS opened this issue Jan 11, 2024 · 12 comments
Open

Code Duplication Throughout PowerSimulations #1043

GabrielKS opened this issue Jan 11, 2024 · 12 comments

Comments

@GabrielKS
Copy link
Contributor

This is an issue to track instances of code duplication in PowerSimulations.jl that aren't new and aren't a top priority but should be fixed at some point.

@GabrielKS
Copy link
Contributor Author

GabrielKS commented Jan 11, 2024

@GabrielKS
Copy link
Contributor Author

In src/network_models/powermodels_interface.jl, the two methods of powermodels_network! are nearly identical.

@GabrielKS
Copy link
Contributor Author

Lots of duplication between the _make_system_expressions! methods of src/core/optimization_container.jl

@GabrielKS
Copy link
Contributor Author

The two branch_rate_bounds! methods in


are nearly identical

@GabrielKS
Copy link
Contributor Author

The add_constraints! method at

and the one right after it are nearly identical

@GabrielKS
Copy link
Contributor Author

(Probably not all of these are a good first issue, but some of them are)

@GabrielKS
Copy link
Contributor Author

GabrielKS commented Mar 8, 2024

Lots of duplication in core/optimization_container.jlhas_container_key, get_variable, etc. My first thought is that an approach like this could help factor out differences between the various key types.

@GabrielKS
Copy link
Contributor Author

Duplicate block starting

for (k, var_array) in IS.get_optimization_container(get_internal(model)).variables

@GabrielKS
Copy link
Contributor Author

GabrielKS commented Mar 11, 2024

The various write_model_*_results! functions in store_common.jl. This speaks to a trend of code duplication across [variables, expressions, duals, etc.] — even if we hold that it's necessary to have separate functions in the public interface for each of these, we don't need nearly as much duplication in the underlying implementations.

@GabrielKS
Copy link
Contributor Author

Same thing at

export_path = mkpath(joinpath(path, problem_results.problem, "variables"))

@GabrielKS
Copy link
Contributor Author

template = get_thermal_dispatch_template_network(network)
just twice but still, got an error caused by find-and-replace that implies this shouldn't be duplicated

@GabrielKS
Copy link
Contributor Author

The two methods of get_time_series_values! at

function get_time_series_values!(

are nearly identical

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

No branches or pull requests

2 participants