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