1#include <gtest/gtest.h>
7using pyne::nucname::id;
8using cyclus::Composition;
10using cyclus::QueryResult;
12using cyclus::toolkit::MatQuery;
15namespace reactortests {
17Composition::Ptr
c_uox() {
21 return Composition::CreateFromMass(m);
24Composition::Ptr
c_mox() {
29 return Composition::CreateFromMass(m);
37 return Composition::CreateFromMass(m);
45 return Composition::CreateFromMass(m);
52 return Composition::CreateFromAtom(m);
58TEST(ReactorTests, JustInTimeOrdering) {
60 " <fuel_inrecipes> <val>lwr_fresh</val> </fuel_inrecipes> "
61 " <fuel_outrecipes> <val>lwr_spent</val> </fuel_outrecipes> "
62 " <fuel_incommods> <val>enriched_u</val> </fuel_incommods> "
63 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
64 " <fuel_prefs> <val>1.0</val> </fuel_prefs> "
66 " <cycle_time>1</cycle_time> "
67 " <refuel_time>0</refuel_time> "
68 " <assem_size>300</assem_size> "
69 " <n_assem_core>1</n_assem_core> "
70 " <n_assem_batch>1</n_assem_batch> ";
73 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
74 sim.AddSource(
"enriched_u").Finalize();
75 sim.AddRecipe(
"lwr_fresh",
c_uox());
79 QueryResult qr = sim.db().Query(
"Transactions", NULL);
80 EXPECT_EQ(simdur, qr.rows.size()) <<
"failed to order+run on fresh fuel inside 1 time step";
85TEST(ReactorTests, BatchSizes) {
87 " <fuel_inrecipes> <val>uox</val> </fuel_inrecipes> "
88 " <fuel_outrecipes> <val>spentuox</val> </fuel_outrecipes> "
89 " <fuel_incommods> <val>uox</val> </fuel_incommods> "
90 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
92 " <cycle_time>1</cycle_time> "
93 " <refuel_time>0</refuel_time> "
94 " <assem_size>1</assem_size> "
95 " <n_assem_core>7</n_assem_core> "
96 " <n_assem_batch>3</n_assem_batch> ";
99 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
100 sim.AddSource(
"uox").Finalize();
101 sim.AddRecipe(
"uox",
c_uox());
105 QueryResult qr = sim.db().Query(
"Transactions", NULL);
107 EXPECT_EQ(7+3*(simdur-1), qr.rows.size());
112TEST(ReactorTests, RefuelTimes) {
114 " <fuel_inrecipes> <val>uox</val> </fuel_inrecipes> "
115 " <fuel_outrecipes> <val>spentuox</val> </fuel_outrecipes> "
116 " <fuel_incommods> <val>uox</val> </fuel_incommods> "
117 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
119 " <cycle_time>4</cycle_time> "
120 " <refuel_time>3</refuel_time> "
121 " <assem_size>1</assem_size> "
122 " <n_assem_core>1</n_assem_core> "
123 " <n_assem_batch>1</n_assem_batch> ";
126 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
127 sim.AddSource(
"uox").Finalize();
128 sim.AddRecipe(
"uox",
c_uox());
132 QueryResult qr = sim.db().Query(
"Transactions", NULL);
135 int n_assem_want = simdur/(cyclet+refuelt)+1;
136 EXPECT_EQ(n_assem_want, qr.rows.size());
142TEST(ReactorTests, DecomTimes) {
144 " <fuel_inrecipes> <val>uox</val> </fuel_inrecipes> "
145 " <fuel_outrecipes> <val>spentuox</val> </fuel_outrecipes> "
146 " <fuel_incommods> <val>uox</val> </fuel_incommods> "
147 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
149 " <cycle_time>2</cycle_time> "
150 " <refuel_time>2</refuel_time> "
151 " <assem_size>1</assem_size> "
152 " <n_assem_core>3</n_assem_core> "
153 " <power_cap>1000</power_cap> "
154 " <n_assem_batch>1</n_assem_batch> ";
158 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur, lifetime);
159 sim.AddSource(
"uox").Finalize();
160 sim.AddRecipe(
"uox",
c_uox());
166 std::vector<Cond> conds;
167 conds.push_back(Cond(
"Value",
"==", 1000));
168 QueryResult qr = sim.db().Query(
"TimeSeriesPower", &conds);
169 EXPECT_EQ(on_time, qr.rows.size());
173 conds.push_back(Cond(
"Value",
"==", 0));
174 qr = sim.db().Query(
"TimeSeriesPower", &conds);
175 EXPECT_EQ(off_time, qr.rows.size());
181TEST(ReactorTests, DecomZeroRefuel) {
183 " <fuel_inrecipes> <val>uox</val> </fuel_inrecipes> "
184 " <fuel_outrecipes> <val>spentuox</val> </fuel_outrecipes> "
185 " <fuel_incommods> <val>uox</val> </fuel_incommods> "
186 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
188 " <cycle_time>2</cycle_time> "
189 " <refuel_time>0</refuel_time> "
190 " <assem_size>1</assem_size> "
191 " <n_assem_core>3</n_assem_core> "
192 " <power_cap>1000</power_cap> "
193 " <n_assem_batch>1</n_assem_batch> ";
197 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur, lifetime);
198 sim.AddSource(
"uox").Finalize();
199 sim.AddRecipe(
"uox",
c_uox());
205 std::vector<Cond> conds;
206 conds.push_back(Cond(
"Value",
"==", 1000));
207 QueryResult qr = sim.db().Query(
"TimeSeriesPower", &conds);
208 EXPECT_EQ(on_time, qr.rows.size());
214TEST(ReactorTests, OrderAtRefuelStart) {
216 " <fuel_inrecipes> <val>uox</val> </fuel_inrecipes> "
217 " <fuel_outrecipes> <val>spentuox</val> </fuel_outrecipes> "
218 " <fuel_incommods> <val>uox</val> </fuel_incommods> "
219 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
221 " <cycle_time>4</cycle_time> "
222 " <refuel_time>3</refuel_time> "
223 " <assem_size>1</assem_size> "
224 " <n_assem_core>1</n_assem_core> "
225 " <n_assem_batch>1</n_assem_batch> ";
228 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
229 sim.AddSource(
"uox").Finalize();
230 sim.AddRecipe(
"uox",
c_uox());
234 QueryResult qr = sim.db().Query(
"Transactions", NULL);
237 int n_assem_want = simdur/(cyclet+refuelt)+1;
238 EXPECT_EQ(n_assem_want, qr.rows.size());
243TEST(ReactorTests, MultiFuelMix) {
245 " <fuel_inrecipes> <val>uox</val> <val>mox</val> </fuel_inrecipes> "
246 " <fuel_outrecipes> <val>spentuox</val> <val>spentmox</val> </fuel_outrecipes> "
247 " <fuel_incommods> <val>uox</val> <val>mox</val> </fuel_incommods> "
248 " <fuel_outcommods> <val>waste</val> <val>waste</val> </fuel_outcommods> "
250 " <cycle_time>1</cycle_time> "
251 " <refuel_time>0</refuel_time> "
252 " <assem_size>1</assem_size> "
253 " <n_assem_fresh>3</n_assem_fresh> "
254 " <n_assem_core>3</n_assem_core> "
255 " <n_assem_batch>3</n_assem_batch> ";
263 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
264 sim.AddSource(
"uox").capacity(2).Finalize();
265 sim.AddSource(
"mox").capacity(2).Finalize();
266 sim.AddRecipe(
"uox",
c_uox());
272 QueryResult qr = sim.db().Query(
"Transactions", NULL);
274 EXPECT_EQ(3*simdur+3, qr.rows.size());
279TEST(ReactorTests, FullSpentInventory) {
281 " <fuel_inrecipes> <val>uox</val> </fuel_inrecipes> "
282 " <fuel_outrecipes> <val>spentuox</val> </fuel_outrecipes> "
283 " <fuel_incommods> <val>uox</val> </fuel_incommods> "
284 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
286 " <cycle_time>1</cycle_time> "
287 " <refuel_time>0</refuel_time> "
288 " <assem_size>1</assem_size> "
289 " <n_assem_core>1</n_assem_core> "
290 " <n_assem_batch>1</n_assem_batch> "
291 " <n_assem_spent>3</n_assem_spent> ";
294 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
295 sim.AddSource(
"uox").Finalize();
296 sim.AddRecipe(
"uox",
c_uox());
300 QueryResult qr = sim.db().Query(
"Transactions", NULL);
301 int n_assem_spent = 3;
304 EXPECT_EQ(n_assem_spent+1, qr.rows.size());
309TEST(ReactorTests, FullSpentInventoryShutdown) {
311 " <fuel_inrecipes> <val>uox</val> </fuel_inrecipes> "
312 " <fuel_outrecipes> <val>spentuox</val> </fuel_outrecipes> "
313 " <fuel_incommods> <val>uox</val> </fuel_incommods> "
314 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
316 " <cycle_time>1</cycle_time> "
317 " <refuel_time>0</refuel_time> "
318 " <assem_size>1</assem_size> "
319 " <n_assem_core>1</n_assem_core> "
320 " <n_assem_batch>1</n_assem_batch> "
321 " <n_assem_spent>1</n_assem_spent> "
322 " <power_cap>100</power_cap> ";
325 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
326 sim.AddSource(
"uox").Finalize();
327 sim.AddRecipe(
"uox",
c_uox());
331 QueryResult qr = sim.db().Query(
"TimeSeriesPower", NULL);
332 EXPECT_EQ(0, qr.GetVal<
double>(
"Value", simdur - 1));
341TEST(ReactorTests, FuelShortage) {
343 " <fuel_inrecipes> <val>uox</val> </fuel_inrecipes> "
344 " <fuel_outrecipes> <val>spentuox</val> </fuel_outrecipes> "
345 " <fuel_incommods> <val>uox</val> </fuel_incommods> "
346 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
348 " <cycle_time>7</cycle_time> "
349 " <refuel_time>0</refuel_time> "
350 " <assem_size>1</assem_size> "
351 " <n_assem_core>3</n_assem_core> "
352 " <n_assem_batch>3</n_assem_batch> ";
355 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
356 sim.AddSource(
"uox").lifetime(1).Finalize();
357 sim.AddSource(
"uox").start(9).lifetime(1).capacity(2).Finalize();
358 sim.AddSource(
"uox").start(15).Finalize();
359 sim.AddRecipe(
"uox",
c_uox());
364 std::vector<Cond> conds;
365 conds.push_back(Cond(
"Time",
"<", 15));
366 QueryResult qr = sim.db().Query(
"Transactions", &conds);
367 EXPECT_EQ(5, qr.rows.size());
372 conds.push_back(Cond(
"Time",
"==", 15));
373 qr = sim.db().Query(
"Transactions", &conds);
374 EXPECT_EQ(1, qr.rows.size());
378 conds.push_back(Cond(
"Time",
"<", 21));
379 qr = sim.db().Query(
"Transactions", &conds);
380 EXPECT_EQ(6, qr.rows.size());
384 conds.push_back(Cond(
"Time",
"==", 22));
385 qr = sim.db().Query(
"Transactions", &conds);
386 EXPECT_EQ(3, qr.rows.size());
390TEST(ReactorTests, DischargedFuelTransmute) {
392 " <fuel_inrecipes> <val>uox</val> </fuel_inrecipes> "
393 " <fuel_outrecipes> <val>spentuox</val> </fuel_outrecipes> "
394 " <fuel_incommods> <val>uox</val> </fuel_incommods> "
395 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
397 " <cycle_time>4</cycle_time> "
398 " <refuel_time>3</refuel_time> "
399 " <assem_size>1</assem_size> "
400 " <n_assem_core>1</n_assem_core> "
401 " <n_assem_batch>1</n_assem_batch> ";
404 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
405 sim.AddSource(
"uox").Finalize();
406 sim.AddSink(
"waste").Finalize();
407 sim.AddRecipe(
"uox",
c_uox());
409 sim.AddRecipe(
"spentuox", spentuox);
412 std::vector<Cond> conds;
413 conds.push_back(Cond(
"SenderId",
"==",
id));
414 int resid = sim.db().Query(
"Transactions", &conds).GetVal<
int>(
"ResourceId");
415 Material::Ptr m = sim.GetMaterial(resid);
417 EXPECT_EQ(spentuox->id(), m->comp()->id());
418 EXPECT_TRUE(mq.mass(942390000) > 0) <<
"transmuted spent fuel doesn't have Pu239";
424TEST(ReactorTests, SpentFuelProperCommodTracking) {
426 " <fuel_inrecipes> <val>uox</val> <val>mox</val> </fuel_inrecipes> "
427 " <fuel_outrecipes> <val>spentuox</val> <val>spentmox</val> </fuel_outrecipes> "
428 " <fuel_incommods> <val>uox</val> <val>mox</val> </fuel_incommods> "
429 " <fuel_outcommods> <val>waste1</val> <val>waste2</val> </fuel_outcommods> "
431 " <cycle_time>1</cycle_time> "
432 " <refuel_time>0</refuel_time> "
433 " <assem_size>1</assem_size> "
434 " <n_assem_core>3</n_assem_core> "
435 " <n_assem_batch>3</n_assem_batch> ";
438 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
439 sim.AddSource(
"uox").capacity(1).Finalize();
440 sim.AddSource(
"mox").capacity(2).Finalize();
441 sim.AddSink(
"waste1").Finalize();
442 sim.AddSink(
"waste2").Finalize();
443 sim.AddRecipe(
"uox",
c_uox());
445 sim.AddRecipe(
"mox",
c_mox());
449 std::vector<Cond> conds;
450 conds.push_back(Cond(
"SenderId",
"==",
id));
451 conds.push_back(Cond(
"Commodity",
"==", std::string(
"waste1")));
452 QueryResult qr = sim.db().Query(
"Transactions", &conds);
453 EXPECT_EQ(simdur-1, qr.rows.size());
455 conds[1] = Cond(
"Commodity",
"==", std::string(
"waste2"));
456 qr = sim.db().Query(
"Transactions", &conds);
457 EXPECT_EQ(2*(simdur-1), qr.rows.size());
464TEST(ReactorTests, PrefChange) {
467 " <fuel_inrecipes> <val>lwr_fresh</val> </fuel_inrecipes> "
468 " <fuel_outrecipes> <val>lwr_spent</val> </fuel_outrecipes> "
469 " <fuel_incommods> <val>enriched_u</val> </fuel_incommods> "
470 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
472 " <cycle_time>1</cycle_time> "
473 " <refuel_time>0</refuel_time> "
474 " <assem_size>300</assem_size> "
475 " <n_assem_core>1</n_assem_core> "
476 " <n_assem_batch>1</n_assem_batch> "
478 " <pref_change_times> <val>25</val> </pref_change_times>"
479 " <pref_change_commods> <val>enriched_u</val> </pref_change_commods>"
480 " <pref_change_values> <val>-1</val> </pref_change_values>";
483 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
484 sim.AddSource(
"enriched_u").Finalize();
485 sim.AddRecipe(
"lwr_fresh",
c_uox());
489 QueryResult qr = sim.db().Query(
"Transactions", NULL);
490 EXPECT_EQ(25, qr.rows.size()) <<
"failed to adjust preferences properly";
493TEST(ReactorTests, RecipeChange) {
496 " <fuel_inrecipes> <val>lwr_fresh</val> </fuel_inrecipes> "
497 " <fuel_outrecipes> <val>lwr_spent</val> </fuel_outrecipes> "
498 " <fuel_incommods> <val>enriched_u</val> </fuel_incommods> "
499 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
501 " <cycle_time>1</cycle_time> "
502 " <refuel_time>0</refuel_time> "
503 " <assem_size>300</assem_size> "
504 " <n_assem_core>1</n_assem_core> "
505 " <n_assem_batch>1</n_assem_batch> "
507 " <recipe_change_times> <val>25</val> <val>35</val> </recipe_change_times>"
508 " <recipe_change_commods> <val>enriched_u</val> <val>enriched_u</val> </recipe_change_commods>"
509 " <recipe_change_in> <val>water</val> <val>water</val> </recipe_change_in>"
510 " <recipe_change_out> <val>lwr_spent</val> <val>water</val> </recipe_change_out>";
513 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
514 sim.AddSource(
"enriched_u").Finalize();
515 sim.AddSink(
"waste").Finalize();
516 sim.AddRecipe(
"lwr_fresh",
c_uox());
518 sim.AddRecipe(
"water",
c_water());
521 std::vector<Cond> conds;
526 conds.push_back(Cond(
"Time",
"==", 24));
527 conds.push_back(Cond(
"ReceiverId",
"==", aid));
528 qr = sim.db().Query(
"Transactions", &conds);
529 MatQuery mq = MatQuery(sim.GetMaterial(qr.GetVal<
int>(
"ResourceId")));
531 EXPECT_TRUE(0 < mq.qty());
532 EXPECT_TRUE(0 == mq.mass(
id(
"H1")));
536 conds.push_back(Cond(
"Time",
"==", 26));
537 conds.push_back(Cond(
"ReceiverId",
"==", aid));
538 qr = sim.db().Query(
"Transactions", &conds);
539 mq = MatQuery(sim.GetMaterial(qr.GetVal<
int>(
"ResourceId")));
541 EXPECT_TRUE(0 < mq.qty());
542 EXPECT_TRUE(0 < mq.mass(
id(
"H1")));
546 conds.push_back(Cond(
"Time",
"==", 34));
547 conds.push_back(Cond(
"SenderId",
"==", aid));
548 qr = sim.db().Query(
"Transactions", &conds);
549 mq = MatQuery(sim.GetMaterial(qr.GetVal<
int>(
"ResourceId")));
551 EXPECT_TRUE(0 < mq.qty());
552 EXPECT_TRUE(0 == mq.mass(
id(
"H1")));
556 conds.push_back(Cond(
"Time",
"==", 36));
557 conds.push_back(Cond(
"SenderId",
"==", aid));
558 qr = sim.db().Query(
"Transactions", &conds);
559 mq = MatQuery(sim.GetMaterial(qr.GetVal<
int>(
"ResourceId")));
561 EXPECT_TRUE(0 < mq.qty());
562 EXPECT_TRUE(0 < mq.mass(
id(
"H1")));
565TEST(ReactorTests, Retire) {
567 " <fuel_inrecipes> <val>lwr_fresh</val> </fuel_inrecipes> "
568 " <fuel_outrecipes> <val>lwr_spent</val> </fuel_outrecipes> "
569 " <fuel_incommods> <val>enriched_u</val> </fuel_incommods> "
570 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
572 " <cycle_time>7</cycle_time> "
573 " <refuel_time>0</refuel_time> "
574 " <assem_size>300</assem_size> "
575 " <n_assem_fresh>1</n_assem_fresh> "
576 " <n_assem_core>3</n_assem_core> "
577 " <n_assem_batch>1</n_assem_batch> "
578 " <power_cap>1</power_cap> "
585 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, dur, life);
586 sim.AddSource(
"enriched_u").Finalize();
587 sim.AddSink(
"waste").Finalize();
588 sim.AddRecipe(
"lwr_fresh",
c_uox());
597 static_cast<int>(ceil(
static_cast<double>(life) / 7.0)) * nbatch +
600 std::vector<Cond> conds;
601 conds.push_back(Cond(
"ReceiverId",
"==",
id));
602 QueryResult qr = sim.db().Query(
"Transactions", &conds);
603 EXPECT_EQ(nassem_recv, qr.rows.size())
604 <<
"failed to stop ordering near retirement";
608 conds.push_back(Cond(
"SenderId",
"==",
id));
609 qr = sim.db().Query(
"Transactions", &conds);
610 EXPECT_EQ(nassem_recv, qr.rows.size())
611 <<
"failed to discharge all material by retirement time";
614 int time_online = life / (cycle_time + refuel_time) * cycle_time + std::min(life % (cycle_time + refuel_time), cycle_time);
616 conds.push_back(Cond(
"AgentId",
"==",
id));
617 conds.push_back(Cond(
"Value",
">", 0));
618 qr = sim.db().Query(
"TimeSeriesPower", &conds);
619 EXPECT_EQ(time_online, qr.rows.size())
620 <<
"failed to generate power for the correct number of time steps";
623TEST(ReactorTests, PositionInitialize) {
625 " <fuel_inrecipes> <val>lwr_fresh</val> </fuel_inrecipes> "
626 " <fuel_outrecipes> <val>lwr_spent</val> </fuel_outrecipes> "
627 " <fuel_incommods> <val>enriched_u</val> </fuel_incommods> "
628 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
629 " <fuel_prefs> <val>1.0</val> </fuel_prefs> "
631 " <cycle_time>1</cycle_time> "
632 " <refuel_time>0</refuel_time> "
633 " <assem_size>300</assem_size> "
634 " <n_assem_core>1</n_assem_core> "
635 " <n_assem_batch>1</n_assem_batch> ";
638 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
639 sim.AddSource(
"enriched_u").Finalize();
640 sim.AddRecipe(
"lwr_fresh",
c_uox());
644 QueryResult qr = sim.db().Query(
"AgentPosition", NULL);
645 EXPECT_EQ(qr.GetVal<
double>(
"Latitude"), 0.0);
646 EXPECT_EQ(qr.GetVal<
double>(
"Longitude"), 0.0);
649TEST(ReactorTests, PositionInitialize2) {
651 " <fuel_inrecipes> <val>lwr_fresh</val> </fuel_inrecipes> "
652 " <fuel_outrecipes> <val>lwr_spent</val> </fuel_outrecipes> "
653 " <fuel_incommods> <val>enriched_u</val> </fuel_incommods> "
654 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
655 " <fuel_prefs> <val>1.0</val> </fuel_prefs> "
657 " <cycle_time>1</cycle_time> "
658 " <refuel_time>0</refuel_time> "
659 " <assem_size>300</assem_size> "
660 " <n_assem_core>1</n_assem_core> "
661 " <n_assem_batch>1</n_assem_batch> "
662 " <longitude>30.0</longitude> "
663 " <latitude>30.0</latitude> ";
666 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
667 sim.AddSource(
"enriched_u").Finalize();
668 sim.AddRecipe(
"lwr_fresh",
c_uox());
672 QueryResult qr = sim.db().Query(
"AgentPosition", NULL);
673 EXPECT_EQ(qr.GetVal<
double>(
"Latitude"), 30.0);
674 EXPECT_EQ(qr.GetVal<
double>(
"Longitude"), 30.0);
677TEST(ReactorTests, ByProduct) {
679 " <fuel_inrecipes> <val>uox</val> </fuel_inrecipes> "
680 " <fuel_outrecipes> <val>spentuox</val> </fuel_outrecipes> "
681 " <fuel_incommods> <val>uox</val> </fuel_incommods> "
682 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
684 " <cycle_time>1</cycle_time> "
685 " <refuel_time>1</refuel_time> "
686 " <assem_size>1</assem_size> "
687 " <n_assem_core>7</n_assem_core> "
688 " <n_assem_batch>3</n_assem_batch> "
690 " <side_products> <val>process_heat</val> </side_products>"
691 " <side_product_quantity> <val>10</val> </side_product_quantity>";
694 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
695 sim.AddSource(
"uox").Finalize();
696 sim.AddRecipe(
"uox",
c_uox());
700 std::vector<Cond> conds;
703 conds.push_back(Cond(
"Value",
"==", quantity));
704 QueryResult qr = sim.db().Query(
"ReactorSideProducts", &conds);
705 EXPECT_EQ(5, qr.rows.size());
709 conds.push_back(Cond(
"Value",
"==", 0));
710 qr = sim.db().Query(
"ReactorSideProducts", &conds);
711 EXPECT_EQ(5, qr.rows.size());
714TEST(ReactorTests, MultipleByProduct) {
716 " <fuel_inrecipes> <val>uox</val> </fuel_inrecipes> "
717 " <fuel_outrecipes> <val>spentuox</val> </fuel_outrecipes> "
718 " <fuel_incommods> <val>uox</val> </fuel_incommods> "
719 " <fuel_outcommods> <val>waste</val> </fuel_outcommods> "
721 " <cycle_time>1</cycle_time> "
722 " <refuel_time>1</refuel_time> "
723 " <assem_size>1</assem_size> "
724 " <n_assem_core>7</n_assem_core> "
725 " <n_assem_batch>3</n_assem_batch> "
727 " <side_products> <val>process_heat</val> <val>water</val> </side_products>"
728 " <side_product_quantity> <val>10</val> <val>100</val> </side_product_quantity>";
731 cyclus::MockSim sim(cyclus::AgentSpec(
":cycamore:Reactor"), config, simdur);
732 sim.AddSource(
"uox").Finalize();
733 sim.AddRecipe(
"uox",
c_uox());
738 std::vector<Cond> conds;
741 conds.push_back(Cond(
"Product",
"==", std::string(
"process_heat")));
742 conds.push_back(Cond(
"Value",
"==", quantity));
743 QueryResult qr = sim.db().Query(
"ReactorSideProducts", &conds);
744 EXPECT_EQ(5, qr.rows.size());
749 conds.push_back(Cond(
"Product",
"==", std::string(
"water")));
750 conds.push_back(Cond(
"Value",
"==", quantity));
751 qr = sim.db().Query(
"ReactorSideProducts", &conds);
752 EXPECT_EQ(5, qr.rows.size());
755 conds.push_back(Cond(
"Value",
"==", 0));
756 qr = sim.db().Query(
"ReactorSideProducts", &conds);
757 EXPECT_EQ(10, qr.rows.size());
Composition::Ptr c_spentuox()
Composition::Ptr c_water()
TEST(ReactorTests, JustInTimeOrdering)
Composition::Ptr c_spentmox()