CYCAMORE
Loading...
Searching...
No Matches
src/source.h
Go to the documentation of this file.
1#ifndef CYCAMORE_SRC_SOURCE_H_
2#define CYCAMORE_SRC_SOURCE_H_
3
4#include <set>
5#include <vector>
6
7#include "cyclus.h"
8#include "cycamore_version.h"
9
10#pragma cyclus exec from cyclus.system import CY_LARGE_DOUBLE, CY_LARGE_INT, CY_NEAR_ZERO
11
12namespace cycamore {
13
14class Context;
15
25class Source : public cyclus::Facility,
26 public cyclus::toolkit::CommodityProducer,
27 public cyclus::toolkit::Position {
28 friend class SourceTest;
29 public:
30
31 Source(cyclus::Context* ctx);
32
33 virtual ~Source();
34
35 virtual std::string version() { return CYCAMORE_VERSION; }
36
37 #pragma cyclus note { \
38 "doc": "This facility acts as a source of material with a fixed throughput (per\n" \
39 "time step) capacity and a lifetime capacity defined by a total inventory\n" \
40 "size. It offers its material as a single commodity. If a composition\n" \
41 "recipe is specified, it provides that single material composition to\n" \
42 "requesters. If unspecified, the source provides materials with the exact\n" \
43 "requested compositions. The inventory size and throughput both default to\n" \
44 "infinite. Supplies material results in corresponding decrease in\n" \
45 "inventory, and when the inventory size reaches zero, the source can provide\n" \
46 "no more material.\n" \
47 "", \
48 }
49
50 #pragma cyclus def clone
51 #pragma cyclus def schema
52 #pragma cyclus def annotations
53 #pragma cyclus def infiletodb
54 #pragma cyclus def snapshot
55 #pragma cyclus def snapshotinv
56 #pragma cyclus def initinv
57
58 virtual void InitFrom(Source* m);
59
60 virtual void InitFrom(cyclus::QueryableBackend* b);
61
62 virtual void Tick() {};
63
64 virtual void Tock() {};
65
66 virtual std::string str();
67
68 virtual std::set<cyclus::BidPortfolio<cyclus::Material>::Ptr>
69 GetMatlBids(cyclus::CommodMap<cyclus::Material>::type&
70 commod_requests);
71
72 virtual void EnterNotify();
73
76 virtual void Build(cyclus::Agent* parent);
77
78 virtual void GetMatlTrades(
79 const std::vector< cyclus::Trade<cyclus::Material> >& trades,
80 std::vector<std::pair<cyclus::Trade<cyclus::Material>,
81 cyclus::Material::Ptr> >& responses);
82
83 private:
84 // Code Injection:
85 #include "toolkit/position.cycpp.h"
86
87 #pragma cyclus var { \
88 "tooltip": "source output commodity", \
89 "doc": "Output commodity on which the source offers material.", \
90 "uilabel": "Output Commodity", \
91 "uitype": "outcommodity", \
92 }
93 std::string outcommod;
94
95 #pragma cyclus var { \
96 "tooltip": "name of material recipe to provide", \
97 "doc": "Name of composition recipe that this source provides regardless " \
98 "of requested composition. If empty, source creates and provides " \
99 "whatever compositions are requested.", \
100 "uilabel": "Output Recipe", \
101 "default": "", \
102 "uitype": "outrecipe", \
103 }
104 std::string outrecipe;
105
106 #pragma cyclus var { \
107 "doc": "Total amount of material this source has remaining." \
108 " Every trade decreases this value by the supplied material " \
109 "quantity. When it reaches zero, the source cannot provide any " \
110 " more material.", \
111 "default": CY_LARGE_DOUBLE, \
112 "uitype": "range", \
113 "range": [0.0, CY_LARGE_DOUBLE], \
114 "uilabel": "Initial Inventory", \
115 "units": "kg", \
116 }
117 double inventory_size;
118
119 #pragma cyclus var { \
120 "default": CY_LARGE_DOUBLE, \
121 "tooltip": "per time step throughput", \
122 "units": "kg/(time step)", \
123 "uilabel": "Maximum Throughput", \
124 "uitype": "range", \
125 "range": [0.0, CY_LARGE_DOUBLE], \
126 "doc": "amount of commodity that can be supplied at each time step", \
127 }
128 double throughput;
129
130 #pragma cyclus var { \
131 "default": "unpackaged", \
132 "tooltip": "name of package to provide material in", \
133 "doc": "Name of package that this source provides. Offers will only be" \
134 "made in packagable quantities of material.", \
135 "uilabel": "Output Package Type", \
136 "uitype": "package", \
137 }
138 std::string package;
139
140 #pragma cyclus var { \
141 "default": "unrestricted", \
142 "tooltip": "name of transport unit to ship packages in", \
143 "doc": "Name of transport unit that this source uses to ship packages of " \
144 "material. Offers will only be made in shippable quantities of " \
145 "packages. Optional if packaging is used, but use of transport " \
146 "units requires packaging type to also be set", \
147 "uilabel": "Output Transport Unit Type", \
148 "uitype": "transportunit", \
149 }
150 std::string transport_unit;
151
152 #pragma cyclus var { \
153 "tooltip":"Material buffer"}
154 cyclus::toolkit::ResBuf<cyclus::Material> inventory;
155
157};
158
159} // namespace cycamore
160
161#endif // CYCAMORE_SRC_SOURCE_H_
#define CYCAMORE_VERSION
This facility acts as a source of material with a fixed throughput (per time step) capacity and a lif...
virtual void InitFrom(Source *m)
virtual std::string version()
Definition src/source.h:35
virtual void Tick()
Definition src/source.h:62
virtual void EnterNotify()
virtual std::set< cyclus::BidPortfolio< cyclus::Material >::Ptr > GetMatlBids(cyclus::CommodMap< cyclus::Material >::type &commod_requests)
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 Build(cyclus::Agent *parent)
— Facility Members — perform module-specific tasks when entering the simulation
Source(cyclus::Context *ctx)
cyclus::toolkit::ResBuf< cyclus::Material > inventory
virtual ~Source()
virtual void InitFrom(cyclus::QueryableBackend *b)
virtual std::string str()
virtual void Tock()
Definition src/source.h:64