コード例 #1
0
def create_functional_units_and_actors(sys: UnitSystem) -> List[FunctionalUnit]:
    return [
        InputActor.start(sys.create_input_paper_stack((0, 1))),
        OutputActor.start(sys.create_output_paper_stack((3, 1))),
        ConveyorActor.start(sys.create_conveyor((1, 1))),
        ConveyorActor.start(sys.create_conveyor((2, 1))),
        PlotterActor.start(sys.create_plotter((1, 0), color=Color.Red)),
        PlotterActor.start(sys.create_plotter((2, 0), color=Color.Green)),
        PlotterActor.start(sys.create_plotter((1, 2), color=Color.Yellow)),
        PlotterActor.start(sys.create_plotter((2, 2), color=Color.Blue))]
コード例 #2
0
 def test_setup_1(self):  # check nothing crashes
     sys = UnitSystem()
     supervisor = SupervisorActor.start()
     InputActor.start(sys.create_input_paper_stack((0, 1))),
     OutputActor.start(sys.create_output_paper_stack((3, 1))),
     ConveyorActor.start(sys.create_conveyor((1, 1))),
     ConveyorActor.start(sys.create_conveyor((2, 1))),
     PlotterActor.start(sys.create_plotter((1, 0), color=Color.Red)),
     PlotterActor.start(sys.create_plotter((2, 0), color=Color.Green)),
     PlotterActor.start(sys.create_plotter((1, 3), color=Color.Yellow)),
     PlotterActor.start(sys.create_plotter((2, 3), color=Color.Blue))
     time.sleep(10)
     ActorRegistry().stop_all(block=True)
コード例 #3
0
 def test_setup_2(self):  # smaller setup
     sys = UnitSystem()
     supervisor = SupervisorActor.start()
     InputActor.start(sys.create_input_paper_stack((0, 1))),
     ops = sys.create_output_paper_stack((2, 1))
     OutputActor.start(ops),
     ConveyorActor.start(sys.create_conveyor((1, 1))),
     PlotterActor.start(sys.create_plotter((1, 0), color=Color.Red)),
     PlotterActor.start(sys.create_plotter((1, 2), color=Color.Blue)),
     sheet_orders = [SheetOrder({Color.Red: 1})]
     for order in sheet_orders:
         supervisor.tell(SheetOrderMessage(order))
     SleepyActor.start(20).stop(True)
     for order in sheet_orders:
         self.assertIn(order, ops.received_sheets)
     ActorRegistry().stop_all(block=True)
コード例 #4
0
 def test_take_from(self):
     sys = UnitSystem()
     location = (0, 0)
     plt = sys.create_plotter(location, Color.Red)
     sheet = Sheet()
     plt.sheet = sheet
     plt.plot()
     time.sleep(plt.plot_duration_seconds * 1.5)
     self.assertIn(Color.Red, sheet.plots.keys())
     sheet2 = sys.take_from_unit_at(location, (0, 1))
     self.assertEqual(sheet, sheet2)
コード例 #5
0
 def test_unit_creation(self):
     sys = UnitSystem()
     ips = sys.create_input_paper_stack((0, 0))
     self.assertIsNotNone(ips)
     self.assertEqual(sys, ips.unit_sytem)
     ops = sys.create_output_paper_stack((0, 0))
     self.assertIsNotNone(ops)
     self.assertEqual(sys, ops.unit_sytem)
     plt = sys.create_plotter((0, 0), Color.Red)
     self.assertIsNotNone(plt)
     self.assertEqual(sys, plt.unit_sytem)
     con = sys.create_conveyor((0, 0))
     self.assertIsNotNone(con)