Skip to content

Commit

Permalink
Add Sell quantity to storage (#524)
Browse files Browse the repository at this point in the history
* first attempt at adding minimum sell inventory

* second pass at sell quantity implementation

* removing traces of min_sell_inv

* remove if sell quantity != 0 conditional

* Update src/storage.cc

Co-authored-by: Katie Mummah <[email protected]>

Co-authored-by: Baptiste Mouginot <[email protected]>
  • Loading branch information
nuclearkatie and bam241 authored Jul 21, 2021
1 parent 224e6e4 commit fd1623c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ void Storage::EnterNotify() {
buy_policy.Start();

if (out_commods.size() == 1) {
sell_policy.Init(this, &stocks, std::string("stocks"))
.Set(out_commods.front())
.Start();
sell_policy.Init(this, &stocks, std::string("stocks"), 1e+299, false, sell_quantity)
.Set(out_commods.front())
.Start();

} else {
std::stringstream ss;
ss << "out_commods has " << out_commods.size() << " values, expected 1.";
Expand Down
12 changes: 12 additions & 0 deletions src/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace cycamore {
/// in_recipe (optional) describes the incoming resource by recipe
///
/// @section optionalparams Optional Parameters
/// sell_quantity restricts selling to only integer multiples of this value
/// max_inv_size is the maximum capacity of the inventory storage
/// throughput is the maximum processing capacity per timestep
///
Expand Down Expand Up @@ -162,6 +163,17 @@ class Storage
"range": [0, 12000]}
int residence_time;

#pragma cyclus var {"default": 0,\
"tooltip":"sell quantity (kg)",\
"doc":"material will be sold in integer multiples of this quantity. If"\
" the buffer contains less than the sell quantity, no material will be"\
" offered", \
"uilabel":"Sell Quantity",\
"uitype": "range", \
"range": [0.0, 1e299], \
"units": "kg"}
double sell_quantity;

#pragma cyclus var {"default": 1e299,\
"tooltip":"throughput per timestep (kg)",\
"doc":"the max amount that can be moved through the facility per timestep (kg)",\
Expand Down

0 comments on commit fd1623c

Please sign in to comment.