CYCAMORE
Loading...
Searching...
No Matches
build/cycamore/sink.cc
Go to the documentation of this file.
1#line 1 "/cycamore/src/sink.cc"
2// Implements the Sink class
3#include <algorithm>
4#include <sstream>
5
6#include <boost/lexical_cast.hpp>
7
8#include "sink.h"
9
10namespace cycamore {
11
12// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13Sink::Sink(cyclus::Context* ctx)
14 : cyclus::Facility(ctx),
15 capacity(std::numeric_limits<double>::max()),
16 latitude(0.0),
17 longitude(0.0),
18 keep_packaging(true),
20 SetMaxInventorySize(std::numeric_limits<double>::max());}
21
22// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24std::string Sink::schema() {
25 return ""
26 "<interleave>\n"
27 " <element name=\"in_commods\">\n"
28 " <oneOrMore>\n"
29 " <element name=\"val\">\n"
30 " <data type=\"string\"/>\n"
31 " </element>\n"
32 " </oneOrMore>\n"
33 " </element>\n"
34 " <optional>\n"
35 " <element name=\"in_commod_prefs\">\n"
36 " <oneOrMore>\n"
37 " <element name=\"val\">\n"
38 " <data type=\"double\"/>\n"
39 " </element>\n"
40 " </oneOrMore>\n"
41 " </element>\n"
42 " </optional>\n"
43 " <optional>\n"
44 " <element name=\"recipe_name\">\n"
45 " <a:documentation>name of recipe to use for material requests, where the default (empty string) is to accept everything</a:documentation>\n"
46 " <data type=\"string\"/>\n"
47 " </element>\n"
48 " </optional>\n"
49 " <optional>\n"
50 " <element name=\"max_inv_size\">\n"
51 " <a:documentation>total maximum inventory size of sink facility</a:documentation>\n"
52 " <data type=\"double\"/>\n"
53 " </element>\n"
54 " </optional>\n"
55 " <optional>\n"
56 " <element name=\"capacity\">\n"
57 " <a:documentation>capacity the sink facility can accept at each time step</a:documentation>\n"
58 " <data type=\"double\"/>\n"
59 " </element>\n"
60 " </optional>\n"
61 " <optional>\n"
62 " <element name=\"random_size_type\">\n"
63 " <a:documentation>type of random behavior to use. Default None, other options are 'UniformReal', 'UniformInt', 'NormalReal', and 'NormalInt'</a:documentation>\n"
64 " <data type=\"string\"/>\n"
65 " </element>\n"
66 " </optional>\n"
67 " <optional>\n"
68 " <element name=\"random_size_mean\">\n"
69 " <a:documentation>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.</a:documentation>\n"
70 " <data type=\"double\"/>\n"
71 " </element>\n"
72 " </optional>\n"
73 " <optional>\n"
74 " <element name=\"random_size_stddev\">\n"
75 " <a:documentation>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</a:documentation>\n"
76 " <data type=\"double\"/>\n"
77 " </element>\n"
78 " </optional>\n"
79 " <optional>\n"
80 " <element name=\"random_frequency_type\">\n"
81 " <a:documentation>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. </a:documentation>\n"
82 " <data type=\"string\"/>\n"
83 " </element>\n"
84 " </optional>\n"
85 " <optional>\n"
86 " <element name=\"random_frequency_mean\">\n"
87 " <a:documentation>When a normal distribution is used to determine the frequency of the request, this is the mean. Default 1</a:documentation>\n"
88 " <data type=\"double\"/>\n"
89 " </element>\n"
90 " </optional>\n"
91 " <optional>\n"
92 " <element name=\"random_frequency_stddev\">\n"
93 " <a:documentation>When a normal distribution is used to determine the frequency of the request, this is the standard deviation. Default 1</a:documentation>\n"
94 " <data type=\"double\"/>\n"
95 " </element>\n"
96 " </optional>\n"
97 " <optional>\n"
98 " <element name=\"random_frequency_min\">\n"
99 " <a:documentation>When a random distribution is used to determine the frequency of the request, this is the lower bound. Default 1</a:documentation>\n"
100 " <data type=\"int\"/>\n"
101 " </element>\n"
102 " </optional>\n"
103 " <optional>\n"
104 " <element name=\"random_frequency_max\">\n"
105 " <a:documentation>When a random distribution is used to determine the frequency of the request, this is the upper bound. Default 2147483647 (CY_LARGE_INT)</a:documentation>\n"
106 " <data type=\"int\"/>\n"
107 " </element>\n"
108 " </optional>\n"
109 " <optional>\n"
110 " <element name=\"keep_packaging\">\n"
111 " <a:documentation>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.</a:documentation>\n"
112 " <data type=\"boolean\"/>\n"
113 " </element>\n"
114 " </optional>\n"
115 " <optional>\n"
116 " <element name=\"latitude\">\n"
117 " <a:documentation>Latitude of the agent's geographical position. The value should be expressed in degrees as a double.</a:documentation>\n"
118 " <data type=\"double\"/>\n"
119 " </element>\n"
120 " </optional>\n"
121 " <optional>\n"
122 " <element name=\"longitude\">\n"
123 " <a:documentation>Longitude of the agent's geographical position. The value should be expressed in degrees as a double.</a:documentation>\n"
124 " <data type=\"double\"/>\n"
125 " </element>\n"
126 " </optional>\n"
127 "</interleave>\n";
128};
129#line 23 "/cycamore/src/sink.cc"
130
131Json::Value Sink::annotations() {
132 Json::Value root;
133 Json::Reader reader;
134 bool parsed_ok = reader.parse(
135 "{\"name\":\"cycamore::Sink\",\"entity\":\"facility\",\"pare"
136 "nts\":[\"cyclus::Facility\",\"cyclus::toolkit::Positio"
137 "n\"],\"all_parents\":[\"EconomicEntity\",\"cyclus::Agent"
138 "\",\"cyclus::Facility\",\"cyclus::Ider\",\"cyclus::State"
139 "Wrangler\",\"cyclus::TimeListener\",\"cyclus::Trader\","
140 "\"cyclus::toolkit::Position\"],\"vars\":{\"in_commods\":"
141 "{\"tooltip\":[\"input "
142 "commodities\",\"\"],\"doc\":\"commodities that the sink "
143 "facility accepts\",\"uilabel\":[\"List of Input Commod"
144 "ities\",\"\"],\"uitype\":[\"oneormore\",\"incommodity\"],\"t"
145 "ype\":[\"std::vector\",\"std::string\"],\"index\":0,\"shap"
146 "e\":[-1,-"
147 "1],\"alias\":[\"in_commods\",\"val\"]},\"in_commod_prefs\""
148 ":{\"default\":[],\"doc\":\"preferences for each of the "
149 "given commodities, in the same order.Defauts to 1 "
150 "if unspecified\",\"uilabel\":[\"In Commody Preferences"
151 "\",\"\"],\"range\":[null,[1e-"
152 "08,1e+299]],\"uitype\":[\"oneormore\",\"range\"],\"type\":"
153 "[\"std::vector\",\"double\"],\"index\":1,\"shape\":[-1,-"
154 "1],\"alias\":[\"in_commod_prefs\",\"val\"],\"tooltip\":[\"i"
155 "n_commod_prefs\",\"\"]},\"recipe_name\":{\"default\":\"\",\""
156 "tooltip\":\"requested composition\",\"doc\":\"name of "
157 "recipe to use for material requests, where the "
158 "default (empty string) is to accept "
159 "everything\",\"uilabel\":\"Input Recipe\",\"uitype\":\"inr"
160 "ecipe\",\"type\":\"std::string\",\"index\":2,\"shape\":[-"
161 "1],\"alias\":\"recipe_name\"},\"max_inv_size\":{\"default"
162 "\":1e+299,\"tooltip\":\"sink maximum inventory "
163 "size\",\"uilabel\":\"Maximum Inventory\",\"uitype\":\"rang"
164 "e\",\"range\":[0.0,1e+299],\"doc\":\"total maximum "
165 "inventory size of sink facility\",\"type\":\"double\",\""
166 "index\":3,\"shape\":[-"
167 "1],\"alias\":\"max_inv_size\"},\"capacity\":{\"default\":1"
168 "e+299,\"tooltip\":\"sink capacity\",\"uilabel\":\"Maximum"
169 " Throughput\",\"uitype\":\"range\",\"range\":[0.0,1e+299]"
170 ",\"doc\":\"capacity the sink facility can accept at "
171 "each time step\",\"type\":\"double\",\"index\":4,\"shape\":"
172 "[-"
173 "1],\"alias\":\"capacity\"},\"inventory\":{\"capacity\":\"ma"
174 "x_inv_size\",\"type\":[\"cyclus::toolkit::ResBuf\",\"cyc"
175 "lus::Resource\"],\"index\":5,\"shape\":[-1,-"
176 "1]},\"random_size_type\":{\"default\":\"None\",\"tooltip\""
177 ":\"type of random behavior when setting the size of"
178 " the "
179 "request\",\"uitype\":\"combobox\",\"uilabel\":\"Random Siz"
180 "e\",\"categorical\":[\"None\",\"UniformReal\",\"UniformInt"
181 "\",\"NormalReal\",\"NormalInt\"],\"doc\":\"type of random "
182 "behavior to use. Default None, other options are "
183 "'UniformReal', 'UniformInt', 'NormalReal', and 'No"
184 "rmalInt'\",\"type\":\"std::string\",\"index\":6,\"shape\":["
185 "-1],\"alias\":\"random_size_type\"},\"random_size_mean\""
186 ":{\"default\":1.0,\"tooltip\":\"fraction of available "
187 "space to determine the mean\",\"uilabel\":\"Random "
188 "Size Mean\",\"uitype\":\"range\",\"range\":[0.0,1e+299],\""
189 "doc\":\"When a normal distribution is used to "
190 "determine the size of the request, this is the "
191 "fraction of available space to use as the mean. "
192 "Default 1.0. Note that values significantly above "
193 "1 without a correspondingly large std dev may "
194 "result in inefficient use of the random number gen"
195 "erator.\",\"type\":\"double\",\"index\":7,\"shape\":[-"
196 "1],\"alias\":\"random_size_mean\"},\"random_size_stddev"
197 "\":{\"default\":0.1,\"tooltip\":\"fraction of available "
198 "space to determine the std dev\",\"uilabel\":\"Random "
199 "Size Std Dev\",\"uitype\":\"range\",\"range\":[0.0,1e+299"
200 "],\"doc\":\"When a normal distribution is used to "
201 "determine the size of the request, this is the "
202 "fraction of available space to use as the standard"
203 " deviation. Default 0.1\",\"type\":\"double\",\"index\":8"
204 ",\"shape\":[-"
205 "1],\"alias\":\"random_size_stddev\"},\"random_frequency"
206 "_type\":{\"default\":\"None\",\"tooltip\":\"type of random"
207 " behavior when setting the timing of the "
208 "request\",\"uitype\":\"combobox\",\"uilabel\":\"Random Tim"
209 "ing\",\"categorical\":[\"None\",\"UniformInt\",\"NormalInt"
210 "\"],\"doc\":\"type of random behavior to use. Default "
211 "None, other options are, 'UniformInt', and "
212 "'NormalInt'. When using 'UniformInt', also set "
213 "'random_frequency_min' and 'random_frequency_max'."
214 " For 'NormalInt', set 'random_frequency_mean' and "
215 "'random_fequency_stddev', min and max values are "
216 "optional. \",\"type\":\"std::string\",\"index\":9,\"shape\""
217 ":[-"
218 "1],\"alias\":\"random_frequency_type\"},\"random_freque"
219 "ncy_mean\":{\"default\":1,\"tooltip\":\"mean of the "
220 "random frequency\",\"uilabel\":\"Random Frequency Mean"
221 "\",\"uitype\":\"range\",\"range\":[0.0,1e+299],\"doc\":\"Whe"
222 "n a normal distribution is used to determine the "
223 "frequency of the request, this is the mean. "
224 "Default 1\",\"type\":\"double\",\"index\":10,\"shape\":[-"
225 "1],\"alias\":\"random_frequency_mean\"},\"random_freque"
226 "ncy_stddev\":{\"default\":1,\"tooltip\":\"std dev of the"
227 " random frequency\",\"uilabel\":\"Random Frequency Std"
228 " Dev\",\"uitype\":\"range\",\"range\":[0.0,1e+299],\"doc\":"
229 "\"When a normal distribution is used to determine "
230 "the frequency of the request, this is the standard"
231 " deviation. Default 1\",\"type\":\"double\",\"index\":11,"
232 "\"shape\":[-"
233 "1],\"alias\":\"random_frequency_stddev\"},\"random_freq"
234 "uency_min\":{\"default\":1,\"tooltip\":\"lower bound of "
235 "the random frequency\",\"uilabel\":\"Random Frequency "
236 "Lower Bound\",\"uitype\":\"range\",\"range\":[1,214748364"
237 "7],\"doc\":\"When a random distribution is used to "
238 "determine the frequency of the request, this is "
239 "the lower bound. Default 1\",\"type\":\"int\",\"index\":1"
240 "2,\"shape\":[-"
241 "1],\"alias\":\"random_frequency_min\"},\"random_frequen"
242 "cy_max\":{\"default\":2147483647,\"tooltip\":\"upper "
243 "bound of the random frequency\",\"uilabel\":\"Random "
244 "Frequency Upper Bound\",\"uitype\":\"range\",\"range\":[1"
245 ",2147483647],\"doc\":\"When a random distribution is "
246 "used to determine the frequency of the request, "
247 "this is the upper bound. Default 2147483647 (CY_LA"
248 "RGE_INT)\",\"type\":\"int\",\"index\":13,\"shape\":[-"
249 "1],\"alias\":\"random_frequency_max\"},\"keep_packaging"
250 "\":{\"default\":true,\"tooltip\":\"Whether to persist "
251 "packaging in the sink.\",\"doc\":\"Boolean value about"
252 " whether to keep packaging. If true, packaging "
253 "will not be stripped upon acceptance into the "
254 "sink. If false, package type will be stripped "
255 "immediately upon acceptance. Has no effect if the "
256 "incoming material is not "
257 "packaged.\",\"uilabel\":\"Keep Packaging\",\"uitype\":\"bo"
258 "ol\",\"type\":\"bool\",\"index\":14,\"shape\":[-"
259 "1],\"alias\":\"keep_packaging\"},\"latitude\":{\"default\""
260 ":0.0,\"uilabel\":\"Geographical latitude in degrees "
261 "as a double\",\"doc\":\"Latitude of the agent's "
262 "geographical position. The value should be "
263 "expressed in degrees as a double.\",\"type\":\"double\""
264 ",\"index\":15,\"shape\":[-"
265 "1],\"alias\":\"latitude\",\"tooltip\":\"latitude\"},\"longi"
266 "tude\":{\"default\":0.0,\"uilabel\":\"Geographical "
267 "longitude in degrees as a double\",\"doc\":\"Longitude"
268 " of the agent's geographical position. The value "
269 "should be expressed in degrees as a double.\",\"type"
270 "\":\"double\",\"index\":16,\"shape\":[-"
271 "1],\"alias\":\"longitude\",\"tooltip\":\"longitude\"}},\"do"
272 "c\":\" A sink facility that accepts materials and "
273 "products with a fixed\\n throughput (per time step)"
274 " capacity and a lifetime capacity defined by\\n a "
275 "total inventory size. The inventory size and "
276 "throughput capacity\\n both default to infinite. If"
277 " a recipe is provided, it will request\\n material "
278 "with that recipe. Requests are made for any number"
279 " of\\n specified commodities.\\n\"}", root);
280 if (!parsed_ok) {
281 throw cyclus::ValueError("failed to parse annotations for cycamore::Sink.");
282 }
283 return root;
284};
285#line 25 "/cycamore/src/sink.cc"
286
287void Sink::InfileToDb(cyclus::InfileTree* tree, cyclus::DbInit di) {
288 cyclus::Facility::InfileToDb(tree, di);
289 int rawcycpp_shape_in_commods[2] = {-1, -1};
290 cycpp_shape_in_commods = std::vector<int>(rawcycpp_shape_in_commods, rawcycpp_shape_in_commods + 2);
291 int rawcycpp_shape_in_commod_prefs[2] = {-1, -1};
292 cycpp_shape_in_commod_prefs = std::vector<int>(rawcycpp_shape_in_commod_prefs, rawcycpp_shape_in_commod_prefs + 2);
293 int rawcycpp_shape_recipe_name[1] = {-1};
294 cycpp_shape_recipe_name = std::vector<int>(rawcycpp_shape_recipe_name, rawcycpp_shape_recipe_name + 1);
295 int rawcycpp_shape_max_inv_size[1] = {-1};
296 cycpp_shape_max_inv_size = std::vector<int>(rawcycpp_shape_max_inv_size, rawcycpp_shape_max_inv_size + 1);
297 int rawcycpp_shape_capacity[1] = {-1};
298 cycpp_shape_capacity = std::vector<int>(rawcycpp_shape_capacity, rawcycpp_shape_capacity + 1);
299 int rawcycpp_shape_inventory[2] = {-1, -1};
300 cycpp_shape_inventory = std::vector<int>(rawcycpp_shape_inventory, rawcycpp_shape_inventory + 2);
301 int rawcycpp_shape_random_size_type[1] = {-1};
302 cycpp_shape_random_size_type = std::vector<int>(rawcycpp_shape_random_size_type, rawcycpp_shape_random_size_type + 1);
303 int rawcycpp_shape_random_size_mean[1] = {-1};
304 cycpp_shape_random_size_mean = std::vector<int>(rawcycpp_shape_random_size_mean, rawcycpp_shape_random_size_mean + 1);
305 int rawcycpp_shape_random_size_stddev[1] = {-1};
306 cycpp_shape_random_size_stddev = std::vector<int>(rawcycpp_shape_random_size_stddev, rawcycpp_shape_random_size_stddev + 1);
307 int rawcycpp_shape_random_frequency_type[1] = {-1};
308 cycpp_shape_random_frequency_type = std::vector<int>(rawcycpp_shape_random_frequency_type, rawcycpp_shape_random_frequency_type + 1);
309 int rawcycpp_shape_random_frequency_mean[1] = {-1};
310 cycpp_shape_random_frequency_mean = std::vector<int>(rawcycpp_shape_random_frequency_mean, rawcycpp_shape_random_frequency_mean + 1);
311 int rawcycpp_shape_random_frequency_stddev[1] = {-1};
312 cycpp_shape_random_frequency_stddev = std::vector<int>(rawcycpp_shape_random_frequency_stddev, rawcycpp_shape_random_frequency_stddev + 1);
313 int rawcycpp_shape_random_frequency_min[1] = {-1};
314 cycpp_shape_random_frequency_min = std::vector<int>(rawcycpp_shape_random_frequency_min, rawcycpp_shape_random_frequency_min + 1);
315 int rawcycpp_shape_random_frequency_max[1] = {-1};
316 cycpp_shape_random_frequency_max = std::vector<int>(rawcycpp_shape_random_frequency_max, rawcycpp_shape_random_frequency_max + 1);
317 int rawcycpp_shape_keep_packaging[1] = {-1};
318 cycpp_shape_keep_packaging = std::vector<int>(rawcycpp_shape_keep_packaging, rawcycpp_shape_keep_packaging + 1);
319 int rawcycpp_shape_latitude[1] = {-1};
320 cycpp_shape_latitude = std::vector<int>(rawcycpp_shape_latitude, rawcycpp_shape_latitude + 1);
321 int rawcycpp_shape_longitude[1] = {-1};
322 cycpp_shape_longitude = std::vector<int>(rawcycpp_shape_longitude, rawcycpp_shape_longitude + 1);
323 cyclus::InfileTree* sub = tree->SubTree("config/*");
324 int i;
325 int n;
326 {
327 cyclus::InfileTree* bub = sub->SubTree("in_commods", 0);
328 cyclus::InfileTree* sub = bub;
329 int n1 = sub->NMatches("val");
330 std::vector< std::string > in_commods_val;
331 in_commods_val.resize(n1);
332 for (int i1 = 0; i1 < n1; ++i1) {
333 std::string elem;
334 {
335 std::string elem_in = cyclus::Query<std::string>(sub, "val", i1);
336 elem = elem_in;
337 }
338 in_commods_val[i1] = elem;
339 }
340 in_commods = in_commods_val;
341 }
342 if (sub->NMatches("in_commod_prefs") > 0) {
343 {
344 cyclus::InfileTree* bub = sub->SubTree("in_commod_prefs", 0);
345 cyclus::InfileTree* sub = bub;
346 int n1 = sub->NMatches("val");
347 std::vector< double > in_commod_prefs_val;
348 in_commod_prefs_val.resize(n1);
349 for (int i1 = 0; i1 < n1; ++i1) {
350 double elem;
351 {
352 double elem_in = cyclus::Query<double>(sub, "val", i1);
353 elem = elem_in;
354 }
355 in_commod_prefs_val[i1] = elem;
356 }
357 in_commod_prefs = in_commod_prefs_val;
358 }
359 } else {
360 std::vector< double > in_commod_prefs_tmp;
361 in_commod_prefs_tmp.resize(0);
362 {
363 }
364 in_commod_prefs = in_commod_prefs_tmp;
365 }
366 if (sub->NMatches("recipe_name") > 0) {
367 {
368 std::string recipe_name_val = cyclus::Query<std::string>(sub, "recipe_name");
369 recipe_name = recipe_name_val;
370 }
371 } else {
372 std::string recipe_name_tmp("");
373 recipe_name = recipe_name_tmp;
374 }
375 if (sub->NMatches("max_inv_size") > 0) {
376 {
377 double max_inv_size_val = cyclus::Query<double>(sub, "max_inv_size");
378 max_inv_size = max_inv_size_val;
379 }
380 } else {
381 double max_inv_size_tmp = 1e+299;
382 max_inv_size = max_inv_size_tmp;
383 }
384 if (sub->NMatches("capacity") > 0) {
385 {
386 double capacity_val = cyclus::Query<double>(sub, "capacity");
387 capacity = capacity_val;
388 }
389 } else {
390 double capacity_tmp = 1e+299;
391 capacity = capacity_tmp;
392 }
393 if (sub->NMatches("random_size_type") > 0) {
394 {
395 std::string random_size_type_val = cyclus::Query<std::string>(sub, "random_size_type");
396 random_size_type = random_size_type_val;
397 }
398 } else {
399 std::string random_size_type_tmp("None");
400 random_size_type = random_size_type_tmp;
401 }
402 if (sub->NMatches("random_size_mean") > 0) {
403 {
404 double random_size_mean_val = cyclus::Query<double>(sub, "random_size_mean");
405 random_size_mean = random_size_mean_val;
406 }
407 } else {
408 double random_size_mean_tmp = 1.0;
409 random_size_mean = random_size_mean_tmp;
410 }
411 if (sub->NMatches("random_size_stddev") > 0) {
412 {
413 double random_size_stddev_val = cyclus::Query<double>(sub, "random_size_stddev");
414 random_size_stddev = random_size_stddev_val;
415 }
416 } else {
417 double random_size_stddev_tmp = 0.1;
418 random_size_stddev = random_size_stddev_tmp;
419 }
420 if (sub->NMatches("random_frequency_type") > 0) {
421 {
422 std::string random_frequency_type_val = cyclus::Query<std::string>(sub, "random_frequency_type");
423 random_frequency_type = random_frequency_type_val;
424 }
425 } else {
426 std::string random_frequency_type_tmp("None");
427 random_frequency_type = random_frequency_type_tmp;
428 }
429 if (sub->NMatches("random_frequency_mean") > 0) {
430 {
431 double random_frequency_mean_val = cyclus::Query<double>(sub, "random_frequency_mean");
432 random_frequency_mean = random_frequency_mean_val;
433 }
434 } else {
435 double random_frequency_mean_tmp = 1;
436 random_frequency_mean = random_frequency_mean_tmp;
437 }
438 if (sub->NMatches("random_frequency_stddev") > 0) {
439 {
440 double random_frequency_stddev_val = cyclus::Query<double>(sub, "random_frequency_stddev");
441 random_frequency_stddev = random_frequency_stddev_val;
442 }
443 } else {
444 double random_frequency_stddev_tmp = 1;
445 random_frequency_stddev = random_frequency_stddev_tmp;
446 }
447 if (sub->NMatches("random_frequency_min") > 0) {
448 {
449 int random_frequency_min_val = cyclus::Query<int>(sub, "random_frequency_min");
450 random_frequency_min = random_frequency_min_val;
451 }
452 } else {
453 int random_frequency_min_tmp = 1;
454 random_frequency_min = random_frequency_min_tmp;
455 }
456 if (sub->NMatches("random_frequency_max") > 0) {
457 {
458 int random_frequency_max_val = cyclus::Query<int>(sub, "random_frequency_max");
459 random_frequency_max = random_frequency_max_val;
460 }
461 } else {
462 int random_frequency_max_tmp = 2147483647;
463 random_frequency_max = random_frequency_max_tmp;
464 }
465 if (sub->NMatches("keep_packaging") > 0) {
466 {
467 bool keep_packaging_val = cyclus::Query<bool>(sub, "keep_packaging");
468 keep_packaging = keep_packaging_val;
469 }
470 } else {
471 bool keep_packaging_tmp = true;
472 keep_packaging = keep_packaging_tmp;
473 }
474 if (sub->NMatches("latitude") > 0) {
475 {
476 double latitude_val = cyclus::Query<double>(sub, "latitude");
477 latitude = latitude_val;
478 }
479 } else {
480 double latitude_tmp = 0.0;
481 latitude = latitude_tmp;
482 }
483 if (sub->NMatches("longitude") > 0) {
484 {
485 double longitude_val = cyclus::Query<double>(sub, "longitude");
486 longitude = longitude_val;
487 }
488 } else {
489 double longitude_tmp = 0.0;
490 longitude = longitude_tmp;
491 }
492 di.NewDatum("Info")
493 ->AddVal("in_commods", in_commods, &cycpp_shape_in_commods)
494 ->AddVal("in_commod_prefs", in_commod_prefs, &cycpp_shape_in_commod_prefs)
495 ->AddVal("recipe_name", recipe_name, &cycpp_shape_recipe_name)
496 ->AddVal("max_inv_size", max_inv_size, &cycpp_shape_max_inv_size)
497 ->AddVal("capacity", capacity, &cycpp_shape_capacity)
498 ->AddVal("random_size_type", random_size_type, &cycpp_shape_random_size_type)
499 ->AddVal("random_size_mean", random_size_mean, &cycpp_shape_random_size_mean)
500 ->AddVal("random_size_stddev", random_size_stddev, &cycpp_shape_random_size_stddev)
501 ->AddVal("random_frequency_type", random_frequency_type, &cycpp_shape_random_frequency_type)
502 ->AddVal("random_frequency_mean", random_frequency_mean, &cycpp_shape_random_frequency_mean)
503 ->AddVal("random_frequency_stddev", random_frequency_stddev, &cycpp_shape_random_frequency_stddev)
504 ->AddVal("random_frequency_min", random_frequency_min, &cycpp_shape_random_frequency_min)
505 ->AddVal("random_frequency_max", random_frequency_max, &cycpp_shape_random_frequency_max)
506 ->AddVal("keep_packaging", keep_packaging, &cycpp_shape_keep_packaging)
507 ->AddVal("latitude", latitude, &cycpp_shape_latitude)
508 ->AddVal("longitude", longitude, &cycpp_shape_longitude)
509 ->Record();
510};
511#line 27 "/cycamore/src/sink.cc"
512
513void Sink::Snapshot(cyclus::DbInit di) {
514 di.NewDatum("Info")
515 ->AddVal("in_commods", in_commods, &cycpp_shape_in_commods)
516 ->AddVal("in_commod_prefs", in_commod_prefs, &cycpp_shape_in_commod_prefs)
517 ->AddVal("recipe_name", recipe_name, &cycpp_shape_recipe_name)
518 ->AddVal("max_inv_size", max_inv_size, &cycpp_shape_max_inv_size)
519 ->AddVal("capacity", capacity, &cycpp_shape_capacity)
520 ->AddVal("random_size_type", random_size_type, &cycpp_shape_random_size_type)
521 ->AddVal("random_size_mean", random_size_mean, &cycpp_shape_random_size_mean)
522 ->AddVal("random_size_stddev", random_size_stddev, &cycpp_shape_random_size_stddev)
523 ->AddVal("random_frequency_type", random_frequency_type, &cycpp_shape_random_frequency_type)
524 ->AddVal("random_frequency_mean", random_frequency_mean, &cycpp_shape_random_frequency_mean)
525 ->AddVal("random_frequency_stddev", random_frequency_stddev, &cycpp_shape_random_frequency_stddev)
526 ->AddVal("random_frequency_min", random_frequency_min, &cycpp_shape_random_frequency_min)
527 ->AddVal("random_frequency_max", random_frequency_max, &cycpp_shape_random_frequency_max)
528 ->AddVal("keep_packaging", keep_packaging, &cycpp_shape_keep_packaging)
529 ->AddVal("latitude", latitude, &cycpp_shape_latitude)
530 ->AddVal("longitude", longitude, &cycpp_shape_longitude)
531 ->Record();
532};
533#line 29 "/cycamore/src/sink.cc"
534
535cyclus::Inventories Sink::SnapshotInv() {
536 cyclus::Inventories invs;
537 invs["inventory"] = inventory.PopNRes(inventory.count());
538 inventory.Push(invs["inventory"]);
539 return invs;
540};
541#line 31 "/cycamore/src/sink.cc"
542
543void Sink::InitInv(cyclus::Inventories& inv) {
544 inventory.Push(inv["inventory"]);
545
546};
547#line 33 "/cycamore/src/sink.cc"
548
549cyclus::Agent* Sink::Clone() {
550 cycamore::Sink* m = new cycamore::Sink(context());
551 m->InitFrom(this);
552 return m;
553};
554#line 35 "/cycamore/src/sink.cc"
555
556void Sink::InitFrom(cyclus::QueryableBackend* b) {
557 cyclus::Facility::InitFrom(b);
558 int rawcycpp_shape_in_commods[2] = {-1, -1};
559 cycpp_shape_in_commods = std::vector<int>(rawcycpp_shape_in_commods, rawcycpp_shape_in_commods + 2);
560 int rawcycpp_shape_in_commod_prefs[2] = {-1, -1};
561 cycpp_shape_in_commod_prefs = std::vector<int>(rawcycpp_shape_in_commod_prefs, rawcycpp_shape_in_commod_prefs + 2);
562 int rawcycpp_shape_recipe_name[1] = {-1};
563 cycpp_shape_recipe_name = std::vector<int>(rawcycpp_shape_recipe_name, rawcycpp_shape_recipe_name + 1);
564 int rawcycpp_shape_max_inv_size[1] = {-1};
565 cycpp_shape_max_inv_size = std::vector<int>(rawcycpp_shape_max_inv_size, rawcycpp_shape_max_inv_size + 1);
566 int rawcycpp_shape_capacity[1] = {-1};
567 cycpp_shape_capacity = std::vector<int>(rawcycpp_shape_capacity, rawcycpp_shape_capacity + 1);
568 int rawcycpp_shape_inventory[2] = {-1, -1};
569 cycpp_shape_inventory = std::vector<int>(rawcycpp_shape_inventory, rawcycpp_shape_inventory + 2);
570 int rawcycpp_shape_random_size_type[1] = {-1};
571 cycpp_shape_random_size_type = std::vector<int>(rawcycpp_shape_random_size_type, rawcycpp_shape_random_size_type + 1);
572 int rawcycpp_shape_random_size_mean[1] = {-1};
573 cycpp_shape_random_size_mean = std::vector<int>(rawcycpp_shape_random_size_mean, rawcycpp_shape_random_size_mean + 1);
574 int rawcycpp_shape_random_size_stddev[1] = {-1};
575 cycpp_shape_random_size_stddev = std::vector<int>(rawcycpp_shape_random_size_stddev, rawcycpp_shape_random_size_stddev + 1);
576 int rawcycpp_shape_random_frequency_type[1] = {-1};
577 cycpp_shape_random_frequency_type = std::vector<int>(rawcycpp_shape_random_frequency_type, rawcycpp_shape_random_frequency_type + 1);
578 int rawcycpp_shape_random_frequency_mean[1] = {-1};
579 cycpp_shape_random_frequency_mean = std::vector<int>(rawcycpp_shape_random_frequency_mean, rawcycpp_shape_random_frequency_mean + 1);
580 int rawcycpp_shape_random_frequency_stddev[1] = {-1};
581 cycpp_shape_random_frequency_stddev = std::vector<int>(rawcycpp_shape_random_frequency_stddev, rawcycpp_shape_random_frequency_stddev + 1);
582 int rawcycpp_shape_random_frequency_min[1] = {-1};
583 cycpp_shape_random_frequency_min = std::vector<int>(rawcycpp_shape_random_frequency_min, rawcycpp_shape_random_frequency_min + 1);
584 int rawcycpp_shape_random_frequency_max[1] = {-1};
585 cycpp_shape_random_frequency_max = std::vector<int>(rawcycpp_shape_random_frequency_max, rawcycpp_shape_random_frequency_max + 1);
586 int rawcycpp_shape_keep_packaging[1] = {-1};
587 cycpp_shape_keep_packaging = std::vector<int>(rawcycpp_shape_keep_packaging, rawcycpp_shape_keep_packaging + 1);
588 int rawcycpp_shape_latitude[1] = {-1};
589 cycpp_shape_latitude = std::vector<int>(rawcycpp_shape_latitude, rawcycpp_shape_latitude + 1);
590 int rawcycpp_shape_longitude[1] = {-1};
591 cycpp_shape_longitude = std::vector<int>(rawcycpp_shape_longitude, rawcycpp_shape_longitude + 1);
592 cyclus::QueryResult qr = b->Query("Info", NULL);
593 in_commods = qr.GetVal<std::vector< std::string > >("in_commods");
594 in_commod_prefs = qr.GetVal<std::vector< double > >("in_commod_prefs");
595 recipe_name = qr.GetVal<std::string>("recipe_name");
596 max_inv_size = qr.GetVal<double>("max_inv_size");
597 capacity = qr.GetVal<double>("capacity");
598 random_size_type = qr.GetVal<std::string>("random_size_type");
599 random_size_mean = qr.GetVal<double>("random_size_mean");
600 random_size_stddev = qr.GetVal<double>("random_size_stddev");
601 random_frequency_type = qr.GetVal<std::string>("random_frequency_type");
602 random_frequency_mean = qr.GetVal<double>("random_frequency_mean");
603 random_frequency_stddev = qr.GetVal<double>("random_frequency_stddev");
604 random_frequency_min = qr.GetVal<int>("random_frequency_min");
605 random_frequency_max = qr.GetVal<int>("random_frequency_max");
606 keep_packaging = qr.GetVal<bool>("keep_packaging");
607 latitude = qr.GetVal<double>("latitude");
608 longitude = qr.GetVal<double>("longitude");
609 inventory.capacity(max_inv_size);
610};
611#line 37 "/cycamore/src/sink.cc"
612
614 cyclus::Facility::InitFrom(m);
615 int rawcycpp_shape_in_commods[2] = {-1, -1};
616 cycpp_shape_in_commods = std::vector<int>(rawcycpp_shape_in_commods, rawcycpp_shape_in_commods + 2);
617 int rawcycpp_shape_in_commod_prefs[2] = {-1, -1};
618 cycpp_shape_in_commod_prefs = std::vector<int>(rawcycpp_shape_in_commod_prefs, rawcycpp_shape_in_commod_prefs + 2);
619 int rawcycpp_shape_recipe_name[1] = {-1};
620 cycpp_shape_recipe_name = std::vector<int>(rawcycpp_shape_recipe_name, rawcycpp_shape_recipe_name + 1);
621 int rawcycpp_shape_max_inv_size[1] = {-1};
622 cycpp_shape_max_inv_size = std::vector<int>(rawcycpp_shape_max_inv_size, rawcycpp_shape_max_inv_size + 1);
623 int rawcycpp_shape_capacity[1] = {-1};
624 cycpp_shape_capacity = std::vector<int>(rawcycpp_shape_capacity, rawcycpp_shape_capacity + 1);
625 int rawcycpp_shape_inventory[2] = {-1, -1};
626 cycpp_shape_inventory = std::vector<int>(rawcycpp_shape_inventory, rawcycpp_shape_inventory + 2);
627 int rawcycpp_shape_random_size_type[1] = {-1};
628 cycpp_shape_random_size_type = std::vector<int>(rawcycpp_shape_random_size_type, rawcycpp_shape_random_size_type + 1);
629 int rawcycpp_shape_random_size_mean[1] = {-1};
630 cycpp_shape_random_size_mean = std::vector<int>(rawcycpp_shape_random_size_mean, rawcycpp_shape_random_size_mean + 1);
631 int rawcycpp_shape_random_size_stddev[1] = {-1};
632 cycpp_shape_random_size_stddev = std::vector<int>(rawcycpp_shape_random_size_stddev, rawcycpp_shape_random_size_stddev + 1);
633 int rawcycpp_shape_random_frequency_type[1] = {-1};
634 cycpp_shape_random_frequency_type = std::vector<int>(rawcycpp_shape_random_frequency_type, rawcycpp_shape_random_frequency_type + 1);
635 int rawcycpp_shape_random_frequency_mean[1] = {-1};
636 cycpp_shape_random_frequency_mean = std::vector<int>(rawcycpp_shape_random_frequency_mean, rawcycpp_shape_random_frequency_mean + 1);
637 int rawcycpp_shape_random_frequency_stddev[1] = {-1};
638 cycpp_shape_random_frequency_stddev = std::vector<int>(rawcycpp_shape_random_frequency_stddev, rawcycpp_shape_random_frequency_stddev + 1);
639 int rawcycpp_shape_random_frequency_min[1] = {-1};
640 cycpp_shape_random_frequency_min = std::vector<int>(rawcycpp_shape_random_frequency_min, rawcycpp_shape_random_frequency_min + 1);
641 int rawcycpp_shape_random_frequency_max[1] = {-1};
642 cycpp_shape_random_frequency_max = std::vector<int>(rawcycpp_shape_random_frequency_max, rawcycpp_shape_random_frequency_max + 1);
643 int rawcycpp_shape_keep_packaging[1] = {-1};
644 cycpp_shape_keep_packaging = std::vector<int>(rawcycpp_shape_keep_packaging, rawcycpp_shape_keep_packaging + 1);
645 int rawcycpp_shape_latitude[1] = {-1};
646 cycpp_shape_latitude = std::vector<int>(rawcycpp_shape_latitude, rawcycpp_shape_latitude + 1);
647 int rawcycpp_shape_longitude[1] = {-1};
648 cycpp_shape_longitude = std::vector<int>(rawcycpp_shape_longitude, rawcycpp_shape_longitude + 1);
653 capacity = m->capacity;
663 latitude = m->latitude;
664 longitude = m->longitude;
665 inventory.capacity(m->inventory.capacity());
666};
667#line 41 "/cycamore/src/sink.cc"
668
669// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
671 cyclus::Facility::EnterNotify();
672 LOG(cyclus::LEV_INFO4, "SnkFac") << " using random behavior " << random_size_type;
673
674 inventory.keep_packaging(keep_packaging);
675
676 if (in_commod_prefs.size() == 0) {
677 for (int i = 0; i < in_commods.size(); ++i) {
678 in_commod_prefs.push_back(cyclus::kDefaultPref);
679 }
680 } else if (in_commod_prefs.size() != in_commods.size()) {
681 std::stringstream ss;
682 ss << "in_commod_prefs has " << in_commod_prefs.size()
683 << " values, expected " << in_commods.size();
684 throw cyclus::ValueError(ss.str());
685 }
690
691 if (random_size_type != "None") {
692 LOG(cyclus::LEV_INFO4, "SnkFac") << "Sink " << this->id()
693 << " is using random behavior "
695 << " for determining request size.";
696 }
697 if (random_frequency_type != "None") {
698 LOG(cyclus::LEV_INFO4, "SnkFac") << "Sink " << this->id()
699 << " is using random behavior "
701 << " for determining request frequency.";
702 }
704}
705
706// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
707std::string Sink::str() {
708 using std::string;
709 using std::vector;
710 std::stringstream ss;
711 ss << cyclus::Facility::str();
712
713 string msg = "";
714 msg += "accepts commodities ";
715 for (vector<string>::iterator commod = in_commods.begin();
716 commod != in_commods.end();
717 commod++) {
718 msg += (commod == in_commods.begin() ? "{" : ", ");
719 msg += (*commod);
720 }
721 msg += "} until its inventory is full at ";
722 ss << msg << inventory.capacity() << " kg.";
723 return "" + ss.str();
724}
725
726// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
727std::set<cyclus::RequestPortfolio<cyclus::Material>::Ptr>
729 using cyclus::Material;
730 using cyclus::RequestPortfolio;
731 using cyclus::Request;
732 using cyclus::Composition;
733
734 std::set<RequestPortfolio<Material>::Ptr> ports;
735 RequestPortfolio<Material>::Ptr port(new RequestPortfolio<Material>());
736 Material::Ptr mat;
737
739 if (requestAmt > SpaceAvailable()) {
741 }
742
743 if (recipe_name.empty()) {
744 mat = cyclus::NewBlankMaterial(requestAmt);
745 } else {
746 Composition::Ptr rec = this->context()->GetRecipe(recipe_name);
747 mat = cyclus::Material::CreateUntracked(requestAmt, rec);
748 }
749
750 if (requestAmt > cyclus::eps()) {
751 std::vector<Request<Material>*> mutuals;
752 for (int i = 0; i < in_commods.size(); i++) {
753 mutuals.push_back(port->AddRequest(mat, this, in_commods[i], in_commod_prefs[i]));
754
755 }
756 port->AddMutualReqs(mutuals);
757 ports.insert(port);
758 } // if amt > eps
759 return ports;
760}
761
762// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
763std::set<cyclus::RequestPortfolio<cyclus::Product>::Ptr>
765 using cyclus::CapacityConstraint;
766 using cyclus::Product;
767 using cyclus::RequestPortfolio;
768
769 std::set<RequestPortfolio<Product>::Ptr> ports;
770 RequestPortfolio<Product>::Ptr
771 port(new RequestPortfolio<Product>());
772
773 if (requestAmt > cyclus::eps()) {
774 CapacityConstraint<Product> cc(requestAmt);
775 port->AddConstraint(cc);
776
777 std::vector<std::string>::const_iterator it;
778 for (it = in_commods.begin(); it != in_commods.end(); ++it) {
779 std::string quality = ""; // not clear what this should be..
780 Product::Ptr rsrc = Product::CreateUntracked(requestAmt, quality);
781 port->AddRequest(rsrc, this, *it);
782 }
783
784 ports.insert(port);
785 } // if amt > eps
786 return ports;
787}
788
789// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
791 const std::vector< std::pair<cyclus::Trade<cyclus::Material>,
792 cyclus::Material::Ptr> >& responses) {
793 std::vector< std::pair<cyclus::Trade<cyclus::Material>,
794 cyclus::Material::Ptr> >::const_iterator it;
795 for (it = responses.begin(); it != responses.end(); ++it) {
796 inventory.Push(it->second);
797 }
798}
799
800// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
802 const std::vector< std::pair<cyclus::Trade<cyclus::Product>,
803 cyclus::Product::Ptr> >& responses) {
804 std::vector< std::pair<cyclus::Trade<cyclus::Product>,
805 cyclus::Product::Ptr> >::const_iterator it;
806 for (it = responses.begin(); it != responses.end(); ++it) {
807 inventory.Push(it->second);
808 }
809}
810
811// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
813 using std::string;
814 using std::vector;
815 LOG(cyclus::LEV_INFO3, "SnkFac") << "Sink " << this->id() << " is ticking {";
816
817 if (nextBuyTime == -1) {
819 }
820 else if (nextBuyTime == context()->time()) {
823
824 LOG(cyclus::LEV_INFO4, "SnkFac") << "Sink " << this->id()
825 << " has reached buying time. The next buy time will be time step " << nextBuyTime;
826 }
827 else {
828 requestAmt = 0;
829 }
830
831 // inform the simulation about what the sink facility will be requesting
832 if (requestAmt > cyclus::eps()) {
833 LOG(cyclus::LEV_INFO4, "SnkFac") << "Sink " << this->id()
834 << " has request amount " << requestAmt
835 << " kg of " << in_commods[0] << ".";
836 for (vector<string>::iterator commod = in_commods.begin();
837 commod != in_commods.end();
838 commod++) {
839 LOG(cyclus::LEV_INFO4, "SnkFac") << "Sink " << this->id()
840 << " will request " << requestAmt
841 << " kg of " << *commod << ".";
842 cyclus::toolkit::RecordTimeSeries<double>("demand"+*commod, this,
843 requestAmt);
844 }
845 }
846 LOG(cyclus::LEV_INFO3, "SnkFac") << "}";
847}
848
849// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
851 LOG(cyclus::LEV_INFO3, "SnkFac") << prototype() << " is tocking {";
852
853 // On the tock, the sink facility doesn't really do much.
854 // Maybe someday it will record things.
855 // For now, lets just print out what we have at each timestep.
856 LOG(cyclus::LEV_INFO4, "SnkFac") << "Sink " << this->id()
857 << " is holding " << inventory.quantity()
858 << " units of material at the close of timestep "
859 << context()->time() << ".";
860 LOG(cyclus::LEV_INFO3, "SnkFac") << "}";
861}
862
864 std::string specification = this->spec();
865 context()
866 ->NewDatum("AgentPosition")
867 ->AddVal("Spec", specification)
868 ->AddVal("Prototype", this->prototype())
869 ->AddVal("AgentId", id())
870 ->AddVal("Latitude", latitude)
871 ->AddVal("Longitude", longitude)
872 ->Record();
873}
874
876 double amt = SpaceAvailable();
877 if (amt < cyclus::eps()) {
878 requestAmt = 0;
879 }
880
881 if (random_size_type == "None") {
882 requestAmt = amt;
883 }
884 else if (random_size_type == "UniformReal") {
885 requestAmt = context()->random_uniform_real(0, amt);
886 }
887 else if (random_size_type == "NormalReal") {
888 requestAmt = context()->random_normal_real(amt * random_size_mean,
889 amt * random_size_stddev,
890 0, amt);
891 }
892 else {
893 requestAmt = amt;
894 }
895 return;
896}
897
899 if (random_frequency_type == "None") {
900 nextBuyTime = -1;
901 }
902 else if (random_frequency_type == "UniformInt") {
903 nextBuyTime = context()->time() + context()->random_uniform_int(random_frequency_min, random_frequency_max);
904 }
905 else if (random_frequency_type == "NormalInt") {
906 nextBuyTime = context()->time() + context()->random_normal_int(random_frequency_mean, random_frequency_stddev, random_frequency_min, random_frequency_max);
907 }
908 else {
909 nextBuyTime = -1;
910 }
911 return;
912}
913
914// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
915extern "C" cyclus::Agent* ConstructSink(cyclus::Context* ctx) {
916 return new Sink(ctx);
917}
918
919} // namespace cycamore
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
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()
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 str()
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
virtual cyclus::Agent * Clone()
std::vector< int > cycpp_shape_recipe_name
std::vector< int > cycpp_shape_max_inv_size
cyclus::Agent * ConstructSink(cyclus::Context *ctx)