-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflowitem.py
118 lines (99 loc) · 5.19 KB
/
flowitem.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
"""
Project: ProcessSim
Made By: Arno Kasper
Version: 1.0.0
"""
class Order(object):
# __ Set all params related to an instance of an process (order)
def __init__(self, simulation):
"""
object having all attributes of the an flow item
:param simulation: simulation object stored in simulation_model.py
:return: void
"""
# Set up individual parameters for each order ------------------------------------------------------------------
self.sim = simulation
self.customized_control = self.sim.model_panel.CUSTOM_CONTROL
# CEM params
self.entry_time = 0
# pool params
self.release = False
self.first_entry = True
self.release_time = 0
self.pool_time = 0
# rotting sequence params
if self.sim.model_panel.WC_AND_FLOW_CONFIGURATION == "GFS" or \
self.sim.model_panel.WC_AND_FLOW_CONFIGURATION == "RJS":
self.routing_sequence = self.sim.random_generator.sample(
self.sim.model_panel.MANUFACTURING_FLOOR_LAYOUT,
self.sim.random_generator.randint(1, len(self.sim.model_panel.MANUFACTURING_FLOOR_LAYOUT)))
# Sort the routing if necessary
if self.sim.model_panel.WC_AND_FLOW_CONFIGURATION == "GFS":
self.routing_sequence.sort() # GFS or PFS require sorted list of stations
elif self.sim.model_panel.WC_AND_FLOW_CONFIGURATION == "PFS":
self.routing_sequence = self.sim.model_panel.MANUFACTURING_FLOOR_LAYOUT.copy()
elif self.sim.model_panel.WC_AND_FLOW_CONFIGURATION == "PJS":
self.routing_sequence = \
self.sim.random_generator.shuffle(self.sim.model_panel.MANUFACTURING_FLOOR_LAYOUT)
else:
raise Exception("Please indicate an allowed the work centre and flow configuration")
# Make a variable independent from routing sequence to allow for queue switching
self.routing_sequence_data = self.routing_sequence[:]
# Make libary variables according to routing_sequence ----------------------------------------------------------
# process time
self.process_time = {}
self.process_time_cumulative = 0
# priority
self.dispatching_priority = {}
# data collection variables
self.queue_entry_time = {}
self.proc_finished_time = {}
self.queue_time = {}
self.order_start_time = {}
self.machine_route = {} # tracks which machine was used
for WC in self.routing_sequence:
# Type of process time distribution
if self.sim.model_panel.PROCESS_TIME_DISTRIBUTION == "2_erlang":
self.process_time[WC] = self.sim.general_functions.two_erlang_truncated()
elif self.sim.model_panel.PROCESS_TIME_DISTRIBUTION == "lognormal":
self.process_time[WC] = self.sim.general_functions.log_normal_truncated()
elif self.sim.model_panel.PROCESS_TIME_DISTRIBUTION == "constant":
self.process_time[WC] = self.sim.model_panel.MEAN_PROCESS_TIME
else:
raise Exception("Please indicate a allowed process time distribution")
# calculate cum
self.process_time_cumulative += self.process_time[WC]
self.dispatching_priority[WC] = 0
# data collection variables
self.queue_entry_time[WC] = 0
self.proc_finished_time[WC] = 0
self.queue_time[WC] = 0
self.order_start_time[WC] = 0
self.machine_route[WC] = "NOT_PASSED"
# Due Date -----------------------------------------------------------------------------------------------------
self.due_date = None
if self.customized_control:
self.due_date =self.sim.customized_settings.due_date(order=self)
if self.due_date is None:
if self.sim.policy_panel.due_date_method == "random":
self.due_date = self.sim.general_functions.random_value_DD()
elif self.sim.policy_panel.due_date_method == "factor_k":
self.due_date = self.sim.general_functions.factor_K_DD(order=self)
elif self.sim.policy_panel.due_date_method == "constant":
self.due_date = self.sim.general_functions.add_contant_DD(order=self)
elif self.sim.policy_panel.due_date_method == "total_work_content":
self.due_date = self.sim.general_functions.total_work_content(order=self)
else:
raise Exception("Please indicate a allowed due date procedure")
self.PRD = self.due_date - (len(self.routing_sequence) * self.sim.policy_panel.PRD_k)
self.ODDs = {}
if self.sim.policy_panel.dispatching_rule == "ODD_k":
for WC in self.routing_sequence:
self.ODDs[WC] = self.due_date - (
(len(self.routing_sequence) - (self.routing_sequence.index(WC) + 1)) * self.sim.policy_panel.ODD_k)
# Other order parameters ---------------------------------------------------------------------------------------
# data collection
self.finishing_time = 0
# Other
self.continuous_trigger = False
return