CYCAMORE
Loading...
Searching...
No Matches
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
12namespace cycamore {
13class GrowthRegion;
14} // namespace cycamore
15
16// forward includes
17#include "growth_region_tests.h"
18
19namespace cycamore {
20
22typedef std::vector<
23 std::pair<int, std::pair<std::string, std::string> > > Demand;
24
38class GrowthRegion : public cyclus::Region,
39 public cyclus::toolkit::Position {
40 friend class GrowthRegionTests;
41 public:
43 GrowthRegion(cyclus::Context* ctx);
44
46 virtual ~GrowthRegion();
47
48 virtual std::string version() { return CYCAMORE_VERSION; }
49
50 #pragma cyclus
51
52 #pragma cyclus note {"doc": "A region that governs a scenario in which " \
53 "there is growth in demand for a commodity. "}
54
60 virtual void Tick();
61
63 virtual void EnterNotify();
64
66 virtual void DecomNotify(Agent* m);
67
68 inline cyclus::toolkit::SupplyDemandManager* sdmanager() {
69 return &sdmanager_;
70 }
71
72 protected:
73 #pragma cyclus var { \
74 "alias": ["growth", "commod", \
75 ["piecewise_function", \
76 ["piece", "start", ["function", "type", "params"]]]], \
77 "uitype": ["oneormore", "string", \
78 ["oneormore", \
79 ["pair", "int", ["pair", "string", "string"]]]], \
80 "uilabel": "Growth Demand Curves", \
81 "doc": "Nameplate capacity demand functions." \
82 "\n\n" \
83 "Each demand type must be for a commodity for which capacity can be built "\
84 "(e.g., 'power' from cycamore::Reactors). Any archetype that implements the "\
85 "cyclus::toolkit::CommodityProducer interface can interact with the "\
86 "GrowthRegion in the manner." \
87 "\n\n" \
88 "Demand functions are defined as piecewise functions. Each piece must "\
89 "be provided a starting time and function description. Each function "\
90 "description is comprised of a function type and associated parameters. "\
91 "\n\n" \
92 " * Start times are inclusive. For a start time :math:`t_0`, the demand "\
93 "function is evaluated on :math:`[t_0, \infty)`." \
94 "\n\n" \
95 " * Supported function types are based on the "\
96 "`cyclus::toolkit::BasicFunctionFactory "\
97 "types <http://fuelcycle.org/cyclus/api/classcyclus_1_1toolkit_1_1BasicFunctionFactory.html#a2f3806305d99a745ab57c300e54a603d>`_. " \
98 "\n\n" \
99 " * The type name is the lower-case name of the function (e.g., " \
100 "'linear', 'exponential', etc.)." \
101 "\n\n" \
102 " * The parameters associated with each function type can be found on their " \
103 "respective documentation pages.", \
104 }
105 std::map<std::string, std::vector<std::pair<int, std::pair<std::string, std::string> > > > commodity_demand; // must match Demand typedef
106
107#if CYCLUS_HAS_COIN
109 cyclus::toolkit::BuildingManager buildmanager_;
110#endif
111
113 cyclus::toolkit::SupplyDemandManager sdmanager_;
114
116 void Register_(cyclus::Agent* agent);
117
119 void Unregister_(cyclus::Agent* agent);
120
123 void AddCommodityDemand_(std::string commod, Demand& demand);
124
129 void OrderBuilds(cyclus::toolkit::Commodity& commodity, double unmetdemand);
130
131 private:
132 #pragma cyclus var { \
133 "default": 0.0, \
134 "uilabel": "Geographical latitude in degrees as a double", \
135 "doc": "Latitude of the agent's geographical position. The value should " \
136 "be expressed in degrees as a double." \
137 }
138 double latitude;
139
140 #pragma cyclus var { \
141 "default": 0.0, \
142 "uilabel": "Geographical longitude in degrees as a double", \
143 "doc": "Longitude of the agent's geographical position. The value should " \
144 "be expressed in degrees as a double." \
145 }
146 double longitude;
147
148 cyclus::toolkit::Position coordinates;
149
152};
153} // namespace cycamore
154
155#endif // CYCAMORE_SRC_GROWTH_REGION_H_
#define CYCAMORE_VERSION
void RecordPosition()
Records an agent's latitude and longitude to the output db.
cyclus::toolkit::SupplyDemandManager * sdmanager()
void Unregister_(cyclus::Agent *agent)
unregister a child
GrowthRegion(cyclus::Context *ctx)
The default constructor for the GrowthRegion.
virtual std::string version()
cyclus::toolkit::SupplyDemandManager sdmanager_
manager for Supply and demand
cyclus::toolkit::Position coordinates
virtual void Tick()
On each tick, the GrowthRegion queries its supply demand manager to determine if there exists some de...
void OrderBuilds(cyclus::toolkit::Commodity &commodity, double unmetdemand)
orders builds given a commodity and an unmet demand for production capacity of that commodity
std::map< std::string, std::vector< std::pair< int, std::pair< std::string, std::string > > > > commodity_demand
virtual void DecomNotify(Agent *m)
unregister a child
void Register_(cyclus::Agent *agent)
register a child
void AddCommodityDemand_(std::string commod, Demand &demand)
add a demand for a commodity on which this region request that facilities be built
virtual void EnterNotify()
enter the simulation and register any children present
virtual ~GrowthRegion()
The default destructor for the GrowthRegion.
std::vector< std::pair< int, std::pair< std::string, std::string > > > Demand
A container of (time, (demand type, demand parameters))