Commit 236e141f authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Sebastien Robin

in-line comments added to Job.py

parent 5e38cf4a
......@@ -29,36 +29,43 @@ in the system and also in the processing times at each station
from Globals import G
from Entity import Entity
#The part object
class Job(Entity):
# ============================ The part object ==============================
class Job(Entity): # inherits from the Entity class
type="Job"
def __init__(self, id, name, route=[], priority=0, dueDate=0, orderDate=0):
Entity.__init__(self, name, priority=priority, dueDate=dueDate, orderDate=orderDate)
self.id=id
self.route=route #the route that the job follows, also contains the processing times in each station
self.remainingRoute=route #the remaining route. in the beginning this should be the same as the full route
self.schedule=[] #keeps the result of the simulation. A list with the stations and time of entrance
# instance specific attributes
self.id=id # id
# information on the routing and the stops of the entity
self.route=route # the route that the job follows,
# also contains the processing times in each station
self.remainingRoute=route # the remaining route. in the beginning
# this should be the same as the full route
# the scheduling of the entity as resolved by the simulation
self.schedule=[] # keeps the result of the simulation.
# A list with the stations and time of entrance
#outputs results to JSON File
#==================== outputs results to JSON File ======================
def outputResultsJSON(self):
from Globals import G
if(G.numberOfReplications==1): #if we had just one replication output the results to excel
json={}
json={} # dictionary holding information related to the specific entity
json['_class'] = 'Dream.Job';
json['id'] = str(self.id)
json['results'] = {}
json['results']['schedule']={}
i=0
for record in self.schedule:
json['results']['schedule'][str(i)]={}
json['results']['schedule'][str(i)]['stationId']=record[0]
json['results']['schedule'][str(i)]['entranceTime']=record[1]
json['results']['schedule'][str(i)]={} # dictionary holding time and
json['results']['schedule'][str(i)]['stationId']=record[0] # id of the Object
json['results']['schedule'][str(i)]['entranceTime']=record[1] # time entering the Object
i+=1
G.outputJSON['elementList'].append(json)
#initializes all the Entity for a new simulation replication
# ==== initializes all the Entity for a new simulation replication ======
def initialize(self):
# has to be re-initialized each time a new Job is added
self.remainingRoute=self.route
self.currentStation=self.route[0][0]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment