-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathoperation.py
More file actions
33 lines (30 loc) · 1.2 KB
/
operation.py
File metadata and controls
33 lines (30 loc) · 1.2 KB
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
"""
operation.py
~~~~~~~~~~~~~
This stores the information of each individual operation in the
production line.
- name improves readability when printing
- machine is the machine in which that operation will be executed
- duration is the amount of time in which the operation will be completed
- job_model is the radiator model that this operation belongs to
- job_id is the job to which this operation belongs
- dependencies is a list containing the operations that this operation
depends on
"""
class Operation:
def __init__(self, name, machine, duration, job_model, job_id):
self.name = name
self.machine = machine
self.duration = duration
self.job_model = job_model
self.job_id = job_id
self.dependencies = []
self.start_time = 0
def __str__(self):
return ("Job ID: " + str(self.job_id) + " Stage: " + str(self.machine)
+ "\t Model: " + str(self.job_model)+ "\t Start time: " + str(format(round(self.start_time,2))) + "\t Duration: " + str(format(round(self.duration,2))))
def print_dependencies(self):
if len(self.dependencies) > 0:
print(str(self) + " depends on ")
for operation in self.dependencies:
print(str(operation))