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