コード例 #1
0
ファイル: Test.py プロジェクト: Torla/IdeaSim
 def __init__(self, sim, position, capacity):
     Performer.__init__(self, sim)
     Movable.__init__(self, position, sim)
     self.full = Container(sim, capacity)
     Event(sim, sim.now + 1000, "empty_tank" + str(self.id))
     self.sim.manager.add_mapping("empty_tank" + str(self.id),
                                  self.empty_tank)
     self.add_mapping("empty", self.__do_empty__)
コード例 #2
0
 def get_from_bay(self, action, sim, taken_inf):
     self.content = action.param["item"]
     if not isinstance(self.content, Item.Item):
         raise Performer.IllegalAction("Satellite pickup non Item from bay")
     self.util += self.TIME_TO_PICKUP_FROM_BAY
     yield self.env.timeout(self.TIME_TO_PICKUP_FROM_BAY)
     return
コード例 #3
0
 def drop_to_bay(self, action, sim, taken_inf):
     if self.content is None:
         raise Performer.IllegalAction("Satellite drop None Item to bay")
     self.content = None
     self.util += self.TIME_TO_DROP_TO_BAY
     yield self.env.timeout(self.TIME_TO_DROP_TO_BAY)
     return
コード例 #4
0
ファイル: Shuttle.py プロジェクト: Torla/Warehouse_opt
    def __init__(self, env, position, acc, max_v, par):
        MovableResource.__init__(self, env, position, acc, max_v, par)
        Performer.__init__(self, env)
        self.position = position
        self.env = env
        self.position = position
        self.TIME_TO_DROP = 10
        self.TIME_TO_PICKUP = 10
        self.weight = par.Wsh
        if par.tech == 0:
            self.weight = par.Wli * 10
        self.add_mapping(ActionType.MOVE, self.move_shuttle)
        self.add_mapping(ActionType.PICKUP, self.pickup)
        self.add_mapping(ActionType.DROP, self.drop)

        self.monitor = self.sim.get_status().monitor
        self.util = 0
コード例 #5
0
 def pickup(self, action, sim, taken_inf):
     assert (isinstance(sim, Simulation))
     if self.content is not None:
         raise Performer.IllegalAction("Lift full before pickup")
     if "shuttle" in action.param:
         self.content = list(
             filter(lambda x: x.id == action.param["shuttle"],
                    taken_inf))[0]
     elif "auto" in action.param:
         self.content = list(
             filter(lambda x: isinstance(x, Shuttle), taken_inf))[0]
     if self.content is None:
         raise Performer.IllegalAction("Lift getting None item")
     sim.logger.log(str(self.content), 15)
     yield self.env.timeout(self.TIME_TO_PICKUP)
     self.util_proc += self.TIME_TO_PICKUP
     return
コード例 #6
0
    def __init__(self, env, position, acc, max_v, par):
        MovableResource.__init__(self, env, position, acc, max_v, par)
        Performer.__init__(self, env)
        self.position = position
        self.env = env
        self.TIME_TO_DROP = 10
        self.TIME_TO_PICKUP = 10
        self.weight = par.Wli
        self.add_mapping(ActionType.MOVE, self.move_lift)
        self.add_mapping(ActionType.PICKUP, self.pickup)
        self.add_mapping(ActionType.DROP, self.drop)
        self.monitor = self.sim.get_status().monitor
        self.util_proc = 0
        # for cycle time
        self.cycle_start = 0
        self.cycle_start_energy = 0
        self.last_op = None

        self.bay_level = None
コード例 #7
0
 def pickup(self, action, sim, taken_inf):
     assert (isinstance(sim, Simulation))
     self.content = list(
         filter(lambda x: x.id == action.param["channel_id"],
                taken_inf))[0].items.pop()
     if not isinstance(self.content, Item.Item):
         raise Performer.IllegalAction("Satellite pickup non Item")
     self.util += self.TIME_TO_PICKUP_FROM_CHANNEL
     yield self.env.timeout(self.TIME_TO_PICKUP_FROM_CHANNEL)
     return
コード例 #8
0
    def __init__(self, env, position, acc, max_v, par):
        MovableResource.__init__(self, env, position, acc, max_v, par)
        Performer.__init__(self, env)
        self.env = env
        self.position = position
        self.position = position
        self.TIME_TO_DROP_TO_CHANNEL = 10
        self.TIME_TO_PICKUP_FROM_CHANNEL = 10
        self.TIME_TO_DROP_TO_BAY = 10
        self.TIME_TO_PICKUP_FROM_BAY = 10
        self.weight = par.Wsa
        self.add_mapping(ActionType.MOVE, self.move_satellite)
        self.add_mapping(ActionType.PICKUP, self.pickup)
        self.add_mapping(ActionType.DROP, self.drop)
        self.add_mapping(ActionType.DROP_TO_BAY, self.drop_to_bay)
        self.add_mapping(ActionType.GET_FROM_BAY, self.get_from_bay)

        self.monitor = self.sim.get_status().monitor
        self.util = 0
コード例 #9
0
 def drop(self, action, sim, taken_inf):
     assert (isinstance(sim, Simulation))
     yield list(
         filter(lambda x: x.id == action.param["channel_id"],
                taken_inf))[0].put(self.content)
     if self.content is None:
         raise Performer.IllegalAction(
             "Satellite drop None Item to channel")
     self.content = None
     self.util += self.TIME_TO_DROP_TO_CHANNEL
     yield self.env.timeout(self.TIME_TO_DROP_TO_CHANNEL)
     return
コード例 #10
0
 def drop(self, action, sim, taken_inf):
     assert (isinstance(sim, Simulation))
     if self.content is None:
         self.content = None
         return
     if not isinstance(self.content, Shuttle):
         raise Performer.IllegalAction("Lift drop not shuttle")
     if self.content is None:
         self.content = None
     self.content.position.level = self.position.level
     self.content.position.x = 0
     sim.logger.log(str(self.content), 15)
     self.content = None
     yield self.env.timeout(self.TIME_TO_DROP)
     self.util_proc += self.TIME_TO_DROP
     return
コード例 #11
0
ファイル: Test.py プロジェクト: Torla/IdeaSim
 def __init__(self, sim, position):
     Performer.__init__(self, sim)
     Movable.__init__(self, position, sim)
     self.add_mapping("take", self.take)
     self.add_mapping("drop", self.drop)
     Event(sim, 10 + len(sim.all_res), "haul")