25 int rawcycpp_shape_outcommod[1] = {-1};
27 int rawcycpp_shape_outrecipe[1] = {-1};
29 int rawcycpp_shape_inventory_size[1] = {-1};
31 int rawcycpp_shape_throughput[1] = {-1};
33 int rawcycpp_shape_package[1] = {-1};
35 int rawcycpp_shape_transport_unit[1] = {-1};
37 int rawcycpp_shape_latitude[1] = {-1};
39 int rawcycpp_shape_longitude[1] = {-1};
41 int rawcycpp_shape_inventory[2] = {-1, -1};
51 inventory.capacity(m->inventory.capacity());
52#line 24 "/cycamore/src/source.cc"
53 cyclus::toolkit::CommodityProducer::Copy(m);
57 int rawcycpp_shape_outcommod[1] = {-1};
59 int rawcycpp_shape_outrecipe[1] = {-1};
61 int rawcycpp_shape_inventory_size[1] = {-1};
63 int rawcycpp_shape_throughput[1] = {-1};
65 int rawcycpp_shape_package[1] = {-1};
67 int rawcycpp_shape_transport_unit[1] = {-1};
69 int rawcycpp_shape_latitude[1] = {-1};
71 int rawcycpp_shape_longitude[1] = {-1};
73 int rawcycpp_shape_inventory[2] = {-1, -1};
75 cyclus::QueryResult qr = b->Query(
"Info", NULL);
76 outcommod = qr.GetVal<std::string>(
"outcommod");
77 outrecipe = qr.GetVal<std::string>(
"outrecipe");
80 package = qr.GetVal<std::string>("package");
82 latitude = qr.GetVal<
double>(
"latitude");
83 longitude = qr.GetVal<
double>(
"longitude");
85#line 29 "/cycamore/src/source.cc"
86 namespace tk = cyclus::toolkit;
87 tk::CommodityProducer::Add(tk::Commodity(
outcommod),
92 namespace tk = cyclus::toolkit;
95 if (cyclus::toolkit::CommodityProducer::Produces(
101 ss << cyclus::Facility::str() <<
" supplies commodity '" <<
outcommod
102 <<
"' with recipe '" <<
outrecipe <<
"' at a throughput of "
104 <<
" commod producer members: "
105 <<
" produces " <<
outcommod <<
"?: " << ans
106 <<
" throughput: " << cyclus::toolkit::CommodityProducer::Capacity(
outcommod)
107 <<
" with package type: " <<
package
108 << " and transport unit type: " << transport_unit
109 << " cost: " << cyclus::toolkit::CommodityProducer::Cost(outcommod);
119 Facility::Build(parent);
121 using cyclus::CompMap;
122 using cyclus::Composition;
123 using cyclus::Material;
126 cyclus::Material::Ptr all_inv;
127 Composition::Ptr blank_comp = Composition::CreateFromMass(CompMap());
129#line 74 "/cycamore/src/source.cc"
135 cyclus::CommodMap<cyclus::Material>::type& commod_requests) {
136 using cyclus::BidPortfolio;
137 using cyclus::CapacityConstraint;
138 using cyclus::Material;
139 using cyclus::Package;
140 using cyclus::Request;
141 using cyclus::TransportUnit;
144 cyclus::toolkit::RecordTimeSeries<double>(
"supply"+
outcommod,
this,
146 LOG(cyclus::LEV_INFO3,
"Source") << prototype() <<
" is bidding up to "
148 LOG(cyclus::LEV_INFO5,
"Source") <<
"stats: " <<
str();
150 std::set<BidPortfolio<Material>::Ptr> ports;
151 if (max_qty < cyclus::eps()) {
153 }
else if (commod_requests.count(
outcommod) == 0) {
157 BidPortfolio<Material>::Ptr port(
new BidPortfolio<Material>());
158 std::vector<Request<Material>*>& requests = commod_requests[
outcommod];
159 std::vector<Request<Material>*>::iterator it;
160 for (it = requests.begin(); it != requests.end(); ++it) {
161 Request<Material>* req = *it;
162 Material::Ptr target = req->target();
163 double qty = std::min(target->quantity(), max_qty);
166 std::vector<double> bids = context()->GetPackage(
package)->GetFillMass(qty);
170 ->MaxShippablePackages(bids.size());
171 if (shippable_pkgs < bids.size()) {
172 bids.erase(bids.begin() + shippable_pkgs, bids.end());
175 std::vector<double>::iterator bit;
176 for (bit = bids.begin(); bit != bids.end(); ++bit) {
178 m =
outrecipe.empty() ? Material::CreateUntracked(*bit, target->comp()) : Material::CreateUntracked(*bit, context()->GetRecipe(
outrecipe));
179#line 125 "/cycamore/src/source.cc"
180 port->AddBid(req, m,
this);
184 CapacityConstraint<Material> cc(max_qty);
185 port->AddConstraint(cc);
191 const std::vector<cyclus::Trade<cyclus::Material> >& trades,
192 std::vector<std::pair<cyclus::Trade<cyclus::Material>,
193 cyclus::Material::Ptr> >& responses) {
194 using cyclus::Material;
197 int shippable_trades = context()->GetTransportUnit(
transport_unit)
198 ->MaxShippablePackages(trades.size());
200 std::vector<Trade<Material> >::const_iterator it;
201 for (it = trades.begin(); it != trades.end(); ++it) {
202 if (shippable_trades > 0) {
203 double qty = it->amt;
207 std::vector<Material::Ptr> m_pkgd = m->Package<Material>(context()->GetPackage(
package));
209 if (m->quantity() > cyclus::eps()) {
215 Material::Ptr response;
216 if (m_pkgd.size() > 0) {
220 response = m_pkgd[0];
221 shippable_trades -= 1;
224 response = Material::CreateUntracked(0, m->comp());
227 if (
outrecipe.empty() && response->comp() != it->request->target()->comp()) {
228 response->Transmute(it->request->target()->comp());
231 responses.push_back(std::make_pair(*it, response));
232 LOG(cyclus::LEV_INFO5,
"Source") << prototype() <<
" sent an order"
233 <<
" for " << response->quantity() <<
" of " <<
outcommod;