Skip to content

Commit

Permalink
Merge pull request #618 from nuclearkatie/rx_pkg
Browse files Browse the repository at this point in the history
Reactor and sink keep packaging
  • Loading branch information
gonuke authored Jul 31, 2024
2 parents aea4bb5 + 65d04c7 commit 5eafa6c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Since last release
**Added:**
* Added package parameter to storage (#603, #612, #616)
* Added package parameter to source (#613, #617)
* Added default keep packaging to reactor (#618)

**Changed:**

Expand Down
6 changes: 6 additions & 0 deletions src/reactor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Reactor::Reactor(cyclus::Context* ctx)
discharged(false),
latitude(0.0),
longitude(0.0),
keep_packaging(true),
coordinates(latitude, longitude) {}


Expand Down Expand Up @@ -62,6 +63,11 @@ void Reactor::InitFrom(cyclus::QueryableBackend* b) {
void Reactor::EnterNotify() {
cyclus::Facility::EnterNotify();

// Set keep packaging parameter in all ResBufs
fresh.keep_packaging(keep_packaging);
core.keep_packaging(keep_packaging);
spent.keep_packaging(keep_packaging);

// If the user ommitted fuel_prefs, we set it to zeros for each fuel
// type. Without this segfaults could occur - yuck.
if (fuel_prefs.size() == 0) {
Expand Down
12 changes: 12 additions & 0 deletions src/reactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,18 @@ class Reactor : public cyclus::Facility,
}
std::vector<double> pref_change_values;

#pragma cyclus var { \
"default": true, \
"tooltip": "Whether to persist packaging throughout the reactor", \
"doc": "Boolean value about whether to keep packaging. If true, " \
"packaging will not be stripped upon acceptance into the " \
"reactor. If false, package type will be stripped immediately " \
"upon acceptance. Has no effect if the incoming material is not " \
"packaged.", \
"uilabel": "Keep Packaging", \
"uitype": "bool"}
bool keep_packaging;

// Resource inventories - these must be defined AFTER/BELOW the member vars
// referenced (e.g. n_batch_fresh, assem_size, etc.).
#pragma cyclus var {"capacity": "n_assem_fresh * assem_size"}
Expand Down
3 changes: 3 additions & 0 deletions src/sink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Sink::Sink(cyclus::Context* ctx)
capacity(std::numeric_limits<double>::max()),
latitude(0.0),
longitude(0.0),
keep_packaging(true),
coordinates(latitude, longitude) {
SetMaxInventorySize(std::numeric_limits<double>::max());}

Expand Down Expand Up @@ -43,6 +44,8 @@ void Sink::EnterNotify() {
cyclus::Facility::EnterNotify();
LOG(cyclus::LEV_INFO4, "SnkFac") << " using random behavior " << random_size_type;

inventory.keep_packaging(keep_packaging);

if (in_commod_prefs.size() == 0) {
for (int i = 0; i < in_commods.size(); ++i) {
in_commod_prefs.push_back(cyclus::kDefaultPref);
Expand Down
12 changes: 12 additions & 0 deletions src/sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,18 @@ class Sink
f"frequency of the request, this is the upper bound. Default {CY_LARGE_INT} (CY_LARGE_INT)"}
int random_frequency_max;

#pragma cyclus var { \
"default": true, \
"tooltip": "Whether to persist packaging in the sink.", \
"doc": "Boolean value about whether to keep packaging. If true, " \
"packaging will not be stripped upon acceptance into the " \
"sink. If false, package type will be stripped immediately " \
"upon acceptance. Has no effect if the incoming material is not " \
"packaged.", \
"uilabel": "Keep Packaging", \
"uitype": "bool"}
bool keep_packaging;

#pragma cyclus var { \
"default": 0.0, \
"uilabel": "Geographical latitude in degrees as a double", \
Expand Down

0 comments on commit 5eafa6c

Please sign in to comment.