![]() |
CYCLUS
|
The Facility class is the abstract class/interface used by all facility agents.
This is all that is known externally about facilities
The Facility type plays a primary role in Cyclus. A Facility facility is where offers and requests are generated and transmitted to a ResourceExchange and where shipments of material, issued by the exchange, are executed. The algorithms to determine what offers and requests are issued and how material shipments are handled are the primary differentiators between different Facility implementations.
Like all agent implementations, there are a number of implementations that are distributed as part of the core Cyclus application as well as implementations contributed by third-party developers. The links below describe additional parameters necessary for the complete definition of a facility of that implementation.
Developers are encouraged to add to this list and create pages that describe the detailed behavior of these agents.
Collaborators are encouraged to add to this list and link to external pages that describe how to get the agents and the detailed behavior
Definition at line 68 of file facility.h.
#include <facility.h>
Public Member Functions | |
virtual void | AcceptMatlTrades (const std::vector< std::pair< Trade< Material >, Material::Ptr > > &responses) |
virtual void | AcceptProductTrades (const std::vector< std::pair< Trade< Product >, Product::Ptr > > &responses) |
virtual void | AdjustMatlPrefs (PrefMap< Material >::type &prefs) |
virtual void | AdjustProductPrefs (PrefMap< Product >::type &prefs) |
virtual void | Build (Agent *parent) |
virtual bool | CheckDecommissionCondition () |
virtual void | Decommission () |
virtual void | EnterNotify () |
Facility (Context *ctx) | |
virtual std::set< BidPortfolio< Material >::Ptr > | GetMatlBids (CommodMap< Material >::type &commod_requests) |
virtual std::set< RequestPortfolio< Material >::Ptr > | GetMatlRequests () |
virtual void | GetMatlTrades (const std::vector< Trade< Material > > &trades, std::vector< std::pair< Trade< Material >, Material::Ptr > > &responses) |
virtual std::set< BidPortfolio< Product >::Ptr > | GetProductBids (CommodMap< Product >::type &commod_requests) |
virtual std::set< RequestPortfolio< Product >::Ptr > | GetProductRequests () |
virtual void | GetProductTrades (const std::vector< Trade< Product > > &trades, std::vector< std::pair< Trade< Product >, Product::Ptr > > &responses) |
virtual void | InfileToDb (InfileTree *qe, DbInit di) |
void | InitFrom (Facility *m) |
virtual void | InitFrom (QueryableBackend *b) |
virtual void | Snapshot (DbInit di) |
virtual std::string | str () |
virtual | ~Facility () |
![]() | |
virtual void | Decision () |
virtual bool | IsShim () |
virtual void | Tick ()=0 |
virtual void | Tock ()=0 |
![]() | |
Agent (Context *ctx) | |
bool | AncestorOf (Agent *other) |
virtual Json::Value | annotations () |
virtual void | BuildNotify (Agent *m) |
const std::set< Agent * > & | children () const |
virtual Agent * | Clone ()=0 |
Context * | context () const |
bool | DecendentOf (Agent *other) |
virtual void | DecomNotify (Agent *m) |
const int | enter_time () const |
const int | exit_time () const |
std::vector< std::string > | GetTreePrintOuts (Agent *m) |
virtual const int | id () const |
bool | InFamilyTree (Agent *other) |
virtual void | InitInv (Inventories &inv)=0 |
const std::string | kind () const |
const int | lifetime () const |
void | lifetime (int n_timesteps) |
void | lifetime_force (int n_timesteps) |
Agent * | parent () const |
const int | parent_id () const |
std::string | PrintChildren () |
const std::string | prototype () const |
void | prototype (std::string p) |
virtual std::string | schema () |
virtual Inventories | SnapshotInv ()=0 |
std::string | spec () |
void | spec (std::string new_impl) |
virtual std::string | version () |
virtual | ~Agent () |
![]() | |
virtual double | FV (int n, double i, double P, double A) const |
virtual std::unordered_map< std::string, double > | GenerateParamList () const |
virtual double | GetEconParameter (const std::string &key) const |
void | InitEconParameters () |
virtual double | PMT (int n, double i, double P, double F) const |
virtual double | PV (double i, const std::vector< double > &A) const |
virtual double | PV (int n, double i, double F, double A) const |
virtual void | SetEconParameter (const std::string &key, double value) |
![]() | |
virtual Agent * | manager () |
Trader (Agent *manager) | |
Additional Inherited Members | |
![]() | |
virtual std::string | InformErrorMsg (std::string msg) |
void | InitFrom (Agent *m) |
![]() | |
std::string | kind_ |
![]() | |
Agent * | manager_ |
![]() | |
static constexpr int | kDefaultUnitCost = 1 |
cyclus::Facility::Facility | ( | Context * | ctx | ) |
Definition at line 16 of file facility.cc.
|
virtual |
Definition at line 20 of file facility.cc.
|
inlinevirtual |
default implementation for material trade acceptance
Reimplemented from cyclus::Trader.
Definition at line 152 of file facility.h.
|
inlinevirtual |
default implementation for product trade acceptance
Reimplemented from cyclus::Trader.
Definition at line 157 of file facility.h.
default implementation for material preferences.
Reimplemented from cyclus::Agent.
Definition at line 130 of file facility.h.
default implementation for material preferences.
Reimplemented from cyclus::Agent.
Definition at line 133 of file facility.h.
|
virtual |
builds the facility in the simulation
parent | the parent of this facility |
Reimplemented from cyclus::Agent.
Definition at line 26 of file facility.cc.
|
virtual |
facilities over write this method if a condition must be met before their destructors can be called
Definition at line 53 of file facility.cc.
|
virtual |
decommissions the facility, default behavior is for the facility to delete itself
Reimplemented from cyclus::Agent.
Definition at line 43 of file facility.cc.
|
virtual |
Called to give the agent an opportunity to register for services.
Reimplemented from cyclus::Agent.
Definition at line 30 of file facility.cc.
|
inlinevirtual |
default implementation for material requests
Reimplemented from cyclus::Trader.
Definition at line 118 of file facility.h.
|
inlinevirtual |
default implementation for material requests
Reimplemented from cyclus::Trader.
Definition at line 108 of file facility.h.
|
inlinevirtual |
default implementation for responding to material trades
trades | all trades in which this trader is the supplier |
responses | a container to populate with responses to each trade |
Reimplemented from cyclus::Trader.
Definition at line 138 of file facility.h.
|
inlinevirtual |
default implementation for product requests
Reimplemented from cyclus::Trader.
Definition at line 124 of file facility.h.
|
inlinevirtual |
default implementation for product requests
Reimplemented from cyclus::Trader.
Definition at line 113 of file facility.h.
|
inlinevirtual |
default implementation for responding to product trades
trades | all trades in which this trader is the supplier |
responses | a container to populate with responses to each trade |
Reimplemented from cyclus::Trader.
Definition at line 147 of file facility.h.
|
inlinevirtual |
Translates info for the agent from an input file to the database by reading parameters from the passed InfileTree (parsed from xml) and recording data via the DbInit variable.
The simulation id and agent id are automatically injected in all data transfered to the database through DbInit. This function must be implemented by all agents. This function must call the superclass' InfileToDb function before doing any other work.
Agent parameters in the InfileTree are scoped in the "agent/*‍/" path. The superclass InitFrom expects the scope InfileTree passed to it to be unchanged from the agent's InfileTree arg.
Example:
Reimplemented from cyclus::Agent.
Definition at line 75 of file facility.h.
void cyclus::Facility::InitFrom | ( | Facility * | m | ) |
Copy module members from a source agent Any facility subclassing facility agent should invoke their own InitFrom method, calling Facility's first!
m | the agent to copy from |
Definition at line 22 of file facility.cc.
|
inlinevirtual |
Intializes an agent's internal state from the database.
Appropriate simulation id, agent id, and time filters are automatically included in all queries. If the agent is a direct subclass of the Agent class, than it should NOT call its superclass' InitFrom(QueryableBackend*) function. If, however, it is a subclasses other Agent subclasses (e.g. subclass of Facility, Region, etc.), then it MUST call its superclass' InitFrom(QueryableBackend*) function. Example:
Reimplemented from cyclus::Agent.
Definition at line 78 of file facility.h.
|
inlinevirtual |
Snapshots agent-internal state to the database via the DbInit var di.
The simulation id , agent id, and the simulation time are automatically injected in all information transfered to the database through DbInit. If the agent is a direct subclass of the Agent class, than it should NOT call its superclass' Snapshot function. If, however, it subclasses other Agent subclasses (e.g. subclass of Facility, Region, etc.), then it MUST call its superclass' Snapshot function. Example:
Implements cyclus::Agent.
Definition at line 81 of file facility.h.
|
virtual |
every agent should be able to print a verbose description
Reimplemented from cyclus::Agent.
Definition at line 36 of file facility.cc.