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
22  : public cyclus::Facility,
23  public cyclus::toolkit::Position {
24  public:
25  Sink(cyclus::Context* ctx);
26 
27  virtual ~Sink();
28 
29  virtual std::string version() { return CYCAMORE_VERSION; }
30 
31  #pragma cyclus note { \
32  "doc": \
33  " A sink facility that accepts materials and products with a fixed\n"\
34  " throughput (per time step) capacity and a lifetime capacity defined by\n"\
35  " a total inventory size. The inventory size and throughput capacity\n"\
36  " both default to infinite. If a recipe is provided, it will request\n"\
37  " material with that recipe. Requests are made for any number of\n"\
38  " specified commodities.\n" \
39  }
40 
41  #pragma cyclus decl
42 
43  virtual std::string str();
44 
45  virtual void EnterNotify();
46 
47  virtual void Tick();
48 
49  virtual void Tock();
50 
53  virtual std::set<cyclus::RequestPortfolio<cyclus::Material>::Ptr>
55 
59  virtual std::set<cyclus::RequestPortfolio<cyclus::Product>::Ptr>
61 
63  virtual void AcceptMatlTrades(
64  const std::vector< std::pair<cyclus::Trade<cyclus::Material>,
65  cyclus::Material::Ptr> >& responses);
66 
68  virtual void AcceptGenRsrcTrades(
69  const std::vector< std::pair<cyclus::Trade<cyclus::Product>,
70  cyclus::Product::Ptr> >& responses);
71 
74  inline void AddCommodity(std::string name) { in_commods.push_back(name); }
75 
78  inline void SetMaxInventorySize(double size) {
79  max_inv_size = size;
80  inventory.capacity(size);
81  }
82 
84  inline double MaxInventorySize() const { return inventory.capacity(); }
85 
87  inline double InventorySize() const { return inventory.quantity(); }
88 
90  inline double RequestAmt() const {
91  return std::min(capacity, std::max(0.0, inventory.space()));
92  }
93 
96  inline void Capacity(double cap) { capacity = cap; }
97 
99  inline double Capacity() const { return capacity; }
100 
102  inline const std::vector<std::string>&
103  input_commodities() const { return in_commods; }
104 
106  inline const std::vector<double>&
108 
109  private:
111  #pragma cyclus var {"tooltip": "input commodities", \
112  "doc": "commodities that the sink facility accepts", \
113  "uilabel": "List of Input Commodities", \
114  "uitype": ["oneormore", "incommodity"]}
115  std::vector<std::string> in_commods;
116 
117  #pragma cyclus var {"default": [],\
118  "doc":"preferences for each of the given commodities, in the same order."\
119  "Defauts to 1 if unspecified",\
120  "uilabel":"In Commody Preferences", \
121  "range": [None, [1e-299, 1e299]], \
122  "uitype":["oneormore", "range"]}
123  std::vector<double> in_commod_prefs;
124 
125  #pragma cyclus var {"default": "", \
126  "tooltip": "requested composition", \
127  "doc": "name of recipe to use for material requests, " \
128  "where the default (empty string) is to accept " \
129  "everything", \
130  "uilabel": "Input Recipe", \
131  "uitype": "inrecipe"}
133 
135  #pragma cyclus var {"default": 1e299, \
136  "tooltip": "sink maximum inventory size", \
137  "uilabel": "Maximum Inventory", \
138  "uitype": "range", \
139  "range": [0.0, 1e299], \
140  "doc": "total maximum inventory size of sink facility"}
141  double max_inv_size;
142 
144  #pragma cyclus var {"default": 1e299, \
145  "tooltip": "sink capacity", \
146  "uilabel": "Maximum Throughput", \
147  "uitype": "range", \
148  "range": [0.0, 1e299], \
149  "doc": "capacity the sink facility can " \
150  "accept at each time step"}
151  double capacity;
152 
154  #pragma cyclus var {'capacity': 'max_inv_size'}
155  cyclus::toolkit::ResBuf<cyclus::Resource> inventory;
156 
157  #pragma cyclus var { \
158  "default": 0.0, \
159  "uilabel": "Geographical latitude in degrees as a double", \
160  "doc": "Latitude of the agent's geographical position. The value should " \
161  "be expressed in degrees as a double." \
162  }
163  double latitude;
164 
165  #pragma cyclus var { \
166  "default": 0.0, \
167  "uilabel": "Geographical longitude in degrees as a double", \
168  "doc": "Longitude of the agent's geographical position. The value should " \
169  "be expressed in degrees as a double." \
170  }
171  double longitude;
172 
173  cyclus::toolkit::Position coordinates;
174 
175  void RecordPosition();
176 };
177 
178 } // namespace cycamore
179 
180 #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 RequestAmt() const
determines the amount to request
Definition: src/sink.h:90
cyclus::toolkit::Position coordinates
double InventorySize() const
Definition: src/sink.h:87
double max_inv_size
max inventory size
Sink(cyclus::Context *ctx)
const std::vector< std::string > & input_commodities() const
Definition: src/sink.h:103
void AddCommodity(std::string name)
add a commodity to the set of input commodities
Definition: src/sink.h:74
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:96
const std::vector< double > & input_commodity_preferences() const
Definition: src/sink.h:107
cycamore::GrowthRegion string
virtual std::string version()
Definition: src/sink.h:29
virtual std::set< cyclus::RequestPortfolio< cyclus::Product >::Ptr > GetGenRsrcRequests()
SinkFacilities request Products of their given commodity.
std::vector< double > in_commod_prefs
double MaxInventorySize() const
Definition: src/sink.h:84
virtual void AcceptMatlTrades(const std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &responses)
SinkFacilities place accepted trade Materials in their Inventory.
double Capacity() const
Definition: src/sink.h:99
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:78
double capacity
monthly acceptance capacity
virtual std::string str()