[docs]@abstractmethoddefdefineRouting(self,predecessorList=[],successorList=[]):""" Method for defining routing. :param predecessorList: List containing the previous Objects :param successorList: List containing the next Objects """pass
[docs]@abstractmethoddefgetRoutingStart(self):""" Returns a list with the starting point of the module, i.e. the first objects. This list can be used as an input for defineRouting. :return: List containing the object(s) of the first stage in the module """pass
[docs]@abstractmethoddefgetRoutingEnd(self):""" Returns a list with the end point of the module, i.e. the last objects. This list can be used as an input for defineRouting. :return: List containing the object(s) of the last stage in the module """pass
[docs]@abstractmethoddefdefineNext(self,successorList=[]):""" Adds the objects in successorList as successor of the last object(s) in the module. :param successorList: list containing the successor(s) """pass
[docs]@abstractmethoddefappendPrevious(self,previous):""" Appends an object to the previous objects of the first object(s) in the module. :param previous: The object to append the previous list of the first object(s) in the module """pass
[docs]@abstractmethoddefgetObjectList(self):""" :return: All objects in the module relevant for simulation. """pass
[docs]@abstractmethoddefgetRoutingTarget(self):""" This method is used for dynamic routing in order to handle CoreObjects and ProductionLineModules differently :return: Returns the actually relevant objects for external routing, e.g. the first stage of the module. """pass
[docs]classSequentialProductionLineModule(AbstractProductionLineModule):""" ProductionLineModule that keeps the components in sequential order. :param routing: List containing the objects for routing in the correct order. Each "stage" of the production line is defined in its own list. Each stage can consist of multiple objects. Example: `routing_list=[[source1], [machine1], [machine2, source2], [assembly], [exit]]` :param properties_and_interruptions: List containing all features belonging to the module. :param name: Name of the module as a string """def__init__(self,routing:list,properties_and_interruptions:list,name=""):self.routing=routingself.properties_and_interruptions=properties_and_interruptionsself.first=self.routing[0]self.last=self.routing[-1]self.isNext=Trueself.isPrevious=Trueself.name=name
[docs]defgenerate_routing_from_list(routing_list:list):""" Takes a list containing the objects for routing and defines the routing in the provided order. :param routing_list: List containing the objects for routing in the correct order. Each "stage" of the production line is defined in its own list. Each stage can consist of multiple objects. Example: `routing_list=[[source1], [machine1], [machine2, source2], [assembly], [exit]]` """print(15*"#")print("Start routing...")foridx,stageinenumerate(routing_list):forobjinstage:try:next_stage=routing_list[idx+1]obj.defineNext(next_stage)print(f"Added Routing for {obj.name}. Successor(s): {[s.nameforsinnext_stage]}")exceptIndexError:continueprint(15*"#")