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