Skip to content

Commit 4e447c7

Browse files
committed
more implementation changes
1 parent 6bfec62 commit 4e447c7

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

src/mixer.cc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ void Mixer::EnterNotify() {
5959
in_commods.push_back(streams_[i].second);
6060
}
6161

62+
// Optional recipe per stream: size to match streams_, use "" where not set
63+
if (in_stream_recipes.size() < streams_.size()) {
64+
in_stream_recipes.resize(streams_.size(), "");
65+
}
66+
6267
// ratio normalisation
6368
if (mixing_ratios.size() != in_commods.size()) {
6469
std::stringstream ss;
@@ -90,6 +95,13 @@ void Mixer::EnterNotify() {
9095

9196
sell_policy.Init(this, &output, "output").Set(out_commod).Start();
9297

98+
// Register output recipe name at sim start so it exists before first mix.
99+
// Placeholder composition is overwritten with the real blend when we push.
100+
if (!out_recipe.empty()) {
101+
cyclus::CompMap empty;
102+
context()->AddRecipe(out_recipe, cyclus::Composition::CreateFromMass(empty));
103+
}
104+
93105
InitializeMarginalCost();
94106
InitializePosition();
95107
}
@@ -122,6 +134,9 @@ void Mixer::Tick() {
122134
}
123135
}
124136

137+
if (!out_recipe.empty()) {
138+
context()->AddRecipe(out_recipe, m->comp());
139+
}
125140
output.Push(m);
126141
}
127142
}
@@ -169,7 +184,12 @@ Mixer::GetMatlRequests() {
169184
new RequestPortfolio<cyclus::Material>());
170185

171186
cyclus::Material::Ptr m;
172-
m = cyclus::NewBlankMaterial(streambufs[name].space());
187+
if (i < in_stream_recipes.size() && !in_stream_recipes[i].empty()) {
188+
cyclus::Composition::Ptr rec = context()->GetRecipe(in_stream_recipes[i]);
189+
m = cyclus::Material::CreateUntracked(streambufs[name].space(), rec);
190+
} else {
191+
m = cyclus::NewBlankMaterial(streambufs[name].space());
192+
}
173193

174194
std::vector<cyclus::Request<cyclus::Material>*> reqs;
175195

src/mixer.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,31 @@ class Mixer
7676
// state var.
7777
std::map<std::string, cyclus::toolkit::ResBuf<cyclus::Material> > streambufs;
7878

79+
#pragma cyclus var { \
80+
"default": [], \
81+
"doc": "Optional recipe name for each input stream (same order as in_streams). " \
82+
"If set, requests on that stream use this recipe so suppliers (e.g. Enrichment) " \
83+
"can match. Empty string or omitted means no recipe (blank/dummy composition).", \
84+
"uilabel": "Input Stream Recipes", \
85+
"uitype": ["oneormore", "inrecipe"] \
86+
}
87+
std::vector<std::string> in_stream_recipes;
7988

8089
#pragma cyclus var { \
8190
"doc" : "Commodity on which to offer/supply mixed fuel material.", \
8291
"uilabel" : "Output Commodity", "uitype" : "outcommodity", }
8392
std::string out_commod;
8493

94+
#pragma cyclus var { \
95+
"default": "", \
96+
"doc": "Optional name to register the blended composition under. If set, " \
97+
"the mixed material's composition is registered as this recipe name " \
98+
"in the context (no transmutation); the blend is kept and just named.", \
99+
"uilabel": "Output Recipe", \
100+
"uitype": "outrecipe", \
101+
}
102+
std::string out_recipe;
103+
85104
#pragma cyclus var { \
86105
"doc" : "Maximum amount of mixed material that can be stored." \
87106
" If full, the facility halts operation until space becomes" \

src/separations.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ std::set<cyclus::BidPortfolio<Material>::Ptr> Separations::GetMatlBids(
334334
tot_bid += m->quantity();
335335

336336

337-
double marginal_cost = CalcMarginalCost(m->UnitValue());
337+
double marginal_cost = 0.0; // Set to zero since this is a waste stream?
338338

339339
// this fix the problem of the cyclus exchange manager which crashes
340340
// when a bid with a quantity <=0 is offered.

0 commit comments

Comments
 (0)