From 828657eecd1cda751b7c0b329b676ba43a8bfcdf Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 8 May 2024 09:39:56 -0500 Subject: [PATCH 01/11] convert instances of e299 to cyclus limit constants --- src/enrichment.h | 8 ++++---- src/fuel_fab.h | 4 ++-- src/mixer.h | 8 ++++---- src/separations.h | 8 ++++---- src/sink.h | 26 +++++++++++++------------- src/source.h | 8 ++++---- src/storage.cc | 5 ++++- src/storage.h | 32 ++++++++++++++++---------------- src/storage_tests.cc | 2 +- 9 files changed, 52 insertions(+), 49 deletions(-) diff --git a/src/enrichment.h b/src/enrichment.h index 9fb7eb333d..8eac4b0456 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -324,10 +324,10 @@ class Enrichment double initial_feed; #pragma cyclus var { \ - "default": 1e299, "tooltip": "max inventory of feed material (kg)", \ + "default": "kLinBoundLimit", "tooltip": "max inventory of feed material (kg)", \ "uilabel": "Maximum Feed Inventory", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "doc": "maximum total inventory of natural uranium in " \ "the enrichment facility (kg)" \ } @@ -362,11 +362,11 @@ class Enrichment bool order_prefs; #pragma cyclus var { \ - "default": 1e299, \ + "default": "kLinBoundLimit", \ "tooltip": "SWU capacity (kgSWU/timestep)", \ "uilabel": "SWU Capacity", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "doc": "separative work unit (SWU) capacity of enrichment " \ "facility (kgSWU/timestep) " \ } diff --git a/src/fuel_fab.h b/src/fuel_fab.h index f988a90d00..86798f2db1 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -234,9 +234,9 @@ class FuelFab "doc": "Maximum number of kg of fuel material that can be supplied per time step.", \ "uilabel": "Maximum Throughput", \ "units": "kg", \ - "default": 1e299, \ + "default": "kLinBoundLimit", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ } double throughput; diff --git a/src/mixer.h b/src/mixer.h index ca039b7e77..89fc0a7af1 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -85,9 +85,9 @@ class Mixer " If full, the facility halts operation until space becomes" \ " available.", \ "uilabel": "Maximum Leftover Inventory", \ - "default": 1e299, \ + "default": "kLinBoundLimit", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "units": "kg", \ } double out_buf_size; @@ -96,11 +96,11 @@ class Mixer cyclus::toolkit::ResBuf output; #pragma cyclus var { \ - "default": 1e299, \ + "default": "kLinBoundLimit", \ "doc": "Maximum number of kg of fuel material that can be mixed per time step.", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "units": "kg", \ } double throughput; diff --git a/src/separations.h b/src/separations.h index 822956fd6e..cc454fa931 100644 --- a/src/separations.h +++ b/src/separations.h @@ -147,9 +147,9 @@ class Separations "doc" : "Maximum quantity of feed material that can be processed per time "\ "step.", \ "uilabel": "Maximum Separations Throughput", \ - "default": 1e299, \ + "default": "kLinBoundLimit", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "units": "kg/(time step)", \ } double throughput; @@ -170,9 +170,9 @@ class Separations " If full, the facility halts operation until space becomes " \ "available.", \ "uilabel": "Maximum Leftover Inventory", \ - "default": 1e299, \ + "default": "kLinBoundLimit", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "units": "kg", \ } double leftoverbuf_size; diff --git a/src/sink.h b/src/sink.h index 8de16975d9..cae01728f7 100644 --- a/src/sink.h +++ b/src/sink.h @@ -126,7 +126,7 @@ class Sink "doc":"preferences for each of the given commodities, in the same order."\ "Defauts to 1 if unspecified",\ "uilabel":"In Commody Preferences", \ - "range": [None, [1e-299, 1e299]], \ + "range": [None, ["kConstraintEps", "kLinBoundLimit"]], \ "uitype":["oneormore", "range"]} std::vector in_commod_prefs; @@ -140,20 +140,20 @@ class Sink std::string recipe_name; /// max inventory size - #pragma cyclus var {"default": 1e299, \ + #pragma cyclus var {"default": "kLinBoundLimit", \ "tooltip": "sink maximum inventory size", \ "uilabel": "Maximum Inventory", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "doc": "total maximum inventory size of sink facility"} double max_inv_size; /// monthly acceptance capacity - #pragma cyclus var {"default": 1e299, \ + #pragma cyclus var {"default": "kLinBoundLimit", \ "tooltip": "sink capacity", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "doc": "capacity the sink facility can " \ "accept at each time step"} double capacity; @@ -179,7 +179,7 @@ class Sink "tooltip": "fraction of available space to determine the mean", \ "uilabel": "Random Size Mean", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "doc": "When a normal distribution is used to determine the " \ "size of the request, this is the fraction of available " \ "space to use as the mean. Default 1.0. Note " \ @@ -193,7 +193,7 @@ class Sink "tooltip": "fraction of available space to determine the std dev", \ "uilabel": "Random Size Std Dev", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "doc": "When a normal distribution is used to determine the " \ "size of the request, this is the fraction of available " \ "space to use as the standard deviation. Default 0.1"} @@ -220,7 +220,7 @@ class Sink "tooltip": "mean of the random frequency", \ "uilabel": "Random Frequency Mean", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "doc": "When a normal distribution is used to determine the " \ "frequency of the request, this is the mean. Default 1"} double random_frequency_mean; @@ -230,7 +230,7 @@ class Sink "tooltip": "std dev of the random frequency", \ "uilabel": "Random Frequency Std Dev", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "doc": "When a normal distribution is used to determine the " \ "frequency of the request, this is the standard deviation. Default 1"} double random_frequency_stddev; @@ -240,19 +240,19 @@ class Sink "tooltip": "lower bound of the random frequency", \ "uilabel": "Random Frequency Lower Bound", \ "uitype": "range", \ - "range": [1, 1e299], \ + "range": [1, "kIntBoundLimit"], \ "doc": "When a random distribution is used to determine the " \ "frequency of the request, this is the lower bound. Default 1"} int random_frequency_min; // random frequency upper bound - #pragma cyclus var {"default": 1e299, \ + #pragma cyclus var {"default": "std::numeric_limits::max()", \ "tooltip": "upper bound of the random frequency", \ "uilabel": "Random Frequency Upper Bound", \ "uitype": "range", \ - "range": [1, 1e299], \ + "range": [1, "kIntBoundLimit"], \ "doc": "When a random distribution is used to determine the " \ - "frequency of the request, this is the upper bound. Default 1e299"} + "frequency of the request, this is the upper bound. Default cyclus::kLinBoundLimit"} int random_frequency_max; #pragma cyclus var { \ diff --git a/src/source.h b/src/source.h index ee4f72813a..3e011816b1 100644 --- a/src/source.h +++ b/src/source.h @@ -97,21 +97,21 @@ class Source : public cyclus::Facility, " Every trade decreases this value by the supplied material " \ "quantity. When it reaches zero, the source cannot provide any " \ " more material.", \ - "default": 1e299, \ + "default": "kLinBoundLimit", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "uilabel": "Initial Inventory", \ "units": "kg", \ } double inventory_size; #pragma cyclus var { \ - "default": 1e299, \ + "default": "kLinBoundLimit", \ "tooltip": "per time step throughput", \ "units": "kg/(time step)", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "doc": "amount of commodity that can be supplied at each time step", \ } double throughput; diff --git a/src/storage.cc b/src/storage.cc index 9fc563e174..c417af1b1f 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -1,6 +1,7 @@ // storage.cc // Implements the Storage class #include "storage.h" +#include namespace cycamore { @@ -10,7 +11,7 @@ Storage::Storage(cyclus::Context* ctx) latitude(0.0), longitude(0.0), coordinates(latitude, longitude) { - inventory_tracker.Init({&inventory, &stocks, &ready, &processing}, 1e299); + inventory_tracker.Init({&inventory, &stocks, &ready, &processing}, cyclus::kLinBoundLimit); cyclus::Warn( "The Storage Facility is experimental.");}; @@ -74,6 +75,8 @@ void Storage::InitBuyPolicyParameters() { if (active_buying_min == -1) {active_buying_min = 1;} if (active_buying_max == -1) { active_buying_max = std::numeric_limits::max();} + + std::cout << "active_buying_max=" << active_buying_max << std::endl; active_dist_ = cyclus::NormalIntDist::Ptr (new cyclus::NormalIntDist(active_buying_mean, active_buying_stddev, active_buying_min, active_buying_max)); diff --git a/src/storage.h b/src/storage.h index 01186fdf43..139a1c5952 100644 --- a/src/storage.h +++ b/src/storage.h @@ -165,7 +165,7 @@ class Storage "doc":"preferences for each of the given commodities, in the same order."\ "Defauts to 1 if unspecified",\ "uilabel":"In Commody Preferences", \ - "range": [None, [1e-299, 1e299]], \ + "range": [None, ["kConstraintEps", "kLinBoundLimit"]], \ "uitype":["oneormore", "range"]} std::vector in_commod_prefs; @@ -199,25 +199,25 @@ class Storage " offered", \ "uilabel":"Sell Quantity",\ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "units": "kg"} double sell_quantity; - #pragma cyclus var {"default": 1e299,\ + #pragma cyclus var {"default": "kLinBoundLimit",\ "tooltip":"throughput per timestep (kg)",\ "doc":"the max amount that can be moved through the facility per timestep (kg)",\ "uilabel":"Throughput",\ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "units":"kg"} double throughput; - #pragma cyclus var {"default": 1e299,\ + #pragma cyclus var {"default": "kLinBoundLimit",\ "tooltip":"maximum inventory size (kg)",\ "doc":"the maximum amount of material that can be in all storage buffer stages",\ "uilabel":"Maximum Inventory Size",\ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "units":"kg"} double max_inv_size; @@ -247,7 +247,7 @@ class Storage "active_buying_frequency_type. Must be greater than or equal to 1 (i.e., agent "\ "cannot always be dormant)",\ "uitype": "range", \ - "range": [1, 1e299], \ + "range": [1, "kLinBoundLimit"], \ "uilabel": "Active Buying Frequency Value"} int active_buying_val; @@ -257,7 +257,7 @@ class Storage "Uniform and optional for Normal active_buying_frequency_type. Must be greater than "\ "or equal to 1 ",\ "uitype": "range", \ - "range": [1, 1e299], \ + "range": [1, "kLinBoundLimit"], \ "uilabel": "Active Buying Frequency Minimum"} int active_buying_min; @@ -266,7 +266,7 @@ class Storage "doc": "The maximum length in time steps of the active buying period. Required for "\ "Uniform active_buying_frequency_type, optional for Normal. Must be greater than or equal to active_buying_min ",\ "uitype": "range", \ - "range": [1, 1e299], \ + "range": [1, "kLinBoundLimit"], \ "uilabel": "Active Buying Frequency Maximum"} int active_buying_max; @@ -275,7 +275,7 @@ class Storage "doc": "The mean length in time steps of the active buying period. Required for "\ "Normal active_buying_frequency_type. Must be greater than or equal to 1 ",\ "uitype": "range", \ - "range": [1.0, 1e299], \ + "range": [1.0, "kLinBoundLimit"], \ "uilabel": "Active Buying Frequency Mean"} double active_buying_mean; @@ -284,7 +284,7 @@ class Storage "doc": "The standard deviation of the length in time steps of the active buying period. "\ "Required for Normal active_buying_frequency_type. Must be greater than or equal to 0 ",\ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "uilabel": "Active Buying Frequency Standard Deviation"} double active_buying_stddev; @@ -304,7 +304,7 @@ class Storage "doc": "The length in time steps of the dormant buying period. Required for fixed "\ "dormant_buying_frequency_type. Default is -1, agent has no dormant period and stays active.",\ "uitype": "range", \ - "range": [-1, 1e299], \ + "range": [-1, "kLinBoundLimit"], \ "uilabel": "Dormant Buying Frequency Value"} int dormant_buying_val; @@ -313,7 +313,7 @@ class Storage "doc": "The minimum length in time steps of the dormant buying period. Required for Uniform and optional for "\ "Normal dormant_buying_frequency_type.",\ "uitype": "range", \ - "range": [0, 1e299], \ + "range": [0, "kLinBoundLimit"], \ "uilabel": "Dormant Buying Frequency Minimum"} int dormant_buying_min; @@ -322,7 +322,7 @@ class Storage "doc": "The maximum length in time steps of the dormant buying period. Required for "\ "Uniform dormant_buying_frequency_type, optional for Normal. Must be greater than or equal to dormant_buying_min ",\ "uitype": "range", \ - "range": [0, 1e299], \ + "range": [0, "kLinBoundLimit"], \ "uilabel": "Dormant Buying Frequency Maximum"} int dormant_buying_max; @@ -331,7 +331,7 @@ class Storage "doc": "The mean length in time steps of the dormant buying period. Required for "\ "Normal dormant_buying_frequency_type. Must be greater than or equal to 0 ",\ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "uilabel": "Dormant Buying Frequency Mean"} double dormant_buying_mean; @@ -340,7 +340,7 @@ class Storage "doc": "The standard deviation of the length in time steps of the dormant buying period. "\ "Required for Normal dormant_buying_frequency_type. Must be greater than or equal to 0 ",\ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, "kLinBoundLimit"], \ "uilabel": "Dormant Buying Frequency Standard Deviation"} double dormant_buying_stddev; diff --git a/src/storage_tests.cc b/src/storage_tests.cc index f28a9d6865..e37a3030f3 100644 --- a/src/storage_tests.cc +++ b/src/storage_tests.cc @@ -108,7 +108,7 @@ TEST_F(StorageTest, InitialState) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TEST_F(StorageTest, CurrentCapacity){ TestCurrentCap(src_facility_,max_inv_size); - max_inv_size = 1e299; + max_inv_size = cyclus::kLinBoundLimit; SetUpStorage(); TestInitState(src_facility_); } From 797ae81dc6950bfec8c58f0ce3fadacfb97dc96f Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 8 May 2024 09:40:22 -0500 Subject: [PATCH 02/11] remove requirement of agnostic "python" in environment --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 04b52b03b6..95774f4ef3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,4 +21,4 @@ FROM cycamore as cycamore-test RUN cycamore_unit_tests FROM cycamore-test as cycamore-pytest -RUN cd tests && python3 -m pytest \ No newline at end of file +RUN cd tests && python3 -m pytest From 88f9efff90a9ad4f18d472b5efc5cd5c239bca77 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Mon, 13 May 2024 15:47:33 -0500 Subject: [PATCH 03/11] use new constants --- src/enrichment.h | 15 +++++++++++ src/fuel_fab.h | 6 +++++ src/mixer.h | 14 ++++++++++ src/separations.h | 12 +++++++++ src/sink.h | 50 ++++++++++++++++++++++++++++++++++ src/source.h | 14 ++++++++++ src/storage.cc | 4 +++ src/storage.h | 64 ++++++++++++++++++++++++++++++++++++++++++++ src/storage_tests.cc | 4 +++ 9 files changed, 183 insertions(+) diff --git a/src/enrichment.h b/src/enrichment.h index 8eac4b0456..f5662a7047 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -324,10 +324,17 @@ class Enrichment double initial_feed; #pragma cyclus var { \ +<<<<<<< Updated upstream "default": "kLinBoundLimit", "tooltip": "max inventory of feed material (kg)", \ "uilabel": "Maximum Feed Inventory", \ "uitype": "range", \ "range": [0.0, "kLinBoundLimit"], \ +======= + "default": "cy_max_double", "tooltip": "max inventory of feed material (kg)", \ + "uilabel": "Maximum Feed Inventory", \ + "uitype": "range", \ + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "doc": "maximum total inventory of natural uranium in " \ "the enrichment facility (kg)" \ } @@ -362,11 +369,19 @@ class Enrichment bool order_prefs; #pragma cyclus var { \ +<<<<<<< Updated upstream "default": "kLinBoundLimit", \ "tooltip": "SWU capacity (kgSWU/timestep)", \ "uilabel": "SWU Capacity", \ "uitype": "range", \ "range": [0.0, "kLinBoundLimit"], \ +======= + "default": "cy_max_double", \ + "tooltip": "SWU capacity (kgSWU/timestep)", \ + "uilabel": "SWU Capacity", \ + "uitype": "range", \ + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "doc": "separative work unit (SWU) capacity of enrichment " \ "facility (kgSWU/timestep) " \ } diff --git a/src/fuel_fab.h b/src/fuel_fab.h index 86798f2db1..9d63407375 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -234,9 +234,15 @@ class FuelFab "doc": "Maximum number of kg of fuel material that can be supplied per time step.", \ "uilabel": "Maximum Throughput", \ "units": "kg", \ +<<<<<<< Updated upstream "default": "kLinBoundLimit", \ "uitype": "range", \ "range": [0.0, "kLinBoundLimit"], \ +======= + "default": "cy_max_double", \ + "uitype": "range", \ + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes } double throughput; diff --git a/src/mixer.h b/src/mixer.h index 89fc0a7af1..11e764f1b2 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -85,9 +85,15 @@ class Mixer " If full, the facility halts operation until space becomes" \ " available.", \ "uilabel": "Maximum Leftover Inventory", \ +<<<<<<< Updated upstream "default": "kLinBoundLimit", \ "uitype": "range", \ "range": [0.0, "kLinBoundLimit"], \ +======= + "default": "cy_max_double", \ + "uitype": "range", \ + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "units": "kg", \ } double out_buf_size; @@ -96,11 +102,19 @@ class Mixer cyclus::toolkit::ResBuf output; #pragma cyclus var { \ +<<<<<<< Updated upstream "default": "kLinBoundLimit", \ "doc": "Maximum number of kg of fuel material that can be mixed per time step.", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ "range": [0.0, "kLinBoundLimit"], \ +======= + "default": "cy_max_double", \ + "doc": "Maximum number of kg of fuel material that can be mixed per time step.", \ + "uilabel": "Maximum Throughput", \ + "uitype": "range", \ + "range": [0.0, "cyclus::cy_max_double"], \ +>>>>>>> Stashed changes "units": "kg", \ } double throughput; diff --git a/src/separations.h b/src/separations.h index cc454fa931..10b6e80199 100644 --- a/src/separations.h +++ b/src/separations.h @@ -147,9 +147,15 @@ class Separations "doc" : "Maximum quantity of feed material that can be processed per time "\ "step.", \ "uilabel": "Maximum Separations Throughput", \ +<<<<<<< Updated upstream "default": "kLinBoundLimit", \ "uitype": "range", \ "range": [0.0, "kLinBoundLimit"], \ +======= + "default": "cy_max_double", \ + "uitype": "range", \ + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "units": "kg/(time step)", \ } double throughput; @@ -170,9 +176,15 @@ class Separations " If full, the facility halts operation until space becomes " \ "available.", \ "uilabel": "Maximum Leftover Inventory", \ +<<<<<<< Updated upstream "default": "kLinBoundLimit", \ "uitype": "range", \ "range": [0.0, "kLinBoundLimit"], \ +======= + "default": "cy_max_double", \ + "uitype": "range", \ + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "units": "kg", \ } double leftoverbuf_size; diff --git a/src/sink.h b/src/sink.h index cae01728f7..622f449335 100644 --- a/src/sink.h +++ b/src/sink.h @@ -126,7 +126,11 @@ class Sink "doc":"preferences for each of the given commodities, in the same order."\ "Defauts to 1 if unspecified",\ "uilabel":"In Commody Preferences", \ +<<<<<<< Updated upstream "range": [None, ["kConstraintEps", "kLinBoundLimit"]], \ +======= + "range": [None, ["cy_eps", "cy_max_double"]], \ +>>>>>>> Stashed changes "uitype":["oneormore", "range"]} std::vector in_commod_prefs; @@ -140,20 +144,36 @@ class Sink std::string recipe_name; /// max inventory size +<<<<<<< Updated upstream #pragma cyclus var {"default": "kLinBoundLimit", \ "tooltip": "sink maximum inventory size", \ "uilabel": "Maximum Inventory", \ "uitype": "range", \ "range": [0.0, "kLinBoundLimit"], \ +======= + #pragma cyclus var {"default": "cy_max_double", \ + "tooltip": "sink maximum inventory size", \ + "uilabel": "Maximum Inventory", \ + "uitype": "range", \ + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "doc": "total maximum inventory size of sink facility"} double max_inv_size; /// monthly acceptance capacity +<<<<<<< Updated upstream #pragma cyclus var {"default": "kLinBoundLimit", \ "tooltip": "sink capacity", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ "range": [0.0, "kLinBoundLimit"], \ +======= + #pragma cyclus var {"default": "cy_max_double", \ + "tooltip": "sink capacity", \ + "uilabel": "Maximum Throughput", \ + "uitype": "range", \ + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "doc": "capacity the sink facility can " \ "accept at each time step"} double capacity; @@ -179,7 +199,11 @@ class Sink "tooltip": "fraction of available space to determine the mean", \ "uilabel": "Random Size Mean", \ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0.0, "kLinBoundLimit"], \ +======= + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "doc": "When a normal distribution is used to determine the " \ "size of the request, this is the fraction of available " \ "space to use as the mean. Default 1.0. Note " \ @@ -193,7 +217,11 @@ class Sink "tooltip": "fraction of available space to determine the std dev", \ "uilabel": "Random Size Std Dev", \ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0.0, "kLinBoundLimit"], \ +======= + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "doc": "When a normal distribution is used to determine the " \ "size of the request, this is the fraction of available " \ "space to use as the standard deviation. Default 0.1"} @@ -220,7 +248,11 @@ class Sink "tooltip": "mean of the random frequency", \ "uilabel": "Random Frequency Mean", \ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0.0, "kLinBoundLimit"], \ +======= + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "doc": "When a normal distribution is used to determine the " \ "frequency of the request, this is the mean. Default 1"} double random_frequency_mean; @@ -230,7 +262,11 @@ class Sink "tooltip": "std dev of the random frequency", \ "uilabel": "Random Frequency Std Dev", \ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0.0, "kLinBoundLimit"], \ +======= + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "doc": "When a normal distribution is used to determine the " \ "frequency of the request, this is the standard deviation. Default 1"} double random_frequency_stddev; @@ -240,12 +276,17 @@ class Sink "tooltip": "lower bound of the random frequency", \ "uilabel": "Random Frequency Lower Bound", \ "uitype": "range", \ +<<<<<<< Updated upstream "range": [1, "kIntBoundLimit"], \ +======= + "range": [1, "cy_max_int"], \ +>>>>>>> Stashed changes "doc": "When a random distribution is used to determine the " \ "frequency of the request, this is the lower bound. Default 1"} int random_frequency_min; // random frequency upper bound +<<<<<<< Updated upstream #pragma cyclus var {"default": "std::numeric_limits::max()", \ "tooltip": "upper bound of the random frequency", \ "uilabel": "Random Frequency Upper Bound", \ @@ -253,6 +294,15 @@ class Sink "range": [1, "kIntBoundLimit"], \ "doc": "When a random distribution is used to determine the " \ "frequency of the request, this is the upper bound. Default cyclus::kLinBoundLimit"} +======= + #pragma cyclus var {"default": "cy_max_int", \ + "tooltip": "upper bound of the random frequency", \ + "uilabel": "Random Frequency Upper Bound", \ + "uitype": "range", \ + "range": [1, "cy_max_int"], \ + "doc": "When a random distribution is used to determine the " \ + "frequency of the request, this is the upper bound. Default cy_max_int"} +>>>>>>> Stashed changes int random_frequency_max; #pragma cyclus var { \ diff --git a/src/source.h b/src/source.h index 3e011816b1..1ed38d786d 100644 --- a/src/source.h +++ b/src/source.h @@ -97,21 +97,35 @@ class Source : public cyclus::Facility, " Every trade decreases this value by the supplied material " \ "quantity. When it reaches zero, the source cannot provide any " \ " more material.", \ +<<<<<<< Updated upstream "default": "kLinBoundLimit", \ "uitype": "range", \ "range": [0.0, "kLinBoundLimit"], \ +======= + "default": "cy_max_double", \ + "uitype": "range", \ + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "uilabel": "Initial Inventory", \ "units": "kg", \ } double inventory_size; #pragma cyclus var { \ +<<<<<<< Updated upstream "default": "kLinBoundLimit", \ +======= + "default": "cy_max_double", \ +>>>>>>> Stashed changes "tooltip": "per time step throughput", \ "units": "kg/(time step)", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0.0, "kLinBoundLimit"], \ +======= + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "doc": "amount of commodity that can be supplied at each time step", \ } double throughput; diff --git a/src/storage.cc b/src/storage.cc index c417af1b1f..1542bc934f 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -11,7 +11,11 @@ Storage::Storage(cyclus::Context* ctx) latitude(0.0), longitude(0.0), coordinates(latitude, longitude) { +<<<<<<< Updated upstream inventory_tracker.Init({&inventory, &stocks, &ready, &processing}, cyclus::kLinBoundLimit); +======= + inventory_tracker.Init({&inventory, &stocks, &ready, &processing}, cy_max_double); +>>>>>>> Stashed changes cyclus::Warn( "The Storage Facility is experimental.");}; diff --git a/src/storage.h b/src/storage.h index 139a1c5952..5ef46a6f77 100644 --- a/src/storage.h +++ b/src/storage.h @@ -165,7 +165,11 @@ class Storage "doc":"preferences for each of the given commodities, in the same order."\ "Defauts to 1 if unspecified",\ "uilabel":"In Commody Preferences", \ +<<<<<<< Updated upstream "range": [None, ["kConstraintEps", "kLinBoundLimit"]], \ +======= + "range": [None, ["cy_eps", "cy_max_double"]], \ +>>>>>>> Stashed changes "uitype":["oneormore", "range"]} std::vector in_commod_prefs; @@ -199,25 +203,45 @@ class Storage " offered", \ "uilabel":"Sell Quantity",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0.0, "kLinBoundLimit"], \ "units": "kg"} double sell_quantity; #pragma cyclus var {"default": "kLinBoundLimit",\ +======= + "range": [0.0, "cy_max_double"], \ + "units": "kg"} + double sell_quantity; + + #pragma cyclus var {"default": "cy_max_double",\ +>>>>>>> Stashed changes "tooltip":"throughput per timestep (kg)",\ "doc":"the max amount that can be moved through the facility per timestep (kg)",\ "uilabel":"Throughput",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0.0, "kLinBoundLimit"], \ "units":"kg"} double throughput; #pragma cyclus var {"default": "kLinBoundLimit",\ +======= + "range": [0.0, "cy_max_double"], \ + "units":"kg"} + double throughput; + + #pragma cyclus var {"default": "cy_max_double",\ +>>>>>>> Stashed changes "tooltip":"maximum inventory size (kg)",\ "doc":"the maximum amount of material that can be in all storage buffer stages",\ "uilabel":"Maximum Inventory Size",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0.0, "kLinBoundLimit"], \ +======= + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "units":"kg"} double max_inv_size; @@ -247,7 +271,11 @@ class Storage "active_buying_frequency_type. Must be greater than or equal to 1 (i.e., agent "\ "cannot always be dormant)",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [1, "kLinBoundLimit"], \ +======= + "range": [1, "cy_max_int"], \ +>>>>>>> Stashed changes "uilabel": "Active Buying Frequency Value"} int active_buying_val; @@ -257,7 +285,11 @@ class Storage "Uniform and optional for Normal active_buying_frequency_type. Must be greater than "\ "or equal to 1 ",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [1, "kLinBoundLimit"], \ +======= + "range": [1, "cy_max_int"], \ +>>>>>>> Stashed changes "uilabel": "Active Buying Frequency Minimum"} int active_buying_min; @@ -266,7 +298,11 @@ class Storage "doc": "The maximum length in time steps of the active buying period. Required for "\ "Uniform active_buying_frequency_type, optional for Normal. Must be greater than or equal to active_buying_min ",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [1, "kLinBoundLimit"], \ +======= + "range": [1, "cy_max_int"], \ +>>>>>>> Stashed changes "uilabel": "Active Buying Frequency Maximum"} int active_buying_max; @@ -275,7 +311,11 @@ class Storage "doc": "The mean length in time steps of the active buying period. Required for "\ "Normal active_buying_frequency_type. Must be greater than or equal to 1 ",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [1.0, "kLinBoundLimit"], \ +======= + "range": [1.0, "cy_max_double"], \ +>>>>>>> Stashed changes "uilabel": "Active Buying Frequency Mean"} double active_buying_mean; @@ -284,7 +324,11 @@ class Storage "doc": "The standard deviation of the length in time steps of the active buying period. "\ "Required for Normal active_buying_frequency_type. Must be greater than or equal to 0 ",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0.0, "kLinBoundLimit"], \ +======= + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "uilabel": "Active Buying Frequency Standard Deviation"} double active_buying_stddev; @@ -304,7 +348,11 @@ class Storage "doc": "The length in time steps of the dormant buying period. Required for fixed "\ "dormant_buying_frequency_type. Default is -1, agent has no dormant period and stays active.",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [-1, "kLinBoundLimit"], \ +======= + "range": [-1, "cy_max_int"], \ +>>>>>>> Stashed changes "uilabel": "Dormant Buying Frequency Value"} int dormant_buying_val; @@ -313,7 +361,11 @@ class Storage "doc": "The minimum length in time steps of the dormant buying period. Required for Uniform and optional for "\ "Normal dormant_buying_frequency_type.",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0, "kLinBoundLimit"], \ +======= + "range": [0, "cy_max_int"], \ +>>>>>>> Stashed changes "uilabel": "Dormant Buying Frequency Minimum"} int dormant_buying_min; @@ -322,7 +374,11 @@ class Storage "doc": "The maximum length in time steps of the dormant buying period. Required for "\ "Uniform dormant_buying_frequency_type, optional for Normal. Must be greater than or equal to dormant_buying_min ",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0, "kLinBoundLimit"], \ +======= + "range": [0, "cy_max_int"], \ +>>>>>>> Stashed changes "uilabel": "Dormant Buying Frequency Maximum"} int dormant_buying_max; @@ -331,7 +387,11 @@ class Storage "doc": "The mean length in time steps of the dormant buying period. Required for "\ "Normal dormant_buying_frequency_type. Must be greater than or equal to 0 ",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0.0, "kLinBoundLimit"], \ +======= + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "uilabel": "Dormant Buying Frequency Mean"} double dormant_buying_mean; @@ -340,7 +400,11 @@ class Storage "doc": "The standard deviation of the length in time steps of the dormant buying period. "\ "Required for Normal dormant_buying_frequency_type. Must be greater than or equal to 0 ",\ "uitype": "range", \ +<<<<<<< Updated upstream "range": [0.0, "kLinBoundLimit"], \ +======= + "range": [0.0, "cy_max_double"], \ +>>>>>>> Stashed changes "uilabel": "Dormant Buying Frequency Standard Deviation"} double dormant_buying_stddev; diff --git a/src/storage_tests.cc b/src/storage_tests.cc index e37a3030f3..ec31dff454 100644 --- a/src/storage_tests.cc +++ b/src/storage_tests.cc @@ -108,7 +108,11 @@ TEST_F(StorageTest, InitialState) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TEST_F(StorageTest, CurrentCapacity){ TestCurrentCap(src_facility_,max_inv_size); +<<<<<<< Updated upstream max_inv_size = cyclus::kLinBoundLimit; +======= + max_inv_size = cy_max_double; +>>>>>>> Stashed changes SetUpStorage(); TestInitState(src_facility_); } From 1057949076ab8eae893f6b1b454fd59df75364c8 Mon Sep 17 00:00:00 2001 From: Ben Nibbelink Date: Sat, 18 May 2024 18:33:16 -0500 Subject: [PATCH 04/11] stash pop and resolve conflicts --- src/deploy_inst.cc | 6 +-- src/enrichment.h | 23 ++-------- src/enrichment_tests.cc | 27 ++++-------- src/fuel_fab.h | 10 +---- src/mixer.h | 22 ++-------- src/separations.h | 20 ++------- src/sink.h | 76 ++++++-------------------------- src/source.h | 22 ++-------- src/storage.cc | 6 +-- src/storage.h | 96 +++++++---------------------------------- src/storage_tests.cc | 6 +-- 11 files changed, 60 insertions(+), 254 deletions(-) diff --git a/src/deploy_inst.cc b/src/deploy_inst.cc index dc26c937cd..1acf6ae715 100644 --- a/src/deploy_inst.cc +++ b/src/deploy_inst.cc @@ -78,24 +78,22 @@ void DeployInst::DecomNotify(Agent* a) { void DeployInst::Register_(Agent* a) { using cyclus::toolkit::CommodityProducer; - using cyclus::toolkit::CommodityProducerManager; CommodityProducer* cp_cast = dynamic_cast(a); if (cp_cast != NULL) { LOG(cyclus::LEV_INFO3, "mani") << "Registering agent " << a->prototype() << a->id() << " as a commodity producer."; - CommodityProducerManager::Register(cp_cast); + cyclus::toolkit::CommodityProducerManager::Register(cp_cast); } } void DeployInst::Unregister_(Agent* a) { using cyclus::toolkit::CommodityProducer; - using cyclus::toolkit::CommodityProducerManager; CommodityProducer* cp_cast = dynamic_cast(a); if (cp_cast != NULL) - CommodityProducerManager::Unregister(cp_cast); + cyclus::toolkit::CommodityProducerManager::Unregister(cp_cast); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/enrichment.h b/src/enrichment.h index f5662a7047..5be1dd3b0d 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -324,17 +324,10 @@ class Enrichment double initial_feed; #pragma cyclus var { \ -<<<<<<< Updated upstream - "default": "kLinBoundLimit", "tooltip": "max inventory of feed material (kg)", \ + "default": "cyclus::cy_large_double", "tooltip": "max inventory of feed material (kg)", \ "uilabel": "Maximum Feed Inventory", \ "uitype": "range", \ - "range": [0.0, "kLinBoundLimit"], \ -======= - "default": "cy_max_double", "tooltip": "max inventory of feed material (kg)", \ - "uilabel": "Maximum Feed Inventory", \ - "uitype": "range", \ - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "doc": "maximum total inventory of natural uranium in " \ "the enrichment facility (kg)" \ } @@ -369,19 +362,11 @@ class Enrichment bool order_prefs; #pragma cyclus var { \ -<<<<<<< Updated upstream - "default": "kLinBoundLimit", \ - "tooltip": "SWU capacity (kgSWU/timestep)", \ - "uilabel": "SWU Capacity", \ - "uitype": "range", \ - "range": [0.0, "kLinBoundLimit"], \ -======= - "default": "cy_max_double", \ + "default": "cyclus::cy_large_double", \ "tooltip": "SWU capacity (kgSWU/timestep)", \ "uilabel": "SWU Capacity", \ "uitype": "range", \ - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "doc": "separative work unit (SWU) capacity of enrichment " \ "facility (kgSWU/timestep) " \ } diff --git a/src/enrichment_tests.cc b/src/enrichment_tests.cc index 6439655b13..44d20afc19 100644 --- a/src/enrichment_tests.cc +++ b/src/enrichment_tests.cc @@ -572,25 +572,22 @@ TEST_F(EnrichmentTest, ValidReq) { TEST_F(EnrichmentTest, ConstraintConverters) { // Tests the SWU and NatU converters to make sure that amount of // feed and SWU required are correct to fulfill the enrichment request. - using cyclus::toolkit::MatQuery; - using cyclus::Composition; - cyclus::Env::SetNucDataPath(); double qty = 5; // 5 kg double product_assay = 0.05; // of 5 w/o enriched U - CompMap v; + cyclus::CompMap v; v[922350000] = product_assay; v[922380000] = 1 - product_assay; v[94239] = 0.5; // 94239 shouldn't be taken into account Material::Ptr target = Material::CreateUntracked( - qty, Composition::CreateFromMass(v)); + qty, cyclus::Composition::CreateFromMass(v)); std::set nucs; nucs.insert(922350000); nucs.insert(922380000); - MatQuery mq(target); + cyclus::toolkit::MatQuery mq(target); double mass_frac = mq.mass_frac(nucs); SWUConverter swuc(feed_assay, tails_assay); @@ -608,12 +605,6 @@ TEST_F(EnrichmentTest, Enrich) { // of natural uranium required that is exactly its inventory level. that // inventory will be comprised of two materials to test the manifest/absorb // strategy employed in Enrich_. - using cyclus::toolkit::MatQuery; - using cyclus::Composition; - using cyclus::toolkit::Assays; - using cyclus::toolkit::UraniumAssayMass; - using cyclus::toolkit::SwuRequired; - using cyclus::toolkit::FeedQty; double qty = 5; // kg double product_assay = 0.05; // of 5 w/o enriched U @@ -624,10 +615,10 @@ TEST_F(EnrichmentTest, Enrich) { Material::Ptr target = Material::CreateUntracked( qty + 10, Composition::CreateFromMass(v)); - Assays assays(feed_assay, UraniumAssayMass(target), tails_assay); - double swu_req = SwuRequired(qty, assays); - double natu_req = FeedQty(qty, assays); - double tails_qty = TailsQty(qty, assays); + cyclus::toolkit::Assays assays(feed_assay, cyclus::toolkit::UraniumAssayMass(target), tails_assay); + double swu_req = cyclus::toolkit::SwuRequired(qty, assays); + double natu_req = cyclus::toolkit::FeedQty(qty, assays); + double tails_qty = cyclus::toolkit::TailsQty(qty, assays); double swu_cap = swu_req * 5; src_facility->SwuCapacity(swu_cap); @@ -639,7 +630,7 @@ TEST_F(EnrichmentTest, Enrich) { EXPECT_NO_THROW(response = DoEnrich(target, qty)); EXPECT_DOUBLE_EQ(src_facility->Tails().quantity(), tails_qty); - MatQuery q(response); + cyclus::toolkit::MatQuery q(response); EXPECT_EQ(response->quantity(), qty); EXPECT_EQ(q.mass_frac(922350000), product_assay); EXPECT_EQ(q.mass_frac(922380000), 1 - product_assay); @@ -698,7 +689,7 @@ TEST_F(EnrichmentTest, Response) { Request* req = Request::Create(target, trader, product_commod); - Bid* bid = Bid::Create(req, target, src_facility); + cyclus::Bid* bid = Bid::Create(req, target, src_facility); Trade trade(req, bid, trade_qty); trades.push_back(trade); diff --git a/src/fuel_fab.h b/src/fuel_fab.h index 9d63407375..5d83086f3a 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -234,15 +234,9 @@ class FuelFab "doc": "Maximum number of kg of fuel material that can be supplied per time step.", \ "uilabel": "Maximum Throughput", \ "units": "kg", \ -<<<<<<< Updated upstream - "default": "kLinBoundLimit", \ + "default": "cyclus::cy_large_double", \ "uitype": "range", \ - "range": [0.0, "kLinBoundLimit"], \ -======= - "default": "cy_max_double", \ - "uitype": "range", \ - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ } double throughput; diff --git a/src/mixer.h b/src/mixer.h index 11e764f1b2..ae24512d08 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -85,15 +85,9 @@ class Mixer " If full, the facility halts operation until space becomes" \ " available.", \ "uilabel": "Maximum Leftover Inventory", \ -<<<<<<< Updated upstream - "default": "kLinBoundLimit", \ + "default": "cyclus::cy_large_double", \ "uitype": "range", \ - "range": [0.0, "kLinBoundLimit"], \ -======= - "default": "cy_max_double", \ - "uitype": "range", \ - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "units": "kg", \ } double out_buf_size; @@ -102,19 +96,11 @@ class Mixer cyclus::toolkit::ResBuf output; #pragma cyclus var { \ -<<<<<<< Updated upstream - "default": "kLinBoundLimit", \ - "doc": "Maximum number of kg of fuel material that can be mixed per time step.", \ - "uilabel": "Maximum Throughput", \ - "uitype": "range", \ - "range": [0.0, "kLinBoundLimit"], \ -======= - "default": "cy_max_double", \ + "default": "cyclus::cy_large_double", \ "doc": "Maximum number of kg of fuel material that can be mixed per time step.", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "units": "kg", \ } double throughput; diff --git a/src/separations.h b/src/separations.h index 10b6e80199..18d1e17e26 100644 --- a/src/separations.h +++ b/src/separations.h @@ -147,15 +147,9 @@ class Separations "doc" : "Maximum quantity of feed material that can be processed per time "\ "step.", \ "uilabel": "Maximum Separations Throughput", \ -<<<<<<< Updated upstream - "default": "kLinBoundLimit", \ + "default": "cyclus::cy_large_double", \ "uitype": "range", \ - "range": [0.0, "kLinBoundLimit"], \ -======= - "default": "cy_max_double", \ - "uitype": "range", \ - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "units": "kg/(time step)", \ } double throughput; @@ -176,15 +170,9 @@ class Separations " If full, the facility halts operation until space becomes " \ "available.", \ "uilabel": "Maximum Leftover Inventory", \ -<<<<<<< Updated upstream - "default": "kLinBoundLimit", \ - "uitype": "range", \ - "range": [0.0, "kLinBoundLimit"], \ -======= - "default": "cy_max_double", \ + "default": "cyclus::cy_large_double", \ "uitype": "range", \ - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "units": "kg", \ } double leftoverbuf_size; diff --git a/src/sink.h b/src/sink.h index 622f449335..3e9c86bbab 100644 --- a/src/sink.h +++ b/src/sink.h @@ -126,11 +126,7 @@ class Sink "doc":"preferences for each of the given commodities, in the same order."\ "Defauts to 1 if unspecified",\ "uilabel":"In Commody Preferences", \ -<<<<<<< Updated upstream - "range": [None, ["kConstraintEps", "kLinBoundLimit"]], \ -======= - "range": [None, ["cy_eps", "cy_max_double"]], \ ->>>>>>> Stashed changes + "range": [None, ["cyclus::cy_near_zero", "cyclus::cy_large_double"]], \ "uitype":["oneormore", "range"]} std::vector in_commod_prefs; @@ -144,36 +140,20 @@ class Sink std::string recipe_name; /// max inventory size -<<<<<<< Updated upstream - #pragma cyclus var {"default": "kLinBoundLimit", \ + #pragma cyclus var {"default": "cyclus::cy_large_double", \ "tooltip": "sink maximum inventory size", \ "uilabel": "Maximum Inventory", \ "uitype": "range", \ - "range": [0.0, "kLinBoundLimit"], \ -======= - #pragma cyclus var {"default": "cy_max_double", \ - "tooltip": "sink maximum inventory size", \ - "uilabel": "Maximum Inventory", \ - "uitype": "range", \ - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "doc": "total maximum inventory size of sink facility"} double max_inv_size; /// monthly acceptance capacity -<<<<<<< Updated upstream - #pragma cyclus var {"default": "kLinBoundLimit", \ - "tooltip": "sink capacity", \ - "uilabel": "Maximum Throughput", \ - "uitype": "range", \ - "range": [0.0, "kLinBoundLimit"], \ -======= - #pragma cyclus var {"default": "cy_max_double", \ + #pragma cyclus var {"default": "cyclus::cy_large_double", \ "tooltip": "sink capacity", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "doc": "capacity the sink facility can " \ "accept at each time step"} double capacity; @@ -199,11 +179,7 @@ class Sink "tooltip": "fraction of available space to determine the mean", \ "uilabel": "Random Size Mean", \ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0.0, "kLinBoundLimit"], \ -======= - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "doc": "When a normal distribution is used to determine the " \ "size of the request, this is the fraction of available " \ "space to use as the mean. Default 1.0. Note " \ @@ -217,11 +193,7 @@ class Sink "tooltip": "fraction of available space to determine the std dev", \ "uilabel": "Random Size Std Dev", \ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0.0, "kLinBoundLimit"], \ -======= - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "doc": "When a normal distribution is used to determine the " \ "size of the request, this is the fraction of available " \ "space to use as the standard deviation. Default 0.1"} @@ -248,11 +220,7 @@ class Sink "tooltip": "mean of the random frequency", \ "uilabel": "Random Frequency Mean", \ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0.0, "kLinBoundLimit"], \ -======= - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "doc": "When a normal distribution is used to determine the " \ "frequency of the request, this is the mean. Default 1"} double random_frequency_mean; @@ -262,11 +230,7 @@ class Sink "tooltip": "std dev of the random frequency", \ "uilabel": "Random Frequency Std Dev", \ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0.0, "kLinBoundLimit"], \ -======= - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "doc": "When a normal distribution is used to determine the " \ "frequency of the request, this is the standard deviation. Default 1"} double random_frequency_stddev; @@ -276,33 +240,19 @@ class Sink "tooltip": "lower bound of the random frequency", \ "uilabel": "Random Frequency Lower Bound", \ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [1, "kIntBoundLimit"], \ -======= - "range": [1, "cy_max_int"], \ ->>>>>>> Stashed changes + "range": [1, "cyclus::cy_large_int"], \ "doc": "When a random distribution is used to determine the " \ "frequency of the request, this is the lower bound. Default 1"} int random_frequency_min; // random frequency upper bound -<<<<<<< Updated upstream - #pragma cyclus var {"default": "std::numeric_limits::max()", \ - "tooltip": "upper bound of the random frequency", \ - "uilabel": "Random Frequency Upper Bound", \ - "uitype": "range", \ - "range": [1, "kIntBoundLimit"], \ - "doc": "When a random distribution is used to determine the " \ - "frequency of the request, this is the upper bound. Default cyclus::kLinBoundLimit"} -======= - #pragma cyclus var {"default": "cy_max_int", \ + #pragma cyclus var {"default": "cyclus::cy_large_int", \ "tooltip": "upper bound of the random frequency", \ "uilabel": "Random Frequency Upper Bound", \ "uitype": "range", \ - "range": [1, "cy_max_int"], \ + "range": [1, "cyclus::cy_large_int"], \ "doc": "When a random distribution is used to determine the " \ - "frequency of the request, this is the upper bound. Default cy_max_int"} ->>>>>>> Stashed changes + "frequency of the request, this is the upper bound. Default cyclus::cy_large_int"} int random_frequency_max; #pragma cyclus var { \ diff --git a/src/source.h b/src/source.h index 1ed38d786d..ade91dea89 100644 --- a/src/source.h +++ b/src/source.h @@ -97,35 +97,21 @@ class Source : public cyclus::Facility, " Every trade decreases this value by the supplied material " \ "quantity. When it reaches zero, the source cannot provide any " \ " more material.", \ -<<<<<<< Updated upstream - "default": "kLinBoundLimit", \ + "default": "cyclus::cy_large_double", \ "uitype": "range", \ - "range": [0.0, "kLinBoundLimit"], \ -======= - "default": "cy_max_double", \ - "uitype": "range", \ - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "uilabel": "Initial Inventory", \ "units": "kg", \ } double inventory_size; #pragma cyclus var { \ -<<<<<<< Updated upstream - "default": "kLinBoundLimit", \ -======= - "default": "cy_max_double", \ ->>>>>>> Stashed changes + "default": "cyclus::cy_large_double", \ "tooltip": "per time step throughput", \ "units": "kg/(time step)", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0.0, "kLinBoundLimit"], \ -======= - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "doc": "amount of commodity that can be supplied at each time step", \ } double throughput; diff --git a/src/storage.cc b/src/storage.cc index 1542bc934f..0c569412bf 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -11,11 +11,7 @@ Storage::Storage(cyclus::Context* ctx) latitude(0.0), longitude(0.0), coordinates(latitude, longitude) { -<<<<<<< Updated upstream - inventory_tracker.Init({&inventory, &stocks, &ready, &processing}, cyclus::kLinBoundLimit); -======= - inventory_tracker.Init({&inventory, &stocks, &ready, &processing}, cy_max_double); ->>>>>>> Stashed changes + inventory_tracker.Init({&inventory, &stocks, &ready, &processing}, cyclus::cy_large_double); cyclus::Warn( "The Storage Facility is experimental.");}; diff --git a/src/storage.h b/src/storage.h index 5ef46a6f77..1449943823 100644 --- a/src/storage.h +++ b/src/storage.h @@ -165,11 +165,7 @@ class Storage "doc":"preferences for each of the given commodities, in the same order."\ "Defauts to 1 if unspecified",\ "uilabel":"In Commody Preferences", \ -<<<<<<< Updated upstream - "range": [None, ["kConstraintEps", "kLinBoundLimit"]], \ -======= - "range": [None, ["cy_eps", "cy_max_double"]], \ ->>>>>>> Stashed changes + "range": [None, ["cyclus::cy_near_zero", "cyclus::cy_large_double"]], \ "uitype":["oneormore", "range"]} std::vector in_commod_prefs; @@ -203,45 +199,25 @@ class Storage " offered", \ "uilabel":"Sell Quantity",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0.0, "kLinBoundLimit"], \ + "range": [0.0, "cyclus::cy_large_double"], \ "units": "kg"} double sell_quantity; - #pragma cyclus var {"default": "kLinBoundLimit",\ -======= - "range": [0.0, "cy_max_double"], \ - "units": "kg"} - double sell_quantity; - - #pragma cyclus var {"default": "cy_max_double",\ ->>>>>>> Stashed changes + #pragma cyclus var {"default": "cyclus::cy_large_double",\ "tooltip":"throughput per timestep (kg)",\ "doc":"the max amount that can be moved through the facility per timestep (kg)",\ "uilabel":"Throughput",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0.0, "kLinBoundLimit"], \ - "units":"kg"} - double throughput; - - #pragma cyclus var {"default": "kLinBoundLimit",\ -======= - "range": [0.0, "cy_max_double"], \ + "range": [0.0, "cyclus::cy_large_double"], \ "units":"kg"} double throughput; - #pragma cyclus var {"default": "cy_max_double",\ ->>>>>>> Stashed changes + #pragma cyclus var {"default": "cyclus::cy_large_double",\ "tooltip":"maximum inventory size (kg)",\ "doc":"the maximum amount of material that can be in all storage buffer stages",\ "uilabel":"Maximum Inventory Size",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0.0, "kLinBoundLimit"], \ -======= - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "units":"kg"} double max_inv_size; @@ -271,11 +247,7 @@ class Storage "active_buying_frequency_type. Must be greater than or equal to 1 (i.e., agent "\ "cannot always be dormant)",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [1, "kLinBoundLimit"], \ -======= - "range": [1, "cy_max_int"], \ ->>>>>>> Stashed changes + "range": [1, "cy_large_int"], \ "uilabel": "Active Buying Frequency Value"} int active_buying_val; @@ -285,11 +257,7 @@ class Storage "Uniform and optional for Normal active_buying_frequency_type. Must be greater than "\ "or equal to 1 ",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [1, "kLinBoundLimit"], \ -======= - "range": [1, "cy_max_int"], \ ->>>>>>> Stashed changes + "range": [1, "cy_large_int"], \ "uilabel": "Active Buying Frequency Minimum"} int active_buying_min; @@ -298,11 +266,7 @@ class Storage "doc": "The maximum length in time steps of the active buying period. Required for "\ "Uniform active_buying_frequency_type, optional for Normal. Must be greater than or equal to active_buying_min ",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [1, "kLinBoundLimit"], \ -======= - "range": [1, "cy_max_int"], \ ->>>>>>> Stashed changes + "range": [1, "cy_large_int"], \ "uilabel": "Active Buying Frequency Maximum"} int active_buying_max; @@ -311,11 +275,7 @@ class Storage "doc": "The mean length in time steps of the active buying period. Required for "\ "Normal active_buying_frequency_type. Must be greater than or equal to 1 ",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [1.0, "kLinBoundLimit"], \ -======= - "range": [1.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [1.0, "cyclus::cy_large_double"], \ "uilabel": "Active Buying Frequency Mean"} double active_buying_mean; @@ -324,11 +284,7 @@ class Storage "doc": "The standard deviation of the length in time steps of the active buying period. "\ "Required for Normal active_buying_frequency_type. Must be greater than or equal to 0 ",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0.0, "kLinBoundLimit"], \ -======= - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "uilabel": "Active Buying Frequency Standard Deviation"} double active_buying_stddev; @@ -348,11 +304,7 @@ class Storage "doc": "The length in time steps of the dormant buying period. Required for fixed "\ "dormant_buying_frequency_type. Default is -1, agent has no dormant period and stays active.",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [-1, "kLinBoundLimit"], \ -======= - "range": [-1, "cy_max_int"], \ ->>>>>>> Stashed changes + "range": [-1, "cy_large_int"], \ "uilabel": "Dormant Buying Frequency Value"} int dormant_buying_val; @@ -361,11 +313,7 @@ class Storage "doc": "The minimum length in time steps of the dormant buying period. Required for Uniform and optional for "\ "Normal dormant_buying_frequency_type.",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0, "kLinBoundLimit"], \ -======= - "range": [0, "cy_max_int"], \ ->>>>>>> Stashed changes + "range": [0, "cy_large_int"], \ "uilabel": "Dormant Buying Frequency Minimum"} int dormant_buying_min; @@ -374,11 +322,7 @@ class Storage "doc": "The maximum length in time steps of the dormant buying period. Required for "\ "Uniform dormant_buying_frequency_type, optional for Normal. Must be greater than or equal to dormant_buying_min ",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0, "kLinBoundLimit"], \ -======= - "range": [0, "cy_max_int"], \ ->>>>>>> Stashed changes + "range": [0, "cy_large_int"], \ "uilabel": "Dormant Buying Frequency Maximum"} int dormant_buying_max; @@ -387,11 +331,7 @@ class Storage "doc": "The mean length in time steps of the dormant buying period. Required for "\ "Normal dormant_buying_frequency_type. Must be greater than or equal to 0 ",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0.0, "kLinBoundLimit"], \ -======= - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "uilabel": "Dormant Buying Frequency Mean"} double dormant_buying_mean; @@ -400,11 +340,7 @@ class Storage "doc": "The standard deviation of the length in time steps of the dormant buying period. "\ "Required for Normal dormant_buying_frequency_type. Must be greater than or equal to 0 ",\ "uitype": "range", \ -<<<<<<< Updated upstream - "range": [0.0, "kLinBoundLimit"], \ -======= - "range": [0.0, "cy_max_double"], \ ->>>>>>> Stashed changes + "range": [0.0, "cyclus::cy_large_double"], \ "uilabel": "Dormant Buying Frequency Standard Deviation"} double dormant_buying_stddev; diff --git a/src/storage_tests.cc b/src/storage_tests.cc index ec31dff454..a48be3befc 100644 --- a/src/storage_tests.cc +++ b/src/storage_tests.cc @@ -108,11 +108,7 @@ TEST_F(StorageTest, InitialState) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TEST_F(StorageTest, CurrentCapacity){ TestCurrentCap(src_facility_,max_inv_size); -<<<<<<< Updated upstream - max_inv_size = cyclus::kLinBoundLimit; -======= - max_inv_size = cy_max_double; ->>>>>>> Stashed changes + max_inv_size = cyclus::cy_large_double; SetUpStorage(); TestInitState(src_facility_); } From 7bd93ae6b3fc2df43ab88fabdf6c54f9d7029c5a Mon Sep 17 00:00:00 2001 From: Ben Nibbelink Date: Sat, 18 May 2024 18:35:55 -0500 Subject: [PATCH 05/11] specify cyclus:: namespace for cy_large_int --- src/storage.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/storage.h b/src/storage.h index 1449943823..227af17aed 100644 --- a/src/storage.h +++ b/src/storage.h @@ -247,7 +247,7 @@ class Storage "active_buying_frequency_type. Must be greater than or equal to 1 (i.e., agent "\ "cannot always be dormant)",\ "uitype": "range", \ - "range": [1, "cy_large_int"], \ + "range": [1, "cyclus::cy_large_int"], \ "uilabel": "Active Buying Frequency Value"} int active_buying_val; @@ -257,7 +257,7 @@ class Storage "Uniform and optional for Normal active_buying_frequency_type. Must be greater than "\ "or equal to 1 ",\ "uitype": "range", \ - "range": [1, "cy_large_int"], \ + "range": [1, "cyclus::cy_large_int"], \ "uilabel": "Active Buying Frequency Minimum"} int active_buying_min; @@ -266,7 +266,7 @@ class Storage "doc": "The maximum length in time steps of the active buying period. Required for "\ "Uniform active_buying_frequency_type, optional for Normal. Must be greater than or equal to active_buying_min ",\ "uitype": "range", \ - "range": [1, "cy_large_int"], \ + "range": [1, "cyclus::cy_large_int"], \ "uilabel": "Active Buying Frequency Maximum"} int active_buying_max; @@ -304,7 +304,7 @@ class Storage "doc": "The length in time steps of the dormant buying period. Required for fixed "\ "dormant_buying_frequency_type. Default is -1, agent has no dormant period and stays active.",\ "uitype": "range", \ - "range": [-1, "cy_large_int"], \ + "range": [-1, "cyclus::cy_large_int"], \ "uilabel": "Dormant Buying Frequency Value"} int dormant_buying_val; @@ -313,7 +313,7 @@ class Storage "doc": "The minimum length in time steps of the dormant buying period. Required for Uniform and optional for "\ "Normal dormant_buying_frequency_type.",\ "uitype": "range", \ - "range": [0, "cy_large_int"], \ + "range": [0, "cyclus::cy_large_int"], \ "uilabel": "Dormant Buying Frequency Minimum"} int dormant_buying_min; @@ -322,7 +322,7 @@ class Storage "doc": "The maximum length in time steps of the dormant buying period. Required for "\ "Uniform dormant_buying_frequency_type, optional for Normal. Must be greater than or equal to dormant_buying_min ",\ "uitype": "range", \ - "range": [0, "cy_large_int"], \ + "range": [0, "cyclus::cy_large_int"], \ "uilabel": "Dormant Buying Frequency Maximum"} int dormant_buying_max; From a1cc8ff216ccad6527670ba23577d4d08fdd9542 Mon Sep 17 00:00:00 2001 From: Ben Nibbelink Date: Sat, 18 May 2024 18:44:47 -0500 Subject: [PATCH 06/11] update CHANGELOG --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bbb17d3915..c601573cc0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,7 @@ Since last release * Rely on ``python3`` in environment instead of ``python`` (#602) * Link against ``libxml++`` imported target in CMake instead of ``LIBXMLXX_LIBRARIES`` (#608) * Cleaned up ``using`` declarations throughout archetypes (#610) +* Update archetype definitions to use cyclus constants instead of arbitrary hardcoded values (#606) **Fixed:** From 4c1d3119934f8bcba2a2438488a3a829f4737bed Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Fri, 31 May 2024 12:56:36 -0500 Subject: [PATCH 07/11] use #pragma cyclus exec to use constants --- src/enrichment.h | 10 ++++++---- src/fuel_fab.h | 6 ++++-- src/mixer.h | 10 ++++++---- src/separations.h | 10 ++++++---- src/sink.h | 26 ++++++++++++++------------ src/source.h | 10 ++++++---- src/storage.cc | 2 +- src/storage.h | 34 ++++++++++++++++++---------------- src/storage_tests.cc | 2 +- 9 files changed, 62 insertions(+), 48 deletions(-) diff --git a/src/enrichment.h b/src/enrichment.h index 5be1dd3b0d..a0dd72d336 100644 --- a/src/enrichment.h +++ b/src/enrichment.h @@ -6,6 +6,8 @@ #include "cyclus.h" #include "cycamore_version.h" +#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO + namespace cycamore { /// @class SWUConverter @@ -324,10 +326,10 @@ class Enrichment double initial_feed; #pragma cyclus var { \ - "default": "cyclus::cy_large_double", "tooltip": "max inventory of feed material (kg)", \ + "default": CY_LARGE_DOUBLE, "tooltip": "max inventory of feed material (kg)", \ "uilabel": "Maximum Feed Inventory", \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "doc": "maximum total inventory of natural uranium in " \ "the enrichment facility (kg)" \ } @@ -362,11 +364,11 @@ class Enrichment bool order_prefs; #pragma cyclus var { \ - "default": "cyclus::cy_large_double", \ + "default": CY_LARGE_DOUBLE, \ "tooltip": "SWU capacity (kgSWU/timestep)", \ "uilabel": "SWU Capacity", \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "doc": "separative work unit (SWU) capacity of enrichment " \ "facility (kgSWU/timestep) " \ } diff --git a/src/fuel_fab.h b/src/fuel_fab.h index 5d83086f3a..a36ff34567 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -5,6 +5,8 @@ #include "cyclus.h" #include "cycamore_version.h" +#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO + namespace cycamore { /// FuelFab takes in 2 streams of material and mixes them in ratios in order to @@ -234,9 +236,9 @@ class FuelFab "doc": "Maximum number of kg of fuel material that can be supplied per time step.", \ "uilabel": "Maximum Throughput", \ "units": "kg", \ - "default": "cyclus::cy_large_double", \ + "default": CY_LARGE_DOUBLE, \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ } double throughput; diff --git a/src/mixer.h b/src/mixer.h index ae24512d08..def723b2b3 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -5,6 +5,8 @@ #include "cycamore_version.h" #include "cyclus.h" +#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO + namespace cycamore { /// Mixer mixes N streams with fixed, static, user-specified @@ -85,9 +87,9 @@ class Mixer " If full, the facility halts operation until space becomes" \ " available.", \ "uilabel": "Maximum Leftover Inventory", \ - "default": "cyclus::cy_large_double", \ + "default": CY_LARGE_DOUBLE, \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "units": "kg", \ } double out_buf_size; @@ -96,11 +98,11 @@ class Mixer cyclus::toolkit::ResBuf output; #pragma cyclus var { \ - "default": "cyclus::cy_large_double", \ + "default": CY_LARGE_DOUBLE, \ "doc": "Maximum number of kg of fuel material that can be mixed per time step.", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "units": "kg", \ } double throughput; diff --git a/src/separations.h b/src/separations.h index 18d1e17e26..6ab6241479 100644 --- a/src/separations.h +++ b/src/separations.h @@ -4,6 +4,8 @@ #include "cyclus.h" #include "cycamore_version.h" +#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO + namespace cycamore { /// SepMaterial returns a material object that represents the composition and @@ -147,9 +149,9 @@ class Separations "doc" : "Maximum quantity of feed material that can be processed per time "\ "step.", \ "uilabel": "Maximum Separations Throughput", \ - "default": "cyclus::cy_large_double", \ + "default": CY_LARGE_DOUBLE, \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "units": "kg/(time step)", \ } double throughput; @@ -170,9 +172,9 @@ class Separations " If full, the facility halts operation until space becomes " \ "available.", \ "uilabel": "Maximum Leftover Inventory", \ - "default": "cyclus::cy_large_double", \ + "default": CY_LARGE_DOUBLE, \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "units": "kg", \ } double leftoverbuf_size; diff --git a/src/sink.h b/src/sink.h index 3e9c86bbab..9e12cd2f6b 100644 --- a/src/sink.h +++ b/src/sink.h @@ -9,6 +9,8 @@ #include "cyclus.h" #include "cycamore_version.h" +#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO + namespace cycamore { class Context; @@ -126,7 +128,7 @@ class Sink "doc":"preferences for each of the given commodities, in the same order."\ "Defauts to 1 if unspecified",\ "uilabel":"In Commody Preferences", \ - "range": [None, ["cyclus::cy_near_zero", "cyclus::cy_large_double"]], \ + "range": [None, [CY_NEAR_ZERO, CY_LARGE_DOUBLE]], \ "uitype":["oneormore", "range"]} std::vector in_commod_prefs; @@ -140,20 +142,20 @@ class Sink std::string recipe_name; /// max inventory size - #pragma cyclus var {"default": "cyclus::cy_large_double", \ + #pragma cyclus var {"default": CY_LARGE_DOUBLE, \ "tooltip": "sink maximum inventory size", \ "uilabel": "Maximum Inventory", \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "doc": "total maximum inventory size of sink facility"} double max_inv_size; /// monthly acceptance capacity - #pragma cyclus var {"default": "cyclus::cy_large_double", \ + #pragma cyclus var {"default": CY_LARGE_DOUBLE, \ "tooltip": "sink capacity", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "doc": "capacity the sink facility can " \ "accept at each time step"} double capacity; @@ -179,7 +181,7 @@ class Sink "tooltip": "fraction of available space to determine the mean", \ "uilabel": "Random Size Mean", \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "doc": "When a normal distribution is used to determine the " \ "size of the request, this is the fraction of available " \ "space to use as the mean. Default 1.0. Note " \ @@ -193,7 +195,7 @@ class Sink "tooltip": "fraction of available space to determine the std dev", \ "uilabel": "Random Size Std Dev", \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "doc": "When a normal distribution is used to determine the " \ "size of the request, this is the fraction of available " \ "space to use as the standard deviation. Default 0.1"} @@ -220,7 +222,7 @@ class Sink "tooltip": "mean of the random frequency", \ "uilabel": "Random Frequency Mean", \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "doc": "When a normal distribution is used to determine the " \ "frequency of the request, this is the mean. Default 1"} double random_frequency_mean; @@ -230,7 +232,7 @@ class Sink "tooltip": "std dev of the random frequency", \ "uilabel": "Random Frequency Std Dev", \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "doc": "When a normal distribution is used to determine the " \ "frequency of the request, this is the standard deviation. Default 1"} double random_frequency_stddev; @@ -240,17 +242,17 @@ class Sink "tooltip": "lower bound of the random frequency", \ "uilabel": "Random Frequency Lower Bound", \ "uitype": "range", \ - "range": [1, "cyclus::cy_large_int"], \ + "range": [1, CY_LARGE_INT], \ "doc": "When a random distribution is used to determine the " \ "frequency of the request, this is the lower bound. Default 1"} int random_frequency_min; // random frequency upper bound - #pragma cyclus var {"default": "cyclus::cy_large_int", \ + #pragma cyclus var {"default": CY_LARGE_INT, \ "tooltip": "upper bound of the random frequency", \ "uilabel": "Random Frequency Upper Bound", \ "uitype": "range", \ - "range": [1, "cyclus::cy_large_int"], \ + "range": [1, CY_LARGE_INT], \ "doc": "When a random distribution is used to determine the " \ "frequency of the request, this is the upper bound. Default cyclus::cy_large_int"} int random_frequency_max; diff --git a/src/source.h b/src/source.h index ade91dea89..692449ecfc 100644 --- a/src/source.h +++ b/src/source.h @@ -7,6 +7,8 @@ #include "cyclus.h" #include "cycamore_version.h" +#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO + namespace cycamore { class Context; @@ -97,21 +99,21 @@ class Source : public cyclus::Facility, " Every trade decreases this value by the supplied material " \ "quantity. When it reaches zero, the source cannot provide any " \ " more material.", \ - "default": "cyclus::cy_large_double", \ + "default": CY_LARGE_DOUBLE, \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "uilabel": "Initial Inventory", \ "units": "kg", \ } double inventory_size; #pragma cyclus var { \ - "default": "cyclus::cy_large_double", \ + "default": CY_LARGE_DOUBLE, \ "tooltip": "per time step throughput", \ "units": "kg/(time step)", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "doc": "amount of commodity that can be supplied at each time step", \ } double throughput; diff --git a/src/storage.cc b/src/storage.cc index 0c569412bf..cd98e685aa 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -11,7 +11,7 @@ Storage::Storage(cyclus::Context* ctx) latitude(0.0), longitude(0.0), coordinates(latitude, longitude) { - inventory_tracker.Init({&inventory, &stocks, &ready, &processing}, cyclus::cy_large_double); + inventory_tracker.Init({&inventory, &stocks, &ready, &processing}, cyclus::CY_LARGE_DOUBLE); cyclus::Warn( "The Storage Facility is experimental.");}; diff --git a/src/storage.h b/src/storage.h index 227af17aed..efb3b0b9d2 100644 --- a/src/storage.h +++ b/src/storage.h @@ -10,6 +10,8 @@ #include "boost/shared_ptr.hpp" +#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO + namespace cycamore { /// @class Storage /// @@ -165,7 +167,7 @@ class Storage "doc":"preferences for each of the given commodities, in the same order."\ "Defauts to 1 if unspecified",\ "uilabel":"In Commody Preferences", \ - "range": [None, ["cyclus::cy_near_zero", "cyclus::cy_large_double"]], \ + "range": [None, [CY_NEAR_ZERO, CY_LARGE_DOUBLE]], \ "uitype":["oneormore", "range"]} std::vector in_commod_prefs; @@ -199,25 +201,25 @@ class Storage " offered", \ "uilabel":"Sell Quantity",\ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "units": "kg"} double sell_quantity; - #pragma cyclus var {"default": "cyclus::cy_large_double",\ + #pragma cyclus var {"default": CY_LARGE_DOUBLE,\ "tooltip":"throughput per timestep (kg)",\ "doc":"the max amount that can be moved through the facility per timestep (kg)",\ "uilabel":"Throughput",\ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "units":"kg"} double throughput; - #pragma cyclus var {"default": "cyclus::cy_large_double",\ + #pragma cyclus var {"default": CY_LARGE_DOUBLE,\ "tooltip":"maximum inventory size (kg)",\ "doc":"the maximum amount of material that can be in all storage buffer stages",\ "uilabel":"Maximum Inventory Size",\ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "units":"kg"} double max_inv_size; @@ -247,7 +249,7 @@ class Storage "active_buying_frequency_type. Must be greater than or equal to 1 (i.e., agent "\ "cannot always be dormant)",\ "uitype": "range", \ - "range": [1, "cyclus::cy_large_int"], \ + "range": [1, CY_LARGE_INT], \ "uilabel": "Active Buying Frequency Value"} int active_buying_val; @@ -257,7 +259,7 @@ class Storage "Uniform and optional for Normal active_buying_frequency_type. Must be greater than "\ "or equal to 1 ",\ "uitype": "range", \ - "range": [1, "cyclus::cy_large_int"], \ + "range": [1, CY_LARGE_INT], \ "uilabel": "Active Buying Frequency Minimum"} int active_buying_min; @@ -266,7 +268,7 @@ class Storage "doc": "The maximum length in time steps of the active buying period. Required for "\ "Uniform active_buying_frequency_type, optional for Normal. Must be greater than or equal to active_buying_min ",\ "uitype": "range", \ - "range": [1, "cyclus::cy_large_int"], \ + "range": [1, CY_LARGE_INT], \ "uilabel": "Active Buying Frequency Maximum"} int active_buying_max; @@ -275,7 +277,7 @@ class Storage "doc": "The mean length in time steps of the active buying period. Required for "\ "Normal active_buying_frequency_type. Must be greater than or equal to 1 ",\ "uitype": "range", \ - "range": [1.0, "cyclus::cy_large_double"], \ + "range": [1.0, CY_LARGE_DOUBLE], \ "uilabel": "Active Buying Frequency Mean"} double active_buying_mean; @@ -284,7 +286,7 @@ class Storage "doc": "The standard deviation of the length in time steps of the active buying period. "\ "Required for Normal active_buying_frequency_type. Must be greater than or equal to 0 ",\ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "uilabel": "Active Buying Frequency Standard Deviation"} double active_buying_stddev; @@ -304,7 +306,7 @@ class Storage "doc": "The length in time steps of the dormant buying period. Required for fixed "\ "dormant_buying_frequency_type. Default is -1, agent has no dormant period and stays active.",\ "uitype": "range", \ - "range": [-1, "cyclus::cy_large_int"], \ + "range": [-1, CY_LARGE_INT], \ "uilabel": "Dormant Buying Frequency Value"} int dormant_buying_val; @@ -313,7 +315,7 @@ class Storage "doc": "The minimum length in time steps of the dormant buying period. Required for Uniform and optional for "\ "Normal dormant_buying_frequency_type.",\ "uitype": "range", \ - "range": [0, "cyclus::cy_large_int"], \ + "range": [0, CY_LARGE_INT], \ "uilabel": "Dormant Buying Frequency Minimum"} int dormant_buying_min; @@ -322,7 +324,7 @@ class Storage "doc": "The maximum length in time steps of the dormant buying period. Required for "\ "Uniform dormant_buying_frequency_type, optional for Normal. Must be greater than or equal to dormant_buying_min ",\ "uitype": "range", \ - "range": [0, "cyclus::cy_large_int"], \ + "range": [0, CY_LARGE_INT], \ "uilabel": "Dormant Buying Frequency Maximum"} int dormant_buying_max; @@ -331,7 +333,7 @@ class Storage "doc": "The mean length in time steps of the dormant buying period. Required for "\ "Normal dormant_buying_frequency_type. Must be greater than or equal to 0 ",\ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "uilabel": "Dormant Buying Frequency Mean"} double dormant_buying_mean; @@ -340,7 +342,7 @@ class Storage "doc": "The standard deviation of the length in time steps of the dormant buying period. "\ "Required for Normal dormant_buying_frequency_type. Must be greater than or equal to 0 ",\ "uitype": "range", \ - "range": [0.0, "cyclus::cy_large_double"], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "uilabel": "Dormant Buying Frequency Standard Deviation"} double dormant_buying_stddev; diff --git a/src/storage_tests.cc b/src/storage_tests.cc index a48be3befc..e595ee2cc3 100644 --- a/src/storage_tests.cc +++ b/src/storage_tests.cc @@ -108,7 +108,7 @@ TEST_F(StorageTest, InitialState) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TEST_F(StorageTest, CurrentCapacity){ TestCurrentCap(src_facility_,max_inv_size); - max_inv_size = cyclus::cy_large_double; + max_inv_size = cyclus::CY_LARGE_DOUBLE; SetUpStorage(); TestInitState(src_facility_); } From e601fd3dd81673a85a3fc935cf1303205d9b2b5d Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Fri, 31 May 2024 19:30:25 -0500 Subject: [PATCH 08/11] revert some debugging changes that were committed --- src/deploy_inst.cc | 6 ++++-- src/enrichment_tests.cc | 18 +++++++++--------- src/sink.h | 2 +- src/storage.cc | 3 --- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/deploy_inst.cc b/src/deploy_inst.cc index 1acf6ae715..dc26c937cd 100644 --- a/src/deploy_inst.cc +++ b/src/deploy_inst.cc @@ -78,22 +78,24 @@ void DeployInst::DecomNotify(Agent* a) { void DeployInst::Register_(Agent* a) { using cyclus::toolkit::CommodityProducer; + using cyclus::toolkit::CommodityProducerManager; CommodityProducer* cp_cast = dynamic_cast(a); if (cp_cast != NULL) { LOG(cyclus::LEV_INFO3, "mani") << "Registering agent " << a->prototype() << a->id() << " as a commodity producer."; - cyclus::toolkit::CommodityProducerManager::Register(cp_cast); + CommodityProducerManager::Register(cp_cast); } } void DeployInst::Unregister_(Agent* a) { using cyclus::toolkit::CommodityProducer; + using cyclus::toolkit::CommodityProducerManager; CommodityProducer* cp_cast = dynamic_cast(a); if (cp_cast != NULL) - cyclus::toolkit::CommodityProducerManager::Unregister(cp_cast); + CommodityProducerManager::Unregister(cp_cast); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/enrichment_tests.cc b/src/enrichment_tests.cc index 44d20afc19..287d526992 100644 --- a/src/enrichment_tests.cc +++ b/src/enrichment_tests.cc @@ -576,18 +576,18 @@ TEST_F(EnrichmentTest, ValidReq) { double qty = 5; // 5 kg double product_assay = 0.05; // of 5 w/o enriched U - cyclus::CompMap v; + CompMap v; v[922350000] = product_assay; v[922380000] = 1 - product_assay; v[94239] = 0.5; // 94239 shouldn't be taken into account Material::Ptr target = Material::CreateUntracked( - qty, cyclus::Composition::CreateFromMass(v)); + qty, Composition::CreateFromMass(v)); std::set nucs; nucs.insert(922350000); nucs.insert(922380000); - cyclus::toolkit::MatQuery mq(target); + MatQuery mq(target); double mass_frac = mq.mass_frac(nucs); SWUConverter swuc(feed_assay, tails_assay); @@ -615,10 +615,10 @@ TEST_F(EnrichmentTest, Enrich) { Material::Ptr target = Material::CreateUntracked( qty + 10, Composition::CreateFromMass(v)); - cyclus::toolkit::Assays assays(feed_assay, cyclus::toolkit::UraniumAssayMass(target), tails_assay); - double swu_req = cyclus::toolkit::SwuRequired(qty, assays); - double natu_req = cyclus::toolkit::FeedQty(qty, assays); - double tails_qty = cyclus::toolkit::TailsQty(qty, assays); + Assays assays(feed_assay, UraniumAssayMass(target), tails_assay); + double swu_req = SwuRequired(qty, assays); + double natu_req = FeedQty(qty, assays); + double tails_qty = TailsQty(qty, assays); double swu_cap = swu_req * 5; src_facility->SwuCapacity(swu_cap); @@ -630,7 +630,7 @@ TEST_F(EnrichmentTest, Enrich) { EXPECT_NO_THROW(response = DoEnrich(target, qty)); EXPECT_DOUBLE_EQ(src_facility->Tails().quantity(), tails_qty); - cyclus::toolkit::MatQuery q(response); + MatQuery q(response); EXPECT_EQ(response->quantity(), qty); EXPECT_EQ(q.mass_frac(922350000), product_assay); EXPECT_EQ(q.mass_frac(922380000), 1 - product_assay); @@ -689,7 +689,7 @@ TEST_F(EnrichmentTest, Response) { Request* req = Request::Create(target, trader, product_commod); - cyclus::Bid* bid = Bid::Create(req, target, src_facility); + Bid* bid = Bid::Create(req, target, src_facility); Trade trade(req, bid, trade_qty); trades.push_back(trade); diff --git a/src/sink.h b/src/sink.h index 9e12cd2f6b..5915377f4d 100644 --- a/src/sink.h +++ b/src/sink.h @@ -254,7 +254,7 @@ class Sink "uitype": "range", \ "range": [1, CY_LARGE_INT], \ "doc": "When a random distribution is used to determine the " \ - "frequency of the request, this is the upper bound. Default cyclus::cy_large_int"} + "frequency of the request, this is the upper bound. Default CY_LARGE_INT (1e299)"} int random_frequency_max; #pragma cyclus var { \ diff --git a/src/storage.cc b/src/storage.cc index cd98e685aa..038a192039 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -1,7 +1,6 @@ // storage.cc // Implements the Storage class #include "storage.h" -#include namespace cycamore { @@ -75,8 +74,6 @@ void Storage::InitBuyPolicyParameters() { if (active_buying_min == -1) {active_buying_min = 1;} if (active_buying_max == -1) { active_buying_max = std::numeric_limits::max();} - - std::cout << "active_buying_max=" << active_buying_max << std::endl; active_dist_ = cyclus::NormalIntDist::Ptr (new cyclus::NormalIntDist(active_buying_mean, active_buying_stddev, active_buying_min, active_buying_max)); From f7da6a381acc60333da967b8a2090147be1f902c Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Sun, 21 Jul 2024 16:08:24 -0400 Subject: [PATCH 09/11] replace CY_LARGE_INT in doc --- src/sink.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sink.h b/src/sink.h index 5915377f4d..0355d0e0e0 100644 --- a/src/sink.h +++ b/src/sink.h @@ -254,7 +254,7 @@ class Sink "uitype": "range", \ "range": [1, CY_LARGE_INT], \ "doc": "When a random distribution is used to determine the " \ - "frequency of the request, this is the upper bound. Default CY_LARGE_INT (1e299)"} + f"frequency of the request, this is the upper bound. Default {CY_LARGE_INT} (CY_LARGE_INT)"} int random_frequency_max; #pragma cyclus var { \ From 96bb0275777b5c35952dcbd34d5cf721166a54d6 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Sun, 21 Jul 2024 16:50:09 -0400 Subject: [PATCH 10/11] replace other instances of large doubles and near-zero values --- src/enrichment_tests.cc | 11 ++++++++++- src/fuel_fab.cc | 12 ++++++------ src/fuel_fab.h | 4 ++-- src/fuel_fab_tests.cc | 18 ++++++++---------- src/mixer_tests.cc | 8 ++++---- src/storage.cc | 10 +++++----- tests/test_regression.py | 23 ++++++++++++----------- 7 files changed, 47 insertions(+), 39 deletions(-) diff --git a/src/enrichment_tests.cc b/src/enrichment_tests.cc index 287d526992..b92032462e 100644 --- a/src/enrichment_tests.cc +++ b/src/enrichment_tests.cc @@ -81,7 +81,7 @@ TEST_F(EnrichmentTest, RequestQty) { // Should be only one transaction into the EF, // and it should be exactly 1kg of natu EXPECT_EQ(1.0, qr.rows.size()); - EXPECT_NEAR(1.0, m->quantity(), 1e-10) << + EXPECT_NEAR(1.0, m->quantity(), cyclus::CY_NEAR_ZERO) << "matched trade provides the wrong quantity of material"; } @@ -572,6 +572,9 @@ TEST_F(EnrichmentTest, ValidReq) { TEST_F(EnrichmentTest, ConstraintConverters) { // Tests the SWU and NatU converters to make sure that amount of // feed and SWU required are correct to fulfill the enrichment request. + using cyclus::toolkit::MatQuery; + using cyclus::Composition; + cyclus::Env::SetNucDataPath(); double qty = 5; // 5 kg @@ -605,6 +608,12 @@ TEST_F(EnrichmentTest, Enrich) { // of natural uranium required that is exactly its inventory level. that // inventory will be comprised of two materials to test the manifest/absorb // strategy employed in Enrich_. + using cyclus::toolkit::MatQuery; + using cyclus::Composition; + using cyclus::toolkit::Assays; + using cyclus::toolkit::UraniumAssayMass; + using cyclus::toolkit::SwuRequired; + using cyclus::toolkit::FeedQty; double qty = 5; // kg double product_assay = 0.05; // of 5 w/o enriched U diff --git a/src/fuel_fab.cc b/src/fuel_fab.cc index 9ed6c4a846..cc1d1dc4c2 100644 --- a/src/fuel_fab.cc +++ b/src/fuel_fab.cc @@ -38,7 +38,7 @@ class FissConverter : public cyclus::Converter { return AtomToMassFrac(frac, c_fiss_, c_topup_) * m->quantity(); } else { // don't bid at all - return 1e200; + return cyclus::CY_LARGE_DOUBLE; } } @@ -77,7 +77,7 @@ class FillConverter : public cyclus::Converter { return 0; } else { // don't bid at all - return 1e200; + return cyclus::CY_LARGE_DOUBLE; } } @@ -116,7 +116,7 @@ class TopupConverter : public cyclus::Converter { return AtomToMassFrac(frac, c_topup_, c_fiss_) * m->quantity(); } else { // don't bid at all - return 1e200; + return cyclus::CY_LARGE_DOUBLE; } } @@ -375,11 +375,11 @@ std::set::Ptr> FuelFab::GetMatlBids( new TopupConverter(c_fill, c_fiss, c_topup, spectrum)); // important! - the std::max calls prevent CapacityConstraint throwing a zero // cap exception - cyclus::CapacityConstraint fissc(std::max(fiss.quantity(), 1e-10), + cyclus::CapacityConstraint fissc(std::max(fiss.quantity(), cyclus::CY_NEAR_ZERO), fissconv); - cyclus::CapacityConstraint fillc(std::max(fill.quantity(), 1e-10), + cyclus::CapacityConstraint fillc(std::max(fill.quantity(), cyclus::CY_NEAR_ZERO), fillconv); - cyclus::CapacityConstraint topupc(std::max(topup.quantity(), 1e-10), + cyclus::CapacityConstraint topupc(std::max(topup.quantity(), cyclus::CY_NEAR_ZERO), topupconv); port->AddConstraint(fillc); port->AddConstraint(fissc); diff --git a/src/fuel_fab.h b/src/fuel_fab.h index a36ff34567..b7b88cf436 100644 --- a/src/fuel_fab.h +++ b/src/fuel_fab.h @@ -279,8 +279,8 @@ class FuelFab double CosiWeight(cyclus::Composition::Ptr c, const std::string& spectrum); bool ValidWeights(double w_low, double w_tgt, double w_high); -double LowFrac(double w_low, double w_tgt, double w_high, double eps = 1e-6); -double HighFrac(double w_low, double w_tgt, double w_high, double eps = 1e-6); +double LowFrac(double w_low, double w_tgt, double w_high, double eps = cyclus::CY_NEAR_ZERO); +double HighFrac(double w_low, double w_tgt, double w_high, double eps = cyclus::CY_NEAR_ZERO); double AtomToMassFrac(double atomfrac, cyclus::Composition::Ptr c1, cyclus::Composition::Ptr c2); } // namespace cycamore diff --git a/src/fuel_fab_tests.cc b/src/fuel_fab_tests.cc index a56d36a287..ca893ec19c 100644 --- a/src/fuel_fab_tests.cc +++ b/src/fuel_fab_tests.cc @@ -531,12 +531,12 @@ TEST(FuelFabTests, CorrectMixing) { conds[0] = Cond("Commodity", "==", std::string("natu")); qr = sim.db().Query("Transactions", &conds); m = sim.GetMaterial(qr.GetVal("ResourceId")); - EXPECT_NEAR(9.7463873197, m->quantity(), 1e-6) << "mixed wrong amount of Nat. U stream"; + EXPECT_NEAR(9.7463873197, m->quantity(), cyclus::CY_NEAR_ZERO) << "mixed wrong amount of Nat. U stream"; conds[0] = Cond("Commodity", "==", std::string("pustream")); qr = sim.db().Query("Transactions", &conds); m = sim.GetMaterial(qr.GetVal("ResourceId")); - EXPECT_NEAR(0.25361268029, m->quantity(), 1e-6) << "mixed wrong amount of Pu stream"; + EXPECT_NEAR(0.25361268029, m->quantity(), cyclus::CY_NEAR_ZERO) << "mixed wrong amount of Pu stream"; } // fuel is requested requiring more filler than is available with plenty of @@ -582,7 +582,7 @@ TEST(FuelFabTests, FillConstrained) { QueryResult qr = sim.db().Query("Transactions", &conds); Material::Ptr m = sim.GetMaterial(qr.GetVal("ResourceId")); - EXPECT_NEAR(max_provide, m->quantity(), 1e-10) << "matched trade uses more fill than available"; + EXPECT_NEAR(max_provide, m->quantity(), cyclus::CY_NEAR_ZERO) << "matched trade uses more fill than available"; } // fuel is requested requiring more fissile material than is available with @@ -628,7 +628,7 @@ TEST(FuelFabTests, FissConstrained) { QueryResult qr = sim.db().Query("Transactions", &conds); Material::Ptr m = sim.GetMaterial(qr.GetVal("ResourceId")); - EXPECT_NEAR(max_provide, m->quantity(), 1e-10) << "matched trade uses more fill than available"; + EXPECT_NEAR(max_provide, m->quantity(), cyclus::CY_NEAR_ZERO) << "matched trade uses more fill than available"; } // swap to topup inventory because fissile has too low reactivity. @@ -669,7 +669,7 @@ TEST(FuelFabTests, SwapTopup) { QueryResult qr = sim.db().Query("Transactions", &conds); ASSERT_EQ(1, qr.rows.size()) << "failed to meet fuel request"; Material::Ptr m = sim.GetMaterial(qr.GetVal("ResourceId")); - EXPECT_NEAR(sink_cap, m->quantity(), 1e-10) << "supplied fuel was constrained too much"; + EXPECT_NEAR(sink_cap, m->quantity(), cyclus::CY_NEAR_ZERO) << "supplied fuel was constrained too much"; conds[0] = Cond("Commodity", "==", std::string("natu")); conds.push_back(Cond("Time", "==", 2)); @@ -719,7 +719,7 @@ TEST(FuelFabTests, SwapTopup_ZeroFill) { QueryResult qr = sim.db().Query("Transactions", &conds); ASSERT_EQ(1, qr.rows.size()) << "failed to meet fuel request"; Material::Ptr m = sim.GetMaterial(qr.GetVal("ResourceId")); - EXPECT_NEAR(sink_cap, m->quantity(), 1e-10) << "supplied fuel was constrained too much"; + EXPECT_NEAR(sink_cap, m->quantity(), cyclus::CY_NEAR_ZERO) << "supplied fuel was constrained too much"; conds[0] = Cond("Commodity", "==", std::string("pustream")); conds.push_back(Cond("Time", "==", 2)); @@ -786,7 +786,7 @@ TEST(FuelFabTests, SwapTopup_TopupConstrained) { ASSERT_EQ(1, qr.rows.size()) << "failed to meet fuel request"; Material::Ptr m = sim.GetMaterial(qr.GetVal("ResourceId")); - EXPECT_NEAR(max_provide, m->quantity(), 1e-10) << "matched trade uses more fiss than available"; + EXPECT_NEAR(max_provide, m->quantity(), cyclus::CY_NEAR_ZERO) << "matched trade uses more fiss than available"; } // swap to topup inventory but are limited by fiss inventory quantity. This @@ -841,7 +841,7 @@ TEST(FuelFabTests, SwapTopup_FissConstrained) { ASSERT_EQ(1, qr.rows.size()) << "failed to meet fuel request"; Material::Ptr m = sim.GetMaterial(qr.GetVal("ResourceId")); - EXPECT_NEAR(max_provide, m->quantity(), 1e-10) << "matched trade uses more fiss than available"; + EXPECT_NEAR(max_provide, m->quantity(), cyclus::CY_NEAR_ZERO) << "matched trade uses more fiss than available"; } // Before this test and a fix, the fuel fab (partially) assumed each entire material @@ -987,5 +987,3 @@ TEST(FuelFabTests, PositionInitialize2) { } // namespace fuelfabtests } // namespace cycamore - - diff --git a/src/mixer_tests.cc b/src/mixer_tests.cc index c5251f4fcb..b8e23eec25 100644 --- a/src/mixer_tests.cc +++ b/src/mixer_tests.cc @@ -176,7 +176,7 @@ class MixerTest : public ::testing::Test { // Checking that ratios correctly default to 1/N. TEST_F(MixerTest, StreamDefaultRatio) { SetOutStream_capacity(50); - SetThroughput(1e200); + SetThroughput(cyclus::CY_LARGE_DOUBLE); mf_facility_->EnterNotify(); double ext_val = 1.0 / 3.0; @@ -198,7 +198,7 @@ TEST_F(MixerTest, StreamRatio) { SetStream_ratio(in_frac_); SetStream_capacity(in_cap_); SetOutStream_capacity(50); - SetThroughput(1e200); + SetThroughput(cyclus::CY_LARGE_DOUBLE); mf_facility_->EnterNotify(); std::vector strm_ratio_ = GetStream_ratio(); @@ -213,7 +213,7 @@ TEST_F(MixerTest, StreamRatio) { // Checking renormalisation when sum of ratio is smaller tham 1. in_frac_ = {0.1, 0.2, 0.5}; SetOutStream_capacity(50); - SetThroughput(1e200); + SetThroughput(cyclus::CY_LARGE_DOUBLE); SetStream_ratio(in_frac_); mf_facility_->EnterNotify(); @@ -237,7 +237,7 @@ TEST_F(MixerTest, MixingComposition) { SetOutStream_capacity(50); - SetThroughput(1e200); + SetThroughput(cyclus::CY_LARGE_DOUBLE); std::vector mat; mat.push_back(Material::CreateUntracked(in_cap[0], c_natu())); diff --git a/src/storage.cc b/src/storage.cc index 038a192039..244464dc7a 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -75,7 +75,7 @@ void Storage::InitBuyPolicyParameters() { if (active_buying_max == -1) { active_buying_max = std::numeric_limits::max();} - active_dist_ = cyclus::NormalIntDist::Ptr (new cyclus::NormalIntDist(active_buying_mean, active_buying_stddev, + active_dist_ = cyclus::NormalIntDist::Ptr (new cyclus::NormalIntDist(active_buying_mean, active_buying_stddev, active_buying_min, active_buying_max)); } else { @@ -184,7 +184,7 @@ void Storage::EnterNotify() { std::string package_name_ = context()->GetPackage(package)->name(); if (out_commods.size() == 1) { - sell_policy.Init(this, &stocks, std::string("stocks"), 1e+299, false, + sell_policy.Init(this, &stocks, std::string("stocks"), cyclus::CY_LARGE_DOUBLE, false, sell_quantity, package_name_) .Set(out_commods.front()) .Start(); @@ -225,7 +225,7 @@ std::string Storage::str() { //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Storage::Tick() { - + LOG(cyclus::LEV_INFO3, "ComCnv") << prototype() << " is ticking {"; @@ -265,9 +265,9 @@ void Storage::Tock() { int maxindx = std::distance(in_commod_prefs.begin(), result); double demand = 0; demand = current_capacity(); - + cyclus::toolkit::RecordTimeSeries("demand"+in_commods[maxindx], this, demand); - + // Multiple commodity tracking is not supported, user can only // provide one value for out_commods, despite it being a vector of strings. cyclus::toolkit::RecordTimeSeries("supply"+out_commods[0], this, diff --git a/tests/test_regression.py b/tests/test_regression.py index 9fded61ee6..1d323ab146 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -9,6 +9,7 @@ from numpy.testing import assert_array_almost_equal from numpy.testing import assert_almost_equal from cyclus.lib import Env +from cyclus.system import CY_NEAR_ZERO from pytest import skip @@ -273,7 +274,7 @@ class TestDynamicCapacitated(TestRegression): facilities being the constraint. At time step 3, after decommissioning 2 older sink facilities, the remaining number of sink facilities becomes the constraint, resulting in the same transaction amount as in time step 1. - """ + """ @classmethod def setup_class(cls): skip_if_dont_allow_milps() @@ -365,7 +366,7 @@ def test_xaction_specific(self): class TestGrowth1(TestRegression): """This class tests the growth.xml - + Tests GrowthRegion, ManagerInst, and Source over a 4-time step simulation. @@ -411,7 +412,7 @@ def test_deployment(self): class TestGrowth2(TestRegression): """This class tests the ./input/deploy_and_manager_insts.xml - + Tests GrowthRegion, ManagerInst, DeployInst, and Source over a 10-time step simulation. @@ -449,17 +450,17 @@ def test_deployment(self): class TestDeployInst(TestRegression): """This class tests the ../input/deploy_inst.xml - + Tests DeployInst, and NullRegion over a 10-time step simulation. - A DeployInst is used to define that a Source agent is to be deployed at + A DeployInst is used to define that a Source agent is to be deployed at time t=1 within a Null Region. A Sink agent is also deployed as - an initial facility. This input is used to test that the Source and - Sink agents are deployed at their respecitve times and that the correct + an initial facility. This input is used to test that the Source and + Sink agents are deployed at their respecitve times and that the correct number of these agents are deployed. - """ + """ @classmethod def setup_class(cls): skip_if_dont_allow_milps() @@ -487,7 +488,7 @@ def test_deployment(self): class _Recycle(TestRegression): """This class tests the input/recycle.xml file. - """ + """ @classmethod def setup_class(cls, inf): super(_Recycle, cls).setup_class(inf) @@ -506,7 +507,7 @@ def setup_class(cls, inf): def do_compare(self, fromfac, tofac, nuclide, exp_invs): conn = sqlite3.connect(self.outf) c = conn.cursor() - eps = 1e-10 + eps = CY_NEAR_ZERO simdur = len(exp_invs) invs = [0.0] * simdur @@ -583,7 +584,7 @@ def setup_class(cls): class TestCBCRecycle(_Recycle): """This class tests the input/recycle.xml file. - """ + """ @classmethod def setup_class(cls): skip_if_dont_allow_milps() From a66905cefed973286d3069be1ba6e88f0c733f58 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Sun, 21 Jul 2024 17:20:15 -0400 Subject: [PATCH 11/11] add back tu_name_ arg, it was accidentally deleted --- src/storage.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage.cc b/src/storage.cc index 244464dc7a..b1b03d2476 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -185,7 +185,7 @@ void Storage::EnterNotify() { std::string package_name_ = context()->GetPackage(package)->name(); if (out_commods.size() == 1) { sell_policy.Init(this, &stocks, std::string("stocks"), cyclus::CY_LARGE_DOUBLE, false, - sell_quantity, package_name_) + sell_quantity, package_name_, tu_name_) .Set(out_commods.front()) .Start();