1#ifndef CYCLUS_STORAGES_STORAGE_H_
2#define CYCLUS_STORAGES_STORAGE_H_
11#include "boost/shared_ptr.hpp"
13#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO
90 :
public cyclus::Facility,
91 public cyclus::toolkit::CommodityProducer,
92 public cyclus::toolkit::Position {
99 #pragma cyclus note {"doc": "Storage is a simple facility which accepts any number of commodities " \
100 "and holds them for a user specified amount of time. The commodities accepted "\
101 "are chosen based on the specified preferences list. Once the desired amount of material "\
102 "has entered the facility it is passed into a 'processing' buffer where it is held until "\
103 "the residence time has passed. The material is then passed into a 'ready' buffer where it is "\
104 "queued for removal. Currently, all input commodities are lumped into a single output commodity. "\
105 "Storage also has the functionality to handle materials in discrete or continuous batches. Discrete "\
106 "mode, which is the default, does not split or combine material batches. Continuous mode, however, "\
107 "divides material batches if necessary in order to push materials through the facility as quickly "\
111 virtual std::string
str();
160 #pragma cyclus var {"tooltip":"input commodity",\
161 "doc":"commodities accepted by this facility",\
162 "uilabel":"Input Commodities",\
163 "uitype":["oneormore","incommodity"]}
166 #pragma cyclus var {"default": [],\
167 "doc":"preferences for each of the given commodities, in the same order."\
168 "Defauts to 1 if unspecified",\
169 "uilabel":"In Commody Preferences", \
170 "range": [None, [CY_NEAR_ZERO, CY_LARGE_DOUBLE]], \
171 "uitype":["oneormore", "range"]}
174 #pragma cyclus var {"tooltip":"output commodity",\
175 "doc":"commodity produced by this facility. Multiple commodity tracking is"\
176 " currently not supported, one output commodity catches all input commodities.",\
177 "uilabel":"Output Commodities",\
178 "uitype":["oneormore","outcommodity"]}
181 #pragma cyclus var {"default":"",\
182 "tooltip":"input recipe",\
183 "doc":"recipe accepted by this facility, if unspecified a dummy recipe is used",\
184 "uilabel":"Input Recipe",\
188 #pragma cyclus var {"default": 0,\
189 "tooltip":"residence time (timesteps)",\
190 "doc":"the minimum holding time for a received commodity (timesteps).",\
191 "units":"time steps",\
192 "uilabel":"Residence Time", \
197 #pragma cyclus var {"default": 0,\
198 "tooltip":"sell quantity (kg)",\
199 "doc":"material will be sold in integer multiples of this quantity. If"\
200 " the buffer contains less than the sell quantity, no material will be"\
202 "uilabel":"Sell Quantity",\
204 "range": [0.0, CY_LARGE_DOUBLE], \
208 #pragma cyclus var {"default": CY_LARGE_DOUBLE,\
209 "tooltip":"throughput per timestep (kg)",\
210 "doc":"the max amount that can be moved through the facility per timestep (kg)",\
211 "uilabel":"Throughput",\
213 "range": [0.0, CY_LARGE_DOUBLE], \
217 #pragma cyclus var {"default": CY_LARGE_DOUBLE,\
218 "tooltip":"maximum inventory size (kg)",\
219 "doc":"the maximum amount of material that can be in all storage buffer stages",\
220 "uilabel":"Maximum Inventory Size",\
222 "range": [0.0, CY_LARGE_DOUBLE], \
226 #pragma cyclus var {"default": False,\
227 "tooltip":"Bool to determine how Storage handles batches",\
228 "doc":"Determines if Storage will divide resource objects. Only controls material "\
229 "handling within this facility, has no effect on DRE material handling. "\
230 "If true, batches are handled as discrete quanta, neither split nor combined. "\
231 "Otherwise, batches may be divided during processing. Default to false (continuous))",\
232 "uilabel":"Batch Handling"}
235 #pragma cyclus var {"default": "Fixed",\
236 "tooltip": "Type of active buying frequency",\
237 "doc": "Options: Fixed, Uniform, Normal. Fixed requires active_buying_val. Uniform "\
238 "requires active_buying_min and active_buying_max. Normal "\
239 "requires active_buying_mean and active_buying_std, with optional "\
240 "active_buying_min and active_buying_max.",\
241 "uitype": "combobox",\
242 "categorical": ["Fixed", "Uniform", "Normal"],\
243 "uilabel": "Active Buying Frequency Type"}
246 #pragma cyclus var {"default": -1,\
247 "tooltip": "Fixed active buying frequency",\
248 "doc": "The length in time steps of the active buying period. Required for fixed "\
249 "active_buying_frequency_type. Must be greater than or equal to 1 (i.e., agent "\
250 "cannot always be dormant)",\
252 "range": [1, CY_LARGE_INT], \
253 "uilabel": "Active Buying Frequency Value"}
256 #pragma cyclus var {"default": -1,\
257 "tooltip": "Active buying distribution minimum",\
258 "doc": "The minimum length in time steps of the active buying period. Required for "\
259 "Uniform and optional for Normal active_buying_frequency_type. Must be greater than "\
262 "range": [1, CY_LARGE_INT], \
263 "uilabel": "Active Buying Frequency Minimum"}
266 #pragma cyclus var {"default": -1,\
267 "tooltip": "Active buying distribution maximum",\
268 "doc": "The maximum length in time steps of the active buying period. Required for "\
269 "Uniform active_buying_frequency_type, optional for Normal. Must be greater than or equal to active_buying_min ",\
271 "range": [1, CY_LARGE_INT], \
272 "uilabel": "Active Buying Frequency Maximum"}
275 #pragma cyclus var {"default": -1,\
276 "tooltip": "Active buying distribution mean",\
277 "doc": "The mean length in time steps of the active buying period. Required for "\
278 "Normal active_buying_frequency_type. Must be greater than or equal to 1 ",\
280 "range": [1.0, CY_LARGE_DOUBLE], \
281 "uilabel": "Active Buying Frequency Mean"}
284 #pragma cyclus var {"default": -1,\
285 "tooltip": "Active buying distribution standard deviation",\
286 "doc": "The standard deviation of the length in time steps of the active buying period. "\
287 "Required for Normal active_buying_frequency_type. Must be greater than or equal to 0 ",\
289 "range": [0.0, CY_LARGE_DOUBLE], \
290 "uilabel": "Active Buying Frequency Standard Deviation"}
293 #pragma cyclus var {"default": "Fixed",\
294 "tooltip": "Type of dormant buying frequency",\
295 "doc": "Options: Fixed, Uniform, Normal. Fixed requires dormant_buying_val. Uniform "\
296 "requires dormant_buying_min and dormant_buying_max. Normal requires "\
297 "dormant_buying_mean and dormant_buying_std, with optional dormant_buying_min "\
298 "and dormant_buying_max.",\
299 "uitype": "combobox",\
300 "categorical": ["Fixed", "Uniform", "Normal"],\
301 "uilabel": "Dormant Buying Frequency Type"}
304 #pragma cyclus var {"default": -1,\
305 "tooltip": "Fixed dormant buying frequency",\
306 "doc": "The length in time steps of the dormant buying period. Required for fixed "\
307 "dormant_buying_frequency_type. Default is -1, agent has no dormant period and stays active.",\
309 "range": [-1, CY_LARGE_INT], \
310 "uilabel": "Dormant Buying Frequency Value"}
313 #pragma cyclus var {"default": -1,\
314 "tooltip": "Dormant buying distribution minimum",\
315 "doc": "The minimum length in time steps of the dormant buying period. Required for Uniform and optional for "\
316 "Normal dormant_buying_frequency_type.",\
318 "range": [0, CY_LARGE_INT], \
319 "uilabel": "Dormant Buying Frequency Minimum"}
322 #pragma cyclus var {"default": -1,\
323 "tooltip": "Dormant buying distribution maximum",\
324 "doc": "The maximum length in time steps of the dormant buying period. Required for "\
325 "Uniform dormant_buying_frequency_type, optional for Normal. Must be greater than or equal to dormant_buying_min ",\
327 "range": [0, CY_LARGE_INT], \
328 "uilabel": "Dormant Buying Frequency Maximum"}
331 #pragma cyclus var {"default": -1,\
332 "tooltip": "Dormant buying distribution mean",\
333 "doc": "The mean length in time steps of the dormant buying period. Required for "\
334 "Normal dormant_buying_frequency_type. Must be greater than or equal to 0 ",\
336 "range": [0.0, CY_LARGE_DOUBLE], \
337 "uilabel": "Dormant Buying Frequency Mean"}
340 #pragma cyclus var {"default": -1,\
341 "tooltip": "Dormant buying distribution standard deviation",\
342 "doc": "The standard deviation of the length in time steps of the dormant buying period. "\
343 "Required for Normal dormant_buying_frequency_type. Must be greater than or equal to 0 ",\
345 "range": [0.0, CY_LARGE_DOUBLE], \
346 "uilabel": "Dormant Buying Frequency Standard Deviation"}
349 #pragma cyclus var {"default": "Fixed",\
350 "tooltip": "Type of behavior used to determine size of buy request",\
351 "doc": "Behavior function used to determine the size of requests made. All values are "\
352 "a fraction of maximum capacity, determined by the throughput and capacity remaining."\
353 " Options: Fixed, Uniform, Normal. Fixed is default behavior. Uniform requires "\
354 "buying_size_min and buying_size_max. Normal requires "\
355 "buying_size_mean and buying_size_stddev, optional buying_size_min and "\
357 "uitype": "combobox",\
358 "categorical": ["Fixed", "Uniform", "Normal"],\
359 "uilabel": "Buying Size Type"}
362 #pragma cyclus var {"default": 1.0,\
363 "tooltip": "Fixed buying size",\
364 "doc": "The size of the buy request as a fraction of maximum capacity. Optional for Fixed "\
365 "buying_size_type. Must be greater than or equal to 0.0",\
367 "range": [0.0, 1.0], \
368 "uilabel": "Buying Size Value"}
371 #pragma cyclus var {"default": -1.0,\
372 "tooltip": "Buying size distribution minimum",\
373 "doc": "The minimum size of the buy request as a fraction of maximum capacity. "\
374 "Required for Uniform and optional for Normal buying_size_type. Must be greater than "\
375 "or equal to zero.",\
377 "range": [0.0, 1.0], \
378 "uilabel": "Buying Size Minimum"}
381 #pragma cyclus var {"default": -1.0,\
382 "tooltip": "Buying size distribution maximum",\
383 "doc": "The maximum size of the buy request as a fraction of maximum capacity. "\
384 "Required for Uniform buying_size_type, optional for Normal. Must be greater than "\
385 "or equal to buying_size_min ",\
387 "range": [0.0, 1.0], \
388 "uilabel": "Buying Size Maximum"}
391 #pragma cyclus var {"default": -1.0,\
392 "tooltip": "Buying size distribution mean",\
393 "doc": "The mean size of the buy request as a fraction of maximum capacity. "\
394 "Required for Normal buying_size_type.",\
396 "range": [0.0, 1.0], \
397 "uilabel": "Buying Size Mean"}
400 #pragma cyclus var {"default": -1.0,\
401 "tooltip": "Buying size distribution standard deviation",\
402 "doc": "The standard deviation of the size of the buy request as a fraction of "\
403 "maximum capacity. Required for Normal buying_size_type.",\
405 "range": [0.0, 1.0], \
406 "uilabel": "Buying Size Standard Deviation"}
409 #pragma cyclus var {"default": -1,\
410 "tooltip":"Reorder point",\
411 "doc":"The point at which the facility will request more material. "\
412 "Above this point, no request will be made. Must be less than max_inv_size."\
413 "If paired with reorder_quantity, this agent will have an (R,Q) inventory policy. "\
414 "If reorder_point is used alone, this agent will have an (s,S) inventory policy, "\
415 " with S (the maximum) being set at max_inv_size.",\
416 "uilabel":"Reorder Point"}
419 #pragma cyclus var {"default": -1,\
420 "tooltip":"Reorder amount (R,Q inventory policy)",\
421 "doc":"The amount of material that will be requested when the reorder point is reached. "\
422 "Exclusive request, so will demand exactly reorder_quantity."\
423 "Reorder_point + reorder_quantity must be less than max_inv_size.",\
424 "uilabel":"Reorder Quantity"}
427 #pragma cyclus var {"default": -1,\
428 "tooltip": "Total amount of material that can be recieved per cycle.",\
429 "doc": "After receiving this much material cumulatively, the agent will go dormant. "\
430 "Must be paired with dormant_buying_frequency_type and any other dormant parameters. "\
431 "The per-time step demand is unchanged except the cycle cap is almost reached.",\
432 "uilabel": "Cumulative Cap"}
435 #pragma cyclus var {"default": "unpackaged", \
436 "tooltip": "Output package", \
437 "doc": "Outgoing material will be packaged when trading.", \
438 "uitype": "package", \
439 "uilabel": "Package"}
442 #pragma cyclus var {"default": "unrestricted", \
443 "tooltip": "Output transport unit", \
444 "doc": "Outgoing material, after packaging, will be "\
445 "further restricted by transport unit when trading.", \
446 "uitype": "transportunit", \
447 "uilabel": "Transport Unit"}
450 #pragma cyclus var {"tooltip":"Incoming material buffer"}
451 cyclus::toolkit::ResBuf<cyclus::Material>
inventory;
453 #pragma cyclus var {"tooltip":"Output material buffer"}
454 cyclus::toolkit::ResBuf<cyclus::Material>
stocks;
456 #pragma cyclus var {"tooltip":"Buffer for material held for required residence_time"}
457 cyclus::toolkit::ResBuf<cyclus::Material>
ready;
460 #pragma cyclus var{"default": [],\
464 #pragma cyclus var {"tooltip":"Buffer for material still waiting for required residence_time"}
465 cyclus::toolkit::ResBuf<cyclus::Material>
processing;
467 #pragma cyclus var {"tooltip": "Total Inventory Tracker to restrict maximum agent inventory"}
476 #pragma cyclus var { \
478 "uilabel": "Geographical latitude in degrees as a double", \
479 "doc": "Latitude of the agent's geographical position. The value should " \
480 "be expressed in degrees as a double." \
484 #pragma cyclus var { \
486 "uilabel": "Geographical longitude in degrees as a double", \
487 "doc": "Longitude of the agent's geographical position. The value should " \
488 "be expressed in degrees as a double." \
494 cyclus::DoubleDistribution::Ptr
size_dist_ = NULL;
Storage(cyclus::Context *ctx)
void AddMat_(cyclus::Material::Ptr mat)
adds a material into the incoming commodity inventory
std::string transport_unit
double current_capacity()
current maximum amount that can be added to processing
cyclus::IntDistribution::Ptr active_dist_
cyclus::toolkit::MatlSellPolicy sell_policy
cyclus::toolkit::ResBuf< cyclus::Material > ready
cyclus::DoubleDistribution::Ptr size_dist_
std::vector< double > in_commod_prefs
virtual void Tick()
The handleTick function specific to the Storage.
double active_buying_stddev
cyclus::toolkit::ResBuf< cyclus::Material > processing
cyclus::toolkit::TotalInvTracker inventory_tracker
virtual std::string str()
A verbose printer for the Storage Facility.
double dormant_buying_mean
std::vector< std::string > in_commods
cyclus::IntDistribution::Ptr dormant_dist_
void InitBuyPolicyParameters()
sets up the distributions for the buy policy
std::string active_buying_frequency_type
virtual std::string version()
std::string dormant_buying_frequency_type
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.
virtual void Tock()
The handleTick function specific to the Storage.
std::vector< std::string > out_commods
std::list< int > entry_times
virtual void EnterNotify()
Sets up the Storage Facility's trade requests.
double active_buying_mean
double dormant_buying_stddev
void ReadyMatl_(int time)
move ready resources from processing to ready at a certain time
std::string buying_size_type
double buying_size_stddev
void BeginProcessing_()
Move all unprocessed inventory to processing.
cyclus::toolkit::ResBuf< cyclus::Material > stocks
cyclus::toolkit::Position coordinates
double capacity()
returns total capacity
cyclus::toolkit::MatlBuyPolicy buy_policy