CYCAMORE
Loading...
Searching...
No Matches
build/cycamore/sink.h
Go to the documentation of this file.
1
2#line 1 "/cycamore/src/sink.h"
3#ifndef CYCAMORE_SRC_SINK_H_
4#define CYCAMORE_SRC_SINK_H_
5
6#include <algorithm>
7#include <string>
8#include <utility>
9#include <vector>
10
11#include "cyclus.h"
12#include "cycamore_version.h"
13
14#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO
15
16namespace cycamore {
17
18class Context;
19
25class Sink
26 : public cyclus::Facility,
27 public cyclus::toolkit::Position {
28 public:
29 Sink(cyclus::Context* ctx);
30
31 virtual ~Sink();
32
33 virtual std::string version() { return CYCAMORE_VERSION; }
34
35 #pragma cyclus note { "doc": " A sink facility that accepts materials and products with a fixed\n" " throughput (per time step) capacity and a lifetime capacity defined by\n" " a total inventory size. The inventory size and throughput capacity\n" " both default to infinite. If a recipe is provided, it will request\n" " material with that recipe. Requests are made for any number of\n" " specified commodities.\n" }
36#line 42 "/cycamore/src/sink.h"
37
38 virtual void InitFrom(cycamore::Sink* m);
39
40 virtual void InitFrom(cyclus::QueryableBackend* b);
41
42 virtual void InfileToDb(cyclus::InfileTree* tree, cyclus::DbInit di);
43
44 virtual cyclus::Agent* Clone();
45
46 virtual std::string schema();
47
48 virtual Json::Value annotations();
49
50 virtual void InitInv(cyclus::Inventories& inv);
51
52 virtual cyclus::Inventories SnapshotInv();
53
54 virtual void Snapshot(cyclus::DbInit di);
55#line 44 "/cycamore/src/sink.h"
56
57 virtual std::string str();
58
59 virtual void EnterNotify();
60
61 virtual void Tick();
62
63 virtual void Tock();
64
67 virtual std::set<cyclus::RequestPortfolio<cyclus::Material>::Ptr>
69
73 virtual std::set<cyclus::RequestPortfolio<cyclus::Product>::Ptr>
75
77 virtual void AcceptMatlTrades(
78 const std::vector< std::pair<cyclus::Trade<cyclus::Material>,
79 cyclus::Material::Ptr> >& responses);
80
82 virtual void AcceptGenRsrcTrades(
83 const std::vector< std::pair<cyclus::Trade<cyclus::Product>,
84 cyclus::Product::Ptr> >& responses);
85
87 virtual void SetRequestAmt();
88
90 virtual void SetNextBuyTime();
91
94 inline void AddCommodity(std::string name) { in_commods.push_back(name); }
95
98 inline void SetMaxInventorySize(double size) {
99 max_inv_size = size;
100 inventory.capacity(size);
101 }
102
104 inline double MaxInventorySize() const { return inventory.capacity(); }
105
107 inline double InventorySize() const { return inventory.quantity(); }
108
110 inline double SpaceAvailable() const {
111 return std::min(capacity, std::max(0.0, inventory.space()));
112 }
113
116 inline void Capacity(double cap) { capacity = cap; }
117
119 inline double Capacity() const { return capacity; }
120
122 inline const std::vector<std::string>&
123 input_commodities() const { return in_commods; }
124
126 inline const std::vector<double>&
128
129 private:
133 #pragma cyclus var {"tooltip": "input commodities", "doc": "commodities that the sink facility accepts", "uilabel": "List of Input Commodities", "uitype": ["oneormore", "incommodity"]}
134#line 125 "/cycamore/src/sink.h"
135 std::vector<std::string> in_commods;
136 std::vector<int> cycpp_shape_in_commods;
137#line 126 "/cycamore/src/sink.h"
138
139
140 #pragma cyclus var {"default": [], "doc":"preferences for each of the given commodities, in the same order." "Defauts to 1 if unspecified", "uilabel":"In Commody Preferences", "range": [None, [CY_NEAR_ZERO, CY_LARGE_DOUBLE]], "uitype":["oneormore", "range"]}
141#line 133 "/cycamore/src/sink.h"
142 std::vector<double> in_commod_prefs;
144#line 134 "/cycamore/src/sink.h"
145
146
147 #pragma cyclus var {"default": "", "tooltip": "requested composition", "doc": "name of recipe to use for material requests, " "where the default (empty string) is to accept " "everything", "uilabel": "Input Recipe", "uitype": "inrecipe"}
148#line 142 "/cycamore/src/sink.h"
149 std::string recipe_name;
150 std::vector<int> cycpp_shape_recipe_name;
151
152#line 143 "/cycamore/src/sink.h"
153
155 #pragma cyclus var {"default": CY_LARGE_DOUBLE, "tooltip": "sink maximum inventory size", "uilabel": "Maximum Inventory", "uitype": "range", "range": [0.0, CY_LARGE_DOUBLE], "doc": "total maximum inventory size of sink facility"}
156#line 151 "/cycamore/src/sink.h"
158 std::vector<int> cycpp_shape_max_inv_size;
159
160#line 152 "/cycamore/src/sink.h"
161
163 #pragma cyclus var {"default": CY_LARGE_DOUBLE, "tooltip": "sink capacity", "uilabel": "Maximum Throughput", "uitype": "range", "range": [0.0, CY_LARGE_DOUBLE], "doc": "capacity the sink facility can " "accept at each time step"}
164#line 161 "/cycamore/src/sink.h"
165 double capacity;
166 std::vector<int> cycpp_shape_capacity;
167
168#line 162 "/cycamore/src/sink.h"
169
171 #pragma cyclus var {'capacity': 'max_inv_size'}
172 cyclus::toolkit::ResBuf<cyclus::Resource> inventory;
173 std::vector<int> cycpp_shape_inventory;
174
175#line 166 "/cycamore/src/sink.h"
176
178 #pragma cyclus var {"default": "None", "tooltip": "type of random behavior when setting the " "size of the request", "uitype": "combobox", "uilabel": "Random Size", "categorical": ["None", "UniformReal", "UniformInt", "NormalReal", "NormalInt"], "doc": "type of random behavior to use. Default None, " "other options are 'UniformReal', 'UniformInt', " "'NormalReal', and 'NormalInt'"}
179#line 177 "/cycamore/src/sink.h"
180 std::string random_size_type;
182
183#line 178 "/cycamore/src/sink.h"
184
185 // random size mean (as a fraction of available space)
186 #pragma cyclus var {"default": 1.0, "tooltip": "fraction of available space to determine the mean", "uilabel": "Random Size Mean", "uitype": "range", "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 " "that values significantly above 1 without a " "correspondingly large std dev may result in " "inefficient use of the random number generator."}
187#line 191 "/cycamore/src/sink.h"
190
191#line 192 "/cycamore/src/sink.h"
192
193 // random size std dev (as a fraction of available space)
194 #pragma cyclus var {"default": 0.1, "tooltip": "fraction of available space to determine the std dev", "uilabel": "Random Size Std Dev", "uitype": "range", "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"}
195#line 202 "/cycamore/src/sink.h"
198
199#line 203 "/cycamore/src/sink.h"
200
201 // random status (frequencing/timing of request)
202 #pragma cyclus var {"default": "None", "tooltip": "type of random behavior when setting the " "timing of the request", "uitype": "combobox", "uilabel": "Random Timing", "categorical": ["None", "UniformInt", "NormalInt"], "doc": "type of random behavior to use. Default None, " "other options are, 'UniformInt', and 'NormalInt'. " "When using 'UniformInt', also set " "'random_frequency_min' and 'random_frequency_max'. " "For 'NormalInt', set 'random_frequency_mean' and " "'random_fequency_stddev', min and max values are " "optional. "}
203#line 218 "/cycamore/src/sink.h"
206
207#line 219 "/cycamore/src/sink.h"
208
209 // random frequency mean
210 #pragma cyclus var {"default": 1, "tooltip": "mean of the random frequency", "uilabel": "Random Frequency Mean", "uitype": "range", "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"}
211#line 228 "/cycamore/src/sink.h"
214
215#line 229 "/cycamore/src/sink.h"
216
217 // random frequency std dev
218 #pragma cyclus var {"default": 1, "tooltip": "std dev of the random frequency", "uilabel": "Random Frequency Std Dev", "uitype": "range", "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"}
219#line 238 "/cycamore/src/sink.h"
222
223#line 239 "/cycamore/src/sink.h"
224
225 // random frequency lower bound
226 #pragma cyclus var {"default": 1, "tooltip": "lower bound of the random frequency", "uilabel": "Random Frequency Lower Bound", "uitype": "range", "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"}
227#line 248 "/cycamore/src/sink.h"
230
231#line 249 "/cycamore/src/sink.h"
232
233 // random frequency upper bound
234 #pragma cyclus var {"default": CY_LARGE_INT, "tooltip": "upper bound of the random frequency", "uilabel": "Random Frequency Upper Bound", "uitype": "range", "range": [1, CY_LARGE_INT], "doc": "When a random distribution is used to determine the " f"frequency of the request, this is the upper bound. Default {CY_LARGE_INT} (CY_LARGE_INT)"}
235#line 258 "/cycamore/src/sink.h"
238#line 259 "/cycamore/src/sink.h"
239
240
241 #pragma cyclus var { "default": True, "tooltip": "Whether to persist packaging in the sink.", "doc": "Boolean value about whether to keep packaging. If true, " "packaging will not be stripped upon acceptance into the " "sink. If false, package type will be stripped immediately " "upon acceptance. Has no effect if the incoming material is not " "packaged.", "uilabel": "Keep Packaging", "uitype": "bool"}
242#line 270 "/cycamore/src/sink.h"
245#line 271 "/cycamore/src/sink.h"
246
247
248 #pragma cyclus var { "default": 0.0, "uilabel": "Geographical latitude in degrees as a double", "doc": "Latitude of the agent's geographical position. The value should " "be expressed in degrees as a double." }
249#line 278 "/cycamore/src/sink.h"
250 double latitude;
251 std::vector<int> cycpp_shape_latitude;
252#line 279 "/cycamore/src/sink.h"
253
254
255 #pragma cyclus var { "default": 0.0, "uilabel": "Geographical longitude in degrees as a double", "doc": "Longitude of the agent's geographical position. The value should " "be expressed in degrees as a double." }
256#line 286 "/cycamore/src/sink.h"
257 double longitude;
258 std::vector<int> cycpp_shape_longitude;
259
260#line 287 "/cycamore/src/sink.h"
261
262 cyclus::toolkit::Position coordinates;
263
264 void RecordPosition();
265};
266
267} // namespace cycamore
268
269#endif // CYCAMORE_SRC_SINK_H_
#define CYCAMORE_VERSION
This facility acts as a sink of materials and products with a fixed throughput (per time step) capaci...
cyclus::toolkit::ResBuf< cyclus::Resource > inventory
this facility holds material in storage.
std::vector< int > cycpp_shape_random_frequency_mean
virtual Json::Value annotations()
Sink(cyclus::Context *ctx)
virtual void SetRequestAmt()
SinkFacilities update request amount using random behavior.
virtual void InitFrom(cycamore::Sink *m)
virtual void EnterNotify()
std::vector< int > cycpp_shape_random_frequency_stddev
std::vector< int > cycpp_shape_random_frequency_max
std::vector< std::string > in_commods
all facilities must have at least one input commodity
virtual void AcceptMatlTrades(const std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &responses)
SinkFacilities place accepted trade Materials in their Inventory.
std::vector< double > in_commod_prefs
std::string random_frequency_type
std::vector< int > cycpp_shape_random_frequency_type
virtual void InitInv(cyclus::Inventories &inv)
std::vector< int > cycpp_shape_in_commod_prefs
const std::vector< double > & input_commodity_preferences() const
void SetMaxInventorySize(double size)
sets the size of the storage inventory for received material
std::vector< int > cycpp_shape_in_commods
std::vector< int > cycpp_shape_keep_packaging
virtual std::set< cyclus::RequestPortfolio< cyclus::Material >::Ptr > GetMatlRequests()
SinkFacilities request Materials of their given commodity.
std::vector< int > cycpp_shape_latitude
std::string random_size_type
random status (size of request)
double capacity
monthly acceptance capacity
std::vector< int > cycpp_shape_longitude
cyclus::toolkit::Position coordinates
double SpaceAvailable() const
determines the amount to request
std::vector< int > cycpp_shape_capacity
virtual std::string schema()
virtual cyclus::Inventories SnapshotInv()
double InventorySize() const
double Capacity() const
std::vector< int > cycpp_shape_random_size_mean
double max_inv_size
max inventory size
virtual std::set< cyclus::RequestPortfolio< cyclus::Product >::Ptr > GetGenRsrcRequests()
SinkFacilities request Products of their given commodity.
virtual void Snapshot(cyclus::DbInit di)
std::vector< int > cycpp_shape_random_size_type
virtual void SetNextBuyTime()
SinkFacilities update request time using random behavior.
virtual void AcceptGenRsrcTrades(const std::vector< std::pair< cyclus::Trade< cyclus::Product >, cyclus::Product::Ptr > > &responses)
SinkFacilities place accepted trade Materials in their Inventory.
virtual std::string version()
virtual std::string str()
double MaxInventorySize() const
const std::vector< std::string > & input_commodities() const
virtual void InfileToDb(cyclus::InfileTree *tree, cyclus::DbInit di)
std::vector< int > cycpp_shape_random_size_stddev
std::vector< int > cycpp_shape_inventory
std::vector< int > cycpp_shape_random_frequency_min
void AddCommodity(std::string name)
add a commodity to the set of input commodities
virtual cyclus::Agent * Clone()
void Capacity(double cap)
sets the capacity of a material generated at any given time step
std::vector< int > cycpp_shape_recipe_name
std::vector< int > cycpp_shape_max_inv_size