CYCAMORE
src/growth_region.h
Go to the documentation of this file.
1 #ifndef CYCAMORE_SRC_GROWTH_REGION_H_
2 #define CYCAMORE_SRC_GROWTH_REGION_H_
3 
4 #include <string>
5 #include <utility>
6 #include <vector>
7 
8 #include "cyclus.h"
9 #include "cycamore_version.h"
10 
11 // forward declarations
12 namespace cycamore {
13 class GrowthRegion;
14 } // namespace cycamore
15 
16 // forward includes
17 #include "growth_region_tests.h"
18 
19 namespace cycamore {
20 
22 typedef std::vector<
23  std::pair<int, std::pair<std::string, std::string> > > Demand;
24 
38 class GrowthRegion : public cyclus::Region {
39  friend class GrowthRegionTests;
40  public:
42  GrowthRegion(cyclus::Context* ctx);
43 
45  virtual ~GrowthRegion();
46 
47  virtual std::string version() { return CYCAMORE_VERSION; }
48 
49  #pragma cyclus
50 
51  #pragma cyclus note {"doc": "A region that governs a scenario in which " \
52  "there is growth in demand for a commodity. "}
53 
59  virtual void Tick();
60 
62  virtual void EnterNotify();
63 
65  virtual void DecomNotify(Agent* m);
66 
67  inline cyclus::toolkit::SupplyDemandManager* sdmanager() {
68  return &sdmanager_;
69  }
70 
71  protected:
72  #pragma cyclus var { \
73  "alias": ["growth", "commod", \
74  ["piecewise_function", \
75  ["piece", "start", ["function", "type", "params"]]]], \
76  "uitype": ["oneormore", "string", \
77  ["oneormore", \
78  ["pair", "int", ["pair", "string", "string"]]]], \
79  "uilabel": "Growth Demand Curves", \
80  "doc": "Nameplate capacity demand functions." \
81  "\n\n" \
82  "Each demand type must be for a commodity for which capacity can be built "\
83  "(e.g., 'power' from cycamore::Reactors). Any archetype that implements the "\
84  "cyclus::toolkit::CommodityProducer interface can interact with the "\
85  "GrowthRegion in the manner." \
86  "\n\n" \
87  "Demand functions are defined as piecewise functions. Each piece must "\
88  "be provided a starting time and function description. Each function "\
89  "description is comprised of a function type and associated parameters. "\
90  "\n\n" \
91  " * Start times are inclusive. For a start time :math:`t_0`, the demand "\
92  "function is evaluated on :math:`[t_0, \infty)`." \
93  "\n\n" \
94  " * Supported function types are based on the "\
95  "`cyclus::toolkit::BasicFunctionFactory "\
96  "types <http://fuelcycle.org/cyclus/api/classcyclus_1_1toolkit_1_1BasicFunctionFactory.html#a2f3806305d99a745ab57c300e54a603d>`_. " \
97  "\n\n" \
98  " * The type name is the lower-case name of the function (e.g., " \
99  "'linear', 'exponential', etc.)." \
100  "\n\n" \
101  " * The parameters associated with each function type can be found on their " \
102  "respective documentation pages.", \
103  }
104  std::map<std::string, std::vector<std::pair<int, std::pair<std::string, std::string> > > > commodity_demand; // must match Demand typedef
105 
107  cyclus::toolkit::BuildingManager buildmanager_;
108 
110  cyclus::toolkit::SupplyDemandManager sdmanager_;
111 
113  void Register_(cyclus::Agent* agent);
114 
116  void Unregister_(cyclus::Agent* agent);
117 
120  void AddCommodityDemand_(std::string commod, Demand& demand);
121 
126  void OrderBuilds(cyclus::toolkit::Commodity& commodity, double unmetdemand);
127 };
128 
129 } // namespace cycamore
130 
131 #endif // CYCAMORE_SRC_GROWTH_REGION_H_
virtual void Tick()
On each tick, the GrowthRegion queries its supply demand manager to determine if there exists some de...
virtual ~GrowthRegion()
The default destructor for the GrowthRegion.
GrowthRegion(cyclus::Context *ctx)
The default constructor for the GrowthRegion.
virtual std::string version()
std::map< std::string, std::vector< std::pair< int, std::pair< std::string, std::string > > > > commodity_demand
void Unregister_(cyclus::Agent *agent)
unregister a child
void AddCommodityDemand_(std::string commod, Demand &demand)
add a demand for a commodity on which this region request that facilities be built ...
void OrderBuilds(cyclus::toolkit::Commodity &commodity, double unmetdemand)
orders builds given a commodity and an unmet demand for production capacity of that commodity ...
cyclus::toolkit::SupplyDemandManager sdmanager_
manager for Supply and demand
cyclus::toolkit::SupplyDemandManager * sdmanager()
cycamore::GrowthRegion string
virtual void EnterNotify()
enter the simulation and register any children present
virtual void DecomNotify(Agent *m)
unregister a child
cyclus::toolkit::BuildingManager buildmanager_
manager for building things
std::vector< std::pair< int, std::pair< std::string, std::string > > > Demand
A container of (time, (demand type, demand parameters))
void Register_(cyclus::Agent *agent)
register a child