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

Correction to deployment scheme #143

Merged
merged 10 commits into from
Oct 31, 2022
Merged

Correction to deployment scheme #143

merged 10 commits into from
Oct 31, 2022

Conversation

abachma2
Copy link
Contributor

This PR fixes an issue observed after #141 was merged that was not caught in the test suite. With this PR the deployment scheme is as follows:

  • when there is capacity to be installed from an increase in the demand or from decommissioning of facilities in another institution:
    • The prototypes are preferentially deployed based on power
    • The prototype with the largest capacity is deployed until an oversupply of energy would be created (round down on the number deployed)
    • The other prototypes are deployed in a similar manner until the smallest prototype is deployed
    • The smallest prototype is deployed until the demand is at least met (round up on the number deployed)
    • If there is a specified build share for one or more prototypes, then the prototypes with a specified build share are deployed first, and then the other prototypes are deployed based on the previous 4 points, with the prototypes with a specified build share removed from the deployment order (the list of prototypes in order of decreasing capacity)
  • when there is capacity to be installed from the decommissioning of prototypes in this institution:
    • It is assumed first that the number of decommissioning prototypes are re-deployed (e.g. look at time step current minus the lifetime of the prototype in question)
    • If fewer prototypes can be deployed while still meeting the demand, such as in the case of a decrease in the demand, then the lesser number of prototypes are deployed.

This PR fixes the issue of large variations in the number of prototypes re-deployed if multiple prototypes were decommissioned at the same time step.

All tests currently pass. I encourage you to ensure that the test suite for these functions is comprehensive, as the error this fixes was not previously captured in the test suite.

Copy link
Contributor

@samgdotson samgdotson left a comment

Choose a reason for hiding this comment

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

I'm requesting some changes to make the code more readable. I generally prefer longer variable names to shorter ones (although I'm definitely guilty of making lazy names). rx is not a helpful shortening of reactor in my opinion. There are several places where an array slice is extremely verbose (e.g. power_gap[index:index+reactor_prototypes[prototype][1]]) which makes it hard to interpret what's happening.

I'm a little bit surprised that .circleci didn't run this PR. But several previous builds have failed -- you may want to check why that is.

scripts/create_AR_DeployInst.py Outdated Show resolved Hide resolved
scripts/create_AR_DeployInst.py Outdated Show resolved Hide resolved
scripts/create_AR_DeployInst.py Outdated Show resolved Hide resolved
scripts/create_AR_DeployInst.py Outdated Show resolved Hide resolved
scripts/create_AR_DeployInst.py Outdated Show resolved Hide resolved
scripts/create_AR_DeployInst.py Outdated Show resolved Hide resolved
scripts/tests/test_create_AR_DeployInst.py Outdated Show resolved Hide resolved
scripts/tests/test_create_AR_DeployInst.py Outdated Show resolved Hide resolved
scripts/tests/test_create_AR_DeployInst.py Show resolved Hide resolved
@abachma2
Copy link
Contributor Author

Hi @samgdotson, thanks for the review. I think your comments help with the readability of the code. For the CircleCI, it is a known issue with that (Issue #128) because there are some issues with building pyne. I haven't gotten around to fixing it.

@samgdotson
Copy link
Contributor

samgdotson commented Oct 26, 2022 via email

Copy link
Contributor

@samgdotson samgdotson left a comment

Choose a reason for hiding this comment

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

There are a few remaining things that need to be changed in your test file. I made them suggestions so it should be easy to rectify.

As a matter of personal preference, every instance of rx in your create_AR_DeployInst script should be replaced by reactor. I don't know what IDE you use, but most of them have a "find and replace all" feature. If you handle the other comments but not this one, I will still merge.

scripts/tests/test_create_AR_DeployInst.py Outdated Show resolved Hide resolved
scripts/tests/test_create_AR_DeployInst.py Outdated Show resolved Hide resolved
scripts/tests/test_create_AR_DeployInst.py Show resolved Hide resolved
scripts/tests/test_create_AR_DeployInst.py Outdated Show resolved Hide resolved
@abachma2
Copy link
Contributor Author

Thanks for catching those @samgdotson! I have made the requested changes.

Copy link
Contributor

@samgdotson samgdotson 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 @abachma2, merging.

@samgdotson samgdotson merged commit 866b9f0 into arfc:master Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants