CYCAMORE
Loading...
Searching...
No Matches
src/separations.h
Go to the documentation of this file.
1#ifndef CYCAMORE_SRC_SEPARATIONS_H_
2#define CYCAMORE_SRC_SEPARATIONS_H_
3
4#include "cyclus.h"
5#include "cycamore_version.h"
6
7#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO
8
9namespace cycamore {
10
18cyclus::Material::Ptr SepMaterial(std::map<int, double> effs,
19 cyclus::Material::Ptr mat);
20
39class Separations
40 : public cyclus::Facility,
41 public cyclus::toolkit::Position {
42#pragma cyclus note { \
43 "niche": "separations", \
44 "doc": \
45 "Separations processes feed material into one or more streams containing" \
46 " specific elements and/or nuclides. It uses mass-based efficiencies." \
47 "\n\n" \
48 "User defined separations streams are specified as groups of" \
49 " component-efficiency pairs where 'component' means either a particular" \
50 " element or a particular nuclide. Each component's paired efficiency" \
51 " represents the mass fraction of that component in the feed that is" \
52 " separated into that stream. The efficiencies of a particular component" \
53 " across all streams must sum up to less than or equal to one. If less than" \
54 " one, the remainining material is sent to a waste inventory and" \
55 " (potentially) traded away from there." \
56 "\n\n" \
57 "The facility receives material into a feed inventory that it processes with" \
58 " a specified throughput each time step. Each output stream has a" \
59 " corresponding output inventory size/limit. If the facility is unable to" \
60 " reduce its stocks by trading and hits this limit for any of its output" \
61 " streams, further processing/separations of feed material will halt until" \
62 " room is again available in the output streams." \
63 "", \
64}
65 public:
66 Separations(cyclus::Context* ctx);
67 virtual ~Separations(){};
68
69 virtual std::string version() { return CYCAMORE_VERSION; }
70
71 virtual void Tick();
72 virtual void Tock();
73 virtual void EnterNotify();
74
75 virtual void AcceptMatlTrades(const std::vector<std::pair<
76 cyclus::Trade<cyclus::Material>, cyclus::Material::Ptr> >& responses);
77
78 virtual std::set<cyclus::RequestPortfolio<cyclus::Material>::Ptr>
80
81 virtual std::set<cyclus::BidPortfolio<cyclus::Material>::Ptr> GetMatlBids(
82 cyclus::CommodMap<cyclus::Material>::type& commod_requests);
83
84 virtual void GetMatlTrades(
85 const std::vector<cyclus::Trade<cyclus::Material> >& trades,
86 std::vector<std::pair<cyclus::Trade<cyclus::Material>,
87 cyclus::Material::Ptr> >& responses);
88
90
91 #pragma cyclus clone
92 #pragma cyclus initfromcopy
93 #pragma cyclus infiletodb
94 #pragma cyclus initfromdb
95 #pragma cyclus schema
96 #pragma cyclus annotations
97 #pragma cyclus snapshot
98 // the following pragmas are ommitted and the functions are written
99 // manually in order to handle the vector of resource buffers:
100 //
101 // #pragma cyclus snapshotinv
102 // #pragma cyclus initinv
103
104 virtual cyclus::Inventories SnapshotInv();
105 virtual void InitInv(cyclus::Inventories& inv);
106
107 private:
108 // Code Injection:
109 #include "toolkit/position.cycpp.h"
110
111 #pragma cyclus var { \
112 "doc": "Ordered list of commodities on which to request feed material to " \
113 "separate. Order only matters for matching up with feed commodity " \
114 "preferences if specified.", \
115 "uilabel": "Feed Commodity List", \
116 "uitype": ["oneormore", "incommodity"], \
117 }
118 std::vector<std::string> feed_commods;
119
120 #pragma cyclus var { \
121 "default": [], \
122 "uilabel": "Feed Commodity Preference List", \
123 "doc": "Feed commodity request preferences for each of the given feed " \
124 "commodities (same order)." \
125 " If unspecified, default is to use 1.0 for all "\
126 "preferences.", \
127 }
128 std::vector<double> feed_commod_prefs;
129
130 #pragma cyclus var { \
131 "doc": "Name for recipe to be used in feed requests." \
132 " Empty string results in use of a dummy recipe.", \
133 "uilabel": "Feed Commodity Recipe List", \
134 "uitype": "inrecipe", \
135 "default": "", \
136 }
137 std::string feed_recipe;
138
139 #pragma cyclus var { \
140 "doc" : "Maximum amount of feed material to keep on hand.", \
141 "uilabel": "Maximum Feed Inventory", \
142 "units" : "kg", \
143 }
144 double feedbuf_size;
145
146 #pragma cyclus var { \
147 "capacity" : "feedbuf_size", \
148 }
149 cyclus::toolkit::ResBuf<cyclus::Material> feed;
150
151 #pragma cyclus var { \
152 "doc" : "Maximum quantity of feed material that can be processed per time "\
153 "step.", \
154 "uilabel": "Maximum Separations Throughput", \
155 "default": CY_LARGE_DOUBLE, \
156 "uitype": "range", \
157 "range": [0.0, CY_LARGE_DOUBLE], \
158 "units": "kg/(time step)", \
159 }
160 double throughput;
161
162 #pragma cyclus var { \
163 "doc": "Commodity on which to trade the leftover separated material " \
164 "stream. This MUST NOT be the same as any commodity used to define "\
165 "the other separations streams.", \
166 "uitype": "outcommodity", \
167 "uilabel": "Leftover Commodity", \
168 "default": "default-waste-stream", \
169 }
170 std::string leftover_commod;
171
172 #pragma cyclus var { \
173 "doc" : "Maximum amount of leftover separated material (not included in" \
174 " any other stream) that can be stored." \
175 " If full, the facility halts operation until space becomes " \
176 "available.", \
177 "uilabel": "Maximum Leftover Inventory", \
178 "default": CY_LARGE_DOUBLE, \
179 "uitype": "range", \
180 "range": [0.0, CY_LARGE_DOUBLE], \
181 "units": "kg", \
182 }
183 double leftoverbuf_size;
184
185 #pragma cyclus var { \
186 "capacity" : "leftoverbuf_size", \
187 }
188 cyclus::toolkit::ResBuf<cyclus::Material> leftover;
189
190 #pragma cyclus var { \
191 "alias": ["streams", "commod", ["info", "buf_size", ["efficiencies", "comp", "eff"]]], \
192 "uitype": ["oneormore", "outcommodity", ["pair", "double", ["oneormore", "nuclide", "double"]]], \
193 "uilabel": "Separations Streams and Efficiencies", \
194 "doc": "Output streams for separations." \
195 " Each stream must have a unique name identifying the commodity on "\
196 " which its material is traded," \
197 " a max buffer capacity in kg (neg values indicate infinite size)," \
198 " and a set of component efficiencies." \
199 " 'comp' is a component to be separated into the stream" \
200 " (e.g. U, Pu, etc.) and 'eff' is the mass fraction of the" \
201 " component that is separated from the feed into this output" \
202 " stream. If any stream buffer is full, the facility halts" \
203 " operation until space becomes available." \
204 " The sum total of all component efficiencies across streams must" \
205 " be less than or equal to 1" \
206 " (e.g. sum of U efficiencies for all streams must be <= 1).", \
207 }
208 std::map<std::string, std::pair<double, std::map<int, double> > > streams_;
209
210 // custom SnapshotInv and InitInv and EnterNotify are used to persist this
211 // state var.
212 std::map<std::string, cyclus::toolkit::ResBuf<cyclus::Material> > streambufs;
213
214 void Record(std::string name, double val, std::string type);
215};
216
217} // namespace cycamore
218
219#endif // CYCAMORE_SRC_SEPARATIONS_H_
#define CYCAMORE_VERSION
Separations processes feed material into one or more streams containing specific elements and/or nucl...
virtual void InitInv(cyclus::Inventories &inv)
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)
virtual void AcceptMatlTrades(const std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &responses)
cyclus::toolkit::ResBuf< cyclus::Material > feed
virtual void EnterNotify()
virtual std::string version()
virtual cyclus::Inventories SnapshotInv()
virtual void Tock()
cyclus::toolkit::ResBuf< cyclus::Material > leftover
std::map< std::string, cyclus::toolkit::ResBuf< cyclus::Material > > streambufs
virtual void Tick()
void Record(std::string name, double val, std::string type)
std::vector< double > feed_commod_prefs
virtual bool CheckDecommissionCondition()
virtual std::set< cyclus::BidPortfolio< cyclus::Material >::Ptr > GetMatlBids(cyclus::CommodMap< cyclus::Material >::type &commod_requests)
std::vector< std::string > feed_commods
virtual std::set< cyclus::RequestPortfolio< cyclus::Material >::Ptr > GetMatlRequests()
Separations(cyclus::Context *ctx)
Material::Ptr SepMaterial(std::map< int, double > effs, Material::Ptr mat)