def __init__(self, my_type, my_buffers, mean_st, st_file_name, *args, **kwargs): super(Workstation, self).__init__(*args, **kwargs) self.buffers = my_buffers self.type = my_type self.mean_st = mean_st self.isMakingProduct = False self.logger = logging.getLogger(__name__) self.monitor = Monitor.get_instance() if self.monitor.use_common_service_times: self.common_service_times = open(st_file_name).read().splitlines() self.st_counter = 0 self.logger.info("Initialized monitor %s in workstation.", self.monitor) self.service_times = []
def __init__(self, known_workstations, known_inspectors, *args, **kwargs): super(Sampler, self).__init__(*args, **kwargs) self.workstations = known_workstations self.inspectors = known_inspectors self.logger = logging.getLogger(__name__) self.monitor = Monitor.get_instance() self.logger.info("Initialized monitor %s in sampler.", self.monitor) self.num_components_in_queue_samples = { Type.ONE: { # Workstation type Type.ONE: [] # Queue / component type }, Type.TWO: { Type.ONE: [], Type.TWO: [] }, Type.THREE: { Type.ONE: [], Type.THREE: [] }, }
def __init__(self, known_workstations, seed, my_types, mean_st_components, st_file_names, round_robin, *args, **kwargs): super(Inspector, self).__init__(*args, **kwargs) self.types = my_types random.seed(seed) self.workstations = known_workstations self.round_robin_index = 0 self.mean_st_components = mean_st_components self.round_robin = round_robin self.is_working = True self.component = None self.logger = logging.getLogger(__name__) self.monitor = Monitor.get_instance() self.service_times = [] if self.monitor.use_common_service_times: self.common_service_times = {} self.st_counters = {} for typ in my_types: self.common_service_times[typ] = open( st_file_names[typ]).read().splitlines() self.st_counters[typ] = 0 self.logger.info("Initialized monitor %s in inspector.", self.monitor)