commodconverter
 All Classes Namespaces Files Functions Variables Macros
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
commodconverter::CommodConverter Class Reference

Detailed Description

This Facility is intended to convert a resource from one commodity to another.

It also has an optional delay parameter. It can therefore be used quite easily as a storage facility. The CommodConverter class inherits from the Facility class and is dynamically loaded by the Agent class when requested.

Introduction

This Agent was initially developed to support the fco code-to-code comparsion. It's very similar to the "NullFacility" of years past. Its purpose is to convert a commodity from one commodity to another after some period of delay time. This facility is very good for use as a storage facility or fuel fabrication.

Agent Parameters

in_commod is a string naming the commodity that this facility recieves out_commod is a string naming the commodity that in_commod is stocks into process_time is the number of timesteps between receiving and offering in_recipe (optional) describes the incoming resource by recipe out_recipe (optional) describes the outgoing resource by recipe

Optional Parameters

max_inv_size is the maximum capacity of the inventory storage capacity is the maximum processing capacity per timestep

Detailed Behavior

Tick: Nothing really happens on the tick.

Tock: On the tock, any material that has been waiting for long enough (delay time) is stocks and placed in the stocks buffer.

Any brand new inventory that was received in this timestep is placed into the processing queue to begin waiting.

Making Requests: This facility requests all of the in_commod that it can.

Receiving Resources: Anything of the in_commod that is received by this facility goes into the inventory.

Making Offers: Any stocks material in the stocks buffer is offered to the market.

Sending Resources: Matched resources are sent immediately.

Definition at line 68 of file build/CommodConverter/commodconverter.h.

#include <commodconverter.h>

Inheritance diagram for commodconverter::CommodConverter:
Inheritance graph
[legend]

Public Member Functions

virtual void AcceptMatlTrades (const std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &responses)
 
virtual void AcceptMatlTrades (const std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &responses)
 
virtual Json::Value annotations ()
 
virtual cyclus::Agent * Clone ()
 
 CommodConverter (cyclus::Context *ctx)
 
 CommodConverter (cyclus::Context *ctx)
 
virtual void EnterNotify ()
 
virtual void EnterNotify ()
 
virtual std::set
< cyclus::BidPortfolio
< cyclus::Material >::Ptr > 
GetMatlBids (cyclus::CommodMap< cyclus::Material >::type &commod_requests)
 
virtual std::set
< cyclus::BidPortfolio
< cyclus::Material >::Ptr > 
GetMatlBids (cyclus::CommodMap< cyclus::Material >::type &commod_requests)
 
virtual std::set
< cyclus::RequestPortfolio
< cyclus::Material >::Ptr > 
GetMatlRequests ()
 
virtual std::set
< cyclus::RequestPortfolio
< cyclus::Material >::Ptr > 
GetMatlRequests ()
 
virtual void GetMatlTrades (const std::vector< cyclus::Trade< cyclus::Material > > &trades, std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &responses)
 
virtual void GetMatlTrades (const std::vector< cyclus::Trade< cyclus::Material > > &trades, std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &responses)
 
virtual void InfileToDb (cyclus::InfileTree *tree, cyclus::DbInit di)
 
virtual void InitFrom (commodconverter::CommodConverter *m)
 
virtual void InitFrom (cyclus::QueryableBackend *b)
 
virtual void InitInv (cyclus::Inventories &inv)
 
virtual std::string schema ()
 
virtual void Snapshot (cyclus::DbInit di)
 
virtual cyclus::Inventories SnapshotInv ()
 
virtual std::string str ()
 
virtual std::string str ()
 
virtual void Tick ()
 
virtual void Tick ()
 
virtual void Tock ()
 
virtual void Tock ()
 

Protected Member Functions

void AddMat_ (cyclus::Material::Ptr mat)
 
void AddMat_ (cyclus::Material::Ptr mat)
 
void BeginProcessing_ ()
 
void BeginProcessing_ ()
 
void capacity_ (double c)
 
double capacity_ () const
 
void capacity_ (double c)
 
double capacity_ () const
 
void Convert_ ()
 
