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

Reactor Deployment Script #168

Merged
merged 21 commits into from
Sep 3, 2024
Merged

Reactor Deployment Script #168

merged 21 commits into from
Sep 3, 2024

Conversation

nsryan2
Copy link
Member

@nsryan2 nsryan2 commented Aug 27, 2024

This PR creates a new script in the repo that calculates when and how many reactors should be deployed with 4.5 deployment schemes.

Deployment Functions

  1. Greedy Algorithm: deploy the largest reactor first at each time step, fill in the remaining capacity with the next smallest, and so on.
  2. Pre-determined distributions: one or more reactors have a preset distribution, and a smaller capacity model fills in the gaps.
    1. Deployment Cap [extension of 2]: there is a single-number capacity for one or more of the reactor models. There is no function for this, just use a constant distribution.
  3. Random Deployment: uses a date and hour as seed to randomly sample the reactors list.
  4. Initially Random, Greedy: randomly deploys reactors until a reactor bigger than the remaining capacity is proposed for each year, then fills remaining capacity with a greedy algorithm.

There are corresponding tests and documentation in the style of the repository.

@pep8speaks
Copy link
Contributor

pep8speaks commented Aug 27, 2024

Hello @nsryan2! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 8:1: E402 module level import not at top of file

Comment last updated at 2024-08-30 17:40:58 UTC

@nsryan2 nsryan2 marked this pull request as draft August 27, 2024 19:33
@nsryan2 nsryan2 marked this pull request as ready for review August 28, 2024 13:30
@nsryan2 nsryan2 requested review from ZoeRichter and yardasol August 28, 2024 13:30
@nsryan2
Copy link
Member Author

nsryan2 commented Aug 28, 2024

I'm ignoring the pep8speaks comment about the module level import because the path needs to be specified in the tests to allow for importing the deployment_script (as with the other tests in this repo). This issue is documented in #148.

@nsryan2 nsryan2 changed the title Deployment Script Reactor Deployment Script Aug 28, 2024
Copy link
Contributor

@LukeSeifert LukeSeifert left a comment

Choose a reason for hiding this comment

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

Looks good! My main overall comment is that I think a class structure would work well for this and let you remove a good chunk of repeated doc strings / code.

scripts/reactor_deployment.py Outdated Show resolved Hide resolved
scripts/reactor_deployment.py Show resolved Hide resolved
scripts/reactor_deployment.py Show resolved Hide resolved
scripts/reactor_deployment.py Show resolved Hide resolved
scripts/reactor_deployment.py Show resolved Hide resolved
Comment on lines 282 to 286
for reactor in ar_dict.keys():
if f'num_{reactor}' not in df:
df[f'num_{reactor}'] = 0
else:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

If you make this into a class method, this could be a function call rather than repeated

scripts/reactor_deployment.py Outdated Show resolved Hide resolved
scripts/reactor_deployment.py Outdated Show resolved Hide resolved
scripts/reactor_deployment.py Show resolved Hide resolved
scripts/scripts_README.md Show resolved Hide resolved
@nsryan2
Copy link
Member Author

nsryan2 commented Aug 29, 2024

Thanks for the suggestions @LukeSeifert, I see what you mean about a class. I'll reconfigure to incorporate that change.

I'll say, it's not how the rest of the scripts are setup and that's probably to their detriment. This feedback would be good to connect with #58

@LukeSeifert
Copy link
Contributor

Thanks for the suggestions @LukeSeifert, I see what you mean about a class. I'll reconfigure to incorporate that change.

I'll say, it's not how the rest of the scripts are setup and that's probably to their detriment. This feedback would be good to connect with #58

I see what you mean, maybe it would be worth putting that off until a full refactor. However you decide, let me know once you're ready for me to take another look.

@nsryan2 nsryan2 requested a review from LukeSeifert August 30, 2024 17:36
@nsryan2
Copy link
Member Author

nsryan2 commented Aug 30, 2024

@LukeSeifert thanks for the suggestions on improving the code. I have implemented all of them except for the class idea. I agree that it would improve this code, but I am hesitant to make the change now without thinking more broadly about the other scripts in this repo. I will make a note of this in the existing issue and start thinking about those changes.

Copy link
Contributor

@LukeSeifert LukeSeifert left a comment

Choose a reason for hiding this comment

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

Looks good!

@LukeSeifert LukeSeifert merged commit 626f51e into arfc:master Sep 3, 2024
@nsryan2 nsryan2 deleted the deployment branch September 3, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants