CYCAMORE
Loading...
Searching...
No Matches
build/cycamore/storage.cc
Go to the documentation of this file.
1#line 1 "/cycamore/src/storage.cc"
2// storage.cc
3// Implements the Storage class
4#include "storage.h"
5
6namespace cycamore {
7
8// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9Storage::Storage(cyclus::Context* ctx)
10 : cyclus::Facility(ctx),
11 latitude(0.0),
12 longitude(0.0),
14 inventory_tracker.Init({&inventory, &stocks, &ready, &processing}, cyclus::CY_LARGE_DOUBLE);
15 cyclus::Warn<cyclus::EXPERIMENTAL_WARNING>(
16 "The Storage Facility is experimental.");};
17
18// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
19// pragmas
20
21std::string Storage::schema() {
22 return ""
23 "<interleave>\n"
24 " <element name=\"in_commods\">\n"
25 " <oneOrMore>\n"
26 " <element name=\"val\">\n"
27 " <data type=\"string\"/>\n"
28 " </element>\n"
29 " </oneOrMore>\n"
30 " </element>\n"
31 " <optional>\n"
32 " <element name=\"in_commod_prefs\">\n"
33 " <oneOrMore>\n"
34 " <element name=\"val\">\n"
35 " <data type=\"double\"/>\n"
36 " </element>\n"
37 " </oneOrMore>\n"
38 " </element>\n"
39 " </optional>\n"
40 " <element name=\"out_commods\">\n"
41 " <oneOrMore>\n"
42 " <element name=\"val\">\n"
43 " <data type=\"string\"/>\n"
44 " </element>\n"
45 " </oneOrMore>\n"
46 " </element>\n"
47 " <optional>\n"
48 " <element name=\"in_recipe\">\n"
49 " <data type=\"string\"/>\n"
50 " </element>\n"
51 " </optional>\n"
52 " <optional>\n"
53 " <element name=\"residence_time\">\n"
54 " <data type=\"int\"/>\n"
55 " </element>\n"
56 " </optional>\n"
57 " <optional>\n"
58 " <element name=\"sell_quantity\">\n"
59 " <data type=\"double\"/>\n"
60 " </element>\n"
61 " </optional>\n"
62 " <optional>\n"
63 " <element name=\"throughput\">\n"
64 " <data type=\"double\"/>\n"
65 " </element>\n"
66 " </optional>\n"
67 " <optional>\n"
68 " <element name=\"max_inv_size\">\n"
69 " <data type=\"double\"/>\n"
70 " </element>\n"
71 " </optional>\n"
72 " <optional>\n"
73 " <element name=\"discrete_handling\">\n"
74 " <data type=\"boolean\"/>\n"
75 " </element>\n"
76 " </optional>\n"
77 " <optional>\n"
78 " <element name=\"active_buying_frequency_type\">\n"
79 " <data type=\"string\"/>\n"
80 " </element>\n"
81 " </optional>\n"
82 " <optional>\n"
83 " <element name=\"active_buying_val\">\n"
84 " <data type=\"int\"/>\n"
85 " </element>\n"
86 " </optional>\n"
87 " <optional>\n"
88 " <element name=\"active_buying_min\">\n"
89 " <data type=\"int\"/>\n"
90 " </element>\n"
91 " </optional>\n"
92 " <optional>\n"
93 " <element name=\"active_buying_max\">\n"
94 " <data type=\"int\"/>\n"
95 " </element>\n"
96 " </optional>\n"
97 " <optional>\n"
98 " <element name=\"active_buying_mean\">\n"
99 " <data type=\"double\"/>\n"
100 " </element>\n"
101 " </optional>\n"
102 " <optional>\n"
103 " <element name=\"active_buying_stddev\">\n"
104 " <data type=\"double\"/>\n"
105 " </element>\n"
106 " </optional>\n"
107 " <optional>\n"
108 " <element name=\"active_buying_end_probability\">\n"
109 " <data type=\"double\"/>\n"
110 " </element>\n"
111 " </optional>\n"
112 " <optional>\n"
113 " <element name=\"active_buying_disruption_probability\">\n"
114 " <data type=\"double\"/>\n"
115 " </element>\n"
116 " </optional>\n"
117 " <optional>\n"
118 " <element name=\"active_buying_disruption\">\n"
119 " <data type=\"int\"/>\n"
120 " </element>\n"
121 " </optional>\n"
122 " <optional>\n"
123 " <element name=\"dormant_buying_frequency_type\">\n"
124 " <data type=\"string\"/>\n"
125 " </element>\n"
126 " </optional>\n"
127 " <optional>\n"
128 " <element name=\"dormant_buying_val\">\n"
129 " <data type=\"int\"/>\n"
130 " </element>\n"
131 " </optional>\n"
132 " <optional>\n"
133 " <element name=\"dormant_buying_min\">\n"
134 " <data type=\"int\"/>\n"
135 " </element>\n"
136 " </optional>\n"
137 " <optional>\n"
138 " <element name=\"dormant_buying_max\">\n"
139 " <data type=\"int\"/>\n"
140 " </element>\n"
141 " </optional>\n"
142 " <optional>\n"
143 " <element name=\"dormant_buying_mean\">\n"
144 " <data type=\"double\"/>\n"
145 " </element>\n"
146 " </optional>\n"
147 " <optional>\n"
148 " <element name=\"dormant_buying_stddev\">\n"
149 " <data type=\"double\"/>\n"
150 " </element>\n"
151 " </optional>\n"
152 " <optional>\n"
153 " <element name=\"dormant_buying_end_probability\">\n"
154 " <data type=\"double\"/>\n"
155 " </element>\n"
156 " </optional>\n"
157 " <optional>\n"
158 " <element name=\"dormant_buying_disruption_probability\">\n"
159 " <data type=\"double\"/>\n"
160 " </element>\n"
161 " </optional>\n"
162 " <optional>\n"
163 " <element name=\"dormant_buying_disruption\">\n"
164 " <data type=\"int\"/>\n"
165 " </element>\n"
166 " </optional>\n"
167 " <optional>\n"
168 " <element name=\"buying_size_type\">\n"
169 " <data type=\"string\"/>\n"
170 " </element>\n"
171 " </optional>\n"
172 " <optional>\n"
173 " <element name=\"buying_size_val\">\n"
174 " <data type=\"double\"/>\n"
175 " </element>\n"
176 " </optional>\n"
177 " <optional>\n"
178 " <element name=\"buying_size_min\">\n"
179 " <data type=\"double\"/>\n"
180 " </element>\n"
181 " </optional>\n"
182 " <optional>\n"
183 " <element name=\"buying_size_max\">\n"
184 " <data type=\"double\"/>\n"
185 " </element>\n"
186 " </optional>\n"
187 " <optional>\n"
188 " <element name=\"buying_size_mean\">\n"
189 " <data type=\"double\"/>\n"
190 " </element>\n"
191 " </optional>\n"
192 " <optional>\n"
193 " <element name=\"buying_size_stddev\">\n"
194 " <data type=\"double\"/>\n"
195 " </element>\n"
196 " </optional>\n"
197 " <optional>\n"
198 " <element name=\"reorder_point\">\n"
199 " <data type=\"double\"/>\n"
200 " </element>\n"
201 " </optional>\n"
202 " <optional>\n"
203 " <element name=\"reorder_quantity\">\n"
204 " <data type=\"double\"/>\n"
205 " </element>\n"
206 " </optional>\n"
207 " <optional>\n"
208 " <element name=\"cumulative_cap\">\n"
209 " <data type=\"double\"/>\n"
210 " </element>\n"
211 " </optional>\n"
212 " <optional>\n"
213 " <element name=\"package\">\n"
214 " <data type=\"string\"/>\n"
215 " </element>\n"
216 " </optional>\n"
217 " <optional>\n"
218 " <element name=\"transport_unit\">\n"
219 " <data type=\"string\"/>\n"
220 " </element>\n"
221 " </optional>\n"
222 " <optional>\n"
223 " <element name=\"latitude\">\n"
224 " <data type=\"double\"/>\n"
225 " </element>\n"
226 " </optional>\n"
227 " <optional>\n"
228 " <element name=\"longitude\">\n"
229 " <data type=\"double\"/>\n"
230 " </element>\n"
231 " </optional>\n"
232 "</interleave>\n";
233};
234#line 21 "/cycamore/src/storage.cc"
235
236Json::Value Storage::annotations() {
237 Json::Value root;
238 Json::Reader reader;
239 bool parsed_ok = reader.parse(
240 "{\"name\":\"cycamore::Storage\",\"entity\":\"facility\",\"p"
241 "arents\":[\"cyclus::Facility\",\"cyclus::toolkit::Comm"
242 "odityProducer\",\"cyclus::toolkit::Position\"],\"all_p"
243 "arents\":[\"cyclus::Agent\",\"cyclus::Facility\",\"cyclu"
244 "s::Ider\",\"cyclus::StateWrangler\",\"cyclus::TimeList"
245 "ener\",\"cyclus::Trader\",\"cyclus::toolkit::AgentMana"
246 "ged\",\"cyclus::toolkit::CommodityProducer\",\"cyclus:"
247 ":toolkit::Position\"],\"vars\":{\"in_commods\":{\"toolti"
248 "p\":[\"input commodity\",\"\"],\"doc\":\"commodities "
249 "accepted by this facility\",\"uilabel\":[\"Input Commo"
250 "dities\",\"\"],\"uitype\":[\"oneormore\",\"incommodity\"],\""
251 "type\":[\"std::vector\",\"std::string\"],\"index\":0,\"sha"
252 "pe\":[-1,-"
253 "1],\"alias\":[\"in_commods\",\"val\"]},\"in_commod_prefs\""
254 ":{\"default\":[],\"doc\":\"preferences for each of the "
255 "given commodities, in the same order.Defauts to 1 "
256 "if unspecified\",\"uilabel\":[\"In Commody Preferences"
257 "\",\"\"],\"range\":[null,[1e-"
258 "08,1e+299]],\"uitype\":[\"oneormore\",\"range\"],\"type\":"
259 "[\"std::vector\",\"double\"],\"index\":1,\"shape\":[-1,-"
260 "1],\"alias\":[\"in_commod_prefs\",\"val\"],\"tooltip\":[\"i"
261 "n_commod_prefs\",\"\"]},\"out_commods\":{\"tooltip\":[\"ou"
262 "tput commodity\",\"\"],\"doc\":\"commodity produced by "
263 "this facility. Multiple commodity tracking is "
264 "currently not supported, one output commodity "
265 "catches all input commodities.\",\"uilabel\":[\"Output"
266 " Commodities\",\"\"],\"uitype\":[\"oneormore\",\"outcommod"
267 "ity\"],\"type\":[\"std::vector\",\"std::string\"],\"index\""
268 ":2,\"shape\":[-1,-"
269 "1],\"alias\":[\"out_commods\",\"val\"]},\"in_recipe\":{\"de"
270 "fault\":\"\",\"tooltip\":\"input recipe\",\"doc\":\"recipe "
271 "accepted by this facility, if unspecified a dummy "
272 "recipe is used\",\"uilabel\":\"Input Recipe\",\"uitype\":"
273 "\"inrecipe\",\"type\":\"std::string\",\"index\":3,\"shape\":"
274 "[-"
275 "1],\"alias\":\"in_recipe\"},\"residence_time\":{\"default"
276 "\":0,\"tooltip\":\"residence time "
277 "(timesteps)\",\"doc\":\"the minimum holding time for a"
278 " received commodity (timesteps).\",\"units\":\"time "
279 "steps\",\"uilabel\":\"Residence Time\",\"uitype\":\"range\""
280 ",\"range\":[0,12000],\"type\":\"int\",\"index\":4,\"shape\":"
281 "[-"
282 "1],\"alias\":\"residence_time\"},\"sell_quantity\":{\"def"
283 "ault\":0,\"tooltip\":\"sell quantity "
284 "(kg)\",\"doc\":\"material will be sold in integer "
285 "multiples of this quantity. If the buffer contains"
286 " less than the sell quantity, no material will be "
287 "offered\",\"uilabel\":\"Sell Quantity\",\"uitype\":\"range"
288 "\",\"range\":[0.0,1e+299],\"units\":\"kg\",\"type\":\"double"
289 "\",\"index\":5,\"shape\":[-"
290 "1],\"alias\":\"sell_quantity\"},\"throughput\":{\"default"
291 "\":1e+299,\"tooltip\":\"throughput per timestep "
292 "(kg)\",\"doc\":\"the max amount that can be moved "
293 "through the facility per timestep (kg)\",\"uilabel\":"
294 "\"Throughput\",\"uitype\":\"range\",\"range\":[0.0,1e+299]"
295 ",\"units\":\"kg\",\"type\":\"double\",\"index\":6,\"shape\":[-"
296 "1],\"alias\":\"throughput\"},\"max_inv_size\":{\"default\""
297 ":1e+299,\"tooltip\":\"maximum inventory size "
298 "(kg)\",\"doc\":\"the maximum amount of material that "
299 "can be in all storage buffer "
300 "stages\",\"uilabel\":\"Maximum Inventory Size\",\"uitype"
301 "\":\"range\",\"range\":[0.0,1e+299],\"units\":\"kg\",\"type\""
302 ":\"double\",\"index\":7,\"shape\":[-"
303 "1],\"alias\":\"max_inv_size\"},\"discrete_handling\":{\"d"
304 "efault\":false,\"tooltip\":\"Bool to determine how "
305 "Storage handles batches\",\"doc\":\"Determines if "
306 "Storage will divide resource objects. Only "
307 "controls material handling within this facility, "
308 "has no effect on DRE material handling. If true, "
309 "batches are handled as discrete quanta, neither "
310 "split nor combined. Otherwise, batches may be "
311 "divided during processing. Default to false "
312 "(continuous))\",\"uilabel\":\"Batch Handling\",\"type\":\""
313 "bool\",\"index\":8,\"shape\":[-"
314 "1],\"alias\":\"discrete_handling\"},\"active_buying_fre"
315 "quency_type\":{\"default\":\"Fixed\",\"tooltip\":\"Type of"
316 " active buying frequency\",\"doc\":\"Options: Fixed, "
317 "Uniform, Normal, Binomial, FixedWithDisruption. "
318 "Fixed requires active_buying_val. Uniform requires"
319 " active_buying_min and active_buying_max. Normal "
320 "requires active_buying_mean and active_buying_std,"
321 " with optional active_buying_min and "
322 "active_buying_max. Binomial requires "
323 "active_buying_end_probability.FixedWithDisruption "
324 "has a probability that any given cycle will have a"
325 " disrupted, active length. Once per cycle, a "
326 "Bernoulli distribution (Binomial dist with N=1) "
327 "will be sampled to determine if typical or "
328 "disrupted cycle. If typical, active_buying_val is "
329 "cycle length. If disrupted, active_buying_disrupti"
330 "on.\",\"uitype\":\"combobox\",\"categorical\":[\"Fixed\",\"U"
331 "niform\",\"Normal\",\"Binomial\",\"FixedWithDisruption\"]"
332 ",\"uilabel\":\"Active Buying Frequency Type\",\"type\":\""
333 "std::string\",\"index\":9,\"shape\":[-"
334 "1],\"alias\":\"active_buying_frequency_type\"},\"active"
335 "_buying_val\":{\"default\":-1,\"tooltip\":\"Fixed active"
336 " buying frequency\",\"doc\":\"The length in time steps"
337 " of the active buying period. Required for fixed "
338 "active_buying_frequency_type. Must be greater than"
339 " or equal to 1 (i.e., agent cannot always be dorma"
340 "nt)\",\"uitype\":\"range\",\"range\":[1,2147483647],\"uila"
341 "bel\":\"Active Buying Frequency Value\",\"type\":\"int\","
342 "\"index\":10,\"shape\":[-"
343 "1],\"alias\":\"active_buying_val\"},\"active_buying_min"
344 "\":{\"default\":-1,\"tooltip\":\"Active buying "
345 "distribution minimum\",\"doc\":\"The minimum length in"
346 " time steps of the active buying period. Required "
347 "for Uniform and optional for Normal "
348 "active_buying_frequency_type. Must be greater than"
349 " or equal to 1 \",\"uitype\":\"range\",\"range\":[1,21474"
350 "83647],\"uilabel\":\"Active Buying Frequency Minimum\""
351 ",\"type\":\"int\",\"index\":11,\"shape\":[-"
352 "1],\"alias\":\"active_buying_min\"},\"active_buying_max"
353 "\":{\"default\":-1,\"tooltip\":\"Active buying "
354 "distribution maximum\",\"doc\":\"The maximum length in"
355 " time steps of the active buying period. Required "
356 "for Uniform active_buying_frequency_type, optional"
357 " for Normal. Must be greater than or equal to "
358 "active_buying_min \",\"uitype\":\"range\",\"range\":[1,21"
359 "47483647],\"uilabel\":\"Active Buying Frequency Maxim"
360 "um\",\"type\":\"int\",\"index\":12,\"shape\":[-"
361 "1],\"alias\":\"active_buying_max\"},\"active_buying_mea"
362 "n\":{\"default\":-1,\"tooltip\":\"Active buying "
363 "distribution mean\",\"doc\":\"The mean length in time "
364 "steps of the active buying period. Required for "
365 "Normal active_buying_frequency_type. Must be "
366 "greater than or equal to 1 \",\"uitype\":\"range\",\"ran"
367 "ge\":[1.0,1e+299],\"uilabel\":\"Active Buying "
368 "Frequency Mean\",\"type\":\"double\",\"index\":13,\"shape\""
369 ":[-"
370 "1],\"alias\":\"active_buying_mean\"},\"active_buying_st"
371 "ddev\":{\"default\":-1,\"tooltip\":\"Active buying "
372 "distribution standard deviation\",\"doc\":\"The "
373 "standard deviation of the length in time steps of "
374 "the active buying period. Required for Normal "
375 "active_buying_frequency_type. Must be greater than"
376 " or equal to 0 \",\"uitype\":\"range\",\"range\":[0.0,1e+"
377 "299],\"uilabel\":\"Active Buying Frequency Standard D"
378 "eviation\",\"type\":\"double\",\"index\":14,\"shape\":[-"
379 "1],\"alias\":\"active_buying_stddev\"},\"active_buying_"
380 "end_probability\":{\"default\":0,\"tooltip\":\"Probabili"
381 "ty that agent will go offline during the next time"
382 " step\",\"doc\":\"Binomial distribution has a fixed "
383 "probability of going dormant at any given "
384 "timestep, like a weighted coin flip. Required for "
385 "Binomial active_buying_frequency_type. Must be "
386 "between 0 and 1\",\"uitype\":\"range\",\"range\":[0.0,1.0"
387 "],\"uilabel\":\"Active Buying Offline Probability\",\"t"
388 "ype\":\"double\",\"index\":15,\"shape\":[-"
389 "1],\"alias\":\"active_buying_end_probability\"},\"activ"
390 "e_buying_disruption_probability\":{\"default\":0,\"too"
391 "ltip\":\"Probability that a cycle contains a "
392 "disruption\",\"doc\":\"Probability that the agent "
393 "undergoes a disruption (disrupted active period) "
394 "during any given cycle. Required for "
395 "FixedWithDisruption active_buying_frequency_type.\""
396 ",\"uitype\":\"range\",\"range\":[0.0,1.0],\"uilabel\":\"Act"
397 "ive Buying Disruption Probability\",\"type\":\"double\""
398 ",\"index\":16,\"shape\":[-"
399 "1],\"alias\":\"active_buying_disruption_probability\"}"
400 ",\"active_buying_disruption\":{\"default\":-"
401 "1,\"tooltip\":\"Fixed length of disrupted active "
402 "cycle\",\"doc\":\"When a active cycle is disrupted, "
403 "this is length of the active period instead of "
404 "active_buying_val. Required for "
405 "FixedWithDisruption active_buying_frequency_type\","
406 "\"uitype\":\"range\",\"range\":[0,2147483647],\"type\":\"in"
407 "t\",\"index\":17,\"shape\":[-"
408 "1],\"alias\":\"active_buying_disruption\",\"uilabel\":\"a"
409 "ctive_buying_disruption\"},\"dormant_buying_frequenc"
410 "y_type\":{\"default\":\"Fixed\",\"tooltip\":\"Type of "
411 "dormant buying frequency\",\"doc\":\"Options: Fixed, "
412 "Uniform, Normal, Binomial, FixedWithDisruption. "
413 "Fixed requires dormant_buying_val. Uniform "
414 "requires dormant_buying_min and "
415 "dormant_buying_max. Normal requires "
416 "dormant_buying_mean and dormant_buying_std, with "
417 "optional dormant_buying_min and "
418 "dormant_buying_max. Binomial requires "
419 "dormant_buying_end_probability. "
420 "FixedWithDisruption has a probability that any "
421 "given cycle will have a disrupted, or long, "
422 "outage. Once per cycle, a Bernoulli distribution "
423 "(Binomial dist with N=1) will be sampled to "
424 "determine if typical or disrupted cycle. If "
425 "typical, dormant_buying_val is cycle length. If "
426 "disrupted, dormant_buying_disruption.\",\"uitype\":\"c"
427 "ombobox\",\"categorical\":[\"Fixed\",\"Uniform\",\"Normal\""
428 ",\"Binomial\",\"FixedWithDisruption\"],\"uilabel\":\"Dorm"
429 "ant Buying Frequency Type\",\"type\":\"std::string\",\"i"
430 "ndex\":18,\"shape\":[-"
431 "1],\"alias\":\"dormant_buying_frequency_type\"},\"dorma"
432 "nt_buying_val\":{\"default\":-1,\"tooltip\":\"Fixed "
433 "dormant buying frequency\",\"doc\":\"The length in "
434 "time steps of the dormant buying period. Required "
435 "for fixed dormant_buying_frequency_type. Default "
436 "is -1, agent has no dormant period and stays activ"
437 "e.\",\"uitype\":\"range\",\"range\":[-"
438 "1,2147483647],\"uilabel\":\"Dormant Buying Frequency "
439 "Value\",\"type\":\"int\",\"index\":19,\"shape\":[-"
440 "1],\"alias\":\"dormant_buying_val\"},\"dormant_buying_m"
441 "in\":{\"default\":-1,\"tooltip\":\"Dormant buying "
442 "distribution minimum\",\"doc\":\"The minimum length in"
443 " time steps of the dormant buying period. Required"
444 " for Uniform and optional for Normal dormant_buyin"
445 "g_frequency_type.\",\"uitype\":\"range\",\"range\":[0,214"
446 "7483647],\"uilabel\":\"Dormant Buying Frequency Minim"
447 "um\",\"type\":\"int\",\"index\":20,\"shape\":[-"
448 "1],\"alias\":\"dormant_buying_min\"},\"dormant_buying_m"
449 "ax\":{\"default\":-1,\"tooltip\":\"Dormant buying "
450 "distribution maximum\",\"doc\":\"The maximum length in"
451 " time steps of the dormant buying period. Required"
452 " for Uniform dormant_buying_frequency_type, "
453 "optional for Normal. Must be greater than or equal"
454 " to dormant_buying_min \",\"uitype\":\"range\",\"range\":"
455 "[0,2147483647],\"uilabel\":\"Dormant Buying Frequency"
456 " Maximum\",\"type\":\"int\",\"index\":21,\"shape\":[-"
457 "1],\"alias\":\"dormant_buying_max\"},\"dormant_buying_m"
458 "ean\":{\"default\":-1,\"tooltip\":\"Dormant buying "
459 "distribution mean\",\"doc\":\"The mean length in time "
460 "steps of the dormant buying period. Required for "
461 "Normal dormant_buying_frequency_type. Must be "
462 "greater than or equal to 0 \",\"uitype\":\"range\",\"ran"
463 "ge\":[0.0,1e+299],\"uilabel\":\"Dormant Buying "
464 "Frequency Mean\",\"type\":\"double\",\"index\":22,\"shape\""
465 ":[-"
466 "1],\"alias\":\"dormant_buying_mean\"},\"dormant_buying_"
467 "stddev\":{\"default\":-1,\"tooltip\":\"Dormant buying "
468 "distribution standard deviation\",\"doc\":\"The "
469 "standard deviation of the length in time steps of "
470 "the dormant buying period. Required for Normal "
471 "dormant_buying_frequency_type. Must be greater "
472 "than or equal to 0 \",\"uitype\":\"range\",\"range\":[0.0"
473 ",1e+299],\"uilabel\":\"Dormant Buying Frequency "
474 "Standard Deviation\",\"type\":\"double\",\"index\":23,\"sh"
475 "ape\":[-"
476 "1],\"alias\":\"dormant_buying_stddev\"},\"dormant_buyin"
477 "g_end_probability\":{\"default\":0,\"tooltip\":\"Probabi"
478 "lity that agent will return to active during the "
479 "next time step\",\"doc\":\"Binomial distribution has a"
480 " fixed probability of going active at any given "
481 "timestep, like a weighted coin flip. Required for "
482 "Binomial dormant_buying_frequency_type. Must be "
483 "between 0 and 1\",\"uitype\":\"range\",\"range\":[0.0,1.0"
484 "],\"uilabel\":\"Dormant Buying Binomial Offline Proba"
485 "bility\",\"type\":\"double\",\"index\":24,\"shape\":[-"
486 "1],\"alias\":\"dormant_buying_end_probability\"},\"dorm"
487 "ant_buying_disruption_probability\":{\"default\":0,\"t"
488 "ooltip\":\"Probability that a cycle contains a "
489 "disruption\",\"doc\":\"Probability that the agent "
490 "undergoes a disruption (longer offline period) "
491 "during any given cycle. Required for "
492 "FixedWithDisruption dormant_buying_frequency_type."
493 "\",\"uitype\":\"range\",\"range\":[0.0,1.0],\"uilabel\":\"Do"
494 "rmant Buying Disruption Probability\",\"type\":\"doubl"
495 "e\",\"index\":25,\"shape\":[-"
496 "1],\"alias\":\"dormant_buying_disruption_probability\""
497 "},\"dormant_buying_disruption\":{\"default\":-"
498 "1,\"tooltip\":\"Fixed length of disrupted "
499 "cycle\",\"doc\":\"When a dormant cycle is disrupted, "
500 "this is length of the offline period instead of "
501 "dormant_buying_val. Required for "
502 "FixedWithDisruption dormant_buying_frequency_type\""
503 ",\"uitype\":\"range\",\"range\":[0,2147483647],\"type\":\"i"
504 "nt\",\"index\":26,\"shape\":[-"
505 "1],\"alias\":\"dormant_buying_disruption\",\"uilabel\":\""
506 "dormant_buying_disruption\"},\"buying_size_type\":{\"d"
507 "efault\":\"Fixed\",\"tooltip\":\"Type of behavior used "
508 "to determine size of buy request\",\"doc\":\"Behavior "
509 "function used to determine the size of requests "
510 "made. All values are a fraction of maximum "
511 "capacity, determined by the throughput and "
512 "capacity remaining. Options: Fixed, Uniform, "
513 "Normal. Fixed is default behavior. Uniform "
514 "requires buying_size_min and buying_size_max. "
515 "Normal requires buying_size_mean and "
516 "buying_size_stddev, optional buying_size_min and b"
517 "uying_size_max.\",\"uitype\":\"combobox\",\"categorical\""
518 ":[\"Fixed\",\"Uniform\",\"Normal\"],\"uilabel\":\"Buying "
519 "Size Type\",\"type\":\"std::string\",\"index\":27,\"shape\""
520 ":[-"
521 "1],\"alias\":\"buying_size_type\"},\"buying_size_val\":{"
522 "\"default\":1.0,\"tooltip\":\"Fixed buying "
523 "size\",\"doc\":\"The size of the buy request as a "
524 "fraction of maximum capacity. Optional for Fixed "
525 "buying_size_type. Must be greater than or equal to"
526 " 0.0\",\"uitype\":\"range\",\"range\":[0.0,1.0],\"uilabel\""
527 ":\"Buying Size Value\",\"type\":\"double\",\"index\":28,\"s"
528 "hape\":[-"
529 "1],\"alias\":\"buying_size_val\"},\"buying_size_min\":{\""
530 "default\":-1.0,\"tooltip\":\"Buying size distribution "
531 "minimum\",\"doc\":\"The minimum size of the buy "
532 "request as a fraction of maximum capacity. "
533 "Required for Uniform and optional for Normal "
534 "buying_size_type. Must be greater than or equal to"
535 " zero.\",\"uitype\":\"range\",\"range\":[0.0,1.0],\"uilabe"
536 "l\":\"Buying Size Minimum\",\"type\":\"double\",\"index\":2"
537 "9,\"shape\":[-"
538 "1],\"alias\":\"buying_size_min\"},\"buying_size_max\":{\""
539 "default\":-1.0,\"tooltip\":\"Buying size distribution "
540 "maximum\",\"doc\":\"The maximum size of the buy "
541 "request as a fraction of maximum capacity. "
542 "Required for Uniform buying_size_type, optional "
543 "for Normal. Must be greater than or equal to "
544 "buying_size_min \",\"uitype\":\"range\",\"range\":[0.0,1."
545 "0],\"uilabel\":\"Buying Size Maximum\",\"type\":\"double\""
546 ",\"index\":30,\"shape\":[-"
547 "1],\"alias\":\"buying_size_max\"},\"buying_size_mean\":{"
548 "\"default\":-1.0,\"tooltip\":\"Buying size distribution"
549 " mean\",\"doc\":\"The mean size of the buy request as "
550 "a fraction of maximum capacity. Required for "
551 "Normal buying_size_type.\",\"uitype\":\"range\",\"range\""
552 ":[0.0,1.0],\"uilabel\":\"Buying Size Mean\",\"type\":\"do"
553 "uble\",\"index\":31,\"shape\":[-"
554 "1],\"alias\":\"buying_size_mean\"},\"buying_size_stddev"
555 "\":{\"default\":-1.0,\"tooltip\":\"Buying size "
556 "distribution standard deviation\",\"doc\":\"The "
557 "standard deviation of the size of the buy request "
558 "as a fraction of maximum capacity. Required for "
559 "Normal buying_size_type.\",\"uitype\":\"range\",\"range\""
560 ":[0.0,1.0],\"uilabel\":\"Buying Size Standard Deviati"
561 "on\",\"type\":\"double\",\"index\":32,\"shape\":[-"
562 "1],\"alias\":\"buying_size_stddev\"},\"reorder_point\":{"
563 "\"default\":-1,\"tooltip\":\"Reorder point\",\"doc\":\"The "
564 "point at which the facility will request more "
565 "material. Above this point, no request will be "
566 "made. Must be less than max_inv_size.If paired "
567 "with reorder_quantity, this agent will have an "
568 "(R,Q) inventory policy. If reorder_point is used "
569 "alone, this agent will have an (s,S) inventory "
570 "policy, with S (the maximum) being set at "
571 "max_inv_size.\",\"uilabel\":\"Reorder Point\",\"type\":\"d"
572 "ouble\",\"index\":33,\"shape\":[-"
573 "1],\"alias\":\"reorder_point\"},\"reorder_quantity\":{\"d"
574 "efault\":-1,\"tooltip\":\"Reorder amount (R,Q "
575 "inventory policy)\",\"doc\":\"The amount of material "
576 "that will be requested when the reorder point is "
577 "reached. Exclusive request, so will demand exactly"
578 " reorder_quantity.Reorder_point + reorder_quantity"
579 " must be less than "
580 "max_inv_size.\",\"uilabel\":\"Reorder Quantity\",\"type\""
581 ":\"double\",\"index\":34,\"shape\":[-"
582 "1],\"alias\":\"reorder_quantity\"},\"cumulative_cap\":{\""
583 "default\":-1,\"tooltip\":\"Total amount of material "
584 "that can be recieved per cycle.\",\"doc\":\"After "
585 "receiving this much material cumulatively, the "
586 "agent will go dormant. Must be paired with "
587 "dormant_buying_frequency_type and any other "
588 "dormant parameters. The per-time step demand is "
589 "unchanged except the cycle cap is almost "
590 "reached.\",\"uilabel\":\"Cumulative Cap\",\"type\":\"doubl"
591 "e\",\"index\":35,\"shape\":[-"
592 "1],\"alias\":\"cumulative_cap\"},\"package\":{\"default\":"
593 "\"unpackaged\",\"tooltip\":\"Output "
594 "package\",\"doc\":\"Outgoing material will be packaged"
595 " when trading.\",\"uitype\":\"package\",\"uilabel\":\"Pack"
596 "age\",\"type\":\"std::string\",\"index\":36,\"shape\":[-"
597 "1],\"alias\":\"package\"},\"transport_unit\":{\"default\":"
598 "\"unrestricted\",\"tooltip\":\"Output transport "
599 "unit\",\"doc\":\"Outgoing material, after packaging, "
600 "will be further restricted by transport unit when "
601 "trading.\",\"uitype\":\"transportunit\",\"uilabel\":\"Tran"
602 "sport Unit\",\"type\":\"std::string\",\"index\":37,\"shape"
603 "\":[-"
604 "1],\"alias\":\"transport_unit\"},\"inventory\":{\"tooltip"
605 "\":\"Incoming material buffer\",\"type\":[\"cyclus::tool"
606 "kit::ResBuf\",\"cyclus::Material\"],\"index\":38,\"shape"
607 "\":[-1,-1]},\"stocks\":{\"tooltip\":\"Output material bu"
608 "ffer\",\"type\":[\"cyclus::toolkit::ResBuf\",\"cyclus::M"
609 "aterial\"],\"index\":39,\"shape\":[-1,-"
610 "1]},\"ready\":{\"tooltip\":\"Buffer for material held "
611 "for required residence_time\",\"type\":[\"cyclus::tool"
612 "kit::ResBuf\",\"cyclus::Material\"],\"index\":40,\"shape"
613 "\":[-1,-1]},\"processing\":{\"tooltip\":\"Buffer for "
614 "material still waiting for required residence_time"
615 "\",\"type\":[\"cyclus::toolkit::ResBuf\",\"cyclus::Mater"
616 "ial\"],\"index\":41,\"shape\":[-1,-"
617 "1]},\"inventory_tracker\":{\"tooltip\":\"Total "
618 "Inventory Tracker to restrict maximum agent invent"
619 "ory\",\"type\":\"cyclus::toolkit::TotalInvTracker\",\"in"
620 "dex\":42,\"shape\":[-"
621 "1],\"alias\":\"inventory_tracker\",\"uilabel\":\"inventor"
622 "y_tracker\"},\"latitude\":{\"default\":0.0,\"uilabel\":\"G"
623 "eographical latitude in degrees as a "
624 "double\",\"doc\":\"Latitude of the agent's "
625 "geographical position. The value should be "
626 "expressed in degrees as a double.\",\"type\":\"double\""
627 ",\"index\":43,\"shape\":[-"
628 "1],\"alias\":\"latitude\",\"tooltip\":\"latitude\"},\"longi"
629 "tude\":{\"default\":0.0,\"uilabel\":\"Geographical "
630 "longitude in degrees as a double\",\"doc\":\"Longitude"
631 " of the agent's geographical position. The value "
632 "should be expressed in degrees as a double.\",\"type"
633 "\":\"double\",\"index\":44,\"shape\":[-"
634 "1],\"alias\":\"longitude\",\"tooltip\":\"longitude\"}},\"do"
635 "c\":\"Storage is a simple facility which accepts any"
636 " number of commodities and holds them for a user "
637 "specified amount of time. The commodities accepted"
638 " are chosen based on the specified preferences "
639 "list. Once the desired amount of material has "
640 "entered the facility it is passed into a "
641 "'processing' buffer where it is held until the "
642 "residence time has passed. The material is then "
643 "passed into a 'ready' buffer where it is queued "
644 "for removal. Currently, all input commodities are "
645 "lumped into a single output commodity. Storage "
646 "also has the functionality to handle materials in "
647 "discrete or continuous batches. Discrete mode, "
648 "which is the default, does not split or combine "
649 "material batches. Continuous mode, however, "
650 "divides material batches if necessary in order to "
651 "push materials through the facility as quickly as "
652 "possible.\"}", root);
653 if (!parsed_ok) {
654 throw cyclus::ValueError("failed to parse annotations for cycamore::Storage.");
655 }
656 return root;
657};
658#line 23 "/cycamore/src/storage.cc"
659
660void Storage::InitInv(cyclus::Inventories& inv) {
661 inventory.Push(inv["inventory"]);
662 stocks.Push(inv["stocks"]);
663 ready.Push(inv["ready"]);
664 processing.Push(inv["processing"]);
665 ;
666
667};
668#line 25 "/cycamore/src/storage.cc"
669
670cyclus::Inventories Storage::SnapshotInv() {
671 cyclus::Inventories invs;
672 invs["inventory"] = inventory.PopNRes(inventory.count());
673 inventory.Push(invs["inventory"]);
674 invs["stocks"] = stocks.PopNRes(stocks.count());
675 stocks.Push(invs["stocks"]);
676 invs["ready"] = ready.PopNRes(ready.count());
677 ready.Push(invs["ready"]);
678 invs["processing"] = processing.PopNRes(processing.count());
679 processing.Push(invs["processing"]);
680 ;
681 return invs;
682};
683#line 27 "/cycamore/src/storage.cc"
684
685void Storage::InfileToDb(cyclus::InfileTree* tree, cyclus::DbInit di) {
686 cyclus::Facility::InfileToDb(tree, di);
687 int rawcycpp_shape_in_commods[2] = {-1, -1};
688 cycpp_shape_in_commods = std::vector<int>(rawcycpp_shape_in_commods, rawcycpp_shape_in_commods + 2);
689 int rawcycpp_shape_in_commod_prefs[2] = {-1, -1};
690 cycpp_shape_in_commod_prefs = std::vector<int>(rawcycpp_shape_in_commod_prefs, rawcycpp_shape_in_commod_prefs + 2);
691 int rawcycpp_shape_out_commods[2] = {-1, -1};
692 cycpp_shape_out_commods = std::vector<int>(rawcycpp_shape_out_commods, rawcycpp_shape_out_commods + 2);
693 int rawcycpp_shape_in_recipe[1] = {-1};
694 cycpp_shape_in_recipe = std::vector<int>(rawcycpp_shape_in_recipe, rawcycpp_shape_in_recipe + 1);
695 int rawcycpp_shape_residence_time[1] = {-1};
696 cycpp_shape_residence_time = std::vector<int>(rawcycpp_shape_residence_time, rawcycpp_shape_residence_time + 1);
697 int rawcycpp_shape_sell_quantity[1] = {-1};
698 cycpp_shape_sell_quantity = std::vector<int>(rawcycpp_shape_sell_quantity, rawcycpp_shape_sell_quantity + 1);
699 int rawcycpp_shape_throughput[1] = {-1};
700 cycpp_shape_throughput = std::vector<int>(rawcycpp_shape_throughput, rawcycpp_shape_throughput + 1);
701 int rawcycpp_shape_max_inv_size[1] = {-1};
702 cycpp_shape_max_inv_size = std::vector<int>(rawcycpp_shape_max_inv_size, rawcycpp_shape_max_inv_size + 1);
703 int rawcycpp_shape_discrete_handling[1] = {-1};
704 cycpp_shape_discrete_handling = std::vector<int>(rawcycpp_shape_discrete_handling, rawcycpp_shape_discrete_handling + 1);
705 int rawcycpp_shape_active_buying_frequency_type[1] = {-1};
706 cycpp_shape_active_buying_frequency_type = std::vector<int>(rawcycpp_shape_active_buying_frequency_type, rawcycpp_shape_active_buying_frequency_type + 1);
707 int rawcycpp_shape_active_buying_val[1] = {-1};
708 cycpp_shape_active_buying_val = std::vector<int>(rawcycpp_shape_active_buying_val, rawcycpp_shape_active_buying_val + 1);
709 int rawcycpp_shape_active_buying_min[1] = {-1};
710 cycpp_shape_active_buying_min = std::vector<int>(rawcycpp_shape_active_buying_min, rawcycpp_shape_active_buying_min + 1);
711 int rawcycpp_shape_active_buying_max[1] = {-1};
712 cycpp_shape_active_buying_max = std::vector<int>(rawcycpp_shape_active_buying_max, rawcycpp_shape_active_buying_max + 1);
713 int rawcycpp_shape_active_buying_mean[1] = {-1};
714 cycpp_shape_active_buying_mean = std::vector<int>(rawcycpp_shape_active_buying_mean, rawcycpp_shape_active_buying_mean + 1);
715 int rawcycpp_shape_active_buying_stddev[1] = {-1};
716 cycpp_shape_active_buying_stddev = std::vector<int>(rawcycpp_shape_active_buying_stddev, rawcycpp_shape_active_buying_stddev + 1);
717 int rawcycpp_shape_active_buying_end_probability[1] = {-1};
718 cycpp_shape_active_buying_end_probability = std::vector<int>(rawcycpp_shape_active_buying_end_probability, rawcycpp_shape_active_buying_end_probability + 1);
719 int rawcycpp_shape_active_buying_disruption_probability[1] = {-1};
720 cycpp_shape_active_buying_disruption_probability = std::vector<int>(rawcycpp_shape_active_buying_disruption_probability, rawcycpp_shape_active_buying_disruption_probability + 1);
721 int rawcycpp_shape_active_buying_disruption[1] = {-1};
722 cycpp_shape_active_buying_disruption = std::vector<int>(rawcycpp_shape_active_buying_disruption, rawcycpp_shape_active_buying_disruption + 1);
723 int rawcycpp_shape_dormant_buying_frequency_type[1] = {-1};
724 cycpp_shape_dormant_buying_frequency_type = std::vector<int>(rawcycpp_shape_dormant_buying_frequency_type, rawcycpp_shape_dormant_buying_frequency_type + 1);
725 int rawcycpp_shape_dormant_buying_val[1] = {-1};
726 cycpp_shape_dormant_buying_val = std::vector<int>(rawcycpp_shape_dormant_buying_val, rawcycpp_shape_dormant_buying_val + 1);
727 int rawcycpp_shape_dormant_buying_min[1] = {-1};
728 cycpp_shape_dormant_buying_min = std::vector<int>(rawcycpp_shape_dormant_buying_min, rawcycpp_shape_dormant_buying_min + 1);
729 int rawcycpp_shape_dormant_buying_max[1] = {-1};
730 cycpp_shape_dormant_buying_max = std::vector<int>(rawcycpp_shape_dormant_buying_max, rawcycpp_shape_dormant_buying_max + 1);
731 int rawcycpp_shape_dormant_buying_mean[1] = {-1};
732 cycpp_shape_dormant_buying_mean = std::vector<int>(rawcycpp_shape_dormant_buying_mean, rawcycpp_shape_dormant_buying_mean + 1);
733 int rawcycpp_shape_dormant_buying_stddev[1] = {-1};
734 cycpp_shape_dormant_buying_stddev = std::vector<int>(rawcycpp_shape_dormant_buying_stddev, rawcycpp_shape_dormant_buying_stddev + 1);
735 int rawcycpp_shape_dormant_buying_end_probability[1] = {-1};
736 cycpp_shape_dormant_buying_end_probability = std::vector<int>(rawcycpp_shape_dormant_buying_end_probability, rawcycpp_shape_dormant_buying_end_probability + 1);
737 int rawcycpp_shape_dormant_buying_disruption_probability[1] = {-1};
738 cycpp_shape_dormant_buying_disruption_probability = std::vector<int>(rawcycpp_shape_dormant_buying_disruption_probability, rawcycpp_shape_dormant_buying_disruption_probability + 1);
739 int rawcycpp_shape_dormant_buying_disruption[1] = {-1};
740 cycpp_shape_dormant_buying_disruption = std::vector<int>(rawcycpp_shape_dormant_buying_disruption, rawcycpp_shape_dormant_buying_disruption + 1);
741 int rawcycpp_shape_buying_size_type[1] = {-1};
742 cycpp_shape_buying_size_type = std::vector<int>(rawcycpp_shape_buying_size_type, rawcycpp_shape_buying_size_type + 1);
743 int rawcycpp_shape_buying_size_val[1] = {-1};
744 cycpp_shape_buying_size_val = std::vector<int>(rawcycpp_shape_buying_size_val, rawcycpp_shape_buying_size_val + 1);
745 int rawcycpp_shape_buying_size_min[1] = {-1};
746 cycpp_shape_buying_size_min = std::vector<int>(rawcycpp_shape_buying_size_min, rawcycpp_shape_buying_size_min + 1);
747 int rawcycpp_shape_buying_size_max[1] = {-1};
748 cycpp_shape_buying_size_max = std::vector<int>(rawcycpp_shape_buying_size_max, rawcycpp_shape_buying_size_max + 1);
749 int rawcycpp_shape_buying_size_mean[1] = {-1};
750 cycpp_shape_buying_size_mean = std::vector<int>(rawcycpp_shape_buying_size_mean, rawcycpp_shape_buying_size_mean + 1);
751 int rawcycpp_shape_buying_size_stddev[1] = {-1};
752 cycpp_shape_buying_size_stddev = std::vector<int>(rawcycpp_shape_buying_size_stddev, rawcycpp_shape_buying_size_stddev + 1);
753 int rawcycpp_shape_reorder_point[1] = {-1};
754 cycpp_shape_reorder_point = std::vector<int>(rawcycpp_shape_reorder_point, rawcycpp_shape_reorder_point + 1);
755 int rawcycpp_shape_reorder_quantity[1] = {-1};
756 cycpp_shape_reorder_quantity = std::vector<int>(rawcycpp_shape_reorder_quantity, rawcycpp_shape_reorder_quantity + 1);
757 int rawcycpp_shape_cumulative_cap[1] = {-1};
758 cycpp_shape_cumulative_cap = std::vector<int>(rawcycpp_shape_cumulative_cap, rawcycpp_shape_cumulative_cap + 1);
759 int rawcycpp_shape_package[1] = {-1};
760 cycpp_shape_package = std::vector<int>(rawcycpp_shape_package, rawcycpp_shape_package + 1);
761 int rawcycpp_shape_transport_unit[1] = {-1};
762 cycpp_shape_transport_unit = std::vector<int>(rawcycpp_shape_transport_unit, rawcycpp_shape_transport_unit + 1);
763 int rawcycpp_shape_inventory[2] = {-1, -1};
764 cycpp_shape_inventory = std::vector<int>(rawcycpp_shape_inventory, rawcycpp_shape_inventory + 2);
765 int rawcycpp_shape_stocks[2] = {-1, -1};
766 cycpp_shape_stocks = std::vector<int>(rawcycpp_shape_stocks, rawcycpp_shape_stocks + 2);
767 int rawcycpp_shape_ready[2] = {-1, -1};
768 cycpp_shape_ready = std::vector<int>(rawcycpp_shape_ready, rawcycpp_shape_ready + 2);
769 int rawcycpp_shape_processing[2] = {-1, -1};
770 cycpp_shape_processing = std::vector<int>(rawcycpp_shape_processing, rawcycpp_shape_processing + 2);
771 int rawcycpp_shape_inventory_tracker[1] = {-1};
772 cycpp_shape_inventory_tracker = std::vector<int>(rawcycpp_shape_inventory_tracker, rawcycpp_shape_inventory_tracker + 1);
773 int rawcycpp_shape_latitude[1] = {-1};
774 cycpp_shape_latitude = std::vector<int>(rawcycpp_shape_latitude, rawcycpp_shape_latitude + 1);
775 int rawcycpp_shape_longitude[1] = {-1};
776 cycpp_shape_longitude = std::vector<int>(rawcycpp_shape_longitude, rawcycpp_shape_longitude + 1);
777 cyclus::InfileTree* sub = tree->SubTree("config/*");
778 int i;
779 int n;
780 {
781 cyclus::InfileTree* bub = sub->SubTree("in_commods", 0);
782 cyclus::InfileTree* sub = bub;
783 int n1 = sub->NMatches("val");
784 std::vector< std::string > in_commods_val;
785 in_commods_val.resize(n1);
786 for (int i1 = 0; i1 < n1; ++i1) {
787 std::string elem;
788 {
789 std::string elem_in = cyclus::Query<std::string>(sub, "val", i1);
790 elem = elem_in;
791 }
792 in_commods_val[i1] = elem;
793 }
794 in_commods = in_commods_val;
795 }
796 if (sub->NMatches("in_commod_prefs") > 0) {
797 {
798 cyclus::InfileTree* bub = sub->SubTree("in_commod_prefs", 0);
799 cyclus::InfileTree* sub = bub;
800 int n1 = sub->NMatches("val");
801 std::vector< double > in_commod_prefs_val;
802 in_commod_prefs_val.resize(n1);
803 for (int i1 = 0; i1 < n1; ++i1) {
804 double elem;
805 {
806 double elem_in = cyclus::Query<double>(sub, "val", i1);
807 elem = elem_in;
808 }
809 in_commod_prefs_val[i1] = elem;
810 }
811 in_commod_prefs = in_commod_prefs_val;
812 }
813 } else {
814 std::vector< double > in_commod_prefs_tmp;
815 in_commod_prefs_tmp.resize(0);
816 {
817 }
818 in_commod_prefs = in_commod_prefs_tmp;
819 }
820 {
821 cyclus::InfileTree* bub = sub->SubTree("out_commods", 0);
822 cyclus::InfileTree* sub = bub;
823 int n1 = sub->NMatches("val");
824 std::vector< std::string > out_commods_val;
825 out_commods_val.resize(n1);
826 for (int i1 = 0; i1 < n1; ++i1) {
827 std::string elem;
828 {
829 std::string elem_in = cyclus::Query<std::string>(sub, "val", i1);
830 elem = elem_in;
831 }
832 out_commods_val[i1] = elem;
833 }
834 out_commods = out_commods_val;
835 }
836 if (sub->NMatches("in_recipe") > 0) {
837 {
838 std::string in_recipe_val = cyclus::Query<std::string>(sub, "in_recipe");
839 in_recipe = in_recipe_val;
840 }
841 } else {
842 std::string in_recipe_tmp("");
843 in_recipe = in_recipe_tmp;
844 }
845 if (sub->NMatches("residence_time") > 0) {
846 {
847 int residence_time_val = cyclus::Query<int>(sub, "residence_time");
848 residence_time = residence_time_val;
849 }
850 } else {
851 int residence_time_tmp = 0;
852 residence_time = residence_time_tmp;
853 }
854 if (sub->NMatches("sell_quantity") > 0) {
855 {
856 double sell_quantity_val = cyclus::Query<double>(sub, "sell_quantity");
857 sell_quantity = sell_quantity_val;
858 }
859 } else {
860 double sell_quantity_tmp = 0;
861 sell_quantity = sell_quantity_tmp;
862 }
863 if (sub->NMatches("throughput") > 0) {
864 {
865 double throughput_val = cyclus::Query<double>(sub, "throughput");
866 throughput = throughput_val;
867 }
868 } else {
869 double throughput_tmp = 1e+299;
870 throughput = throughput_tmp;
871 }
872 if (sub->NMatches("max_inv_size") > 0) {
873 {
874 double max_inv_size_val = cyclus::Query<double>(sub, "max_inv_size");
875 max_inv_size = max_inv_size_val;
876 }
877 } else {
878 double max_inv_size_tmp = 1e+299;
879 max_inv_size = max_inv_size_tmp;
880 }
881 if (sub->NMatches("discrete_handling") > 0) {
882 {
883 bool discrete_handling_val = cyclus::Query<bool>(sub, "discrete_handling");
884 discrete_handling = discrete_handling_val;
885 }
886 } else {
887 bool discrete_handling_tmp = false;
888 discrete_handling = discrete_handling_tmp;
889 }
890 if (sub->NMatches("active_buying_frequency_type") > 0) {
891 {
892 std::string active_buying_frequency_type_val = cyclus::Query<std::string>(sub, "active_buying_frequency_type");
893 active_buying_frequency_type = active_buying_frequency_type_val;
894 }
895 } else {
896 std::string active_buying_frequency_type_tmp("Fixed");
897 active_buying_frequency_type = active_buying_frequency_type_tmp;
898 }
899 if (sub->NMatches("active_buying_val") > 0) {
900 {
901 int active_buying_val_val = cyclus::Query<int>(sub, "active_buying_val");
902 active_buying_val = active_buying_val_val;
903 }
904 } else {
905 int active_buying_val_tmp = -1;
906 active_buying_val = active_buying_val_tmp;
907 }
908 if (sub->NMatches("active_buying_min") > 0) {
909 {
910 int active_buying_min_val = cyclus::Query<int>(sub, "active_buying_min");
911 active_buying_min = active_buying_min_val;
912 }
913 } else {
914 int active_buying_min_tmp = -1;
915 active_buying_min = active_buying_min_tmp;
916 }
917 if (sub->NMatches("active_buying_max") > 0) {
918 {
919 int active_buying_max_val = cyclus::Query<int>(sub, "active_buying_max");
920 active_buying_max = active_buying_max_val;
921 }
922 } else {
923 int active_buying_max_tmp = -1;
924 active_buying_max = active_buying_max_tmp;
925 }
926 if (sub->NMatches("active_buying_mean") > 0) {
927 {
928 double active_buying_mean_val = cyclus::Query<double>(sub, "active_buying_mean");
929 active_buying_mean = active_buying_mean_val;
930 }
931 } else {
932 double active_buying_mean_tmp = -1;
933 active_buying_mean = active_buying_mean_tmp;
934 }
935 if (sub->NMatches("active_buying_stddev") > 0) {
936 {
937 double active_buying_stddev_val = cyclus::Query<double>(sub, "active_buying_stddev");
938 active_buying_stddev = active_buying_stddev_val;
939 }
940 } else {
941 double active_buying_stddev_tmp = -1;
942 active_buying_stddev = active_buying_stddev_tmp;
943 }
944 if (sub->NMatches("active_buying_end_probability") > 0) {
945 {
946 double active_buying_end_probability_val = cyclus::Query<double>(sub, "active_buying_end_probability");
947 active_buying_end_probability = active_buying_end_probability_val;
948 }
949 } else {
950 double active_buying_end_probability_tmp = 0;
951 active_buying_end_probability = active_buying_end_probability_tmp;
952 }
953 if (sub->NMatches("active_buying_disruption_probability") > 0) {
954 {
955 double active_buying_disruption_probability_val = cyclus::Query<double>(sub, "active_buying_disruption_probability");
956 active_buying_disruption_probability = active_buying_disruption_probability_val;
957 }
958 } else {
959 double active_buying_disruption_probability_tmp = 0;
960 active_buying_disruption_probability = active_buying_disruption_probability_tmp;
961 }
962 if (sub->NMatches("active_buying_disruption") > 0) {
963 {
964 int active_buying_disruption_val = cyclus::Query<int>(sub, "active_buying_disruption");
965 active_buying_disruption = active_buying_disruption_val;
966 }
967 } else {
968 int active_buying_disruption_tmp = -1;
969 active_buying_disruption = active_buying_disruption_tmp;
970 }
971 if (sub->NMatches("dormant_buying_frequency_type") > 0) {
972 {
973 std::string dormant_buying_frequency_type_val = cyclus::Query<std::string>(sub, "dormant_buying_frequency_type");
974 dormant_buying_frequency_type = dormant_buying_frequency_type_val;
975 }
976 } else {
977 std::string dormant_buying_frequency_type_tmp("Fixed");
978 dormant_buying_frequency_type = dormant_buying_frequency_type_tmp;
979 }
980 if (sub->NMatches("dormant_buying_val") > 0) {
981 {
982 int dormant_buying_val_val = cyclus::Query<int>(sub, "dormant_buying_val");
983 dormant_buying_val = dormant_buying_val_val;
984 }
985 } else {
986 int dormant_buying_val_tmp = -1;
987 dormant_buying_val = dormant_buying_val_tmp;
988 }
989 if (sub->NMatches("dormant_buying_min") > 0) {
990 {
991 int dormant_buying_min_val = cyclus::Query<int>(sub, "dormant_buying_min");
992 dormant_buying_min = dormant_buying_min_val;
993 }
994 } else {
995 int dormant_buying_min_tmp = -1;
996 dormant_buying_min = dormant_buying_min_tmp;
997 }
998 if (sub->NMatches("dormant_buying_max") > 0) {
999 {
1000 int dormant_buying_max_val = cyclus::Query<int>(sub, "dormant_buying_max");
1001 dormant_buying_max = dormant_buying_max_val;
1002 }
1003 } else {
1004 int dormant_buying_max_tmp = -1;
1005 dormant_buying_max = dormant_buying_max_tmp;
1006 }
1007 if (sub->NMatches("dormant_buying_mean") > 0) {
1008 {
1009 double dormant_buying_mean_val = cyclus::Query<double>(sub, "dormant_buying_mean");
1010 dormant_buying_mean = dormant_buying_mean_val;
1011 }
1012 } else {
1013 double dormant_buying_mean_tmp = -1;
1014 dormant_buying_mean = dormant_buying_mean_tmp;
1015 }
1016 if (sub->NMatches("dormant_buying_stddev") > 0) {
1017 {
1018 double dormant_buying_stddev_val = cyclus::Query<double>(sub, "dormant_buying_stddev");
1019 dormant_buying_stddev = dormant_buying_stddev_val;
1020 }
1021 } else {
1022 double dormant_buying_stddev_tmp = -1;
1023 dormant_buying_stddev = dormant_buying_stddev_tmp;
1024 }
1025 if (sub->NMatches("dormant_buying_end_probability") > 0) {
1026 {
1027 double dormant_buying_end_probability_val = cyclus::Query<double>(sub, "dormant_buying_end_probability");
1028 dormant_buying_end_probability = dormant_buying_end_probability_val;
1029 }
1030 } else {
1031 double dormant_buying_end_probability_tmp = 0;
1032 dormant_buying_end_probability = dormant_buying_end_probability_tmp;
1033 }
1034 if (sub->NMatches("dormant_buying_disruption_probability") > 0) {
1035 {
1036 double dormant_buying_disruption_probability_val = cyclus::Query<double>(sub, "dormant_buying_disruption_probability");
1037 dormant_buying_disruption_probability = dormant_buying_disruption_probability_val;
1038 }
1039 } else {
1040 double dormant_buying_disruption_probability_tmp = 0;
1041 dormant_buying_disruption_probability = dormant_buying_disruption_probability_tmp;
1042 }
1043 if (sub->NMatches("dormant_buying_disruption") > 0) {
1044 {
1045 int dormant_buying_disruption_val = cyclus::Query<int>(sub, "dormant_buying_disruption");
1046 dormant_buying_disruption = dormant_buying_disruption_val;
1047 }
1048 } else {
1049 int dormant_buying_disruption_tmp = -1;
1050 dormant_buying_disruption = dormant_buying_disruption_tmp;
1051 }
1052 if (sub->NMatches("buying_size_type") > 0) {
1053 {
1054 std::string buying_size_type_val = cyclus::Query<std::string>(sub, "buying_size_type");
1055 buying_size_type = buying_size_type_val;
1056 }
1057 } else {
1058 std::string buying_size_type_tmp("Fixed");
1059 buying_size_type = buying_size_type_tmp;
1060 }
1061 if (sub->NMatches("buying_size_val") > 0) {
1062 {
1063 double buying_size_val_val = cyclus::Query<double>(sub, "buying_size_val");
1064 buying_size_val = buying_size_val_val;
1065 }
1066 } else {
1067 double buying_size_val_tmp = 1.0;
1068 buying_size_val = buying_size_val_tmp;
1069 }
1070 if (sub->NMatches("buying_size_min") > 0) {
1071 {
1072 double buying_size_min_val = cyclus::Query<double>(sub, "buying_size_min");
1073 buying_size_min = buying_size_min_val;
1074 }
1075 } else {
1076 double buying_size_min_tmp = -1.0;
1077 buying_size_min = buying_size_min_tmp;
1078 }
1079 if (sub->NMatches("buying_size_max") > 0) {
1080 {
1081 double buying_size_max_val = cyclus::Query<double>(sub, "buying_size_max");
1082 buying_size_max = buying_size_max_val;
1083 }
1084 } else {
1085 double buying_size_max_tmp = -1.0;
1086 buying_size_max = buying_size_max_tmp;
1087 }
1088 if (sub->NMatches("buying_size_mean") > 0) {
1089 {
1090 double buying_size_mean_val = cyclus::Query<double>(sub, "buying_size_mean");
1091 buying_size_mean = buying_size_mean_val;
1092 }
1093 } else {
1094 double buying_size_mean_tmp = -1.0;
1095 buying_size_mean = buying_size_mean_tmp;
1096 }
1097 if (sub->NMatches("buying_size_stddev") > 0) {
1098 {
1099 double buying_size_stddev_val = cyclus::Query<double>(sub, "buying_size_stddev");
1100 buying_size_stddev = buying_size_stddev_val;
1101 }
1102 } else {
1103 double buying_size_stddev_tmp = -1.0;
1104 buying_size_stddev = buying_size_stddev_tmp;
1105 }
1106 if (sub->NMatches("reorder_point") > 0) {
1107 {
1108 double reorder_point_val = cyclus::Query<double>(sub, "reorder_point");
1109 reorder_point = reorder_point_val;
1110 }
1111 } else {
1112 double reorder_point_tmp = -1;
1113 reorder_point = reorder_point_tmp;
1114 }
1115 if (sub->NMatches("reorder_quantity") > 0) {
1116 {
1117 double reorder_quantity_val = cyclus::Query<double>(sub, "reorder_quantity");
1118 reorder_quantity = reorder_quantity_val;
1119 }
1120 } else {
1121 double reorder_quantity_tmp = -1;
1122 reorder_quantity = reorder_quantity_tmp;
1123 }
1124 if (sub->NMatches("cumulative_cap") > 0) {
1125 {
1126 double cumulative_cap_val = cyclus::Query<double>(sub, "cumulative_cap");
1127 cumulative_cap = cumulative_cap_val;
1128 }
1129 } else {
1130 double cumulative_cap_tmp = -1;
1131 cumulative_cap = cumulative_cap_tmp;
1132 }
1133 if (sub->NMatches("package") > 0) {
1134 {
1135 std::string package_val = cyclus::Query<std::string>(sub, "package");
1136 package = package_val;
1137 }
1138 } else {
1139 std::string package_tmp("unpackaged");
1140 package = package_tmp;
1141 }
1142 if (sub->NMatches("transport_unit") > 0) {
1143 {
1144 std::string transport_unit_val = cyclus::Query<std::string>(sub, "transport_unit");
1145 transport_unit = transport_unit_val;
1146 }
1147 } else {
1148 std::string transport_unit_tmp("unrestricted");
1149 transport_unit = transport_unit_tmp;
1150 }
1151 if (sub->NMatches("latitude") > 0) {
1152 {
1153 double latitude_val = cyclus::Query<double>(sub, "latitude");
1154 latitude = latitude_val;
1155 }
1156 } else {
1157 double latitude_tmp = 0.0;
1158 latitude = latitude_tmp;
1159 }
1160 if (sub->NMatches("longitude") > 0) {
1161 {
1162 double longitude_val = cyclus::Query<double>(sub, "longitude");
1163 longitude = longitude_val;
1164 }
1165 } else {
1166 double longitude_tmp = 0.0;
1167 longitude = longitude_tmp;
1168 }
1169 di.NewDatum("Info")
1170 ->AddVal("in_commods", in_commods, &cycpp_shape_in_commods)
1171 ->AddVal("in_commod_prefs", in_commod_prefs, &cycpp_shape_in_commod_prefs)
1172 ->AddVal("out_commods", out_commods, &cycpp_shape_out_commods)
1173 ->AddVal("in_recipe", in_recipe, &cycpp_shape_in_recipe)
1174 ->AddVal("residence_time", residence_time, &cycpp_shape_residence_time)
1175 ->AddVal("sell_quantity", sell_quantity, &cycpp_shape_sell_quantity)
1176 ->AddVal("throughput", throughput, &cycpp_shape_throughput)
1177 ->AddVal("max_inv_size", max_inv_size, &cycpp_shape_max_inv_size)
1178 ->AddVal("discrete_handling", discrete_handling, &cycpp_shape_discrete_handling)
1179 ->AddVal("active_buying_frequency_type", active_buying_frequency_type, &cycpp_shape_active_buying_frequency_type)
1180 ->AddVal("active_buying_val", active_buying_val, &cycpp_shape_active_buying_val)
1181 ->AddVal("active_buying_min", active_buying_min, &cycpp_shape_active_buying_min)
1182 ->AddVal("active_buying_max", active_buying_max, &cycpp_shape_active_buying_max)
1183 ->AddVal("active_buying_mean", active_buying_mean, &cycpp_shape_active_buying_mean)
1184 ->AddVal("active_buying_stddev", active_buying_stddev, &cycpp_shape_active_buying_stddev)
1185 ->AddVal("active_buying_end_probability", active_buying_end_probability, &cycpp_shape_active_buying_end_probability)
1186 ->AddVal("active_buying_disruption_probability", active_buying_disruption_probability, &cycpp_shape_active_buying_disruption_probability)
1187 ->AddVal("active_buying_disruption", active_buying_disruption, &cycpp_shape_active_buying_disruption)
1188 ->AddVal("dormant_buying_frequency_type", dormant_buying_frequency_type, &cycpp_shape_dormant_buying_frequency_type)
1189 ->AddVal("dormant_buying_val", dormant_buying_val, &cycpp_shape_dormant_buying_val)
1190 ->AddVal("dormant_buying_min", dormant_buying_min, &cycpp_shape_dormant_buying_min)
1191 ->AddVal("dormant_buying_max", dormant_buying_max, &cycpp_shape_dormant_buying_max)
1192 ->AddVal("dormant_buying_mean", dormant_buying_mean, &cycpp_shape_dormant_buying_mean)
1193 ->AddVal("dormant_buying_stddev", dormant_buying_stddev, &cycpp_shape_dormant_buying_stddev)
1194 ->AddVal("dormant_buying_end_probability", dormant_buying_end_probability, &cycpp_shape_dormant_buying_end_probability)
1195 ->AddVal("dormant_buying_disruption_probability", dormant_buying_disruption_probability, &cycpp_shape_dormant_buying_disruption_probability)
1196 ->AddVal("dormant_buying_disruption", dormant_buying_disruption, &cycpp_shape_dormant_buying_disruption)
1197 ->AddVal("buying_size_type", buying_size_type, &cycpp_shape_buying_size_type)
1198 ->AddVal("buying_size_val", buying_size_val, &cycpp_shape_buying_size_val)
1199 ->AddVal("buying_size_min", buying_size_min, &cycpp_shape_buying_size_min)
1200 ->AddVal("buying_size_max", buying_size_max, &cycpp_shape_buying_size_max)
1201 ->AddVal("buying_size_mean", buying_size_mean, &cycpp_shape_buying_size_mean)
1202 ->AddVal("buying_size_stddev", buying_size_stddev, &cycpp_shape_buying_size_stddev)
1203 ->AddVal("reorder_point", reorder_point, &cycpp_shape_reorder_point)
1204 ->AddVal("reorder_quantity", reorder_quantity, &cycpp_shape_reorder_quantity)
1205 ->AddVal("cumulative_cap", cumulative_cap, &cycpp_shape_cumulative_cap)
1206 ->AddVal("package", package, &cycpp_shape_package)
1207 ->AddVal("transport_unit", transport_unit, &cycpp_shape_transport_unit)
1208 ->AddVal("latitude", latitude, &cycpp_shape_latitude)
1209 ->AddVal("longitude", longitude, &cycpp_shape_longitude)
1210 ->Record();
1211};
1212#line 29 "/cycamore/src/storage.cc"
1213
1214void Storage::Snapshot(cyclus::DbInit di) {
1215 di.NewDatum("Info")
1216 ->AddVal("in_commods", in_commods, &cycpp_shape_in_commods)
1217 ->AddVal("in_commod_prefs", in_commod_prefs, &cycpp_shape_in_commod_prefs)
1218 ->AddVal("out_commods", out_commods, &cycpp_shape_out_commods)
1219 ->AddVal("in_recipe", in_recipe, &cycpp_shape_in_recipe)
1220 ->AddVal("residence_time", residence_time, &cycpp_shape_residence_time)
1221 ->AddVal("sell_quantity", sell_quantity, &cycpp_shape_sell_quantity)
1222 ->AddVal("throughput", throughput, &cycpp_shape_throughput)
1223 ->AddVal("max_inv_size", max_inv_size, &cycpp_shape_max_inv_size)
1224 ->AddVal("discrete_handling", discrete_handling, &cycpp_shape_discrete_handling)
1225 ->AddVal("active_buying_frequency_type", active_buying_frequency_type, &cycpp_shape_active_buying_frequency_type)
1226 ->AddVal("active_buying_val", active_buying_val, &cycpp_shape_active_buying_val)
1227 ->AddVal("active_buying_min", active_buying_min, &cycpp_shape_active_buying_min)
1228 ->AddVal("active_buying_max", active_buying_max, &cycpp_shape_active_buying_max)
1229 ->AddVal("active_buying_mean", active_buying_mean, &cycpp_shape_active_buying_mean)
1230 ->AddVal("active_buying_stddev", active_buying_stddev, &cycpp_shape_active_buying_stddev)
1231 ->AddVal("active_buying_end_probability", active_buying_end_probability, &cycpp_shape_active_buying_end_probability)
1232 ->AddVal("active_buying_disruption_probability", active_buying_disruption_probability, &cycpp_shape_active_buying_disruption_probability)
1233 ->AddVal("active_buying_disruption", active_buying_disruption, &cycpp_shape_active_buying_disruption)
1234 ->AddVal("dormant_buying_frequency_type", dormant_buying_frequency_type, &cycpp_shape_dormant_buying_frequency_type)
1235 ->AddVal("dormant_buying_val", dormant_buying_val, &cycpp_shape_dormant_buying_val)
1236 ->AddVal("dormant_buying_min", dormant_buying_min, &cycpp_shape_dormant_buying_min)
1237 ->AddVal("dormant_buying_max", dormant_buying_max, &cycpp_shape_dormant_buying_max)
1238 ->AddVal("dormant_buying_mean", dormant_buying_mean, &cycpp_shape_dormant_buying_mean)
1239 ->AddVal("dormant_buying_stddev", dormant_buying_stddev, &cycpp_shape_dormant_buying_stddev)
1240 ->AddVal("dormant_buying_end_probability", dormant_buying_end_probability, &cycpp_shape_dormant_buying_end_probability)
1241 ->AddVal("dormant_buying_disruption_probability", dormant_buying_disruption_probability, &cycpp_shape_dormant_buying_disruption_probability)
1242 ->AddVal("dormant_buying_disruption", dormant_buying_disruption, &cycpp_shape_dormant_buying_disruption)
1243 ->AddVal("buying_size_type", buying_size_type, &cycpp_shape_buying_size_type)
1244 ->AddVal("buying_size_val", buying_size_val, &cycpp_shape_buying_size_val)
1245 ->AddVal("buying_size_min", buying_size_min, &cycpp_shape_buying_size_min)
1246 ->AddVal("buying_size_max", buying_size_max, &cycpp_shape_buying_size_max)
1247 ->AddVal("buying_size_mean", buying_size_mean, &cycpp_shape_buying_size_mean)
1248 ->AddVal("buying_size_stddev", buying_size_stddev, &cycpp_shape_buying_size_stddev)
1249 ->AddVal("reorder_point", reorder_point, &cycpp_shape_reorder_point)
1250 ->AddVal("reorder_quantity", reorder_quantity, &cycpp_shape_reorder_quantity)
1251 ->AddVal("cumulative_cap", cumulative_cap, &cycpp_shape_cumulative_cap)
1252 ->AddVal("package", package, &cycpp_shape_package)
1253 ->AddVal("transport_unit", transport_unit, &cycpp_shape_transport_unit)
1254 ->AddVal("latitude", latitude, &cycpp_shape_latitude)
1255 ->AddVal("longitude", longitude, &cycpp_shape_longitude)
1256 ->Record();
1257};
1258#line 31 "/cycamore/src/storage.cc"
1259
1260cyclus::Agent* Storage::Clone() {
1261 cycamore::Storage* m = new cycamore::Storage(context());
1262 m->InitFrom(this);
1263 return m;
1264};
1265#line 33 "/cycamore/src/storage.cc"
1266
1267//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1268void Storage::InitFrom(Storage* m) { cyclus::Facility::InitFrom(m);
1269 int rawcycpp_shape_in_commods[2] = {-1, -1};
1270 cycpp_shape_in_commods = std::vector<int>(rawcycpp_shape_in_commods, rawcycpp_shape_in_commods + 2);
1271 int rawcycpp_shape_in_commod_prefs[2] = {-1, -1};
1272 cycpp_shape_in_commod_prefs = std::vector<int>(rawcycpp_shape_in_commod_prefs, rawcycpp_shape_in_commod_prefs + 2);
1273 int rawcycpp_shape_out_commods[2] = {-1, -1};
1274 cycpp_shape_out_commods = std::vector<int>(rawcycpp_shape_out_commods, rawcycpp_shape_out_commods + 2);
1275 int rawcycpp_shape_in_recipe[1] = {-1};
1276 cycpp_shape_in_recipe = std::vector<int>(rawcycpp_shape_in_recipe, rawcycpp_shape_in_recipe + 1);
1277 int rawcycpp_shape_residence_time[1] = {-1};
1278 cycpp_shape_residence_time = std::vector<int>(rawcycpp_shape_residence_time, rawcycpp_shape_residence_time + 1);
1279 int rawcycpp_shape_sell_quantity[1] = {-1};
1280 cycpp_shape_sell_quantity = std::vector<int>(rawcycpp_shape_sell_quantity, rawcycpp_shape_sell_quantity + 1);
1281 int rawcycpp_shape_throughput[1] = {-1};
1282 cycpp_shape_throughput = std::vector<int>(rawcycpp_shape_throughput, rawcycpp_shape_throughput + 1);
1283 int rawcycpp_shape_max_inv_size[1] = {-1};
1284 cycpp_shape_max_inv_size = std::vector<int>(rawcycpp_shape_max_inv_size, rawcycpp_shape_max_inv_size + 1);
1285 int rawcycpp_shape_discrete_handling[1] = {-1};
1286 cycpp_shape_discrete_handling = std::vector<int>(rawcycpp_shape_discrete_handling, rawcycpp_shape_discrete_handling + 1);
1287 int rawcycpp_shape_active_buying_frequency_type[1] = {-1};
1288 cycpp_shape_active_buying_frequency_type = std::vector<int>(rawcycpp_shape_active_buying_frequency_type, rawcycpp_shape_active_buying_frequency_type + 1);
1289 int rawcycpp_shape_active_buying_val[1] = {-1};
1290 cycpp_shape_active_buying_val = std::vector<int>(rawcycpp_shape_active_buying_val, rawcycpp_shape_active_buying_val + 1);
1291 int rawcycpp_shape_active_buying_min[1] = {-1};
1292 cycpp_shape_active_buying_min = std::vector<int>(rawcycpp_shape_active_buying_min, rawcycpp_shape_active_buying_min + 1);
1293 int rawcycpp_shape_active_buying_max[1] = {-1};
1294 cycpp_shape_active_buying_max = std::vector<int>(rawcycpp_shape_active_buying_max, rawcycpp_shape_active_buying_max + 1);
1295 int rawcycpp_shape_active_buying_mean[1] = {-1};
1296 cycpp_shape_active_buying_mean = std::vector<int>(rawcycpp_shape_active_buying_mean, rawcycpp_shape_active_buying_mean + 1);
1297 int rawcycpp_shape_active_buying_stddev[1] = {-1};
1298 cycpp_shape_active_buying_stddev = std::vector<int>(rawcycpp_shape_active_buying_stddev, rawcycpp_shape_active_buying_stddev + 1);
1299 int rawcycpp_shape_active_buying_end_probability[1] = {-1};
1300 cycpp_shape_active_buying_end_probability = std::vector<int>(rawcycpp_shape_active_buying_end_probability, rawcycpp_shape_active_buying_end_probability + 1);
1301 int rawcycpp_shape_active_buying_disruption_probability[1] = {-1};
1302 cycpp_shape_active_buying_disruption_probability = std::vector<int>(rawcycpp_shape_active_buying_disruption_probability, rawcycpp_shape_active_buying_disruption_probability + 1);
1303 int rawcycpp_shape_active_buying_disruption[1] = {-1};
1304 cycpp_shape_active_buying_disruption = std::vector<int>(rawcycpp_shape_active_buying_disruption, rawcycpp_shape_active_buying_disruption + 1);
1305 int rawcycpp_shape_dormant_buying_frequency_type[1] = {-1};
1306 cycpp_shape_dormant_buying_frequency_type = std::vector<int>(rawcycpp_shape_dormant_buying_frequency_type, rawcycpp_shape_dormant_buying_frequency_type + 1);
1307 int rawcycpp_shape_dormant_buying_val[1] = {-1};
1308 cycpp_shape_dormant_buying_val = std::vector<int>(rawcycpp_shape_dormant_buying_val, rawcycpp_shape_dormant_buying_val + 1);
1309 int rawcycpp_shape_dormant_buying_min[1] = {-1};
1310 cycpp_shape_dormant_buying_min = std::vector<int>(rawcycpp_shape_dormant_buying_min, rawcycpp_shape_dormant_buying_min + 1);
1311 int rawcycpp_shape_dormant_buying_max[1] = {-1};
1312 cycpp_shape_dormant_buying_max = std::vector<int>(rawcycpp_shape_dormant_buying_max, rawcycpp_shape_dormant_buying_max + 1);
1313 int rawcycpp_shape_dormant_buying_mean[1] = {-1};
1314 cycpp_shape_dormant_buying_mean = std::vector<int>(rawcycpp_shape_dormant_buying_mean, rawcycpp_shape_dormant_buying_mean + 1);
1315 int rawcycpp_shape_dormant_buying_stddev[1] = {-1};
1316 cycpp_shape_dormant_buying_stddev = std::vector<int>(rawcycpp_shape_dormant_buying_stddev, rawcycpp_shape_dormant_buying_stddev + 1);
1317 int rawcycpp_shape_dormant_buying_end_probability[1] = {-1};
1318 cycpp_shape_dormant_buying_end_probability = std::vector<int>(rawcycpp_shape_dormant_buying_end_probability, rawcycpp_shape_dormant_buying_end_probability + 1);
1319 int rawcycpp_shape_dormant_buying_disruption_probability[1] = {-1};
1320 cycpp_shape_dormant_buying_disruption_probability = std::vector<int>(rawcycpp_shape_dormant_buying_disruption_probability, rawcycpp_shape_dormant_buying_disruption_probability + 1);
1321 int rawcycpp_shape_dormant_buying_disruption[1] = {-1};
1322 cycpp_shape_dormant_buying_disruption = std::vector<int>(rawcycpp_shape_dormant_buying_disruption, rawcycpp_shape_dormant_buying_disruption + 1);
1323 int rawcycpp_shape_buying_size_type[1] = {-1};
1324 cycpp_shape_buying_size_type = std::vector<int>(rawcycpp_shape_buying_size_type, rawcycpp_shape_buying_size_type + 1);
1325 int rawcycpp_shape_buying_size_val[1] = {-1};
1326 cycpp_shape_buying_size_val = std::vector<int>(rawcycpp_shape_buying_size_val, rawcycpp_shape_buying_size_val + 1);
1327 int rawcycpp_shape_buying_size_min[1] = {-1};
1328 cycpp_shape_buying_size_min = std::vector<int>(rawcycpp_shape_buying_size_min, rawcycpp_shape_buying_size_min + 1);
1329 int rawcycpp_shape_buying_size_max[1] = {-1};
1330 cycpp_shape_buying_size_max = std::vector<int>(rawcycpp_shape_buying_size_max, rawcycpp_shape_buying_size_max + 1);
1331 int rawcycpp_shape_buying_size_mean[1] = {-1};
1332 cycpp_shape_buying_size_mean = std::vector<int>(rawcycpp_shape_buying_size_mean, rawcycpp_shape_buying_size_mean + 1);
1333 int rawcycpp_shape_buying_size_stddev[1] = {-1};
1334 cycpp_shape_buying_size_stddev = std::vector<int>(rawcycpp_shape_buying_size_stddev, rawcycpp_shape_buying_size_stddev + 1);
1335 int rawcycpp_shape_reorder_point[1] = {-1};
1336 cycpp_shape_reorder_point = std::vector<int>(rawcycpp_shape_reorder_point, rawcycpp_shape_reorder_point + 1);
1337 int rawcycpp_shape_reorder_quantity[1] = {-1};
1338 cycpp_shape_reorder_quantity = std::vector<int>(rawcycpp_shape_reorder_quantity, rawcycpp_shape_reorder_quantity + 1);
1339 int rawcycpp_shape_cumulative_cap[1] = {-1};
1340 cycpp_shape_cumulative_cap = std::vector<int>(rawcycpp_shape_cumulative_cap, rawcycpp_shape_cumulative_cap + 1);
1341 int rawcycpp_shape_package[1] = {-1};
1342 cycpp_shape_package = std::vector<int>(rawcycpp_shape_package, rawcycpp_shape_package + 1);
1343 int rawcycpp_shape_transport_unit[1] = {-1};
1344 cycpp_shape_transport_unit = std::vector<int>(rawcycpp_shape_transport_unit, rawcycpp_shape_transport_unit + 1);
1345 int rawcycpp_shape_inventory[2] = {-1, -1};
1346 cycpp_shape_inventory = std::vector<int>(rawcycpp_shape_inventory, rawcycpp_shape_inventory + 2);
1347 int rawcycpp_shape_stocks[2] = {-1, -1};
1348 cycpp_shape_stocks = std::vector<int>(rawcycpp_shape_stocks, rawcycpp_shape_stocks + 2);
1349 int rawcycpp_shape_ready[2] = {-1, -1};
1350 cycpp_shape_ready = std::vector<int>(rawcycpp_shape_ready, rawcycpp_shape_ready + 2);
1351 int rawcycpp_shape_processing[2] = {-1, -1};
1352 cycpp_shape_processing = std::vector<int>(rawcycpp_shape_processing, rawcycpp_shape_processing + 2);
1353 int rawcycpp_shape_inventory_tracker[1] = {-1};
1354 cycpp_shape_inventory_tracker = std::vector<int>(rawcycpp_shape_inventory_tracker, rawcycpp_shape_inventory_tracker + 1);
1355 int rawcycpp_shape_latitude[1] = {-1};
1356 cycpp_shape_latitude = std::vector<int>(rawcycpp_shape_latitude, rawcycpp_shape_latitude + 1);
1357 int rawcycpp_shape_longitude[1] = {-1};
1358 cycpp_shape_longitude = std::vector<int>(rawcycpp_shape_longitude, rawcycpp_shape_longitude + 1);
1362 in_recipe = m->in_recipe;
1395 package = m->package;
1397 latitude = m->latitude;
1398 longitude = m->longitude;
1399 inventory.capacity(m->inventory.capacity());
1400 stocks.capacity(m->stocks.capacity());
1401 ready.capacity(m->ready.capacity());
1402 processing.capacity(m->processing.capacity());
1403 inventory_tracker.capacity();
1404#line 37 "/cycamore/src/storage.cc"
1405 cyclus::toolkit::CommodityProducer::Copy(m);
1406}
1407
1408//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1409void Storage::InitFrom(cyclus::QueryableBackend* b) { cyclus::Facility::InitFrom(b);
1410 int rawcycpp_shape_in_commods[2] = {-1, -1};
1411 cycpp_shape_in_commods = std::vector<int>(rawcycpp_shape_in_commods, rawcycpp_shape_in_commods + 2);
1412 int rawcycpp_shape_in_commod_prefs[2] = {-1, -1};
1413 cycpp_shape_in_commod_prefs = std::vector<int>(rawcycpp_shape_in_commod_prefs, rawcycpp_shape_in_commod_prefs + 2);
1414 int rawcycpp_shape_out_commods[2] = {-1, -1};
1415 cycpp_shape_out_commods = std::vector<int>(rawcycpp_shape_out_commods, rawcycpp_shape_out_commods + 2);
1416 int rawcycpp_shape_in_recipe[1] = {-1};
1417 cycpp_shape_in_recipe = std::vector<int>(rawcycpp_shape_in_recipe, rawcycpp_shape_in_recipe + 1);
1418 int rawcycpp_shape_residence_time[1] = {-1};
1419 cycpp_shape_residence_time = std::vector<int>(rawcycpp_shape_residence_time, rawcycpp_shape_residence_time + 1);
1420 int rawcycpp_shape_sell_quantity[1] = {-1};
1421 cycpp_shape_sell_quantity = std::vector<int>(rawcycpp_shape_sell_quantity, rawcycpp_shape_sell_quantity + 1);
1422 int rawcycpp_shape_throughput[1] = {-1};
1423 cycpp_shape_throughput = std::vector<int>(rawcycpp_shape_throughput, rawcycpp_shape_throughput + 1);
1424 int rawcycpp_shape_max_inv_size[1] = {-1};
1425 cycpp_shape_max_inv_size = std::vector<int>(rawcycpp_shape_max_inv_size, rawcycpp_shape_max_inv_size + 1);
1426 int rawcycpp_shape_discrete_handling[1] = {-1};
1427 cycpp_shape_discrete_handling = std::vector<int>(rawcycpp_shape_discrete_handling, rawcycpp_shape_discrete_handling + 1);
1428 int rawcycpp_shape_active_buying_frequency_type[1] = {-1};
1429 cycpp_shape_active_buying_frequency_type = std::vector<int>(rawcycpp_shape_active_buying_frequency_type, rawcycpp_shape_active_buying_frequency_type + 1);
1430 int rawcycpp_shape_active_buying_val[1] = {-1};
1431 cycpp_shape_active_buying_val = std::vector<int>(rawcycpp_shape_active_buying_val, rawcycpp_shape_active_buying_val + 1);
1432 int rawcycpp_shape_active_buying_min[1] = {-1};
1433 cycpp_shape_active_buying_min = std::vector<int>(rawcycpp_shape_active_buying_min, rawcycpp_shape_active_buying_min + 1);
1434 int rawcycpp_shape_active_buying_max[1] = {-1};
1435 cycpp_shape_active_buying_max = std::vector<int>(rawcycpp_shape_active_buying_max, rawcycpp_shape_active_buying_max + 1);
1436 int rawcycpp_shape_active_buying_mean[1] = {-1};
1437 cycpp_shape_active_buying_mean = std::vector<int>(rawcycpp_shape_active_buying_mean, rawcycpp_shape_active_buying_mean + 1);
1438 int rawcycpp_shape_active_buying_stddev[1] = {-1};
1439 cycpp_shape_active_buying_stddev = std::vector<int>(rawcycpp_shape_active_buying_stddev, rawcycpp_shape_active_buying_stddev + 1);
1440 int rawcycpp_shape_active_buying_end_probability[1] = {-1};
1441 cycpp_shape_active_buying_end_probability = std::vector<int>(rawcycpp_shape_active_buying_end_probability, rawcycpp_shape_active_buying_end_probability + 1);
1442 int rawcycpp_shape_active_buying_disruption_probability[1] = {-1};
1443 cycpp_shape_active_buying_disruption_probability = std::vector<int>(rawcycpp_shape_active_buying_disruption_probability, rawcycpp_shape_active_buying_disruption_probability + 1);
1444 int rawcycpp_shape_active_buying_disruption[1] = {-1};
1445 cycpp_shape_active_buying_disruption = std::vector<int>(rawcycpp_shape_active_buying_disruption, rawcycpp_shape_active_buying_disruption + 1);
1446 int rawcycpp_shape_dormant_buying_frequency_type[1] = {-1};
1447 cycpp_shape_dormant_buying_frequency_type = std::vector<int>(rawcycpp_shape_dormant_buying_frequency_type, rawcycpp_shape_dormant_buying_frequency_type + 1);
1448 int rawcycpp_shape_dormant_buying_val[1] = {-1};
1449 cycpp_shape_dormant_buying_val = std::vector<int>(rawcycpp_shape_dormant_buying_val, rawcycpp_shape_dormant_buying_val + 1);
1450 int rawcycpp_shape_dormant_buying_min[1] = {-1};
1451 cycpp_shape_dormant_buying_min = std::vector<int>(rawcycpp_shape_dormant_buying_min, rawcycpp_shape_dormant_buying_min + 1);
1452 int rawcycpp_shape_dormant_buying_max[1] = {-1};
1453 cycpp_shape_dormant_buying_max = std::vector<int>(rawcycpp_shape_dormant_buying_max, rawcycpp_shape_dormant_buying_max + 1);
1454 int rawcycpp_shape_dormant_buying_mean[1] = {-1};
1455 cycpp_shape_dormant_buying_mean = std::vector<int>(rawcycpp_shape_dormant_buying_mean, rawcycpp_shape_dormant_buying_mean + 1);
1456 int rawcycpp_shape_dormant_buying_stddev[1] = {-1};
1457 cycpp_shape_dormant_buying_stddev = std::vector<int>(rawcycpp_shape_dormant_buying_stddev, rawcycpp_shape_dormant_buying_stddev + 1);
1458 int rawcycpp_shape_dormant_buying_end_probability[1] = {-1};
1459 cycpp_shape_dormant_buying_end_probability = std::vector<int>(rawcycpp_shape_dormant_buying_end_probability, rawcycpp_shape_dormant_buying_end_probability + 1);
1460 int rawcycpp_shape_dormant_buying_disruption_probability[1] = {-1};
1461 cycpp_shape_dormant_buying_disruption_probability = std::vector<int>(rawcycpp_shape_dormant_buying_disruption_probability, rawcycpp_shape_dormant_buying_disruption_probability + 1);
1462 int rawcycpp_shape_dormant_buying_disruption[1] = {-1};
1463 cycpp_shape_dormant_buying_disruption = std::vector<int>(rawcycpp_shape_dormant_buying_disruption, rawcycpp_shape_dormant_buying_disruption + 1);
1464 int rawcycpp_shape_buying_size_type[1] = {-1};
1465 cycpp_shape_buying_size_type = std::vector<int>(rawcycpp_shape_buying_size_type, rawcycpp_shape_buying_size_type + 1);
1466 int rawcycpp_shape_buying_size_val[1] = {-1};
1467 cycpp_shape_buying_size_val = std::vector<int>(rawcycpp_shape_buying_size_val, rawcycpp_shape_buying_size_val + 1);
1468 int rawcycpp_shape_buying_size_min[1] = {-1};
1469 cycpp_shape_buying_size_min = std::vector<int>(rawcycpp_shape_buying_size_min, rawcycpp_shape_buying_size_min + 1);
1470 int rawcycpp_shape_buying_size_max[1] = {-1};
1471 cycpp_shape_buying_size_max = std::vector<int>(rawcycpp_shape_buying_size_max, rawcycpp_shape_buying_size_max + 1);
1472 int rawcycpp_shape_buying_size_mean[1] = {-1};
1473 cycpp_shape_buying_size_mean = std::vector<int>(rawcycpp_shape_buying_size_mean, rawcycpp_shape_buying_size_mean + 1);
1474 int rawcycpp_shape_buying_size_stddev[1] = {-1};
1475 cycpp_shape_buying_size_stddev = std::vector<int>(rawcycpp_shape_buying_size_stddev, rawcycpp_shape_buying_size_stddev + 1);
1476 int rawcycpp_shape_reorder_point[1] = {-1};
1477 cycpp_shape_reorder_point = std::vector<int>(rawcycpp_shape_reorder_point, rawcycpp_shape_reorder_point + 1);
1478 int rawcycpp_shape_reorder_quantity[1] = {-1};
1479 cycpp_shape_reorder_quantity = std::vector<int>(rawcycpp_shape_reorder_quantity, rawcycpp_shape_reorder_quantity + 1);
1480 int rawcycpp_shape_cumulative_cap[1] = {-1};
1481 cycpp_shape_cumulative_cap = std::vector<int>(rawcycpp_shape_cumulative_cap, rawcycpp_shape_cumulative_cap + 1);
1482 int rawcycpp_shape_package[1] = {-1};
1483 cycpp_shape_package = std::vector<int>(rawcycpp_shape_package, rawcycpp_shape_package + 1);
1484 int rawcycpp_shape_transport_unit[1] = {-1};
1485 cycpp_shape_transport_unit = std::vector<int>(rawcycpp_shape_transport_unit, rawcycpp_shape_transport_unit + 1);
1486 int rawcycpp_shape_inventory[2] = {-1, -1};
1487 cycpp_shape_inventory = std::vector<int>(rawcycpp_shape_inventory, rawcycpp_shape_inventory + 2);
1488 int rawcycpp_shape_stocks[2] = {-1, -1};
1489 cycpp_shape_stocks = std::vector<int>(rawcycpp_shape_stocks, rawcycpp_shape_stocks + 2);
1490 int rawcycpp_shape_ready[2] = {-1, -1};
1491 cycpp_shape_ready = std::vector<int>(rawcycpp_shape_ready, rawcycpp_shape_ready + 2);
1492 int rawcycpp_shape_processing[2] = {-1, -1};
1493 cycpp_shape_processing = std::vector<int>(rawcycpp_shape_processing, rawcycpp_shape_processing + 2);
1494 int rawcycpp_shape_inventory_tracker[1] = {-1};
1495 cycpp_shape_inventory_tracker = std::vector<int>(rawcycpp_shape_inventory_tracker, rawcycpp_shape_inventory_tracker + 1);
1496 int rawcycpp_shape_latitude[1] = {-1};
1497 cycpp_shape_latitude = std::vector<int>(rawcycpp_shape_latitude, rawcycpp_shape_latitude + 1);
1498 int rawcycpp_shape_longitude[1] = {-1};
1499 cycpp_shape_longitude = std::vector<int>(rawcycpp_shape_longitude, rawcycpp_shape_longitude + 1);
1500 cyclus::QueryResult qr = b->Query("Info", NULL);
1501 in_commods = qr.GetVal<std::vector< std::string > >("in_commods");
1502 in_commod_prefs = qr.GetVal<std::vector< double > >("in_commod_prefs");
1503 out_commods = qr.GetVal<std::vector< std::string > >("out_commods");
1504 in_recipe = qr.GetVal<std::string>("in_recipe");
1505 residence_time = qr.GetVal<int>("residence_time");
1506 sell_quantity = qr.GetVal<double>("sell_quantity");
1507 throughput = qr.GetVal<double>("throughput");
1508 max_inv_size = qr.GetVal<double>("max_inv_size");
1509 discrete_handling = qr.GetVal<bool>("discrete_handling");
1510 active_buying_frequency_type = qr.GetVal<std::string>("active_buying_frequency_type");
1511 active_buying_val = qr.GetVal<int>("active_buying_val");
1512 active_buying_min = qr.GetVal<int>("active_buying_min");
1513 active_buying_max = qr.GetVal<int>("active_buying_max");
1514 active_buying_mean = qr.GetVal<double>("active_buying_mean");
1515 active_buying_stddev = qr.GetVal<double>("active_buying_stddev");
1516 active_buying_end_probability = qr.GetVal<double>("active_buying_end_probability");
1517 active_buying_disruption_probability = qr.GetVal<double>("active_buying_disruption_probability");
1518 active_buying_disruption = qr.GetVal<int>("active_buying_disruption");
1519 dormant_buying_frequency_type = qr.GetVal<std::string>("dormant_buying_frequency_type");
1520 dormant_buying_val = qr.GetVal<int>("dormant_buying_val");
1521 dormant_buying_min = qr.GetVal<int>("dormant_buying_min");
1522 dormant_buying_max = qr.GetVal<int>("dormant_buying_max");
1523 dormant_buying_mean = qr.GetVal<double>("dormant_buying_mean");
1524 dormant_buying_stddev = qr.GetVal<double>("dormant_buying_stddev");
1525 dormant_buying_end_probability = qr.GetVal<double>("dormant_buying_end_probability");
1526 dormant_buying_disruption_probability = qr.GetVal<double>("dormant_buying_disruption_probability");
1527 dormant_buying_disruption = qr.GetVal<int>("dormant_buying_disruption");
1528 buying_size_type = qr.GetVal<std::string>("buying_size_type");
1529 buying_size_val = qr.GetVal<double>("buying_size_val");
1530 buying_size_min = qr.GetVal<double>("buying_size_min");
1531 buying_size_max = qr.GetVal<double>("buying_size_max");
1532 buying_size_mean = qr.GetVal<double>("buying_size_mean");
1533 buying_size_stddev = qr.GetVal<double>("buying_size_stddev");
1534 reorder_point = qr.GetVal<double>("reorder_point");
1535 reorder_quantity = qr.GetVal<double>("reorder_quantity");
1536 cumulative_cap = qr.GetVal<double>("cumulative_cap");
1537 package = qr.GetVal<std::string>("package");
1538 transport_unit = qr.GetVal<std::string>("transport_unit");
1539 latitude = qr.GetVal<double>("latitude");
1540 longitude = qr.GetVal<double>("longitude");
1541 inventory.capacity(1e+300);
1542 stocks.capacity(1e+300);
1543 ready.capacity(1e+300);
1544 processing.capacity(1e+300);
1545 inventory_tracker.capacity();
1546#line 43 "/cycamore/src/storage.cc"
1547
1548 cyclus::toolkit::Commodity commod = cyclus::toolkit::Commodity(out_commods.front());
1549 cyclus::toolkit::CommodityProducer::Add(commod);
1550 cyclus::toolkit::CommodityProducer::SetCapacity(commod, throughput);
1551}
1552
1556 throw cyclus::ValueError("Active min larger than max.");
1557 }
1559 throw cyclus::ValueError("Dormant min larger than max.");
1560 }
1562 throw cyclus::ValueError("Buying size min larger than max.");
1563 }
1564
1565 if (active_buying_frequency_type == "Fixed") {
1566 active_dist_ = cyclus::FixedIntDist::Ptr (new cyclus::FixedIntDist(active_buying_val));
1567 }
1568 else if (active_buying_frequency_type == "Uniform") {
1569 if ((active_buying_min == -1) || (active_buying_max == -1)) {
1570 throw cyclus::ValueError("Invalid active buying frequency range. Please provide both a min and max value.");
1571 }
1572 active_dist_ = cyclus::UniformIntDist::Ptr (new cyclus::UniformIntDist(active_buying_min, active_buying_max));
1573 }
1574 else if (active_buying_frequency_type == "Normal") {
1575 if ((active_buying_mean == -1) || (active_buying_stddev == -1)) {
1576 throw cyclus::ValueError("Invalid active buying frequency range. Please provide both a mean and standard deviation value.");
1577 }
1578 if (active_buying_min == -1) {active_buying_min = 1;}
1579 if (active_buying_max == -1) {
1580 active_buying_max = std::numeric_limits<int>::max();}
1581
1582 active_dist_ = cyclus::NormalIntDist::Ptr (new cyclus::NormalIntDist(active_buying_mean, active_buying_stddev,
1584 }
1585 else if (active_buying_frequency_type == "Binomial") {
1587 throw cyclus::ValueError("Active buying end probability must be between 0 and 1");
1588 }
1589 int success = 1; // only one success is needed to end the active buying period
1590 active_dist_ = cyclus::NegativeBinomialIntDist::Ptr (new cyclus::NegativeBinomialIntDist(success, active_buying_end_probability));
1591 } else if (active_buying_frequency_type == "FixedWithDisruption") {
1592 if (active_buying_disruption < 0) {
1593 throw cyclus::ValueError("Disruption must be greater than or equal to 0");
1594 }
1595 active_dist_ = cyclus::BinaryIntDist::Ptr (
1596 new cyclus::BinaryIntDist(active_buying_disruption_probability,
1598 }
1599 else {
1600 throw cyclus::ValueError("Invalid active buying frequency type");}
1601
1603 if (dormant_buying_frequency_type == "Fixed") {
1604 dormant_dist_ = cyclus::FixedIntDist::Ptr (new cyclus::FixedIntDist(dormant_buying_val));
1605 }
1606 else if (dormant_buying_frequency_type == "Uniform") {
1607 if ((dormant_buying_min == -1) || (dormant_buying_max == -1)) {
1608 throw cyclus::ValueError("Invalid dormant buying frequency range. Please provide both a min and max value.");
1609 }
1610 dormant_dist_ = cyclus::UniformIntDist::Ptr (new cyclus::UniformIntDist(dormant_buying_min, dormant_buying_max));
1611 }
1612 else if (dormant_buying_frequency_type == "Normal") {
1613 if ((dormant_buying_mean == -1) || (dormant_buying_stddev == -1)) {
1614 throw cyclus::ValueError("Invalid dormant buying frequency range. Please provide both a mean and standard deviation value.");
1615 }
1616 if (dormant_buying_min == -1) {dormant_buying_min = 1;}
1617 if (dormant_buying_max == -1) {
1618 dormant_buying_max = std::numeric_limits<int>::max();}
1619 dormant_dist_ = cyclus::NormalIntDist::Ptr (new cyclus::NormalIntDist(dormant_buying_mean, dormant_buying_stddev,
1621 }
1622 else if (dormant_buying_frequency_type == "Binomial") {
1624 throw cyclus::ValueError("Dormant buying end probability must be between 0 and 1");
1625 }
1626 int success = 1; // only one success is needed to end the dormant buying period
1627 dormant_dist_ = cyclus::NegativeBinomialIntDist::Ptr (new cyclus::NegativeBinomialIntDist(success, dormant_buying_end_probability));
1628 } else if (dormant_buying_frequency_type == "FixedWithDisruption") {
1629 if (dormant_buying_disruption < 0) {
1630 throw cyclus::ValueError("Disruption must be greater than or equal to 0");
1631 }
1632 dormant_dist_ = cyclus::BinaryIntDist::Ptr (
1633 new cyclus::BinaryIntDist(dormant_buying_disruption_probability,
1635 }
1636 else {
1637 throw cyclus::ValueError("Invalid dormant buying frequency type");}
1638
1640 if (buying_size_type == "Fixed") {
1641 size_dist_ = cyclus::FixedDoubleDist::Ptr (new cyclus::FixedDoubleDist(buying_size_val));
1642 }
1643 else if (buying_size_type == "Uniform") {
1644 if ((buying_size_min == -1) || (buying_size_max == -1)) {
1645 throw cyclus::ValueError("Invalid buying size range. Please provide both a min and max value.");
1646 }
1647 size_dist_ = cyclus::UniformDoubleDist::Ptr (new cyclus::UniformDoubleDist(buying_size_min, buying_size_max));
1648 }
1649 else if (buying_size_type == "Normal") {
1650 if ((buying_size_mean == -1) || (buying_size_stddev == -1)) {
1651 throw cyclus::ValueError("Invalid buying size range. Please provide both a mean and standard deviation value.");
1652 }
1653 if (buying_size_min == -1) {buying_size_min = 0;}
1654 if (buying_size_max == -1) {buying_size_max = 1;}
1655 size_dist_ = cyclus::NormalDoubleDist::Ptr (new cyclus::NormalDoubleDist(buying_size_mean, buying_size_stddev,
1657 }
1658 else {
1659 throw cyclus::ValueError("Invalid buying size type");}
1660}
1661
1662//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1664 cyclus::Facility::EnterNotify();
1665
1666 inventory_tracker.set_capacity(max_inv_size);
1667 if (reorder_point < 0 && cumulative_cap <= 0) {
1669 buy_policy.Init(this, &inventory, std::string("inventory"),
1672 }
1673 else if (cumulative_cap > 0) {
1675 buy_policy.Init(this, &inventory, std::string("inventory"),
1678 }
1679 else if (reorder_quantity > 0) {
1681 throw cyclus::ValueError(
1682 "reorder_point + reorder_quantity must be less than or equal to max_inv_size");
1683 }
1684 buy_policy.Init(this, &inventory, std::string("inventory"),
1687 }
1688 else {
1689 buy_policy.Init(this, &inventory, std::string("inventory"),
1692 }
1693
1694 // dummy comp, use in_recipe if provided
1695 cyclus::CompMap v;
1696 cyclus::Composition::Ptr comp = cyclus::Composition::CreateFromAtom(v);
1697 if (in_recipe != "") {
1698 comp = context()->GetRecipe(in_recipe);
1699 }
1700
1701 if (in_commod_prefs.size() == 0) {
1702 for (int i = 0; i < in_commods.size(); ++i) {
1703 in_commod_prefs.push_back(cyclus::kDefaultPref);
1704 }
1705 } else if (in_commod_prefs.size() != in_commods.size()) {
1706 std::stringstream ss;
1707 ss << "in_commod_prefs has " << in_commod_prefs.size()
1708 << " values, expected " << in_commods.size();
1709 throw cyclus::ValueError(ss.str());
1710 }
1711
1712 for (int i = 0; i != in_commods.size(); ++i) {
1713 buy_policy.Set(in_commods[i], comp, in_commod_prefs[i]);
1714 }
1715 buy_policy.Start();
1716
1717 std::string package_name_ = context()->GetPackage(package)->name();
1718 std::string tu_name_ = context()->GetTransportUnit(transport_unit)->name();
1719 if (out_commods.size() == 1) {
1720 sell_policy.Init(this, &stocks, std::string("stocks"), cyclus::CY_LARGE_DOUBLE, false,
1721 sell_quantity, package_name_, tu_name_)
1722 .Set(out_commods.front())
1723 .Start();
1724
1725 } else {
1726 std::stringstream ss;
1727 ss << "out_commods has " << out_commods.size() << " values, expected 1.";
1728 throw cyclus::ValueError(ss.str());
1729 }
1731}
1732
1733//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1734std::string Storage::str() {
1735 std::stringstream ss;
1736 std::string ans, out_str;
1737 if (out_commods.size() == 1) {
1738 out_str = out_commods.front();
1739 } else {
1740 out_str = "";
1741 }
1742 if (cyclus::toolkit::CommodityProducer::Produces(
1743 cyclus::toolkit::Commodity(out_str))) {
1744 ans = "yes";
1745 } else {
1746 ans = "no";
1747 }
1748 ss << cyclus::Facility::str();
1749 ss << " has facility parameters {"
1750 << "\n"
1751 << " Output Commodity = " << out_str << ",\n"
1752 << " Residence Time = " << residence_time << ",\n"
1753 << " Throughput = " << throughput << ",\n"
1754 << " commod producer members: "
1755 << " produces " << out_str << "?:" << ans << "'}";
1756 return ss.str();
1757}
1758
1759//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1761
1762
1763 LOG(cyclus::LEV_INFO3, "ComCnv") << prototype() << " is ticking {";
1764
1765 LOG(cyclus::LEV_INFO5, "ComCnv") << "Processing = " << processing.quantity() << ", ready = " << ready.quantity() << ", stocks = " << stocks.quantity() << " and max inventory = " << max_inv_size;
1766
1767 LOG(cyclus::LEV_INFO4, "ComCnv") << "current capacity " << max_inv_size << " - " << processing.quantity() << " - " << ready.quantity() << " - " << stocks.quantity() << " = " << current_capacity();
1768
1769 if (current_capacity() > cyclus::eps_rsrc()) {
1770 LOG(cyclus::LEV_INFO4, "ComCnv")
1771 << " has capacity for " << current_capacity() << ".";
1772 }
1773 LOG(cyclus::LEV_INFO3, "ComCnv") << "}";
1774}
1775
1776//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1778 LOG(cyclus::LEV_INFO3, "ComCnv") << prototype() << " is tocking {";
1779
1780 BeginProcessing_(); // place unprocessed inventory into processing
1781
1782 LOG(cyclus::LEV_INFO4, "ComCnv") << "processing currently holds " << processing.quantity() << ". ready currently holds " << ready.quantity() << ".";
1783
1784 if (ready_time() >= 0 || residence_time == 0 && !inventory.empty()) {
1785 ReadyMatl_(ready_time()); // place processing into ready
1786 }
1787
1788 LOG(cyclus::LEV_INFO5, "ComCnv") << "Ready now holds " << ready.quantity() << " kg.";
1789
1790 if (ready.quantity() > throughput) {
1791 LOG(cyclus::LEV_INFO5, "ComCnv") << "Up to " << throughput << " kg will be placed in stocks based on throughput limits. ";
1792 }
1793
1794 ProcessMat_(throughput); // place ready into stocks
1795
1796 std::vector<double>::iterator result;
1797 result = std::max_element(in_commod_prefs.begin(), in_commod_prefs.end());
1798 int maxindx = std::distance(in_commod_prefs.begin(), result);
1799 double demand = 0;
1800 demand = current_capacity();
1801
1802 cyclus::toolkit::RecordTimeSeries<double>("demand"+in_commods[maxindx], this, demand);
1803
1804 // Multiple commodity tracking is not supported, user can only
1805 // provide one value for out_commods, despite it being a vector of strings.
1806 cyclus::toolkit::RecordTimeSeries<double>("supply"+out_commods[0], this,
1807 stocks.quantity());
1808
1809 LOG(cyclus::LEV_INFO4, "ComCnv") << "process has "
1810 << processing.quantity() << ". Ready has " << ready.quantity() << ". Stocks has " << stocks.quantity() << ".";
1811 LOG(cyclus::LEV_INFO3, "ComCnv") << "}";
1812}
1813
1814//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1815void Storage::AddMat_(cyclus::Material::Ptr mat) {
1816 LOG(cyclus::LEV_INFO5, "ComCnv") << prototype() << " is initially holding "
1817 << inventory.quantity() << " total.";
1818
1819 try {
1820 inventory.Push(mat);
1821 } catch (cyclus::Error& e) {
1822 e.msg(Agent::InformErrorMsg(e.msg()));
1823 throw e;
1824 }
1825
1826 LOG(cyclus::LEV_INFO5, "ComCnv")
1827 << prototype() << " added " << mat->quantity()
1828 << " of material to its inventory, which is holding "
1829 << inventory.quantity() << " total.";
1830}
1831
1832//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1834 while (inventory.count() > 0) {
1835 try {
1836 processing.Push(inventory.Pop());
1837 entry_times.push_back(context()->time());
1838
1839 LOG(cyclus::LEV_DEBUG2, "ComCnv")
1840 << "Storage " << prototype()
1841 << " added resources to processing at t= " << context()->time();
1842 } catch (cyclus::Error& e) {
1843 e.msg(Agent::InformErrorMsg(e.msg()));
1844 throw e;
1845 }
1846 }
1847}
1848
1849//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1850void Storage::ProcessMat_(double cap) {
1851 if (!ready.empty()) {
1852 try {
1853 double max_pop = std::min(cap, ready.quantity());
1854
1855 if (discrete_handling) {
1856 if (max_pop == ready.quantity()) {
1857 stocks.Push(ready.PopN(ready.count()));
1858 } else {
1859 double cap_pop = ready.Peek()->quantity();
1860 while (cap_pop <= max_pop && !ready.empty()) {
1861 stocks.Push(ready.Pop());
1862 cap_pop += ready.empty() ? 0 : ready.Peek()->quantity();
1863 }
1864 }
1865 } else {
1866 stocks.Push(ready.Pop(max_pop, cyclus::eps_rsrc()));
1867 }
1868
1869 LOG(cyclus::LEV_INFO4, "ComCnv") << "Storage " << prototype()
1870 << " moved resources"
1871 << " from ready to stocks"
1872 << " at t= " << context()->time();
1873 } catch (cyclus::Error& e) {
1874 e.msg(Agent::InformErrorMsg(e.msg()));
1875 throw e;
1876 }
1877 }
1878}
1879
1880//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1881void Storage::ReadyMatl_(int time) {
1882 LOG(cyclus::LEV_INFO5, "ComCnv") << "Placing material into ready";
1883
1884 int to_ready = 0;
1885
1886 while (!entry_times.empty() && entry_times.front() <= time) {
1887 entry_times.pop_front();
1888 ++to_ready;
1889 }
1890
1891 ready.Push(processing.PopN(to_ready));
1892}
1893
1895 std::string specification = this->spec();
1896 context()
1897 ->NewDatum("AgentPosition")
1898 ->AddVal("Spec", specification)
1899 ->AddVal("Prototype", this->prototype())
1900 ->AddVal("AgentId", id())
1901 ->AddVal("Latitude", latitude)
1902 ->AddVal("Longitude", longitude)
1903 ->Record();
1904}
1905
1906
1907// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1908extern "C" cyclus::Agent* ConstructStorage(cyclus::Context* ctx) {
1909 return new Storage(ctx);
1910}
1911
1912} // namespace cycamore
cyclus::toolkit::ResBuf< cyclus::Material > inventory
This Facility is intended to hold materials for a user specified amount of time in order to model a s...
Storage(cyclus::Context *ctx)
void AddMat_(cyclus::Material::Ptr mat)
adds a material into the incoming commodity inventory
std::vector< int > cycpp_shape_dormant_buying_min
virtual std::string str()
A verbose printer for the Storage Facility.
std::vector< int > cycpp_shape_inventory_tracker
double current_capacity()
current maximum amount that can be added to processing
std::vector< int > cycpp_shape_buying_size_stddev
cyclus::IntDistribution::Ptr active_dist_
cyclus::toolkit::MatlSellPolicy sell_policy
std::vector< int > cycpp_shape_buying_size_max
std::vector< int > cycpp_shape_active_buying_val
virtual std::string schema()
std::vector< int > cycpp_shape_processing
cyclus::toolkit::ResBuf< cyclus::Material > ready
cyclus::DoubleDistribution::Ptr size_dist_
std::vector< int > cycpp_shape_reorder_point
std::vector< int > cycpp_shape_cumulative_cap
std::vector< int > cycpp_shape_active_buying_end_probability
std::vector< double > in_commod_prefs
std::vector< int > cycpp_shape_longitude
std::vector< int > cycpp_shape_dormant_buying_max
std::vector< int > cycpp_shape_dormant_buying_mean
std::vector< int > cycpp_shape_buying_size_type
cyclus::toolkit::ResBuf< cyclus::Material > processing
std::vector< int > cycpp_shape_active_buying_disruption_probability
virtual void InitFrom(cycamore::Storage *m)
std::vector< int > cycpp_shape_residence_time
std::vector< int > cycpp_shape_out_commods
cyclus::toolkit::TotalInvTracker inventory_tracker
std::vector< int > cycpp_shape_dormant_buying_stddev
virtual cyclus::Agent * Clone()
std::vector< int > cycpp_shape_package
std::vector< int > cycpp_shape_in_commods
virtual void InfileToDb(cyclus::InfileTree *tree, cyclus::DbInit di)
std::vector< std::string > in_commods
std::vector< int > cycpp_shape_active_buying_stddev
cyclus::IntDistribution::Ptr dormant_dist_
std::vector< int > cycpp_shape_buying_size_min
virtual void Tock()
The handleTick function specific to the Storage.
std::vector< int > cycpp_shape_dormant_buying_end_probability
std::vector< int > cycpp_shape_max_inv_size
void InitBuyPolicyParameters()
sets up the distributions for the buy policy
std::vector< int > cycpp_shape_buying_size_mean
std::string active_buying_frequency_type
std::string dormant_buying_frequency_type
cyclus::toolkit::ResBuf< cyclus::Material > inventory
int ready_time()
returns the time key for ready materials
std::vector< int > cycpp_shape_buying_size_val
std::vector< int > cycpp_shape_dormant_buying_val
void ProcessMat_(double cap)
Move as many ready resources as allowable into stocks.
std::vector< int > cycpp_shape_discrete_handling
std::vector< int > cycpp_shape_sell_quantity
std::vector< int > cycpp_shape_reorder_quantity
virtual void InitInv(cyclus::Inventories &inv)
std::vector< int > cycpp_shape_active_buying_min
std::vector< std::string > out_commods
std::list< int > entry_times
std::vector< int > cycpp_shape_dormant_buying_disruption_probability
std::vector< int > cycpp_shape_dormant_buying_frequency_type
std::vector< int > cycpp_shape_latitude
std::vector< int > cycpp_shape_active_buying_max
std::vector< int > cycpp_shape_dormant_buying_disruption
void ReadyMatl_(int time)
move ready resources from processing to ready at a certain time
std::vector< int > cycpp_shape_active_buying_mean
std::vector< int > cycpp_shape_active_buying_frequency_type
void BeginProcessing_()
Move all unprocessed inventory to processing.
std::vector< int > cycpp_shape_inventory
std::vector< int > cycpp_shape_transport_unit
cyclus::toolkit::ResBuf< cyclus::Material > stocks
std::vector< int > cycpp_shape_active_buying_disruption
virtual void EnterNotify()
Sets up the Storage Facility's trade requests.
virtual Json::Value annotations()
std::vector< int > cycpp_shape_in_commod_prefs
virtual cyclus::Inventories SnapshotInv()
std::vector< int > cycpp_shape_stocks
virtual void Snapshot(cyclus::DbInit di)
std::vector< int > cycpp_shape_throughput
cyclus::toolkit::MatlBuyPolicy buy_policy
std::vector< int > cycpp_shape_ready
virtual void Tick()
The handleTick function specific to the Storage.
std::vector< int > cycpp_shape_in_recipe
cyclus::Agent * ConstructStorage(cyclus::Context *ctx)
cyclus::toolkit::Position coordinates