void Convert_ ()
 
void cost_ (double c)
 
double cost_ () const
 
void cost_ (double c)
 
double cost_ () const
 
void crctx (const cyclus::toolkit::CommodityRecipeContext &crctx)
 
cyclus::toolkit::CommodityRecipeContext crctx () const
 
void crctx (const cyclus::toolkit::CommodityRecipeContext &crctx)
 
cyclus::toolkit::CommodityRecipeContext crctx () const
 
double current_capacity () const
 
double current_capacity () const
 
cyclus::BidPortfolio
< cyclus::Material >::Ptr 
GetBids_ (cyclus::CommodMap< cyclus::Material >::type &commod_requests, std::string commod, cyclus::toolkit::ResourceBuff *buffer)
 
cyclus::BidPortfolio
< cyclus::Material >::Ptr 
GetBids_ (cyclus::CommodMap< cyclus::Material >::type &commod_requests, std::string commod, cyclus::toolkit::ResourceBuff *buffer)
 
void in_commod_ (std::string c)
 
std::string in_commod_ () const
 
void in_commod_ (std::string c)
 
std::string in_commod_ () const
 
void in_recipe_ (std::string c)
 
std::string in_recipe_ () const
 
void in_recipe_ (std::string c)
 
std::string in_recipe_ () const
 
void max_inv_size_ (double c)
 
double max_inv_size_ () const
 
void max_inv_size_ (double c)
 
double max_inv_size_ () const
 
void out_commod_ (std::string c)
 
std::string out_commod_ () const
 
void out_commod_ (std::string c)
 
std::string out_commod_ () const
 
void out_recipe_ (std::string c)
 
std::string out_recipe_ () const
 
void out_recipe_ (std::string c)
 
std::string out_recipe_ () const
 
void process_time_ (int t)
 
int process_time_ () const
 
void process_time_ (int t)
 
int process_time_ () const
 
int ready ()
 
int ready ()
 
cyclus::Material::Ptr Request_ ()
 
cyclus::Material::Ptr Request_ ()
 
cyclus::Material::Ptr TradeResponse_ (double qty, cyclus::toolkit::ResourceBuff *buffer)
 
cyclus::Material::Ptr TradeResponse_ (double qty, cyclus::toolkit::ResourceBuff *buffer)
 

Protected Attributes

double capacity
 
double cost
 
cyclus::toolkit::CommodityRecipeContext crctx_
 
std::string in_commod
 
std::string in_recipe
 
cyclus::toolkit::ResourceBuff inventory
 
double max_inv_size
 
std::string out_commod
 
std::string out_recipe
 
int process_time
 
std::map< int,
cyclus::toolkit::ResourceBuff > 
processing
 
cyclus::toolkit::ResourceBuff stocks
 

Constructor & Destructor Documentation

commodconverter::CommodConverter::CommodConverter ( cyclus::Context *  ctx)

Constructor for CommodConverter Class.

Parameters
ctxthe cyclus context for access to simulation-wide parameters

Definition at line 9 of file build/CommodConverter/commodconverter.cc.

commodconverter::CommodConverter::CommodConverter ( cyclus::Context *  ctx)

Constructor for CommodConverter Class.

Parameters
ctxthe cyclus context for access to simulation-wide parameters

Member Function Documentation

virtual void commodconverter::CommodConverter::AcceptMatlTrades ( const std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &  responses)
virtual

The CommodConverter place accepted trade Materials in their Inventory.

void commodconverter::CommodConverter::AcceptMatlTrades ( const std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &  responses)
virtual

The CommodConverter place accepted trade Materials in their Inventory.

Definition at line 246 of file build/CommodConverter/commodconverter.cc.

void commodconverter::CommodConverter::AddMat_ ( cyclus::Material::Ptr  mat)
protected

adds a material into the incoming commodity inventory

Parameters
matthe material to add to the incoming inventory.
Exceptions
ifthere is trouble with pushing to the inventory buffer.
void commodconverter::CommodConverter::AddMat_ ( cyclus::Material::Ptr  mat)
protected

adds a material into the incoming commodity inventory

Parameters
matthe material to add to the incoming inventory.
Exceptions
ifthere is trouble with pushing to the inventory buffer.

Definition at line 303 of file build/CommodConverter/commodconverter.cc.

Json::Value commodconverter::CommodConverter::annotations ( )
virtual

Definition at line 51 of file build/CommodConverter/commodconverter.cc.

void commodconverter::CommodConverter::BeginProcessing_ ( )
protected

Move all unprocessed inventory to processing.

void commodconverter::CommodConverter::BeginProcessing_ ( )
protected

Move all unprocessed inventory to processing.

Definition at line 401 of file build/CommodConverter/commodconverter.cc.

void commodconverter::CommodConverter::capacity_ ( double  c)
inlineprotected

the maximum amount processed per timestep

Definition at line 232 of file src/commodconverter.h.

double commodconverter::CommodConverter::capacity_ ( ) const
inlineprotected

Definition at line 233 of file src/commodconverter.h.

void commodconverter::CommodConverter::capacity_ ( double  c)
inlineprotected

the maximum amount processed per timestep

Definition at line 238 of file build/CommodConverter/commodconverter.h.

double commodconverter::CommodConverter::capacity_ ( ) const
inlineprotected

Definition at line 239 of file build/CommodConverter/commodconverter.h.

cyclus::Agent * commodconverter::CommodConverter::Clone ( )
virtual

Definition at line 130 of file build/CommodConverter/commodconverter.cc.

void commodconverter::CommodConverter::Convert_ ( )
protected

Convert one ready resource in processing.

void commodconverter::CommodConverter::Convert_ ( )
protected

Convert one ready resource in processing.

Definition at line 415 of file build/CommodConverter/commodconverter.cc.

void commodconverter::CommodConverter::cost_ ( double  c)
inlineprotected

the cost per unit out_commod

Definition at line 236 of file src/commodconverter.h.

double commodconverter::CommodConverter::cost_ ( ) const
inlineprotected

Definition at line 237 of file src/commodconverter.h.

void commodconverter::CommodConverter::cost_ ( double  c)
inlineprotected

the cost per unit out_commod

Definition at line 242 of file build/CommodConverter/commodconverter.h.

double commodconverter::CommodConverter::cost_ ( ) const
inlineprotected

Definition at line 243 of file build/CommodConverter/commodconverter.h.

void commodconverter::CommodConverter::crctx ( const cyclus::toolkit::CommodityRecipeContext &  crctx)
inlineprotected

this facility's commodity-recipe context

Definition at line 163 of file src/commodconverter.h.

cyclus::toolkit::CommodityRecipeContext commodconverter::CommodConverter::crctx ( ) const
inlineprotected

Definition at line 167 of file src/commodconverter.h.

void commodconverter::CommodConverter::crctx ( const cyclus::toolkit::CommodityRecipeContext &  crctx)
inlineprotected

this facility's commodity-recipe context

Definition at line 177 of file build/CommodConverter/commodconverter.h.

cyclus::toolkit::CommodityRecipeContext commodconverter::CommodConverter::crctx ( ) const
inlineprotected

Definition at line 181 of file build/CommodConverter/commodconverter.h.

double commodconverter::CommodConverter::current_capacity ( ) const
inlineprotected

current maximum amount that can be added to processing

Definition at line 256 of file src/commodconverter.h.

double commodconverter::CommodConverter::current_capacity ( ) const
inlineprotected

current maximum amount that can be added to processing

Definition at line 262 of file build/CommodConverter/commodconverter.h.

virtual void commodconverter::CommodConverter::EnterNotify ( )
virtual
void commodconverter::CommodConverter::EnterNotify ( )
virtual

Definition at line 169 of file build/CommodConverter/commodconverter.cc.

cyclus::BidPortfolio<cyclus::Material>::Ptr commodconverter::CommodConverter::GetBids_ ( cyclus::CommodMap< cyclus::Material >::type &  commod_requests,
std::string  commod,
cyclus::toolkit::ResourceBuff *  buffer 
)
protected

gathers information about bids

Parameters
commod_requeststhe materials that have been requested
cyclus::BidPortfolio< cyclus::Material >::Ptr commodconverter::CommodConverter::GetBids_ ( cyclus::CommodMap< cyclus::Material >::type &  commod_requests,
std::string  commod,
cyclus::toolkit::ResourceBuff *  buffer 
)
protected

gathers information about bids

Parameters
commod_requeststhe materials that have been requested

Definition at line 336 of file build/CommodConverter/commodconverter.cc.

virtual std::set<cyclus::BidPortfolio<cyclus::Material>::Ptr> commodconverter::CommodConverter::GetMatlBids ( cyclus::CommodMap< cyclus::Material >::type &  commod_requests)
virtual

Responds to each request for this facility's commodity.

If a given request is more than this facility's inventory capacity, it will offer its minimum of its capacities.

std::set< cyclus::BidPortfolio< cyclus::Material >::Ptr > commodconverter::CommodConverter::GetMatlBids ( cyclus::CommodMap< cyclus::Material >::type &  commod_requests)
virtual

Responds to each request for this facility's commodity.

If a given request is more than this facility's inventory capacity, it will offer its minimum of its capacities.

Definition at line 258 of file build/CommodConverter/commodconverter.cc.

virtual std::set<cyclus::RequestPortfolio<cyclus::Material>::Ptr> commodconverter::CommodConverter::GetMatlRequests ( )
virtual

The CommodConverter request Materials of its given commodity.

std::set< cyclus::RequestPortfolio< cyclus::Material >::Ptr > commodconverter::CommodConverter::GetMatlRequests ( )
virtual

The CommodConverter request Materials of its given commodity.

Definition at line 221 of file build/CommodConverter/commodconverter.cc.

virtual void commodconverter::CommodConverter::GetMatlTrades ( const std::vector< cyclus::Trade< cyclus::Material > > &  trades,
std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &  responses 
)
virtual

respond to each trade with a material of out_commod and out_recipe

Parameters
tradesall trades in which this trader is the supplier
responsesa container to populate with responses to each trade
void commodconverter::CommodConverter::GetMatlTrades ( const std::vector< cyclus::Trade< cyclus::Material > > &  trades,
std::vector< std::pair< cyclus::Trade< cyclus::Material >, cyclus::Material::Ptr > > &  responses 
)
virtual

respond to each trade with a material of out_commod and out_recipe

Parameters
tradesall trades in which this trader is the supplier
responsesa container to populate with responses to each trade

Definition at line 278 of file build/CommodConverter/commodconverter.cc.

void commodconverter::CommodConverter::in_commod_ ( std::string  c)
inlineprotected

the in commodity

Definition at line 240 of file src/commodconverter.h.

std::string commodconverter::CommodConverter::in_commod_ ( ) const
inlineprotected

Definition at line 241 of file src/commodconverter.h.

void commodconverter::CommodConverter::in_commod_ ( std::string  c)
inlineprotected

the in commodity

Definition at line 246 of file build/CommodConverter/commodconverter.h.

std::string commodconverter::CommodConverter::in_commod_ ( ) const
inlineprotected

Definition at line 247 of file build/CommodConverter/commodconverter.h.

void commodconverter::CommodConverter::in_recipe_ ( std::string  c)
inlineprotected

the in recipe

Definition at line 248 of file src/commodconverter.h.

std::string commodconverter::CommodConverter::in_recipe_ ( ) const
inlineprotected

Definition at line 249 of file src/commodconverter.h.

void commodconverter::CommodConverter::in_recipe_ ( std::string  c)
inlineprotected

the in recipe

Definition at line 254 of file build/CommodConverter/commodconverter.h.

std::string commodconverter::CommodConverter::in_recipe_ ( ) const
inlineprotected

Definition at line 255 of file build/CommodConverter/commodconverter.h.

void commodconverter::CommodConverter::InfileToDb ( cyclus::InfileTree *  tree,
cyclus::DbInit  di 
)
virtual

Definition at line 95 of file build/CommodConverter/commodconverter.cc.

