Skip to content

Commit ee28a93

Browse files
committed
more text on buy/sell and package
1 parent be8f0d4 commit ee28a93

File tree

2 files changed

+80
-5
lines changed

2 files changed

+80
-5
lines changed

source/arche/toolkit.rst

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,38 @@ Multi-Resource Buffer Inventory Tracker [C++]
126126

127127
Material Buy Policy Class [C++]
128128
+++++++++++++++++++++++++++++++
129-
The ``cyclus::toolkit::MatlBuyPolicy`` class manages the process of requesting
130-
a particular commodity.
129+
The ``cyclus::toolkit::MatlBuyPolicy`` class performs semi-automatic
130+
inventory management of a material buffer .
131+
For simple behavior, policies virtually eliminate the need to write any code
132+
for resource exchange. Just assign a few policies to work with a few buffers
133+
and focus on writing the physics and other behvavior of your agent. Typical
134+
usage goes something like this:
135+
136+
.. code-block:: c++
137+
class YourAgent : public cyclus::Facility {
138+
public:
139+
...
140+
141+
void EnterNotify() {
142+
cyclus::Facility::EnterNotify(); // always do this first
143+
144+
policy_.Init(this, &inbuf_, "inbuf-label").Set(incommod, comp).Start();
145+
}
146+
...
147+
148+
private:
149+
MatlBuyPolicy policy_;
150+
ResBuf<Material> inbuf_;
151+
...
152+
}
153+
154+
155+
The policy needs to be initialized with its owning agent and the material
156+
buffer that is is managing. It also needs to be activated by calling the
157+
Start function for it to begin participation in resource exchange. And
158+
don't forget to add some commodities to request by calling Set. All policy
159+
configuration should usually occur in the agent's EnterNotify member
160+
function.
131161

132162
The following inventory management strategies are available:
133163

@@ -170,5 +200,48 @@ Material Buy Policy Class [C++]
170200

171201
Material Sell Policy Class [C++]
172202
++++++++++++++++++++++++++++++++
173-
The ``cyclus::toolkit::MatlSellPolicy`` class manages the process of providing
174-
a particular commodity to the DRE.
203+
The ``cyclus::toolkit::MatlSellPolicy`` class performs semi-automatic inventory
204+
management of a material buffer by making offers and trading away materials
205+
in an attempt to empty the buffer's inventory every time step.
206+
207+
For simple behavior, policies virtually eliminate the need to write any code
208+
for resource exchange. Just assign a few policies to work with a few buffers
209+
and focus on writing the physics and other behvavior of your agent. Typical
210+
usage goes something like this:
211+
212+
.. code-block:: c++
213+
class YourAgent : public Facility {
214+
public:
215+
...
216+
217+
void EnterNotify() {
218+
Facility::EnterNotify(); // always do this first
219+
220+
policy_.Init(this, &outbuf_, "outbuf-label", ...).Set(outcommod).Start();
221+
}
222+
...
223+
224+
private:
225+
MatlSellPolicy policy_;
226+
ResBuf<Material> outbuf_;
227+
...
228+
}
229+
230+
The policy needs to be initialized with its owning agent and the material
231+
buffer that is is managing. It also needs to be activated by calling the
232+
Start function for it to begin participation in resource exchange. And
233+
don't forget to add some commodities to offer on by calling Set. All policy
234+
configuration should usually occur in the agent's EnterNotify member
235+
function.
236+
237+
When a policy's managing agent is deallocated, you MUST either
238+
call the policy's Stop function or delete the policy. Otherwise SEGFAULT.
239+
240+
``MatlSellPolicy`` can be initialized with a package and transport unit.
241+
When responding to requests for bids, the policy will only offer resources
242+
in quantities that can be packaged (and placed into transport units, if
243+
applicable). The packaging process occurs only after trades have been accepted,
244+
in the case that partial trades are accepted. Note that partial acceptance of
245+
bids may result in "failed" trades where the accepted amount cannot be packaged
246+
and thus only a portion of the bid gets packaged and sent to the receiving
247+
agent.

source/user/input_specs/package.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ facility archetype; Storage re-packages outgoing commodidies as they are being
99
traded to another agent.
1010

1111
Packaging is currently available in the Material Sell Policy (see Cyclus Toolkit),
12-
and is implemented in cyc
12+
and is implemented in cycamore:Storage. Storage makes bids on its outcommodity
13+
based on its packaging restrictions and re-packages outgoing commodidies
14+
as they are being traded to another agent.
1315

1416
A ``package`` block has the following sections:
1517

0 commit comments

Comments
 (0)