Added referened and Optimize and Refactor Microgrid Test and Utility Code for Improved Clarity and Reusability #255
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This PR introduces optimizations and refactoring across two files to improve code readability, reusability, and maintainability without changing existing functionality. The modifications are focused on enhancing clarity and aligning with best practices.
Summary of Changes:
Microgrid Modular Setup Code:
default_params
to uppercaseDEFAULT_PARAMS
to clearly indicate its status as a constant, following Python conventions.or
operator) to streamline default assignments, making code more concise.MPC Test Suite:
setUp
method to centralize shared constants (e.g.,max_steps
,pv_const
,load_const
) and reusable time series data, reducing repetition across tests.create_microgrid
to construct customized microgrid setups, improving test readability and reducing setup complexity.📚 Documentation preview 📚: https://pymgrid--255.org.readthedocs.build/en/255/