From fd1623c3068d1b7e63f6319c8b7aff7417a3e6d2 Mon Sep 17 00:00:00 2001 From: Katie Mummah Date: Wed, 21 Jul 2021 17:26:34 -0500 Subject: [PATCH] Add Sell quantity to storage (#524) * 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 Co-authored-by: Baptiste Mouginot <15145274+bam241@users.noreply.github.com> --- src/storage.cc | 7 ++++--- src/storage.h | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/storage.cc b/src/storage.cc index 418fdf1710..1c92e20963 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -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."; diff --git a/src/storage.h b/src/storage.h index 7282acce2c..e360193b34 100644 --- a/src/storage.h +++ b/src/storage.h @@ -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 /// @@ -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)",\