diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 78093eb3f..f7fe79d18 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,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:** diff --git a/docker/Dockerfile b/docker/Dockerfile index 04b52b03b..95774f4ef 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 diff --git a/src/enrichment.h b/src/enrichment.h index 9fb7eb333..a0dd72d33 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": 1e299, "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, 1e299], \ + "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": 1e299, \ + "default": CY_LARGE_DOUBLE, \ "tooltip": "SWU capacity (kgSWU/timestep)", \ "uilabel": "SWU Capacity", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, 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 6439655b1..b92032462 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"; } diff --git a/src/fuel_fab.cc b/src/fuel_fab.cc index 9ed6c4a84..cc1d1dc4c 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 f988a90d0..b7b88cf43 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": 1e299, \ + "default": CY_LARGE_DOUBLE, \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, CY_LARGE_DOUBLE], \ } double throughput; @@ -277,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 a56d36a28..ca893ec19 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.h b/src/mixer.h index ca039b7e7..def723b2b 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": 1e299, \ + "default": CY_LARGE_DOUBLE, \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "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": 1e299, \ + "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, 1e299], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "units": "kg", \ } double throughput; diff --git a/src/mixer_tests.cc b/src/mixer_tests.cc index c5251f4fc..b8e23eec2 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/separations.h b/src/separations.h index 822956fd6..6ab624147 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": 1e299, \ + "default": CY_LARGE_DOUBLE, \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "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": 1e299, \ + "default": CY_LARGE_DOUBLE, \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "units": "kg", \ } double leftoverbuf_size; diff --git a/src/sink.h b/src/sink.h index 8de16975d..0355d0e0e 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, [1e-299, 1e299]], \ + "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": 1e299, \ + #pragma cyclus var {"default": CY_LARGE_DOUBLE, \ "tooltip": "sink maximum inventory size", \ "uilabel": "Maximum Inventory", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "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": 1e299, \ + #pragma cyclus var {"default": CY_LARGE_DOUBLE, \ "tooltip": "sink capacity", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "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, 1e299], \ + "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, 1e299], \ + "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, 1e299], \ + "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, 1e299], \ + "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,19 +242,19 @@ class Sink "tooltip": "lower bound of the random frequency", \ "uilabel": "Random Frequency Lower Bound", \ "uitype": "range", \ - "range": [1, 1e299], \ + "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": 1e299, \ + #pragma cyclus var {"default": CY_LARGE_INT, \ "tooltip": "upper bound of the random frequency", \ "uilabel": "Random Frequency Upper Bound", \ "uitype": "range", \ - "range": [1, 1e299], \ + "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 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 { \ diff --git a/src/source.h b/src/source.h index b257d9b09..0024f20f4 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; @@ -99,21 +101,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": CY_LARGE_DOUBLE, \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "uilabel": "Initial Inventory", \ "units": "kg", \ } double inventory_size; #pragma cyclus var { \ - "default": 1e299, \ + "default": CY_LARGE_DOUBLE, \ "tooltip": "per time step throughput", \ "units": "kg/(time step)", \ "uilabel": "Maximum Throughput", \ "uitype": "range", \ - "range": [0.0, 1e299], \ + "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 d37748ad7..7c65db9d7 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -10,7 +10,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::CY_LARGE_DOUBLE); cyclus::Warn( "The Storage Facility is experimental.");}; @@ -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 { @@ -185,7 +185,7 @@ void Storage::EnterNotify() { std::string package_name_ = context()->GetPackage(package)->name(); std::string tu_name_ = context()->GetTransportUnit(transport_unit)->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_, tu_name_) .Set(out_commods.front()) .Start(); @@ -226,7 +226,7 @@ std::string Storage::str() { //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Storage::Tick() { - + LOG(cyclus::LEV_INFO3, "ComCnv") << prototype() << " is ticking {"; @@ -266,9 +266,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/src/storage.h b/src/storage.h index 0674eba57..7bf539c9b 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, [1e-299, 1e299]], \ + "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, 1e299], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "units": "kg"} double sell_quantity; - #pragma cyclus var {"default": 1e299,\ + #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, 1e299], \ + "range": [0.0, CY_LARGE_DOUBLE], \ "units":"kg"} double throughput; - #pragma cyclus var {"default": 1e299,\ + #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, 1e299], \ + "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, 1e299], \ + "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, 1e299], \ + "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, 1e299], \ + "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, 1e299], \ + "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, 1e299], \ + "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, 1e299], \ + "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, 1e299], \ + "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, 1e299], \ + "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, 1e299], \ + "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, 1e299], \ + "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 adb4891d7..8bd80238c 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::CY_LARGE_DOUBLE; SetUpStorage(); TestInitState(src_facility_); } diff --git a/tests/test_regression.py b/tests/test_regression.py index 9fded61ee..1d323ab14 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()