CYCAMORE
Loading...
Searching...
No Matches
build/cycamore/separations.h
Go to the documentation of this file.
1
2#line 1 "/cycamore/src/separations.h"
3#ifndef CYCAMORE_SRC_SEPARATIONS_H_
4#define CYCAMORE_SRC_SEPARATIONS_H_
5
6#include "cyclus.h"
7#include "cycamore_version.h"
8
9#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO
10
11namespace cycamore {
12
20cyclus::Material::Ptr SepMaterial(std::map<int, double> effs,
21 cyclus::Material::Ptr mat);
22
42 : public cyclus::Facility,
43 public cyclus::toolkit::Position {
44#pragma cyclus note { "niche": "separations", "doc": "Separations processes feed material into one or more streams containing" " specific elements and/or nuclides. It uses mass-based efficiencies." "\n\n" "User defined separations streams are specified as groups of" " component-efficiency pairs where 'component' means either a particular" " element or a particular nuclide. Each component's paired efficiency" " represents the mass fraction of that component in the feed that is" " separated into that stream. The efficiencies of a particular component" " across all streams must sum up to less than or equal to one. If less than" " one, the remainining material is sent to a waste inventory and" " (potentially) traded away from there." "\n\n" "The facility receives material into a feed inventory that it processes with" " a specified throughput each time step. Each output stream has a" " corresponding output inventory size/limit. If the facility is unable to" " reduce its stocks by trading and hits this limit for any of its output" " streams, further processing/separations of feed material will halt until" " room is again available in the output streams." "", }
45#line 65 "/cycamore/src/separations.h"
46 public:
47 Separations(cyclus::Context* ctx);
48 virtual ~Separations(){};
49
50 virtual std::string version() { return CYCAMORE_VERSION; }
51
52 virtual void Tick();
53 virtual void Tock();
54 virtual void EnterNotify();
55
56 virtual void AcceptMatlTrades(const std::vector<std::pair<
57 cyclus::Trade<cyclus::Material>, cyclus::Material::Ptr> >& responses);
58
59 virtual std::set<cyclus::RequestPortfolio<cyclus::Material>::Ptr>
61
62 virtual std::set<cyclus::BidPortfolio<cyclus::Material>::Ptr> GetMatlBids(
63 cyclus::CommodMap<cyclus::Material>::type& commod_requests);
64
65 virtual void GetMatlTrades(
66 const std::vector<cyclus::Trade<cyclus::Material> >& trades,
67 std::vector<std::pair<cyclus::Trade<cyclus::Material>,
68 cyclus::Material::Ptr> >& responses);
69
70 virtual bool CheckDecommissionCondition();
71 virtual cyclus::Agent* Clone() {
73 m->InitFrom(this);
74 return m;
75 };
76#line 90 "/cycamore/src/separations.h"
77
79 cyclus::Facility::InitFrom(m);
80 int rawcycpp_shape_feed_commods[2] = {-1, -1};
81 cycpp_shape_feed_commods = std::vector<int>(rawcycpp_shape_feed_commods, rawcycpp_shape_feed_commods + 2);
82 int rawcycpp_shape_feed_commod_prefs[2] = {-1, -1};
83 cycpp_shape_feed_commod_prefs = std::vector<int>(rawcycpp_shape_feed_commod_prefs, rawcycpp_shape_feed_commod_prefs + 2);
84 int rawcycpp_shape_feed_recipe[1] = {-1};
85 cycpp_shape_feed_recipe = std::vector<int>(rawcycpp_shape_feed_recipe, rawcycpp_shape_feed_recipe + 1);
86 int rawcycpp_shape_feedbuf_size[1] = {-1};
87 cycpp_shape_feedbuf_size = std::vector<int>(rawcycpp_shape_feedbuf_size, rawcycpp_shape_feedbuf_size + 1);
88 int rawcycpp_shape_feed[2] = {-1, -1};
89 cycpp_shape_feed = std::vector<int>(rawcycpp_shape_feed, rawcycpp_shape_feed + 2);
90 int rawcycpp_shape_throughput[1] = {-1};
91 cycpp_shape_throughput = std::vector<int>(rawcycpp_shape_throughput, rawcycpp_shape_throughput + 1);
92 int rawcycpp_shape_leftover_commod[1] = {-1};
93 cycpp_shape_leftover_commod = std::vector<int>(rawcycpp_shape_leftover_commod, rawcycpp_shape_leftover_commod + 1);
94 int rawcycpp_shape_leftoverbuf_size[1] = {-1};
95 cycpp_shape_leftoverbuf_size = std::vector<int>(rawcycpp_shape_leftoverbuf_size, rawcycpp_shape_leftoverbuf_size + 1);
96 int rawcycpp_shape_leftover[2] = {-1, -1};
97 cycpp_shape_leftover = std::vector<int>(rawcycpp_shape_leftover, rawcycpp_shape_leftover + 2);
98 int rawcycpp_shape_streams_[7] = {-1, -1, -1, -1, -1, -1, -1};
99 cycpp_shape_streams_ = std::vector<int>(rawcycpp_shape_streams_, rawcycpp_shape_streams_ + 7);
100 int rawcycpp_shape_latitude[1] = {-1};
101 cycpp_shape_latitude = std::vector<int>(rawcycpp_shape_latitude, rawcycpp_shape_latitude + 1);
102 int rawcycpp_shape_longitude[1] = {-1};
103 cycpp_shape_longitude = std::vector<int>(rawcycpp_shape_longitude, rawcycpp_shape_longitude + 1);
104 feed_commods = m->feed_commods;
105 feed_commod_prefs = m->feed_commod_prefs;
106 feed_recipe = m->feed_recipe;
107 feedbuf_size = m->feedbuf_size;
108 throughput = m->throughput;
109 leftover_commod = m->leftover_commod;
110 leftoverbuf_size = m->leftoverbuf_size;
111 streams_ = m->streams_;
112 latitude = m->latitude;
113 longitude = m->longitude;
114 feed.capacity(m->feed.capacity());
115 leftover.capacity(m->leftover.capacity());
116 };
117
118 virtual void InfileToDb(cyclus::InfileTree* tree, cyclus::DbInit di) {
119 cyclus::Facility::InfileToDb(tree, di);
120 int rawcycpp_shape_feed_commods[2] = {-1, -1};
121 cycpp_shape_feed_commods = std::vector<int>(rawcycpp_shape_feed_commods, rawcycpp_shape_feed_commods + 2);
122 int rawcycpp_shape_feed_commod_prefs[2] = {-1, -1};
123 cycpp_shape_feed_commod_prefs = std::vector<int>(rawcycpp_shape_feed_commod_prefs, rawcycpp_shape_feed_commod_prefs + 2);
124 int rawcycpp_shape_feed_recipe[1] = {-1};
125 cycpp_shape_feed_recipe = std::vector<int>(rawcycpp_shape_feed_recipe, rawcycpp_shape_feed_recipe + 1);
126 int rawcycpp_shape_feedbuf_size[1] = {-1};
127 cycpp_shape_feedbuf_size = std::vector<int>(rawcycpp_shape_feedbuf_size, rawcycpp_shape_feedbuf_size + 1);
128 int rawcycpp_shape_feed[2] = {-1, -1};
129 cycpp_shape_feed = std::vector<int>(rawcycpp_shape_feed, rawcycpp_shape_feed + 2);
130 int rawcycpp_shape_throughput[1] = {-1};
131 cycpp_shape_throughput = std::vector<int>(rawcycpp_shape_throughput, rawcycpp_shape_throughput + 1);
132 int rawcycpp_shape_leftover_commod[1] = {-1};
133 cycpp_shape_leftover_commod = std::vector<int>(rawcycpp_shape_leftover_commod, rawcycpp_shape_leftover_commod + 1);
134 int rawcycpp_shape_leftoverbuf_size[1] = {-1};
135 cycpp_shape_leftoverbuf_size = std::vector<int>(rawcycpp_shape_leftoverbuf_size, rawcycpp_shape_leftoverbuf_size + 1);
136 int rawcycpp_shape_leftover[2] = {-1, -1};
137 cycpp_shape_leftover = std::vector<int>(rawcycpp_shape_leftover, rawcycpp_shape_leftover + 2);
138 int rawcycpp_shape_streams_[7] = {-1, -1, -1, -1, -1, -1, -1};
139 cycpp_shape_streams_ = std::vector<int>(rawcycpp_shape_streams_, rawcycpp_shape_streams_ + 7);
140 int rawcycpp_shape_latitude[1] = {-1};
141 cycpp_shape_latitude = std::vector<int>(rawcycpp_shape_latitude, rawcycpp_shape_latitude + 1);
142 int rawcycpp_shape_longitude[1] = {-1};
143 cycpp_shape_longitude = std::vector<int>(rawcycpp_shape_longitude, rawcycpp_shape_longitude + 1);
144 cyclus::InfileTree* sub = tree->SubTree("config/*");
145 int i;
146 int n;
147 {
148 cyclus::InfileTree* bub = sub->SubTree("feed_commods", 0);
149 cyclus::InfileTree* sub = bub;
150 int n1 = sub->NMatches("val");
151 std::vector< std::string > feed_commods_val;
152 feed_commods_val.resize(n1);
153 for (int i1 = 0; i1 < n1; ++i1) {
154 std::string elem;
155 {
156 std::string elem_in = cyclus::Query<std::string>(sub, "val", i1);
157 elem = elem_in;
158 }
159 feed_commods_val[i1] = elem;
160 }
161 feed_commods = feed_commods_val;
162 }
163 if (sub->NMatches("feed_commod_prefs") > 0) {
164 {
165 cyclus::InfileTree* bub = sub->SubTree("feed_commod_prefs", 0);
166 cyclus::InfileTree* sub = bub;
167 int n1 = sub->NMatches("val");
168 std::vector< double > feed_commod_prefs_val;
169 feed_commod_prefs_val.resize(n1);
170 for (int i1 = 0; i1 < n1; ++i1) {
171 double elem;
172 {
173 double elem_in = cyclus::Query<double>(sub, "val", i1);
174 elem = elem_in;
175 }
176 feed_commod_prefs_val[i1] = elem;
177 }
178 feed_commod_prefs = feed_commod_prefs_val;
179 }
180 } else {
181 std::vector< double > feed_commod_prefs_tmp;
182 feed_commod_prefs_tmp.resize(0);
183 {
184 }
185 feed_commod_prefs = feed_commod_prefs_tmp;
186 }
187 if (sub->NMatches("feed_recipe") > 0) {
188 {
189 std::string feed_recipe_val = cyclus::Query<std::string>(sub, "feed_recipe");
190 feed_recipe = feed_recipe_val;
191 }
192 } else {
193 std::string feed_recipe_tmp("");
194 feed_recipe = feed_recipe_tmp;
195 }
196 {
197 double feedbuf_size_val = cyclus::Query<double>(sub, "feedbuf_size");
198 feedbuf_size = feedbuf_size_val;
199 }
200 if (sub->NMatches("throughput") > 0) {
201 {
202 double throughput_val = cyclus::Query<double>(sub, "throughput");
203 throughput = throughput_val;
204 }
205 } else {
206 double throughput_tmp = 1e+299;
207 throughput = throughput_tmp;
208 }
209 if (sub->NMatches("leftover_commod") > 0) {
210 {
211 std::string leftover_commod_val = cyclus::Query<std::string>(sub, "leftover_commod");
212 leftover_commod = leftover_commod_val;
213 }
214 } else {
215 std::string leftover_commod_tmp("default-waste-stream");
216 leftover_commod = leftover_commod_tmp;
217 }
218 if (sub->NMatches("leftoverbuf_size") > 0) {
219 {
220 double leftoverbuf_size_val = cyclus::Query<double>(sub, "leftoverbuf_size");
221 leftoverbuf_size = leftoverbuf_size_val;
222 }
223 } else {
224 double leftoverbuf_size_tmp = 1e+299;
225 leftoverbuf_size = leftoverbuf_size_tmp;
226 }
227 {
228 cyclus::InfileTree* bub = sub->SubTree("streams", 0);
229 cyclus::InfileTree* sub = bub;
230 int n1 = sub->NMatches("item");
231 std::map< std::string, std::pair< double, std::map< int, double > > > streams__val;
232 for (int i1 = 0; i1 < n1; ++i1) {
233 std::string key;
234 {
235 std::string key_in = cyclus::Query<std::string>(sub, "item/commod", i1);
236 key = key_in;
237 }
238 std::pair< double, std::map< int, double > > val;
239 {
240 cyclus::InfileTree* bub = sub->SubTree("item/info", i1);
241 cyclus::InfileTree* sub = bub;
242 double firsti1;
243 {
244 double firsti1_in = cyclus::Query<double>(sub, "buf_size", 0);
245 firsti1 = firsti1_in;
246 }
247 std::map< int, double > secondi1;
248 {
249 cyclus::InfileTree* bub = sub->SubTree("efficiencies", 0);
250 cyclus::InfileTree* sub = bub;
251 int n2 = sub->NMatches("item");
252 std::map< int, double > secondi1_in;
253 for (int i2 = 0; i2 < n2; ++i2) {
254 int key;
255 {
256 int key_in = pyne::nucname::id(cyclus::Query<std::string>(sub, "item/comp", i2));
257 key = key_in;
258 }
259 double val;
260 {
261 double val_in = cyclus::Query<double>(sub, "item/eff", i2);
262 val = val_in;
263 }
264 secondi1_in[key] = val;
265 }
266 secondi1 = secondi1_in;
267 }
268 std::pair< double, std::map< int, double > > val_in(firsti1, secondi1);
269 val = val_in;
270 }
271 streams__val[key] = val;
272 }
273 streams_ = streams__val;
274 }
275 if (sub->NMatches("latitude") > 0) {
276 {
277 double latitude_val = cyclus::Query<double>(sub, "latitude");
278 latitude = latitude_val;
279 }
280 } else {
281 double latitude_tmp = 0.0;
282 latitude = latitude_tmp;
283 }
284 if (sub->NMatches("longitude") > 0) {
285 {
286 double longitude_val = cyclus::Query<double>(sub, "longitude");
287 longitude = longitude_val;
288 }
289 } else {
290 double longitude_tmp = 0.0;
291 longitude = longitude_tmp;
292 }
293 di.NewDatum("Info")
294 ->AddVal("feed_commods", feed_commods, &cycpp_shape_feed_commods)
295 ->AddVal("feed_commod_prefs", feed_commod_prefs, &cycpp_shape_feed_commod_prefs)
296 ->AddVal("feed_recipe", feed_recipe, &cycpp_shape_feed_recipe)
297 ->AddVal("feedbuf_size", feedbuf_size, &cycpp_shape_feedbuf_size)
298 ->AddVal("throughput", throughput, &cycpp_shape_throughput)
299 ->AddVal("leftover_commod", leftover_commod, &cycpp_shape_leftover_commod)
300 ->AddVal("leftoverbuf_size", leftoverbuf_size, &cycpp_shape_leftoverbuf_size)
301 ->AddVal("streams_", streams_, &cycpp_shape_streams_)
302 ->AddVal("latitude", latitude, &cycpp_shape_latitude)
303 ->AddVal("longitude", longitude, &cycpp_shape_longitude)
304 ->Record();
305 };
306
307 virtual void InitFrom(cyclus::QueryableBackend* b) {
308 cyclus::Facility::InitFrom(b);
309 int rawcycpp_shape_feed_commods[2] = {-1, -1};
310 cycpp_shape_feed_commods = std::vector<int>(rawcycpp_shape_feed_commods, rawcycpp_shape_feed_commods + 2);
311 int rawcycpp_shape_feed_commod_prefs[2] = {-1, -1};
312 cycpp_shape_feed_commod_prefs = std::vector<int>(rawcycpp_shape_feed_commod_prefs, rawcycpp_shape_feed_commod_prefs + 2);
313 int rawcycpp_shape_feed_recipe[1] = {-1};
314 cycpp_shape_feed_recipe = std::vector<int>(rawcycpp_shape_feed_recipe, rawcycpp_shape_feed_recipe + 1);
315 int rawcycpp_shape_feedbuf_size[1] = {-1};
316 cycpp_shape_feedbuf_size = std::vector<int>(rawcycpp_shape_feedbuf_size, rawcycpp_shape_feedbuf_size + 1);
317 int rawcycpp_shape_feed[2] = {-1, -1};
318 cycpp_shape_feed = std::vector<int>(rawcycpp_shape_feed, rawcycpp_shape_feed + 2);
319 int rawcycpp_shape_throughput[1] = {-1};
320 cycpp_shape_throughput = std::vector<int>(rawcycpp_shape_throughput, rawcycpp_shape_throughput + 1);
321 int rawcycpp_shape_leftover_commod[1] = {-1};
322 cycpp_shape_leftover_commod = std::vector<int>(rawcycpp_shape_leftover_commod, rawcycpp_shape_leftover_commod + 1);
323 int rawcycpp_shape_leftoverbuf_size[1] = {-1};
324 cycpp_shape_leftoverbuf_size = std::vector<int>(rawcycpp_shape_leftoverbuf_size, rawcycpp_shape_leftoverbuf_size + 1);
325 int rawcycpp_shape_leftover[2] = {-1, -1};
326 cycpp_shape_leftover = std::vector<int>(rawcycpp_shape_leftover, rawcycpp_shape_leftover + 2);
327 int rawcycpp_shape_streams_[7] = {-1, -1, -1, -1, -1, -1, -1};
328 cycpp_shape_streams_ = std::vector<int>(rawcycpp_shape_streams_, rawcycpp_shape_streams_ + 7);
329 int rawcycpp_shape_latitude[1] = {-1};
330 cycpp_shape_latitude = std::vector<int>(rawcycpp_shape_latitude, rawcycpp_shape_latitude + 1);
331 int rawcycpp_shape_longitude[1] = {-1};
332 cycpp_shape_longitude = std::vector<int>(rawcycpp_shape_longitude, rawcycpp_shape_longitude + 1);
333 cyclus::QueryResult qr = b->Query("Info", NULL);
334 feed_commods = qr.GetVal<std::vector< std::string > >("feed_commods");
335 feed_commod_prefs = qr.GetVal<std::vector< double > >("feed_commod_prefs");
336 feed_recipe = qr.GetVal<std::string>("feed_recipe");
337 feedbuf_size = qr.GetVal<double>("feedbuf_size");
338 throughput = qr.GetVal<double>("throughput");
339 leftover_commod = qr.GetVal<std::string>("leftover_commod");
340 leftoverbuf_size = qr.GetVal<double>("leftoverbuf_size");
341 streams_ = qr.GetVal<std::map< std::string, std::pair< double, std::map< int, double > > > >("streams_");
342 latitude = qr.GetVal<double>("latitude");
343 longitude = qr.GetVal<double>("longitude");
344 feed.capacity(feedbuf_size);
345 leftover.capacity(leftoverbuf_size);
346 };
347
348 virtual std::string schema() {
349 return ""
350 "<interleave>\n"
351 " <element name=\"feed_commods\">\n"
352 " <oneOrMore>\n"
353 " <element name=\"val\">\n"
354 " <data type=\"string\"/>\n"
355 " </element>\n"
356 " </oneOrMore>\n"
357 " </element>\n"
358 " <optional>\n"
359 " <element name=\"feed_commod_prefs\">\n"
360 " <oneOrMore>\n"
361 " <element name=\"val\">\n"
362 " <data type=\"double\"/>\n"
363 " </element>\n"
364 " </oneOrMore>\n"
365 " </element>\n"
366 " </optional>\n"
367 " <optional>\n"
368 " <element name=\"feed_recipe\">\n"
369 " <data type=\"string\"/>\n"
370 " </element>\n"
371 " </optional>\n"
372 " <element name=\"feedbuf_size\">\n"
373 " <data type=\"double\"/>\n"
374 " </element>\n"
375 " <optional>\n"
376 " <element name=\"throughput\">\n"
377 " <data type=\"double\"/>\n"
378 " </element>\n"
379 " </optional>\n"
380 " <optional>\n"
381 " <element name=\"leftover_commod\">\n"
382 " <data type=\"string\"/>\n"
383 " </element>\n"
384 " </optional>\n"
385 " <optional>\n"
386 " <element name=\"leftoverbuf_size\">\n"
387 " <data type=\"double\"/>\n"
388 " </element>\n"
389 " </optional>\n"
390 " <element name=\"streams\">\n"
391 " <oneOrMore>\n"
392 " <element name=\"item\">\n"
393 " <interleave>\n"
394 " <element name=\"commod\">\n"
395 " <data type=\"string\"/>\n"
396 " </element>\n"
397 " <element name=\"info\">\n"
398 " <interleave>\n"
399 " <element name=\"buf_size\">\n"
400 " <data type=\"double\"/>\n"
401 " </element>\n"
402 " <element name=\"efficiencies\">\n"
403 " <oneOrMore>\n"
404 " <element name=\"item\">\n"
405 " <interleave>\n"
406 " <element name=\"comp\">\n"
407 " <data type=\"string\"/>\n"
408 " </element>\n"
409 " <element name=\"eff\">\n"
410 " <data type=\"double\"/>\n"
411 " </element>\n"
412 " </interleave>\n"
413 " </element>\n"
414 " </oneOrMore>\n"
415 " </element>\n"
416 " </interleave>\n"
417 " </element>\n"
418 " </interleave>\n"
419 " </element>\n"
420 " </oneOrMore>\n"
421 " </element>\n"
422 " <optional>\n"
423 " <element name=\"latitude\">\n"
424 " <data type=\"double\"/>\n"
425 " </element>\n"
426 " </optional>\n"
427 " <optional>\n"
428 " <element name=\"longitude\">\n"
429 " <data type=\"double\"/>\n"
430 " </element>\n"
431 " </optional>\n"
432 "</interleave>\n";
433 };
434
435 virtual Json::Value annotations() {
436 Json::Value root;
437 Json::Reader reader;
438 bool parsed_ok = reader.parse(
439 "{\"name\":\"cycamore::Separations\",\"entity\":\"facility"
440 "\",\"parents\":[\"cyclus::Facility\",\"cyclus::toolkit::"
441 "Position\"],\"all_parents\":[\"cyclus::Agent\",\"cyclus:"
442 ":Facility\",\"cyclus::Ider\",\"cyclus::StateWrangler\","
443 "\"cyclus::TimeListener\",\"cyclus::Trader\",\"cyclus::t"
444 "oolkit::Position\"],\"vars\":{\"feed_commods\":{\"doc\":\""
445 "Ordered list of commodities on which to request "
446 "feed material to separate. Order only matters for "
447 "matching up with feed commodity preferences if "
448 "specified.\",\"uilabel\":[\"Feed Commodity List\",\"\"],\""
449 "uitype\":[\"oneormore\",\"incommodity\"],\"type\":[\"std::"
450 "vector\",\"std::string\"],\"index\":0,\"shape\":[-1,-"
451 "1],\"alias\":[\"feed_commods\",\"val\"],\"tooltip\":[\"feed"
452 "_commods\",\"\"]},\"feed_commod_prefs\":{\"default\":[],\""
453 "uilabel\":[\"Feed Commodity Preference "
454 "List\",\"\"],\"doc\":\"Feed commodity request "
455 "preferences for each of the given feed commodities"
456 " (same order). If unspecified, default is to use "
457 "1.0 for all preferences.\",\"type\":[\"std::vector\",\"d"
458 "ouble\"],\"index\":1,\"shape\":[-1,-"
459 "1],\"alias\":[\"feed_commod_prefs\",\"val\"],\"tooltip\":["
460 "\"feed_commod_prefs\",\"\"]},\"feed_recipe\":{\"doc\":\"Nam"
461 "e for recipe to be used in feed requests. Empty "
462 "string results in use of a dummy "
463 "recipe.\",\"uilabel\":\"Feed Commodity Recipe List\",\"u"
464 "itype\":\"inrecipe\",\"default\":\"\",\"type\":\"std::string"
465 "\",\"index\":2,\"shape\":[-"
466 "1],\"alias\":\"feed_recipe\",\"tooltip\":\"feed_recipe\"},"
467 "\"feedbuf_size\":{\"doc\":\"Maximum amount of feed "
468 "material to keep on hand.\",\"uilabel\":\"Maximum Feed"
469 " Inventory\",\"units\":\"kg\",\"type\":\"double\",\"index\":3"
470 ",\"shape\":[-"
471 "1],\"alias\":\"feedbuf_size\",\"tooltip\":\"feedbuf_size\""
472 "},\"feed\":{\"capacity\":\"feedbuf_size\",\"type\":[\"cyclu"
473 "s::toolkit::ResBuf\",\"cyclus::Material\"],\"index\":4,"
474 "\"shape\":[-1,-1]},\"throughput\":{\"doc\":\"Maximum "
475 "quantity of feed material that can be processed "
476 "per time step.\",\"uilabel\":\"Maximum Separations Thr"
477 "oughput\",\"default\":1e+299,\"uitype\":\"range\",\"range\""
478 ":[0.0,1e+299],\"units\":\"kg/(time step)\",\"type\":\"dou"
479 "ble\",\"index\":5,\"shape\":[-"
480 "1],\"alias\":\"throughput\",\"tooltip\":\"throughput\"},\"l"
481 "eftover_commod\":{\"doc\":\"Commodity on which to "
482 "trade the leftover separated material stream. This"
483 " MUST NOT be the same as any commodity used to "
484 "define the other separations streams.\",\"uitype\":\"o"
485 "utcommodity\",\"uilabel\":\"Leftover "
486 "Commodity\",\"default\":\"default-waste-stream\",\"type\""
487 ":\"std::string\",\"index\":6,\"shape\":[-"
488 "1],\"alias\":\"leftover_commod\",\"tooltip\":\"leftover_c"
489 "ommod\"},\"leftoverbuf_size\":{\"doc\":\"Maximum amount "
490 "of leftover separated material (not included in "
491 "any other stream) that can be stored. If full, the"
492 " facility halts operation until space becomes "
493 "available.\",\"uilabel\":\"Maximum Leftover Inventory\""
494 ",\"default\":1e+299,\"uitype\":\"range\",\"range\":[0.0,1e"
495 "+299],\"units\":\"kg\",\"type\":\"double\",\"index\":7,\"shap"
496 "e\":[-"
497 "1],\"alias\":\"leftoverbuf_size\",\"tooltip\":\"leftoverb"
498 "uf_size\"},\"leftover\":{\"capacity\":\"leftoverbuf_size"
499 "\",\"type\":[\"cyclus::toolkit::ResBuf\",\"cyclus::Mater"
500 "ial\"],\"index\":8,\"shape\":[-1,-"
501 "1]},\"streams_\":{\"alias\":[[\"streams\",\"item\"],\"commo"
502 "d\",[\"info\",\"buf_size\",[[\"efficiencies\",\"item\"],\"co"
503 "mp\",\"eff\"]]],\"uitype\":[\"oneormore\",\"outcommodity\","
504 "[\"pair\",\"double\",[\"oneormore\",\"nuclide\",\"double\"]]"
505 "],\"uilabel\":[[\"Separations Streams and Efficiencie"
506 "s\",\"\"],\"\",[\"\",\"\",[[\"\",\"\"],\"\",\"\"]]],\"doc\":\"Output "
507 "streams for separations. Each stream must have a "
508 "unique name identifying the commodity on which "
509 "its material is traded, a max buffer capacity in "
510 "kg (neg values indicate infinite size), and a set "
511 "of component efficiencies. 'comp' is a component "
512 "to be separated into the stream (e.g. U, Pu, etc.)"
513 " and 'eff' is the mass fraction of the component "
514 "that is separated from the feed into this output "
515 "stream. If any stream buffer is full, the facility"
516 " halts operation until space becomes available. "
517 "The sum total of all component efficiencies across"
518 " streams must be less than or equal to 1 (e.g. sum"
519 " of U efficiencies for all streams must be <= 1).\""
520 ",\"type\":[\"std::map\",\"std::string\",[\"std::pair\",\"do"
521 "uble\",[\"std::map\",\"int\",\"double\"]]],\"index\":9,\"sha"
522 "pe\":[-1,-1,-1,-1,-1,-1,-"
523 "1],\"tooltip\":[[\"streams_\",\"\"],\"\",[\"\",\"\",[[\"\",\"\"],\""
524 "\",\"\"]]]},\"streams\":\"streams_\",\"latitude\":{\"default"
525 "\":0.0,\"uilabel\":\"Geographical latitude in degrees "
526 "as a double\",\"doc\":\"Latitude of the agent's "
527 "geographical position. The value should be "
528 "expressed in degrees as a double.\",\"type\":\"double\""
529 ",\"index\":11,\"shape\":[-"
530 "1],\"alias\":\"latitude\",\"tooltip\":\"latitude\"},\"longi"
531 "tude\":{\"default\":0.0,\"uilabel\":\"Geographical "
532 "longitude in degrees as a double\",\"doc\":\"Longitude"
533 " of the agent's geographical position. The value "
534 "should be expressed in degrees as a double.\",\"type"
535 "\":\"double\",\"index\":12,\"shape\":[-"
536 "1],\"alias\":\"longitude\",\"tooltip\":\"longitude\"}},\"ni"
537 "che\":\"separations\",\"doc\":\"Separations processes "
538 "feed material into one or more streams containing "
539 "specific elements and/or nuclides. It uses mass-"
540 "based efficiencies.\\n\\nUser defined separations "
541 "streams are specified as groups of component-"
542 "efficiency pairs where 'component' means either a "
543 "particular element or a particular nuclide. Each "
544 "component's paired efficiency represents the mass "
545 "fraction of that component in the feed that is "
546 "separated into that stream. The efficiencies of a"
547 " particular component across all streams must sum "
548 "up to less than or equal to one. If less than "
549 "one, the remainining material is sent to a waste "
550 "inventory and (potentially) traded away from "
551 "there.\\n\\nThe facility receives material into a "
552 "feed inventory that it processes with a specified "
553 "throughput each time step. Each output stream has"
554 " a corresponding output inventory size/limit. If "
555 "the facility is unable to reduce its stocks by "
556 "trading and hits this limit for any of its output "
557 "streams, further processing/separations of feed "
558 "material will halt until room is again available "
559 "in the output streams.\"}", root);
560 if (!parsed_ok) {
561 throw cyclus::ValueError("failed to parse annotations for cycamore::Separations.");
562 }
563 return root;
564 };
565
566 virtual void Snapshot(cyclus::DbInit di) {
567 di.NewDatum("Info")
568 ->AddVal("feed_commods", feed_commods, &cycpp_shape_feed_commods)
569 ->AddVal("feed_commod_prefs", feed_commod_prefs, &cycpp_shape_feed_commod_prefs)
570 ->AddVal("feed_recipe", feed_recipe, &cycpp_shape_feed_recipe)
571 ->AddVal("feedbuf_size", feedbuf_size, &cycpp_shape_feedbuf_size)
572 ->AddVal("throughput", throughput, &cycpp_shape_throughput)
573 ->AddVal("leftover_commod", leftover_commod, &cycpp_shape_leftover_commod)
574 ->AddVal("leftoverbuf_size", leftoverbuf_size, &cycpp_shape_leftoverbuf_size)
575 ->AddVal("streams_", streams_, &cycpp_shape_streams_)
576 ->AddVal("latitude", latitude, &cycpp_shape_latitude)
577 ->AddVal("longitude", longitude, &cycpp_shape_longitude)
578 ->Record();
579 };
580#line 98 "/cycamore/src/separations.h"
581 // the following pragmas are ommitted and the functions are written
582 // manually in order to handle the vector of resource buffers:
583 //
584 // #pragma cyclus snapshotinv
585 // #pragma cyclus initinv
586
587 virtual cyclus::Inventories SnapshotInv();
588 virtual void InitInv(cyclus::Inventories& inv);
589
590 private:
591 #pragma cyclus var { "doc": "Ordered list of commodities on which to request feed material to " "separate. Order only matters for matching up with feed commodity " "preferences if specified.", "uilabel": "Feed Commodity List", "uitype": ["oneormore", "incommodity"], }
592#line 115 "/cycamore/src/separations.h"
593 std::vector<std::string> feed_commods;
594 std::vector<int> cycpp_shape_feed_commods;
595#line 116 "/cycamore/src/separations.h"
596
597
598 #pragma cyclus var { "default": [], "uilabel": "Feed Commodity Preference List", "doc": "Feed commodity request preferences for each of the given feed " "commodities (same order)." " If unspecified, default is to use 1.0 for all " "preferences.", }
599#line 125 "/cycamore/src/separations.h"
600 std::vector<double> feed_commod_prefs;
602#line 126 "/cycamore/src/separations.h"
603
604
605 #pragma cyclus var { "doc": "Name for recipe to be used in feed requests." " Empty string results in use of a dummy recipe.", "uilabel": "Feed Commodity Recipe List", "uitype": "inrecipe", "default": "", }
606#line 134 "/cycamore/src/separations.h"
607 std::string feed_recipe;
608 std::vector<int> cycpp_shape_feed_recipe;
609#line 135 "/cycamore/src/separations.h"
610
611
612 #pragma cyclus var { "doc" : "Maximum amount of feed material to keep on hand.", "uilabel": "Maximum Feed Inventory", "units" : "kg", }
613#line 141 "/cycamore/src/separations.h"
615 std::vector<int> cycpp_shape_feedbuf_size;
616#line 142 "/cycamore/src/separations.h"
617
618
619 #pragma cyclus var { "capacity" : "feedbuf_size", }
620#line 146 "/cycamore/src/separations.h"
621 cyclus::toolkit::ResBuf<cyclus::Material> feed;
622 std::vector<int> cycpp_shape_feed;
623#line 147 "/cycamore/src/separations.h"
624
625
626 #pragma cyclus var { "doc" : "Maximum quantity of feed material that can be processed per time " "step.", "uilabel": "Maximum Separations Throughput", "default": CY_LARGE_DOUBLE, "uitype": "range", "range": [0.0, CY_LARGE_DOUBLE], "units": "kg/(time step)", }
627#line 157 "/cycamore/src/separations.h"
629 std::vector<int> cycpp_shape_throughput;
630#line 158 "/cycamore/src/separations.h"
631
632
633 #pragma cyclus var { "doc": "Commodity on which to trade the leftover separated material " "stream. This MUST NOT be the same as any commodity used to define " "the other separations streams.", "uitype": "outcommodity", "uilabel": "Leftover Commodity", "default": "default-waste-stream", }
634#line 167 "/cycamore/src/separations.h"
635 std::string leftover_commod;
637#line 168 "/cycamore/src/separations.h"
638
639
640 #pragma cyclus var { "doc" : "Maximum amount of leftover separated material (not included in" " any other stream) that can be stored." " If full, the facility halts operation until space becomes " "available.", "uilabel": "Maximum Leftover Inventory", "default": CY_LARGE_DOUBLE, "uitype": "range", "range": [0.0, CY_LARGE_DOUBLE], "units": "kg", }
641#line 180 "/cycamore/src/separations.h"
644#line 181 "/cycamore/src/separations.h"
645
646
647 #pragma cyclus var { "capacity" : "leftoverbuf_size", }
648#line 185 "/cycamore/src/separations.h"
649 cyclus::toolkit::ResBuf<cyclus::Material> leftover;
650 std::vector<int> cycpp_shape_leftover;
651#line 186 "/cycamore/src/separations.h"
652
653
654 #pragma cyclus var { "alias": ["streams", "commod", ["info", "buf_size", ["efficiencies", "comp", "eff"]]], "uitype": ["oneormore", "outcommodity", ["pair", "double", ["oneormore", "nuclide", "double"]]], "uilabel": "Separations Streams and Efficiencies", "doc": "Output streams for separations." " Each stream must have a unique name identifying the commodity on " " which its material is traded," " a max buffer capacity in kg (neg values indicate infinite size)," " and a set of component efficiencies." " 'comp' is a component to be separated into the stream" " (e.g. U, Pu, etc.) and 'eff' is the mass fraction of the" " component that is separated from the feed into this output" " stream. If any stream buffer is full, the facility halts" " operation until space becomes available." " The sum total of all component efficiencies across streams must" " be less than or equal to 1" " (e.g. sum of U efficiencies for all streams must be <= 1).", }
655#line 205 "/cycamore/src/separations.h"
656 std::map<std::string, std::pair<double, std::map<int, double> > > streams_;
657 std::vector<int> cycpp_shape_streams_;
658
659#line 206 "/cycamore/src/separations.h"
660
661 // custom SnapshotInv and InitInv and EnterNotify are used to persist this
662 // state var.
663 std::map<std::string, cyclus::toolkit::ResBuf<cyclus::Material> > streambufs;
664
665 #pragma cyclus var { "default": 0.0, "uilabel": "Geographical latitude in degrees as a double", "doc": "Latitude of the agent's geographical position. The value should " "be expressed in degrees as a double." }
666#line 217 "/cycamore/src/separations.h"
667 double latitude;
668 std::vector<int> cycpp_shape_latitude;
669#line 218 "/cycamore/src/separations.h"
670
671
672 #pragma cyclus var { "default": 0.0, "uilabel": "Geographical longitude in degrees as a double", "doc": "Longitude of the agent's geographical position. The value should " "be expressed in degrees as a double." }
673#line 225 "/cycamore/src/separations.h"
674 double longitude;
675 std::vector<int> cycpp_shape_longitude;
676
677#line 226 "/cycamore/src/separations.h"
678
679 cyclus::toolkit::Position coordinates;
680
682 void RecordPosition();
683 void Record(std::string name, double val, std::string type);
684};
685
686} // namespace cycamore
687
688#endif // CYCAMORE_SRC_SEPARATIONS_H_
#define CYCAMORE_VERSION
Separations processes feed material into one or more streams containing specific elements and/or nucl...
std::vector< int > cycpp_shape_latitude
std::vector< int > cycpp_shape_feed_commods
std::vector< int > cycpp_shape_longitude
std::map< std::string, std::pair< double, std::map< int, double > > > streams_
virtual void GetMatlTrades(const std::vector< cyclus::Trade< cyclus::Material > > &trades, std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &responses)
std::vector< int > cycpp_shape_feed_recipe
std::vector< int > cycpp_shape_feed_commod_prefs
std::vector< int > cycpp_shape_streams_
virtual void AcceptMatlTrades(const std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &responses)
cyclus::toolkit::ResBuf< cyclus::Material > feed
virtual std::set< cyclus::RequestPortfolio< cyclus::Material >::Ptr > GetMatlRequests()
virtual cyclus::Inventories SnapshotInv()
virtual cyclus::Agent * Clone()
virtual Json::Value annotations()
virtual void InitInv(cyclus::Inventories &inv)
std::vector< int > cycpp_shape_leftover_commod
cyclus::toolkit::ResBuf< cyclus::Material > leftover
std::map< std::string, cyclus::toolkit::ResBuf< cyclus::Material > > streambufs
std::vector< int > cycpp_shape_leftoverbuf_size
void Record(std::string name, double val, std::string type)
virtual void Snapshot(cyclus::DbInit di)
std::vector< double > feed_commod_prefs
virtual void InfileToDb(cyclus::InfileTree *tree, cyclus::DbInit di)
cyclus::toolkit::Position coordinates
std::vector< int > cycpp_shape_throughput
void RecordPosition()
Records an agent's latitude and longitude to the output db.
virtual std::set< cyclus::BidPortfolio< cyclus::Material >::Ptr > GetMatlBids(cyclus::CommodMap< cyclus::Material >::type &commod_requests)
std::vector< std::string > feed_commods
std::vector< int > cycpp_shape_feedbuf_size
std::vector< int > cycpp_shape_leftover
virtual void InitFrom(cyclus::QueryableBackend *b)
Separations(cyclus::Context *ctx)
virtual void InitFrom(cycamore::Separations *m)
Material::Ptr SepMaterial(std::map< int, double > effs, Material::Ptr mat)