diff --git a/src/storage.cc b/src/storage.cc index 1c92e2096..46cc3577d 100644 --- a/src/storage.cc +++ b/src/storage.cc @@ -115,14 +115,21 @@ std::string Storage::str() { //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Storage::Tick() { + + + LOG(cyclus::LEV_INFO3, "ComCnv") << prototype() << " is ticking {"; + + LOG(cyclus::LEV_INFO5, "ComCnv") << "Processing = " << processing.quantity() << ", ready = " << ready.quantity() << ", stocks = " << stocks.quantity() << " and max inventory = " << max_inv_size; + + LOG(cyclus::LEV_INFO4, "ComCnv") << "current capacity " << max_inv_size << " - " << processing.quantity() << " - " << ready.quantity() << " - " << stocks.quantity() << " = " << current_capacity(); + // Set available capacity for Buy Policy inventory.capacity(current_capacity()); - LOG(cyclus::LEV_INFO3, "ComCnv") << prototype() << " is ticking {"; if (current_capacity() > cyclus::eps_rsrc()) { LOG(cyclus::LEV_INFO4, "ComCnv") - << " has capacity for " << current_capacity() << " kg of material."; + << " has capacity for " << current_capacity() << "."; } LOG(cyclus::LEV_INFO3, "ComCnv") << "}"; } @@ -134,12 +141,19 @@ void Storage::Tock() { BeginProcessing_(); // place unprocessed inventory into processing + LOG(cyclus::LEV_INFO4, "ComCnv") << "processing currently holds " << processing.quantity() << ". ready currently holds " << ready.quantity() << "."; + if (ready_time() >= 0 || residence_time == 0 && !inventory.empty()) { ReadyMatl_(ready_time()); // place processing into ready } - ProcessMat_(throughput); // place ready into stocks + LOG(cyclus::LEV_INFO5, "ComCnv") << "Ready now holds " << ready.quantity() << " kg."; + + if (ready.quantity() > throughput) { + LOG(cyclus::LEV_INFO5, "ComCnv") << "Up to " << throughput << " kg will be placed in stocks based on throughput limits. "; + } + ProcessMat_(throughput); // place ready into stocks std::vector::iterator result; result = std::max_element(in_commod_prefs.begin(), in_commod_prefs.end()); @@ -150,6 +164,9 @@ void Storage::Tock() { // provide one value for out_commods, despite it being a vector of strings. cyclus::toolkit::RecordTimeSeries("supply"+out_commods[0], this, stocks.quantity()); + + LOG(cyclus::LEV_INFO4, "ComCnv") << "process has " + << processing.quantity() << ". Ready has " << ready.quantity() << ". Stocks has " << stocks.quantity() << "."; LOG(cyclus::LEV_INFO3, "ComCnv") << "}"; } @@ -227,6 +244,7 @@ void Storage::ProcessMat_(double cap) { //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Storage::ReadyMatl_(int time) { using cyclus::toolkit::ResBuf; + LOG(cyclus::LEV_INFO5, "ComCnv") << "Placing material into ready"; int to_ready = 0; diff --git a/src/storage.h b/src/storage.h index e360193b3..ace678874 100644 --- a/src/storage.h +++ b/src/storage.h @@ -119,7 +119,8 @@ class Storage /// @brief current maximum amount that can be added to processing inline double current_capacity() const { - return (max_inv_size - processing.quantity() - stocks.quantity()); } + return (max_inv_size - processing.quantity() - stocks.quantity() + - ready.quantity()); } /// @brief returns the time key for ready materials int ready_time(){ return context()->time() - residence_time; }