Skip to content

Commit

Permalink
comments for active/dormant table
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearkatie committed Nov 20, 2024
1 parent cbc15a5 commit 2106e29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Since last release
* Methods to reset behavaiors of MaterialBuyPolicy (#1822)
* More random distributions for the random number generator (#1821, #1827)
* Added example of header code injection for facility cost (#1829)
* Table for recording active/dormant cycle periods (#1830)

**Changed:**

Expand Down
12 changes: 9 additions & 3 deletions src/toolkit/matl_buy_policy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,20 @@ void MatlBuyPolicy::SetNextDormantTime() {
int dormant_length;
int dormant_start;
if (use_cumulative_capacity()) {
// need the +1 when not using next_active_end_
// cumulative_cap dormant portion is updated only after the active cycle
// ends, because it's based on actual material recieved and not a dist
// that can be sampled at any time. Therefore, need the +1 when
// because next_active_end_ is not useful
dormant_length = dormant_dist_->sample();
dormant_start = manager()->context()->time() + 1;
}
else if (next_dormant_end_ >= 0) {
else if (next_dormant_end_ >= 0) {
// dormant dist is used, and so is active dist. Just need to sample for
// length and add to active cycle
dormant_length = dormant_dist_->sample();
dormant_start = std::max(next_active_end_, 1);

} else { // always active. Do not enter dormant
return;
}
next_dormant_end_ = dormant_length + dormant_start;
if (manager() != NULL) {
Expand Down

0 comments on commit 2106e29

Please sign in to comment.