9 : cyclus::Facility(ctx),
13 cyclus::Warn<cyclus::EXPERIMENTAL_WARNING>(
14 "The Storage Facility is experimental.");};
19 #pragma cyclus def schema storage::Storage 21 #pragma cyclus def annotations storage::Storage 23 #pragma cyclus def initinv storage::Storage 25 #pragma cyclus def snapshotinv storage::Storage 27 #pragma cyclus def infiletodb storage::Storage 29 #pragma cyclus def snapshot storage::Storage 31 #pragma cyclus def clone storage::Storage 35 #pragma cyclus impl initfromcopy storage::Storage 36 cyclus::toolkit::CommodityProducer::Copy(m);
41 #pragma cyclus impl initfromdb storage::Storage 43 using cyclus::toolkit::Commodity;
45 cyclus::toolkit::CommodityProducer::Add(commod);
46 cyclus::toolkit::CommodityProducer::SetCapacity(commod,
throughput);
51 cyclus::Facility::EnterNotify();
56 cyclus::Composition::Ptr comp = cyclus::Composition::CreateFromAtom(v);
69 throw cyclus::ValueError(ss.str());
83 ss <<
"out_commods has " <<
out_commods.size() <<
" values, expected 1.";
84 throw cyclus::ValueError(ss.str());
98 if (cyclus::toolkit::CommodityProducer::Produces(
99 cyclus::toolkit::Commodity(out_str))) {
104 ss << cyclus::Facility::str();
105 ss <<
" has facility parameters {" 107 <<
" Output Commodity = " << out_str <<
",\n" 110 <<
" commod producer members: " 111 <<
" produces " << out_str <<
"?:" << ans <<
"'}";
120 LOG(cyclus::LEV_INFO3,
"ComCnv") << prototype() <<
" is ticking {";
123 LOG(cyclus::LEV_INFO4,
"ComCnv")
126 LOG(cyclus::LEV_INFO3,
"ComCnv") <<
"}";
131 using cyclus::toolkit::RecordTimeSeries;
132 LOG(cyclus::LEV_INFO3,
"ComCnv") << prototype() <<
" is tocking {";
143 std::vector<double>::iterator result;
146 cyclus::toolkit::RecordTimeSeries<double>(
"demand"+
in_commods[maxindx],
this,
150 cyclus::toolkit::RecordTimeSeries<double>(
"supply"+
out_commods[0],
this,
152 LOG(cyclus::LEV_INFO3,
"ComCnv") <<
"}";
157 LOG(cyclus::LEV_INFO5,
"ComCnv") << prototype() <<
" is initially holding " 162 }
catch (cyclus::Error& e) {
163 e.msg(Agent::InformErrorMsg(e.msg()));
167 LOG(cyclus::LEV_INFO5,
"ComCnv")
168 << prototype() <<
" added " << mat->quantity()
169 <<
" of material to its inventory, which is holding " 180 LOG(cyclus::LEV_DEBUG2,
"ComCnv")
181 <<
"Storage " << prototype()
182 <<
" added resources to processing at t= " << context()->time();
183 }
catch (cyclus::Error& e) {
184 e.msg(Agent::InformErrorMsg(e.msg()));
192 using cyclus::Material;
193 using cyclus::ResCast;
194 using cyclus::toolkit::ResBuf;
195 using cyclus::toolkit::Manifest;
197 if (!
ready.empty()) {
199 double max_pop = std::min(cap,
ready.quantity());
202 if (max_pop ==
ready.quantity()) {
205 double cap_pop =
ready.Peek()->quantity();
206 while (cap_pop <= max_pop && !
ready.empty()) {
208 cap_pop +=
ready.empty() ? 0 :
ready.Peek()->quantity();
212 stocks.Push(
ready.Pop(max_pop, cyclus::eps_rsrc()));
215 LOG(cyclus::LEV_INFO1,
"ComCnv") <<
"Storage " << prototype()
216 <<
" moved resources" 217 <<
" from ready to stocks" 218 <<
" at t= " << context()->time();
219 }
catch (cyclus::Error& e) {
220 e.msg(Agent::InformErrorMsg(e.msg()));
228 using cyclus::toolkit::ResBuf;
243 ->NewDatum(
"AgentPosition")
244 ->AddVal(
"Spec", specification)
245 ->AddVal(
"Prototype", this->prototype())
246 ->AddVal(
"AgentId",
id())
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.
cyclus::toolkit::ResBuf< cyclus::Material > ready
virtual void Tock()
The handleTick function specific to the Storage.
virtual void EnterNotify()
Sets up the Storage Facility's trade requests.
cyclus::toolkit::MatlBuyPolicy buy_policy
double current_capacity() const
current maximum amount that can be added to processing
virtual void Tick()
The handleTick function specific to the Storage.
std::vector< double > in_commod_prefs
cycamore::GrowthRegion string
int ready_time()
returns the time key for ready materials
virtual void InitFrom(storage::Storage *m)
cyclus::toolkit::ResBuf< cyclus::Material > stocks
cyclus::toolkit::MatlSellPolicy sell_policy
cyclus::toolkit::Position coordinates
cyclus::toolkit::ResBuf< cyclus::Material > processing
cyclus::toolkit::ResBuf< cyclus::Material > inventory
cyclus::Agent * ConstructStorage(cyclus::Context *ctx)
std::vector< std::string > in_commods
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< std::string > out_commods
std::list< int > entry_times
void ProcessMat_(double cap)
Move as many ready resources as allowable into stocks.
Storage(cyclus::Context *ctx)