void commodconverter::CommodConverter::InitFrom ( commodconverter::CommodConverter m)
virtual

The Prime Directive Generates code that handles all input file reading and restart operations (e.g., reading from the database, instantiating a new object, etc.).

Warning
The Prime Directive must have a space before it! (A fix will be in 2.0 ^TM)

Definition at line 138 of file build/CommodConverter/commodconverter.cc.

void commodconverter::CommodConverter::InitFrom ( cyclus::QueryableBackend *  b)
virtual

Definition at line 151 of file build/CommodConverter/commodconverter.cc.

void commodconverter::CommodConverter::InitInv ( cyclus::Inventories &  inv)
virtual

Definition at line 85 of file build/CommodConverter/commodconverter.cc.

void commodconverter::CommodConverter::max_inv_size_ ( double  c)
inlineprotected

the maximum amount allowed in inventory

Definition at line 228 of file src/commodconverter.h.

double commodconverter::CommodConverter::max_inv_size_ ( ) const
inlineprotected

Definition at line 229 of file src/commodconverter.h.

void commodconverter::CommodConverter::max_inv_size_ ( double  c)
inlineprotected

the maximum amount allowed in inventory

Definition at line 234 of file build/CommodConverter/commodconverter.h.

double commodconverter::CommodConverter::max_inv_size_ ( ) const
inlineprotected

Definition at line 235 of file build/CommodConverter/commodconverter.h.

void commodconverter::CommodConverter::out_commod_ ( std::string  c)
inlineprotected

the out commodity

Definition at line 244 of file src/commodconverter.h.

std::string commodconverter::CommodConverter::out_commod_ ( ) const
inlineprotected

Definition at line 245 of file src/commodconverter.h.

void commodconverter::CommodConverter::out_commod_ ( std::string  c)
inlineprotected

the out commodity

Definition at line 250 of file build/CommodConverter/commodconverter.h.

std::string commodconverter::CommodConverter::out_commod_ ( ) const
inlineprotected

Definition at line 251 of file build/CommodConverter/commodconverter.h.

void commodconverter::CommodConverter::out_recipe_ ( std::string  c)
inlineprotected

the out recipe

Definition at line 252 of file src/commodconverter.h.

std::string commodconverter::CommodConverter::out_recipe_ ( ) const
inlineprotected

Definition at line 253 of file src/commodconverter.h.

void commodconverter::CommodConverter::out_recipe_ ( std::string  c)
inlineprotected

the out recipe

Definition at line 258 of file build/CommodConverter/commodconverter.h.

std::string commodconverter::CommodConverter::out_recipe_ ( ) const
inlineprotected

Definition at line 259 of file build/CommodConverter/commodconverter.h.

void commodconverter::CommodConverter::process_time_ ( int  t)
inlineprotected

the processing time required for a full process

Definition at line 224 of file src/commodconverter.h.

int commodconverter::CommodConverter::process_time_ ( ) const
inlineprotected

Definition at line 225 of file src/commodconverter.h.

void commodconverter::CommodConverter::process_time_ ( int  t)
inlineprotected

the processing time required for a full process

Definition at line 230 of file build/CommodConverter/commodconverter.h.

int commodconverter::CommodConverter::process_time_ ( ) const
inlineprotected

Definition at line 231 of file build/CommodConverter/commodconverter.h.

int commodconverter::CommodConverter::ready ( )
inlineprotected

returns the time key for ready materials

Definition at line 172 of file src/commodconverter.h.

int commodconverter::CommodConverter::ready ( )
inlineprotected

returns the time key for ready materials

Definition at line 186 of file build/CommodConverter/commodconverter.h.

cyclus::Material::Ptr commodconverter::CommodConverter::Request_ ( )
protected

generates a request for this facility given its current state.

The quantity of the material will be equal to the remaining inventory size.

Returns
a material that this facility will request
cyclus::Material::Ptr commodconverter::CommodConverter::Request_ ( )
protected

generates a request for this facility given its current state.

The quantity of the material will be equal to the remaining inventory size.

Returns
a material that this facility will request

