Skip to content

Commit

Permalink
use #pragma cyclus exec to use constants
Browse files Browse the repository at this point in the history
  • Loading branch information
bennibbelink committed Jun 1, 2024
1 parent 747d893 commit 29d0271
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 48 deletions.
10 changes: 6 additions & 4 deletions src/enrichment.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)" \
}
Expand Down Expand Up @@ -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) " \
}
Expand Down
6 changes: 4 additions & 2 deletions src/fuel_fab.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down
10 changes: 6 additions & 4 deletions src/mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -96,11 +98,11 @@ class Mixer
cyclus::toolkit::ResBuf<cyclus::Material> 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;
Expand Down
10 changes: 6 additions & 4 deletions src/separations.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
26 changes: 14 additions & 12 deletions src/sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<double> in_commod_prefs;

Expand All @@ -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;
Expand All @@ -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 " \
Expand All @@ -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"}
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions src/source.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<cyclus::EXPERIMENTAL_WARNING>(
"The Storage Facility is experimental.");};

Expand Down
Loading

0 comments on commit 29d0271

Please sign in to comment.