CYCAMORE
src/sink.h
Go to the documentation of this file.
1 #ifndef CYCAMORE_SRC_SINK_H_
2 #define CYCAMORE_SRC_SINK_H_
3 
4 #include <algorithm>
5 #include <string>
6 #include <utility>
7 #include <vector>
8 
9 #include "cyclus.h"
10 #include "cycamore_version.h"
11 
12 namespace cycamore {
13 
14 class Context;
15 
21 class Sink : public cyclus::Facility {
22  public:
23  Sink(cyclus::Context* ctx);
24 
25  virtual ~Sink();
26 
27  virtual std::string version() { return CYCAMORE_VERSION; }
28 
29  #pragma cyclus note { \
30  "doc": \
31  " A sink facility that accepts materials and products with a fixed\n"\
32  " throughput (per time step) capacity and a lifetime capacity defined by\n"\
33  " a total inventory size. The inventory size and throughput capacity\n"\
34  " both default to infinite. If a recipe is provided, it will request\n"\
35  " material with that recipe. Requests are made for any number of\n"\
36  " specified commodities.\n" \
37  }
38 
39  #pragma cyclus decl
40 
41  virtual std::string str();
42 
43  virtual void EnterNotify();
44 
45  virtual void Tick();
46 
47  virtual void Tock();
48 
51  virtual std::set<cyclus::RequestPortfolio<cyclus::Material>::Ptr>
53 
57  virtual std::set<cyclus::RequestPortfolio<cyclus::Product>::Ptr>
59 
61  virtual void AcceptMatlTrades(
62  const std::vector< std::pair<cyclus::Trade<cyclus::Material>,
63  cyclus::Material::Ptr> >& responses);
64 
66  virtual void AcceptGenRsrcTrades(
67  const std::vector< std::pair<cyclus::Trade<cyclus::Product>,
68  cyclus::Product::Ptr> >& responses);
69 
72  inline void AddCommodity(std::string name) { in_commods.push_back(name); }
73 
76  inline void SetMaxInventorySize(double size) {
77  max_inv_size = size;
78  inventory.capacity(size);
79  }
80 
82  inline double MaxInventorySize() const { return inventory.capacity(); }
83 
85  inline double InventorySize() const { return inventory.quantity(); }
86 
88  inline double RequestAmt() const {
89  return std::min(capacity, std::max(0.0, inventory.space()));
90  }
91 
94  inline void Capacity(double cap) { capacity = cap; }
95 
97  inline double Capacity() const { return capacity; }
98 
100  inline const std::vector<std::string>&
101  input_commodities() const { return in_commods; }
102 
104  inline const std::vector<double>&
106 
107  private:
109  #pragma cyclus var {"tooltip": "input commodities", \
110  "doc": "commodities that the sink facility accepts", \
111  "uilabel": "List of Input Commodities", \
112  "uitype": ["oneormore", "incommodity"]}
113  std::vector<std::string> in_commods;
114 
115  #pragma cyclus var {"default": [],\
116  "doc":"preferences for each of the given commodities, in the same order."\
117  "Defauts to 1 if unspecified",\
118  "uilabel":"In Commody Preferences", \
119  "range": [None, [1e-299, 1e299]], \
120  "uitype":["oneormore", "range"]}
121  std::vector<double> in_commod_prefs;
122 
123  #pragma cyclus var {"default": "", \
124  "tooltip": "requested composition", \
125  "doc": "name of recipe to use for material requests, " \
126  "where the default (empty string) is to accept " \
127  "everything", \
128  "uilabel": "Input Recipe", \
129  "uitype": "recipe"}
131 
133  #pragma cyclus var {"default": 1e299, \
134  "tooltip": "sink maximum inventory size", \
135  "uilabel": "Maximum Inventory", \
136  "uitype": "range", \
137  "range": [0.0, 1e299], \
138  "doc": "total maximum inventory size of sink facility"}
139  double max_inv_size;
140 
142  #pragma cyclus var {"default": 1e299, \
143  "tooltip": "sink capacity", \
144  "uilabel": "Maximum Throughput", \
145  "uitype": "range", \
146  "range": [0.0, 1e299], \
147  "doc": "capacity the sink facility can " \
148  "accept at each time step"}
149  double capacity;
150 
152  #pragma cyclus var {'capacity': 'max_inv_size'}
153  cyclus::toolkit::ResBuf<cyclus::Resource> inventory;
154 };
155 
156 } // namespace cycamore
157 
158 #endif // CYCAMORE_SRC_SINK_H_
virtual std::set< cyclus::RequestPortfolio< cyclus::Material >::Ptr > GetMatlRequests()
SinkFacilities request Materials of their given commodity.
cyclus::toolkit::ResBuf< cyclus::Resource > inventory
this facility holds material in storage.
double max_inv_size
max inventory size
Sink(cyclus::Context *ctx)
void AddCommodity(std::string name)
add a commodity to the set of input commodities
Definition: src/sink.h:72
double MaxInventorySize() const
Definition: src/sink.h:82
virtual void AcceptGenRsrcTrades(const std::vector< std::pair< cyclus::Trade< cyclus::Product >, cyclus::Product::Ptr > > &responses)
SinkFacilities place accepted trade Materials in their Inventory.
void Capacity(double cap)
sets the capacity of a material generated at any given time step
Definition: src/sink.h:94
const std::vector< std::string > & input_commodities() const
Definition: src/sink.h:101
double RequestAmt() const
determines the amount to request
Definition: src/sink.h:88
cycamore::GrowthRegion string
double Capacity() const
Definition: src/sink.h:97
double InventorySize() const
Definition: src/sink.h:85
virtual std::string version()
Definition: src/sink.h:27
virtual std::set< cyclus::RequestPortfolio< cyclus::Product >::Ptr > GetGenRsrcRequests()
SinkFacilities request Products of their given commodity.
std::vector< double > in_commod_prefs
const std::vector< double > & input_commodity_preferences() const
Definition: src/sink.h:105
virtual void AcceptMatlTrades(const std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &responses)
SinkFacilities place accepted trade Materials in their Inventory.
std::vector< std::string > in_commods
all facilities must have at least one input commodity
void SetMaxInventorySize(double size)
sets the size of the storage inventory for received material
Definition: src/sink.h:76
double capacity
monthly acceptance capacity
virtual std::string str()