Skip to content

Commit

Permalink
Merge pull request #621 from nuclearkatie/source_packaging
Browse files Browse the repository at this point in the history
prevent underflow when not enough material is available to make a packagable bid
  • Loading branch information
gonuke authored Sep 13, 2024
2 parents dce0237 + f3637af commit 58650fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Since last release

**Added:**
* Added package parameter to storage (#603, #612, #616)
* Added package parameter to source (#613, #617)
* Added package parameter to source (#613, #617, #621)
* Added default keep packaging to reactor (#618, #619)

**Changed:**
Expand Down
5 changes: 3 additions & 2 deletions src/source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ std::set<cyclus::BidPortfolio<cyclus::Material>::Ptr> Source::GetMatlBids(
double qty = std::min(target->quantity(), max_qty);

// calculate packaging
double bid_qty = context()->GetPackage(package)->GetFillMass(qty);
int n_full_bids = static_cast<int>(std::floor(qty / bid_qty));
std::pair<double, int> fill = context()->GetPackage(package)->GetFillMass(qty);
double bid_qty = fill.first;
int n_full_bids = fill.second;
Package::ExceedsSplitLimits(n_full_bids);

std::vector<double> bids;
Expand Down

0 comments on commit 58650fe

Please sign in to comment.