CYCAMORE
Loading...
Searching...
No Matches
build/cycamore/storage.h
Go to the documentation of this file.
1
2#line 1 "/cycamore/src/storage.h"
3#ifndef CYCLUS_STORAGES_STORAGE_H_
4#define CYCLUS_STORAGES_STORAGE_H_
5
6#include <string>
7#include <list>
8#include <vector>
9
10#include "cyclus.h"
11#include "cycamore_version.h"
12
13#include "boost/shared_ptr.hpp"
14
15#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO
16
17namespace cycamore {
69 : public cyclus::Facility,
70 public cyclus::toolkit::CommodityProducer {
71
72 public:
74 Storage(cyclus::Context* ctx);
75 virtual void InitFrom(cycamore::Storage* m);
76#line 73 "/cycamore/src/storage.h"
77
78 virtual void InitFrom(cyclus::QueryableBackend* b);
79#line 75 "/cycamore/src/storage.h"
80
81 virtual void InfileToDb(cyclus::InfileTree* tree, cyclus::DbInit di);
82
83 virtual cyclus::Agent* Clone();
84
85 virtual std::string schema();
86
87 virtual Json::Value annotations();
88
89 virtual void InitInv(cyclus::Inventories& inv);
90
91 virtual cyclus::Inventories SnapshotInv();
92
93 virtual void Snapshot(cyclus::DbInit di);
94
95 #pragma cyclus note {"doc": "Storage is a simple facility which accepts any number of commodities " "and holds them for a user specified amount of time. The commodities accepted " "are chosen based on the specified preferences list. Once the desired amount of material " "has entered the facility it is passed into a 'processing' buffer where it is held until " "the residence time has passed. The material is then passed into a 'ready' buffer where it is " "queued for removal. Currently, all input commodities are lumped into a single output commodity. " "Storage also has the functionality to handle materials in discrete or continuous batches. Discrete " "mode, which is the default, does not split or combine material batches. Continuous mode, however, " "divides material batches if necessary in order to push materials through the facility as quickly " "as possible."}
96#line 86 "/cycamore/src/storage.h"
97
99 virtual std::string str();
100
102 virtual void EnterNotify();
103
105 virtual void Tick();
106
108 virtual void Tock();
109
110 virtual std::string version() { return CYCAMORE_VERSION; }
111
112 protected:
116 void AddMat_(cyclus::Material::Ptr mat);
117
119 void BeginProcessing_();
120
123 void ProcessMat_(double cap);
124
127 void ReadyMatl_(int time);
128
129 // --- Storage Members ---
130
132 inline double current_capacity() {
133 return (inventory_tracker.space()); }
134
136 inline double capacity() { return inventory_tracker.capacity(); }
137
139 int ready_time(){ return context()->time() - residence_time; }
140
141 // --- Module Members ---
142
143 #pragma cyclus var {"tooltip":"input commodity", "doc":"commodities accepted by this facility", "uilabel":"Input Commodities", "uitype":["oneormore","incommodity"]}
144#line 136 "/cycamore/src/storage.h"
145 std::vector<std::string> in_commods;
146 std::vector<int> cycpp_shape_in_commods;
147#line 137 "/cycamore/src/storage.h"
148
149
150 #pragma cyclus var {"default": [], "doc":"preferences for each of the given commodities, in the same order." "Defauts to 1 if unspecified", "uilabel":"In Commody Preferences", "range": [None, [CY_NEAR_ZERO, CY_LARGE_DOUBLE]], "uitype":["oneormore", "range"]}
151#line 144 "/cycamore/src/storage.h"
152 std::vector<double> in_commod_prefs;
154#line 145 "/cycamore/src/storage.h"
155
156
157 #pragma cyclus var {"tooltip":"output commodity", "doc":"commodity produced by this facility. Multiple commodity tracking is" " currently not supported, one output commodity catches all input commodities.", "uilabel":"Output Commodities", "uitype":["oneormore","outcommodity"]}
158#line 151 "/cycamore/src/storage.h"
159 std::vector<std::string> out_commods;
160 std::vector<int> cycpp_shape_out_commods;
161#line 152 "/cycamore/src/storage.h"
162
163
164 #pragma cyclus var {"default":"", "tooltip":"input recipe", "doc":"recipe accepted by this facility, if unspecified a dummy recipe is used", "uilabel":"Input Recipe", "uitype":"inrecipe"}
165#line 158 "/cycamore/src/storage.h"
166 std::string in_recipe;
167 std::vector<int> cycpp_shape_in_recipe;
168#line 159 "/cycamore/src/storage.h"
169
170
171 #pragma cyclus var {"default": 0, "tooltip":"residence time (timesteps)", "doc":"the minimum holding time for a received commodity (timesteps).", "units":"time steps", "uilabel":"Residence Time", "uitype": "range", "range": [0, 12000]}
172#line 167 "/cycamore/src/storage.h"
175#line 168 "/cycamore/src/storage.h"
176
177
178 #pragma cyclus var {"default": CY_LARGE_DOUBLE, "tooltip":"throughput per timestep (kg)", "doc":"the max amount that can be moved through the facility per timestep (kg)", "uilabel":"Throughput", "uitype": "range", "range": [0.0, CY_LARGE_DOUBLE], "units":"kg"}
179#line 176 "/cycamore/src/storage.h"
181 std::vector<int> cycpp_shape_throughput;
182#line 177 "/cycamore/src/storage.h"
183
184
185 #pragma cyclus var {"default": CY_LARGE_DOUBLE, "tooltip":"maximum inventory size (kg)", "doc":"the maximum amount of material that can be in all storage buffer stages", "uilabel":"Maximum Inventory Size", "uitype": "range", "range": [0.0, CY_LARGE_DOUBLE], "units":"kg"}
186#line 185 "/cycamore/src/storage.h"
188 std::vector<int> cycpp_shape_max_inv_size;
189#line 186 "/cycamore/src/storage.h"
190
191
192 #pragma cyclus var {"default": False, "tooltip":"Bool to determine how Storage handles batches", "doc":"Determines if Storage will divide resource objects. Only controls material " "handling within this facility, has no effect on DRE material handling. " "If true, batches are handled as discrete quanta, neither split nor combined. " "Otherwise, batches may be divided during processing. Default to false (continuous))", "uilabel":"Batch Handling"}
193#line 194 "/cycamore/src/storage.h"
196#line 195 "/cycamore/src/storage.h"
197
198
199 #pragma cyclus var {"default": "unpackaged", "tooltip": "Output package", "doc": "Outgoing material will be packaged when trading.", "uitype": "package", "uilabel": "Package"}
200#line 201 "/cycamore/src/storage.h"
201 std::string package;
202 std::vector<int> cycpp_shape_package;
203#line 202 "/cycamore/src/storage.h"
204
205
206 #pragma cyclus var {"default": "unrestricted", "tooltip": "Output transport unit", "doc": "Outgoing material, after packaging, will be " "further restricted by transport unit when trading.", "uitype": "transportunit", "uilabel": "Transport Unit"}
207#line 209 "/cycamore/src/storage.h"
208 std::string transport_unit;
210
211#line 210 "/cycamore/src/storage.h"
212
213 #pragma cyclus var {"tooltip":"Incoming material buffer"}
214 cyclus::toolkit::ResBuf<cyclus::Material> inventory;
215 std::vector<int> cycpp_shape_inventory;
216
217#line 213 "/cycamore/src/storage.h"
218
219 #pragma cyclus var {"tooltip":"Output material buffer"}
220 cyclus::toolkit::ResBuf<cyclus::Material> stocks;
221 std::vector<int> cycpp_shape_stocks;
222
223#line 216 "/cycamore/src/storage.h"
224
225 #pragma cyclus var {"tooltip":"Buffer for material held for required residence_time"}
226 cyclus::toolkit::ResBuf<cyclus::Material> ready;
227 std::vector<int> cycpp_shape_ready;
228
229#line 219 "/cycamore/src/storage.h"
230
232 #pragma cyclus var{"default": [], "internal": True}
233#line 223 "/cycamore/src/storage.h"
234 std::list<int> entry_times;
235
236 #pragma cyclus var {"tooltip":"Buffer for material still waiting for required residence_time"}
237 cyclus::toolkit::ResBuf<cyclus::Material> processing;
238 std::vector<int> cycpp_shape_processing;
239
240#line 227 "/cycamore/src/storage.h"
241
242 #pragma cyclus var {"tooltip": "Total Inventory Tracker to restrict maximum agent inventory"}
243 cyclus::toolkit::TotalInvTracker inventory_tracker;
245
246#line 230 "/cycamore/src/storage.h"
247
248 friend class StorageTest;
249
250 private:
251 // Code Injection
252 #include "toolkit/matl_buy_policy.cycpp.h"
253 #include "toolkit/matl_sell_policy.cycpp.h"
254 #include "toolkit/position.cycpp.h"
255
256};
257
258} // namespace cycamore
259
260#endif // CYCLUS_STORAGES_STORAGE_H_
#define CYCAMORE_VERSION
This Facility is intended to hold materials for a user specified amount of time in order to model a s...
Storage(cyclus::Context *ctx)
void AddMat_(cyclus::Material::Ptr mat)
adds a material into the incoming commodity inventory
virtual std::string str()
A verbose printer for the Storage Facility.
std::vector< int > cycpp_shape_inventory_tracker
double current_capacity()
current maximum amount that can be added to processing
virtual std::string schema()
std::vector< int > cycpp_shape_processing
cyclus::toolkit::ResBuf< cyclus::Material > ready
std::vector< double > in_commod_prefs
cyclus::toolkit::ResBuf< cyclus::Material > processing
virtual void InitFrom(cycamore::Storage *m)
std::vector< int > cycpp_shape_residence_time
std::vector< int > cycpp_shape_out_commods
cyclus::toolkit::TotalInvTracker inventory_tracker
virtual cyclus::Agent * Clone()
std::vector< int > cycpp_shape_package
std::vector< int > cycpp_shape_in_commods
virtual void InfileToDb(cyclus::InfileTree *tree, cyclus::DbInit di)
std::vector< std::string > in_commods
virtual void Tock()
The handleTick function specific to the Storage.
std::vector< int > cycpp_shape_max_inv_size
virtual std::string version()
cyclus::toolkit::ResBuf< cyclus::Material > inventory
int ready_time()
returns the time key for ready materials
void ProcessMat_(double cap)
Move as many ready resources as allowable into stocks.
std::vector< int > cycpp_shape_discrete_handling
virtual void InitInv(cyclus::Inventories &inv)
std::vector< std::string > out_commods
std::list< int > entry_times
void ReadyMatl_(int time)
move ready resources from processing to ready at a certain time
void BeginProcessing_()
Move all unprocessed inventory to processing.
std::vector< int > cycpp_shape_inventory
std::vector< int > cycpp_shape_transport_unit
cyclus::toolkit::ResBuf< cyclus::Material > stocks
virtual void EnterNotify()
Sets up the Storage Facility's trade requests.
virtual Json::Value annotations()
double capacity()
returns total capacity
std::vector< int > cycpp_shape_in_commod_prefs
virtual cyclus::Inventories SnapshotInv()
std::vector< int > cycpp_shape_stocks
virtual void Snapshot(cyclus::DbInit di)
std::vector< int > cycpp_shape_throughput
std::vector< int > cycpp_shape_ready
virtual void Tick()
The handleTick function specific to the Storage.
std::vector< int > cycpp_shape_in_recipe