From e4112ec16bb9591f2f5b2a9c8e02e3b2a416655e Mon Sep 17 00:00:00 2001 From: Katie Mummah Date: Fri, 19 Jul 2024 15:31:31 -0500 Subject: [PATCH 1/5] reactor keep packaging --- CHANGELOG.rst | 1 + src/reactor.cc | 6 ++++++ src/reactor.h | 21 ++++++++++++++++++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e4460ca1b1..c39a987b04 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,7 @@ Since last release **Added:** * Added package parameter to storage (#603, #612) * Added package parameter to source (#613, #617) +* Added default keep packaging to reactor (#618) **Changed:** diff --git a/src/reactor.cc b/src/reactor.cc index 27297cc297..0e4dca51c7 100644 --- a/src/reactor.cc +++ b/src/reactor.cc @@ -23,6 +23,7 @@ Reactor::Reactor(cyclus::Context* ctx) discharged(false), latitude(0.0), longitude(0.0), + keep_packaging(1), coordinates(latitude, longitude) {} @@ -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) { diff --git a/src/reactor.h b/src/reactor.h index d412f2026c..f94e5a0eab 100644 --- a/src/reactor.h +++ b/src/reactor.h @@ -407,13 +407,28 @@ class Reactor : public cyclus::Facility, } std::vector pref_change_values; + #pragma cyclus var { \ + "default": 1, \ + "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"} + #pragma cyclus var {"capacity": "n_assem_fresh * assem_size", \ + "keep_packaging": "keep_packaging"} cyclus::toolkit::ResBuf fresh; - #pragma cyclus var {"capacity": "n_assem_core * assem_size"} + #pragma cyclus var {"capacity": "n_assem_core * assem_size", \ + "keep_packaging": "keep_packaging"} cyclus::toolkit::ResBuf core; - #pragma cyclus var {"capacity": "n_assem_spent * assem_size"} + #pragma cyclus var {"capacity": "n_assem_spent * assem_size", \ + "keep_packaging": "keep_packaging"} cyclus::toolkit::ResBuf spent; From 798c8e900d717536c1ff7d8ddc02f5888fd9a59e Mon Sep 17 00:00:00 2001 From: Katie Mummah Date: Tue, 23 Jul 2024 15:11:53 -0500 Subject: [PATCH 2/5] use resbuf unpackaged --- src/reactor.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/reactor.cc b/src/reactor.cc index 0e4dca51c7..5059a3d47f 100644 --- a/src/reactor.cc +++ b/src/reactor.cc @@ -64,9 +64,9 @@ 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); + fresh.unpackaged(!keep_packaging); + core.unpackaged(!keep_packaging); + spent.unpackaged(!keep_packaging); // If the user ommitted fuel_prefs, we set it to zeros for each fuel // type. Without this segfaults could occur - yuck. From c3581804811fad9b001fa6d6b8e922f57599c8cb Mon Sep 17 00:00:00 2001 From: Katie Mummah Date: Wed, 24 Jul 2024 15:42:36 -0500 Subject: [PATCH 3/5] default keep packaging for sink --- src/sink.cc | 3 +++ src/sink.h | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/sink.cc b/src/sink.cc index bb7894e5af..98d2b2189f 100644 --- a/src/sink.cc +++ b/src/sink.cc @@ -14,6 +14,7 @@ Sink::Sink(cyclus::Context* ctx) capacity(std::numeric_limits::max()), latitude(0.0), longitude(0.0), + keep_packaging(1), coordinates(latitude, longitude) { SetMaxInventorySize(std::numeric_limits::max());} @@ -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); diff --git a/src/sink.h b/src/sink.h index 8de16975d9..ea1ae17321 100644 --- a/src/sink.h +++ b/src/sink.h @@ -255,6 +255,18 @@ class Sink "frequency of the request, this is the upper bound. Default 1e299"} int random_frequency_max; + #pragma cyclus var { \ + "default": 1, \ + "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", \ From d5cc4dc1ded478e79afa07f94d634fcf3da264e1 Mon Sep 17 00:00:00 2001 From: Katie Mummah Date: Wed, 24 Jul 2024 15:47:56 -0500 Subject: [PATCH 4/5] keep_packaging resbuf --- src/reactor.cc | 6 +++--- src/reactor.h | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/reactor.cc b/src/reactor.cc index 5059a3d47f..0e4dca51c7 100644 --- a/src/reactor.cc +++ b/src/reactor.cc @@ -64,9 +64,9 @@ void Reactor::EnterNotify() { cyclus::Facility::EnterNotify(); // Set keep packaging parameter in all ResBufs - fresh.unpackaged(!keep_packaging); - core.unpackaged(!keep_packaging); - spent.unpackaged(!keep_packaging); + 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. diff --git a/src/reactor.h b/src/reactor.h index f94e5a0eab..d6c1cc65dd 100644 --- a/src/reactor.h +++ b/src/reactor.h @@ -421,14 +421,11 @@ class Reactor : public cyclus::Facility, // 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", \ - "keep_packaging": "keep_packaging"} + #pragma cyclus var {"capacity": "n_assem_fresh * assem_size"} cyclus::toolkit::ResBuf fresh; - #pragma cyclus var {"capacity": "n_assem_core * assem_size", \ - "keep_packaging": "keep_packaging"} + #pragma cyclus var {"capacity": "n_assem_core * assem_size"} cyclus::toolkit::ResBuf core; - #pragma cyclus var {"capacity": "n_assem_spent * assem_size", \ - "keep_packaging": "keep_packaging"} + #pragma cyclus var {"capacity": "n_assem_spent * assem_size"} cyclus::toolkit::ResBuf spent; From 65d04c7149e0fe7ec371ab6ee838157a4bb36dae Mon Sep 17 00:00:00 2001 From: Katie Mummah Date: Wed, 31 Jul 2024 14:55:05 -0600 Subject: [PATCH 5/5] Apply suggestions from code review - use boolean true Co-authored-by: Paul Wilson --- src/reactor.cc | 2 +- src/reactor.h | 2 +- src/sink.cc | 2 +- src/sink.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/reactor.cc b/src/reactor.cc index 0e4dca51c7..30e7857eb8 100644 --- a/src/reactor.cc +++ b/src/reactor.cc @@ -23,7 +23,7 @@ Reactor::Reactor(cyclus::Context* ctx) discharged(false), latitude(0.0), longitude(0.0), - keep_packaging(1), + keep_packaging(true), coordinates(latitude, longitude) {} diff --git a/src/reactor.h b/src/reactor.h index d6c1cc65dd..7767403fbe 100644 --- a/src/reactor.h +++ b/src/reactor.h @@ -408,7 +408,7 @@ class Reactor : public cyclus::Facility, std::vector pref_change_values; #pragma cyclus var { \ - "default": 1, \ + "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 " \ diff --git a/src/sink.cc b/src/sink.cc index 98d2b2189f..b2b5644389 100644 --- a/src/sink.cc +++ b/src/sink.cc @@ -14,7 +14,7 @@ Sink::Sink(cyclus::Context* ctx) capacity(std::numeric_limits::max()), latitude(0.0), longitude(0.0), - keep_packaging(1), + keep_packaging(true), coordinates(latitude, longitude) { SetMaxInventorySize(std::numeric_limits::max());} diff --git a/src/sink.h b/src/sink.h index ea1ae17321..c95daa1f7a 100644 --- a/src/sink.h +++ b/src/sink.h @@ -256,7 +256,7 @@ class Sink int random_frequency_max; #pragma cyclus var { \ - "default": 1, \ + "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 " \