67 double proc,
double ready,
double stocks){
68 double t =
tc_.get()->time();
70 EXPECT_EQ(inv, fac->inventory.quantity());
71 EXPECT_EQ(proc, fac->processing.quantity());
72 EXPECT_EQ(stocks, fac->stocks.quantity());
73 EXPECT_EQ(ready, fac->ready.quantity());
406 " <in_commods> <val>spent_fuel</val> </in_commods> "
407 " <out_commods> <val>dry_spent</val> </out_commods> "
408 " <residence_time>1</residence_time>"
409 " <max_inv_size>10</max_inv_size>";
413 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
415 sim.AddSource(
"spent_fuel").Finalize();
416 sim.AddSink(
"dry_spent").Finalize();
421 std::vector<cyclus::Cond> conds;
422 conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"dry_spent")));
423 cyclus::QueryResult qr = sim.db().Query(
"Transactions", &conds);
424 int n_trans = qr.rows.size();
425 EXPECT_EQ(1, n_trans) <<
"expected 1 transactions, got " << n_trans;
433 " <in_commods> <val>spent_fuel</val>"
434 " <val>spent_fuel2</val> </in_commods>"
435 " <in_commod_prefs> <val>1</val>"
436 " <val>1</val> </in_commod_prefs>"
437 " <out_commods> <val>dry_spent</val> </out_commods> "
438 " <max_inv_size>10</max_inv_size>";
442 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
444 sim.AddSource(
"spent_fuel").capacity(5).Finalize();
445 sim.AddSource(
"spent_fuel2").capacity(5).Finalize();
446 sim.AddSink(
"dry_spent").Finalize();
451 std::vector<cyclus::Cond> conds;
452 conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"spent_fuel")));
453 cyclus::QueryResult qr = sim.db().Query(
"Transactions", &conds);
454 int n_trans = qr.rows.size();
455 EXPECT_EQ(1, n_trans) <<
"expected 1 transactions, got " << n_trans;
457 std::vector<cyclus::Cond> conds2;
458 conds2.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"spent_fuel2")));
459 cyclus::QueryResult qr2 = sim.db().Query(
"Transactions", &conds2);
460 int n_trans2 = qr2.rows.size();
461 EXPECT_EQ(1, n_trans2) <<
"expected 1 transactions, got " << n_trans;
469 " <in_commods> <val>spent_fuel</val> </in_commods> "
470 " <out_commods> <val>dry_spent</val> </out_commods> "
471 " <throughput>1</throughput>"
472 " <active_buying_val>1</active_buying_val>"
473 " <dormant_buying_val>1</dormant_buying_val>";
477 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
479 sim.AddSource(
"spent_fuel").capacity(5).Finalize();
480 sim.AddSink(
"dry_spent").Finalize();
485 std::vector<cyclus::Cond> conds;
486 conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"spent_fuel")));
487 cyclus::QueryResult qr = sim.db().Query(
"Transactions", &conds);
488 int n_trans = qr.rows.size();
489 EXPECT_EQ(1, n_trans) <<
"expected 1 transactions, got " << n_trans;
496 " <in_commods> <val>spent_fuel</val> </in_commods> "
497 " <out_commods> <val>dry_spent</val> </out_commods> "
498 " <throughput>1</throughput>"
499 " <active_buying_frequency_type>Fixed</active_buying_frequency_type>"
500 " <active_buying_val>1</active_buying_val>"
501 " <dormant_buying_frequency_type>Fixed</dormant_buying_frequency_type>"
502 " <dormant_buying_val>-1</dormant_buying_val>";
506 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
508 sim.AddSource(
"spent_fuel").capacity(5).Finalize();
509 sim.AddSink(
"dry_spent").Finalize();
513 std::vector<cyclus::Cond> conds;
514 conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"spent_fuel")));
515 cyclus::QueryResult qr = sim.db().Query(
"Transactions", &conds);
516 int n_trans = qr.rows.size();
517 EXPECT_EQ(3, n_trans) <<
"expected 3 transactions, got " << n_trans;
522 " <in_commods> <val>spent_fuel</val> </in_commods> "
523 " <out_commods> <val>dry_spent</val> </out_commods> "
524 " <throughput>1</throughput>"
525 " <active_buying_frequency_type>Uniform</active_buying_frequency_type>"
526 " <active_buying_min>2</active_buying_min>"
527 " <active_buying_max>3</active_buying_max>"
528 " <dormant_buying_frequency_type>Normal</dormant_buying_frequency_type>"
529 " <dormant_buying_mean>5</dormant_buying_mean>"
530 " <dormant_buying_stddev>1</dormant_buying_stddev>";
534 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
536 sim.AddSource(
"spent_fuel").capacity(5).Finalize();
537 sim.AddSink(
"dry_spent").Finalize();
541 std::vector<cyclus::Cond> conds;
542 conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"spent_fuel")));
543 cyclus::QueryResult qr = sim.db().Query(
"Transactions", &conds);
546 EXPECT_EQ(0, qr.GetVal<
int>(
"Time", 0));
547 EXPECT_EQ(1, qr.GetVal<
int>(
"Time", 1));
549 EXPECT_EQ(7, qr.GetVal<
int>(
"Time", 2));
550 EXPECT_EQ(8, qr.GetVal<
int>(
"Time", 3));
551 EXPECT_EQ(9, qr.GetVal<
int>(
"Time", 4));
556 " <in_commods> <val>spent_fuel</val> </in_commods> "
557 " <out_commods> <val>dry_spent</val> </out_commods> "
558 " <throughput>1</throughput>"
559 " <buying_size_type>Fixed</buying_size_type>"
560 " <buying_size_val>0.5</buying_size_val>";
564 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
566 sim.AddSource(
"spent_fuel").Finalize();
569 cyclus::QueryResult qr = sim.db().Query(
"Resources", NULL);
570 EXPECT_NEAR(0.5, qr.GetVal<
double>(
"Quantity", 0), 0.00001);
571 EXPECT_NEAR(0.5, qr.GetVal<
double>(
"Quantity", 1), 0.00001);
576 " <in_commods> <val>spent_fuel</val> </in_commods> "
577 " <out_commods> <val>dry_spent</val> </out_commods> "
578 " <throughput>1</throughput>"
579 " <buying_size_type>Uniform</buying_size_type>"
580 " <buying_size_min>0.5</buying_size_min>"
581 " <buying_size_max>0.7</buying_size_max>";
585 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
587 sim.AddSource(
"spent_fuel").Finalize();
590 cyclus::QueryResult qr = sim.db().Query(
"Resources", NULL);
591 EXPECT_NEAR(0.56393, qr.GetVal<
double>(
"Quantity", 0), 0.00001);
592 EXPECT_NEAR(0.68825, qr.GetVal<
double>(
"Quantity", 1), 0.00001);
597 " <in_commods> <val>spent_fuel</val> </in_commods> "
598 " <out_commods> <val>dry_spent</val> </out_commods> "
599 " <throughput>1</throughput>"
600 " <buying_size_type>Normal</buying_size_type>"
601 " <buying_size_mean>0.5</buying_size_mean>"
602 " <buying_size_stddev>0.1</buying_size_stddev>";
606 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
608 sim.AddSource(
"spent_fuel").Finalize();
612 cyclus::QueryResult qr = sim.db().Query(
"Resources", NULL);
613 EXPECT_NEAR(0.64083, qr.GetVal<
double>(
"Quantity", 0), 0.00001);
614 EXPECT_NEAR(0.32648, qr.GetVal<
double>(
"Quantity", 1), 0.00001);
619 " <in_commods> <val>spent_fuel</val> </in_commods> "
620 " <out_commods> <val>dry_spent</val> </out_commods> "
621 " <throughput>1</throughput>"
622 " <active_buying_frequency_type>Normal</active_buying_frequency_type>"
623 " <active_buying_mean>3</active_buying_mean>"
624 " <active_buying_stddev>1</active_buying_stddev>"
625 " <dormant_buying_frequency_type>Normal</dormant_buying_frequency_type>"
626 " <dormant_buying_mean>2</dormant_buying_mean>"
627 " <dormant_buying_stddev>1</dormant_buying_stddev>"
628 " <buying_size_type>Normal</buying_size_type>"
629 " <buying_size_mean>0.5</buying_size_mean>"
630 " <buying_size_stddev>0.1</buying_size_stddev>";
634 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
636 sim.AddSource(
"spent_fuel").capacity(5).Finalize();
637 sim.AddSink(
"dry_spent").Finalize();
641 std::vector<cyclus::Cond> conds;
642 conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"spent_fuel")));
643 cyclus::QueryResult qr = sim.db().Query(
"Transactions", &conds);
644 int n_trans = qr.rows.size();
645 EXPECT_EQ(10, n_trans) <<
"expected 10 transactions, got " << n_trans;
648 EXPECT_EQ(0, qr.GetVal<
int>(
"Time", 0));
649 EXPECT_EQ(3, qr.GetVal<
int>(
"Time", 3));
651 EXPECT_EQ(6, qr.GetVal<
int>(
"Time", 4));
652 EXPECT_EQ(7, qr.GetVal<
int>(
"Time", 5));
654 EXPECT_EQ(8, qr.GetVal<
int>(
"Time", 6));
655 EXPECT_EQ(9, qr.GetVal<
int>(
"Time", 7));
657 EXPECT_EQ(13, qr.GetVal<
int>(
"Time", 8));
658 EXPECT_EQ(14, qr.GetVal<
int>(
"Time", 9));
660 qr = sim.db().Query(
"Resources", NULL);
661 EXPECT_NEAR(0.61256, qr.GetVal<
double>(
"Quantity", 0), 0.00001);
662 EXPECT_NEAR(0.62217, qr.GetVal<
double>(
"Quantity", 1), 0.00001);
663 EXPECT_NEAR(0.39705, qr.GetVal<
double>(
"Quantity", 2), 0.00001);
668 std::string config_uniform =
669 " <in_commods> <val>spent_fuel</val> </in_commods> "
670 " <out_commods> <val>dry_spent</val> </out_commods> "
671 " <throughput>1</throughput>"
672 " <active_buying_frequency_type>Uniform</active_buying_frequency_type>";
676 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config_uniform,
678 EXPECT_THROW(sim.Run(), cyclus::ValueError);
683 std::string config_normal =
684 " <in_commods> <val>spent_fuel</val> </in_commods> "
685 " <out_commods> <val>dry_spent</val> </out_commods> "
686 " <throughput>1</throughput>"
687 " <active_buying_frequency_type>Normal</active_buying_frequency_type>";
690 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config_normal,
692 EXPECT_THROW(sim.Run(), cyclus::ValueError);
697 std::string config_uniform_min_bigger_max =
698 " <in_commods> <val>spent_fuel</val> </in_commods> "
699 " <out_commods> <val>dry_spent</val> </out_commods> "
700 " <throughput>1</throughput>"
701 " <active_buying_frequency_type>Uniform</active_buying_frequency_type>"
702 " <active_buying_min>3</active_buying_min>"
703 " <active_buying_max>2</active_buying_max>";
707 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"),
708 config_uniform_min_bigger_max, simdur);
709 EXPECT_THROW(sim.Run(), cyclus::ValueError);
777 " <in_commods> <val>spent_fuel</val> </in_commods> "
778 " <out_commods> <val>dry_spent</val> </out_commods> "
779 " <max_inv_size>5</max_inv_size>"
780 " <reorder_point>2</reorder_point>"
781 " <reorder_quantity>3</reorder_quantity>";
785 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
787 sim.AddSource(
"spent_fuel").capacity(5).Finalize();
788 sim.AddSink(
"dry_spent").Finalize();
792 std::vector<cyclus::Cond> conds;
793 conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"spent_fuel")));
794 cyclus::QueryResult qr = sim.db().Query(
"Transactions", &conds);
795 int n_trans = qr.rows.size();
797 EXPECT_EQ(3, n_trans) <<
"expected 3 transactions, got " << n_trans;
799 EXPECT_EQ(0, qr.GetVal<
int>(
"Time", 0));
800 EXPECT_EQ(2, qr.GetVal<
int>(
"Time", 1));
801 EXPECT_EQ(4, qr.GetVal<
int>(
"Time", 2));
804 qr = sim.db().Query(
"Resources", NULL);
805 EXPECT_EQ(3, qr.GetVal<
double>(
"Quantity", 0));
810 " <in_commods> <val>spent_fuel</val> </in_commods> "
811 " <out_commods> <val>dry_spent</val> </out_commods> "
812 " <max_inv_size>5</max_inv_size>"
813 " <reorder_point>2</reorder_point>";
817 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
819 sim.AddSource(
"spent_fuel").capacity(5).Finalize();
820 sim.AddSink(
"dry_spent").Finalize();
824 std::vector<cyclus::Cond> conds;
825 conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"spent_fuel")));
826 cyclus::QueryResult qr = sim.db().Query(
"Transactions", &conds);
827 int n_trans = qr.rows.size();
828 EXPECT_EQ(3, n_trans) <<
"expected 3 transactions, got " << n_trans;
830 EXPECT_EQ(0, qr.GetVal<
int>(
"Time", 0));
831 EXPECT_EQ(2, qr.GetVal<
int>(
"Time", 1));
832 EXPECT_EQ(4, qr.GetVal<
int>(
"Time", 2));
835 qr = sim.db().Query(
"Resources", NULL);
836 EXPECT_EQ(5, qr.GetVal<
double>(
"Quantity", 0));
841 " <in_commods> <val>spent_fuel</val> </in_commods> "
842 " <out_commods> <val>dry_spent</val> </out_commods> "
843 " <throughput>1</throughput> "
844 " <cumulative_cap>2</cumulative_cap> "
845 " <dormant_buying_frequency_type>Fixed</dormant_buying_frequency_type> "
846 " <dormant_buying_val>2</dormant_buying_val> ";
850 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
852 sim.AddSource(
"spent_fuel").capacity(5).Finalize();
853 sim.AddSink(
"dry_spent").Finalize();
857 std::vector<cyclus::Cond> conds;
858 conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"spent_fuel")));
859 cyclus::QueryResult qr = sim.db().Query(
"Transactions", &conds);
860 int n_trans = qr.rows.size();
861 EXPECT_EQ(5, n_trans) <<
"expected 5 transactions, got " << n_trans;
863 EXPECT_EQ(0, qr.GetVal<
int>(
"Time", 0));
864 EXPECT_EQ(1, qr.GetVal<
int>(
"Time", 1));
865 EXPECT_EQ(4, qr.GetVal<
int>(
"Time", 2));
866 EXPECT_EQ(5, qr.GetVal<
int>(
"Time", 3));
867 EXPECT_EQ(8, qr.GetVal<
int>(
"Time", 4));
870 qr = sim.db().Query(
"Resources", NULL);
871 EXPECT_EQ(1, qr.GetVal<
double>(
"Quantity", 0));
872 EXPECT_EQ(1, qr.GetVal<
double>(
"Quantity", 4));
878 " <in_commods> <val>spent_fuel</val> </in_commods> "
879 " <out_commods> <val>dry_spent</val> </out_commods> "
880 " <package>foo</package>";
884 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
885 sim.context()->AddPackage(
"foo", 1, 2,
"first");
886 cyclus::Package::Ptr p = sim.context()->GetPackage(
"foo");
888 sim.AddSource(
"spent_fuel").capacity(2).Finalize();
889 sim.AddSink(
"dry_spent").Finalize();
893 std::vector<cyclus::Cond> tr_conds;
894 tr_conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"dry_spent")));
895 cyclus::QueryResult qr_trans = sim.db().Query(
"Transactions", &tr_conds);
897 EXPECT_EQ(2, qr_trans.rows.size());
899 EXPECT_EQ(1, qr_trans.GetVal<
int>(
"Time", 0));
900 EXPECT_EQ(2, qr_trans.GetVal<
int>(
"Time", 1));
902 std::vector<cyclus::Cond> res_conds;
903 res_conds.push_back(cyclus::Cond(
"PackageName",
"==", p->name()));
904 cyclus::QueryResult qr_res = sim.db().Query(
"Resources", &res_conds);
906 EXPECT_EQ(qr_res.rows.size(), 2);
907 EXPECT_EQ(qr_res.GetVal<
double>(
"Quantity", 0), 2);
908 EXPECT_EQ(qr_res.GetVal<
double>(
"Quantity", 1), 2);
914 " <in_commods> <val>commodity</val> </in_commods> "
915 " <out_commods> <val>commodity1</val> </out_commods> "
916 " <package>foo</package>";
920 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
921 sim.context()->AddPackage(
"foo", 1, 2,
"equal");
922 cyclus::Package::Ptr p = sim.context()->GetPackage(
"foo");
924 sim.AddSource(
"commodity").capacity(3).Finalize();
925 sim.AddSink(
"commodity1").Finalize();
929 std::vector<cyclus::Cond> tr_conds;
930 tr_conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"commodity1")));
931 cyclus::QueryResult qr_trans = sim.db().Query(
"Transactions", &tr_conds);
934 EXPECT_EQ(4, qr_trans.rows.size());
936 EXPECT_EQ(1, qr_trans.GetVal<
int>(
"Time", 0));
937 EXPECT_EQ(1, qr_trans.GetVal<
int>(
"Time", 1));
938 EXPECT_EQ(2, qr_trans.GetVal<
int>(
"Time", 2));
939 EXPECT_EQ(2, qr_trans.GetVal<
int>(
"Time", 3));
941 std::vector<cyclus::Cond> res_conds;
942 res_conds.push_back(cyclus::Cond(
"PackageName",
"==", p->name()));
943 cyclus::QueryResult qr_res = sim.db().Query(
"Resources", &res_conds);
945 EXPECT_EQ(qr_res.rows.size(), 4);
946 EXPECT_EQ(1.5, qr_res.GetVal<
double>(
"Quantity", 0));
947 EXPECT_EQ(1.5, qr_res.GetVal<
double>(
"Quantity", 1));
948 EXPECT_EQ(1.5, qr_res.GetVal<
double>(
"Quantity", 2));
949 EXPECT_EQ(1.5, qr_res.GetVal<
double>(
"Quantity", 3));
955 " <in_commods> <val>commodity</val> </in_commods> "
956 " <out_commods> <val>commodity1</val> </out_commods> "
957 " <package>foo</package>";
961 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
962 sim.context()->AddPackage(
"foo", 1, 2,
"first");
963 cyclus::Package::Ptr p = sim.context()->GetPackage(
"foo");
965 sim.AddSource(
"commodity").capacity(3).Finalize();
966 sim.AddSink(
"commodity1").Finalize();
970 std::vector<cyclus::Cond> tr_conds;
971 tr_conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"commodity1")));
972 cyclus::QueryResult qr_trans = sim.db().Query(
"Transactions", &tr_conds);
975 EXPECT_EQ(4, qr_trans.rows.size());
977 EXPECT_EQ(1, qr_trans.GetVal<
int>(
"Time", 0));
978 EXPECT_EQ(1, qr_trans.GetVal<
int>(
"Time", 1));
979 EXPECT_EQ(2, qr_trans.GetVal<
int>(
"Time", 2));
980 EXPECT_EQ(2, qr_trans.GetVal<
int>(
"Time", 3));
982 std::vector<cyclus::Cond> res_conds;
983 res_conds.push_back(cyclus::Cond(
"PackageName",
"==", p->name()));
984 cyclus::QueryResult qr_res = sim.db().Query(
"Resources", &res_conds);
986 EXPECT_EQ(qr_res.rows.size(), 4);
990 std::vector<double> pkgd_t0 = {qr_res.GetVal<
double>(
"Quantity", 0),
991 qr_res.GetVal<
double>(
"Quantity", 1)};
992 std::sort(pkgd_t0.begin(), pkgd_t0.end(), std::greater<double>());
993 std::vector<double> exp_t0 = {2, 1};
995 EXPECT_EQ(exp_t0, pkgd_t0);
997 std::vector<double> pkgd_t1 = {qr_res.GetVal<
double>(
"Quantity", 2),
998 qr_res.GetVal<
double>(
"Quantity", 3)};
999 std::sort(pkgd_t1.begin(), pkgd_t1.end(), std::greater<double>());
1000 std::vector<double> exp_t1 = {2, 1};
1002 EXPECT_EQ(exp_t1, pkgd_t1);
1006 std::string config =
1007 " <in_commods> <val>commodity</val> </in_commods> "
1008 " <out_commods> <val>commodity1</val> </out_commods> "
1009 " <throughput>1</throughput> "
1010 " <package>foo</package>";
1014 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
1015 sim.context()->AddPackage(
"foo", 1, 2,
"first");
1016 cyclus::Package::Ptr p = sim.context()->GetPackage(
"foo");
1018 sim.AddSource(
"commodity").capacity(0.5).Finalize();
1019 sim.AddSink(
"commodity1").Finalize();
1023 std::vector<cyclus::Cond> tr_conds;
1024 tr_conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"commodity1")));
1026 cyclus::QueryResult qr_trans = sim.db().Query(
"Transactions", &tr_conds);
1030 EXPECT_EQ(2, qr_trans.rows.size());
1032 EXPECT_EQ(2, qr_trans.GetVal<
int>(
"Time", 0));
1033 EXPECT_EQ(4, qr_trans.GetVal<
int>(
"Time", 1));
1035 std::vector<cyclus::Cond> res_conds;
1036 res_conds.push_back(cyclus::Cond(
"PackageName",
"==", p->name()));
1037 cyclus::QueryResult qr_res = sim.db().Query(
"Resources", &res_conds);
1039 EXPECT_EQ(2, qr_res.rows.size());
1040 EXPECT_EQ(1, qr_res.GetVal<
double>(
"Quantity", 0));
1041 EXPECT_EQ(1, qr_res.GetVal<
double>(
"Quantity", 1));
1045 std::string config =
1046 " <in_commods> <val>commodity</val> </in_commods> "
1047 " <out_commods> <val>commodity1</val> </out_commods> "
1048 " <throughput>3</throughput> "
1049 " <package>foo</package>"
1050 " <transport_unit>bar</transport_unit>";
1054 cyclus::MockSim sim(cyclus::AgentSpec (
":cycamore:Storage"), config, simdur);
1055 sim.context()->AddPackage(
"foo", 1, 1,
"first");
1056 cyclus::Package::Ptr p = sim.context()->GetPackage(
"foo");
1057 sim.context()->AddTransportUnit(
"bar", 2, 2,
"first");
1059 sim.AddSource(
"commodity").Finalize();
1060 sim.AddSink(
"commodity1").Finalize();
1064 std::vector<cyclus::Cond> tr_conds;
1065 tr_conds.push_back(cyclus::Cond(
"Commodity",
"==", std::string(
"commodity1")));
1067 cyclus::QueryResult qr_trans = sim.db().Query(
"Transactions", &tr_conds);
1074 EXPECT_EQ(6, qr_trans.rows.size());
1076 EXPECT_EQ(1, qr_trans.GetVal<
int>(
"Time", 0));
1077 EXPECT_EQ(1, qr_trans.GetVal<
int>(
"Time", 1));
1078 EXPECT_EQ(2, qr_trans.GetVal<
int>(
"Time", 2));
1079 EXPECT_EQ(2, qr_trans.GetVal<
int>(
"Time", 3));
1080 EXPECT_EQ(2, qr_trans.GetVal<
int>(
"Time", 4));
1081 EXPECT_EQ(2, qr_trans.GetVal<
int>(
"Time", 5));
1083 for (
int i = 0; i < qr_trans.rows.size(); i++) {
1084 std::cerr <<
"transaction " << i <<
"is at time " << qr_trans.GetVal<
int>(
"Time", i) << std::endl;
1087 std::vector<cyclus::Cond> res_conds;
1088 res_conds.push_back(cyclus::Cond(
"PackageName",
"==", p->name()));
1089 cyclus::QueryResult qr_res = sim.db().Query(
"Resources", &res_conds);
1091 EXPECT_EQ(6, qr_res.rows.size());
1093 EXPECT_EQ(1, qr_res.GetVal<
double>(
"Quantity", 0));
1094 EXPECT_EQ(1, qr_res.GetVal<
double>(
"Quantity", 5));