Definition at line 324 of file build/CommodConverter/commodconverter.cc.

std::string commodconverter::CommodConverter::schema ( )
virtual

Definition at line 17 of file build/CommodConverter/commodconverter.cc.

void commodconverter::CommodConverter::Snapshot ( cyclus::DbInit  di)
virtual

Definition at line 118 of file build/CommodConverter/commodconverter.cc.

cyclus::Inventories commodconverter::CommodConverter::SnapshotInv ( )
virtual

Definition at line 89 of file build/CommodConverter/commodconverter.cc.

virtual std::string commodconverter::CommodConverter::str ( )
virtual

The Prime Directive Generates code that handles all input file reading and restart operations (e.g., reading from the database, instantiating a new object, etc.).

Warning
The Prime Directive must have a space before it! (A fix will be in 2.0 ^TM) A verbose printer for the CommodConverter
std::string commodconverter::CommodConverter::str ( )
virtual

A verbose printer for the CommodConverter.

Definition at line 180 of file build/CommodConverter/commodconverter.cc.

virtual void commodconverter::CommodConverter::Tick ( )
virtual

The handleTick function specific to the CommodConverter.

Parameters
timethe time of the tick
void commodconverter::CommodConverter::Tick ( )
virtual

The handleTick function specific to the CommodConverter.

Parameters
timethe time of the tick

Definition at line 204 of file build/CommodConverter/commodconverter.cc.

virtual void commodconverter::CommodConverter::Tock ( )
virtual

The handleTick function specific to the CommodConverter.

Parameters
timethe time of the tock
void commodconverter::CommodConverter::Tock ( )
virtual

The handleTick function specific to the CommodConverter.

Parameters
timethe time of the tock

Definition at line 210 of file build/CommodConverter/commodconverter.cc.

cyclus::Material::Ptr commodconverter::CommodConverter::TradeResponse_ ( double  qty,
cyclus::toolkit::ResourceBuff *  buffer 
)
protected

suggests, based on the buffer, a material response to an offer

cyclus::Material::Ptr commodconverter::CommodConverter::TradeResponse_ ( double  qty,
cyclus::toolkit::ResourceBuff *  buffer 
)
protected

suggests, based on the buffer, a material response to an offer

Definition at line 376 of file build/CommodConverter/commodconverter.cc.

Member Data Documentation

double commodconverter::CommodConverter::capacity
protected

Definition at line 215 of file build/CommodConverter/commodconverter.h.

double commodconverter::CommodConverter::cost
protected

Definition at line 219 of file build/CommodConverter/commodconverter.h.

cyclus::toolkit::CommodityRecipeContext commodconverter::CommodConverter::crctx_
protected

Definition at line 227 of file build/CommodConverter/commodconverter.h.

std::string commodconverter::CommodConverter::in_commod
protected

Definition at line 191 of file build/CommodConverter/commodconverter.h.

std::string commodconverter::CommodConverter::in_recipe
protected

Definition at line 199 of file build/CommodConverter/commodconverter.h.

cyclus::toolkit::ResourceBuff commodconverter::CommodConverter::inventory
protected

Definition at line 221 of file build/CommodConverter/commodconverter.h.

double commodconverter::CommodConverter::max_inv_size
protected

Definition at line 211 of file build/CommodConverter/commodconverter.h.

std::string commodconverter::CommodConverter::out_commod
protected

Definition at line 195 of file build/CommodConverter/commodconverter.h.

std::string commodconverter::CommodConverter::out_recipe
protected

Definition at line 203 of file build/CommodConverter/commodconverter.h.

int commodconverter::CommodConverter::process_time
protected

Definition at line 207 of file build/CommodConverter/commodconverter.h.

std::map< int, cyclus::toolkit::ResourceBuff > commodconverter::CommodConverter::processing
protected

map from ready time to resource buffers

Definition at line 225 of file build/CommodConverter/commodconverter.h.

cyclus::toolkit::ResourceBuff commodconverter::CommodConverter::stocks
protected

Definition at line 222 of file build/CommodConverter/commodconverter.h.


The documentation for this class was generated from the following files: