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 #pragma cyclus var { \
109 "doc": "Ordered list of commodities on which to request feed material to " \
110 "separate. Order only matters for matching up with feed commodity " \
111 "preferences if specified.", \
112 "uilabel": "Feed Commodity List", \
113 "uitype": ["oneormore", "incommodity"], \
114 }
115 std::vector<std::string> feed_commods;
116
117 #pragma cyclus var { \
118 "default": [], \
119 "uilabel": "Feed Commodity Preference List", \
120 "doc": "Feed commodity request preferences for each of the given feed " \
121 "commodities (same order)." \
122 " If unspecified, default is to use 1.0 for all "\
123 "preferences.", \
124 }
125 std::vector<double> feed_commod_prefs;
126
127 #pragma cyclus var { \
128 "doc": "Name for recipe to be used in feed requests." \
129 " Empty string results in use of a dummy recipe.", \
130 "uilabel": "Feed Commodity Recipe List", \
131 "uitype": "inrecipe", \
132 "default": "", \
133 }
134 std::string feed_recipe;
135
136 #pragma cyclus var { \
137 "doc" : "Maximum amount of feed material to keep on hand.", \
138 "uilabel": "Maximum Feed Inventory", \
139 "units" : "kg", \
140 }
141 double feedbuf_size;
142
143 #pragma cyclus var { \
144 "capacity" : "feedbuf_size", \
145 }
146 cyclus::toolkit::ResBuf<cyclus::Material> feed;
147
148 #pragma cyclus var { \
149 "doc" : "Maximum quantity of feed material that can be processed per time "\
150 "step.", \
151 "uilabel": "Maximum Separations Throughput", \
152 "default": CY_LARGE_DOUBLE, \
153 "uitype": "range", \
154 "range": [0.0, CY_LARGE_DOUBLE], \
155 "units": "kg/(time step)", \
156 }
157 double throughput;
158
159 #pragma cyclus var { \
160 "doc": "Commodity on which to trade the leftover separated material " \
161 "stream. This MUST NOT be the same as any commodity used to define "\
162 "the other separations streams.", \
163 "uitype": "outcommodity", \
164 "uilabel": "Leftover Commodity", \
165 "default": "default-waste-stream", \
166 }
167 std::string leftover_commod;
168
169 #pragma cyclus var { \
170 "doc" : "Maximum amount of leftover separated material (not included in" \
171 " any other stream) that can be stored." \
172 " If full, the facility halts operation until space becomes " \
173 "available.", \
174 "uilabel": "Maximum Leftover Inventory", \
175 "default": CY_LARGE_DOUBLE, \
176 "uitype": "range", \
177 "range": [0.0, CY_LARGE_DOUBLE], \
178 "units": "kg", \
179 }
180 double leftoverbuf_size;
181
182 #pragma cyclus var { \
183 "capacity" : "leftoverbuf_size", \
184 }
185 cyclus::toolkit::ResBuf<cyclus::Material> leftover;
186
187 #pragma cyclus var { \
188 "alias": ["streams", "commod", ["info", "buf_size", ["efficiencies", "comp", "eff"]]], \
189 "uitype": ["oneormore", "outcommodity", ["pair", "double", ["oneormore", "nuclide", "double"]]], \
190 "uilabel": "Separations Streams and Efficiencies", \
191 "doc": "Output streams for separations." \
192 " Each stream must have a unique name identifying the commodity on "\
193 " which its material is traded," \
194 " a max buffer capacity in kg (neg values indicate infinite size)," \
195 " and a set of component efficiencies." \
196 " 'comp' is a component to be separated into the stream" \
197 " (e.g. U, Pu, etc.) and 'eff' is the mass fraction of the" \
198 " component that is separated from the feed into this output" \
199 " stream. If any stream buffer is full, the facility halts" \
200 " operation until space becomes available." \
201 " The sum total of all component efficiencies across streams must" \
202 " be less than or equal to 1" \
203 " (e.g. sum of U efficiencies for all streams must be <= 1).", \
204 }
205 std::map<std::string, std::pair<double, std::map<int, double> > > streams_;
206
207 // custom SnapshotInv and InitInv and EnterNotify are used to persist this
208 // state var.
209 std::map<std::string, cyclus::toolkit::ResBuf<cyclus::Material> > streambufs;
210
211 #pragma cyclus var { \
212 "default": 0.0, \
213 "uilabel": "Geographical latitude in degrees as a double", \
214 "doc": "Latitude of the agent's geographical position. The value should " \
215 "be expressed in degrees as a double." \
216 }
217 double latitude;
218
219 #pragma cyclus var { \
220 "default": 0.0, \
221 "uilabel": "Geographical longitude in degrees as a double", \
222 "doc": "Longitude of the agent's geographical position. The value should " \
223 "be expressed in degrees as a double." \
224 }
225 double longitude;
226
227 cyclus::toolkit::Position coordinates;
228
231 void Record(std::string name, double val, std::string type);
232};
233
234} // namespace cycamore
235
236#endif // CYCAMORE_SRC_SEPARATIONS_H_
#define CYCAMORE_VERSION
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()
cyclus::toolkit::Position coordinates
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
virtual std::set< cyclus::RequestPortfolio< cyclus::Material >::Ptr > GetMatlRequests()
Separations(cyclus::Context *ctx)
Material::Ptr SepMaterial(std::map< int, double > effs, Material::Ptr mat)