Commit 3aebce38 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Jérome Perrin

checkForManualOperation introduced to assemble() to update the multOperationTypeList

parent 8caa1475
...@@ -54,11 +54,9 @@ class G: ...@@ -54,11 +54,9 @@ class G:
maxSimTime=0 #the total simulation time maxSimTime=0 #the total simulation time
# flag for printing in console # flag for printing in console
# -----------------------------------------------------------------------
console="" console=""
# data for the trace output in excel # data for the trace output in excel
# -----------------------------------------------------------------------
trace="" #this is written from input. If it is "Yes" then you write to trace, else we do not trace="" #this is written from input. If it is "Yes" then you write to trace, else we do not
traceIndex=0 #index that shows in what row we are traceIndex=0 #index that shows in what row we are
sheetIndex=1 #index that shows in what sheet we are sheetIndex=1 #index that shows in what sheet we are
...@@ -67,26 +65,21 @@ class G: ...@@ -67,26 +65,21 @@ class G:
# variables for excel output # variables for excel output
# -----------------------------------------------------------------------
outputIndex=0 #index that shows in what row we are outputIndex=0 #index that shows in what row we are
sheetIndex=1 #index that shows in what sheet we are sheetIndex=1 #index that shows in what sheet we are
outputFile = xlwt.Workbook() #create excel file outputFile = xlwt.Workbook() #create excel file
outputSheet = outputFile.add_sheet('sheet '+str(sheetIndex), cell_overwrite_ok=True) #create excel sheet outputSheet = outputFile.add_sheet('sheet '+str(sheetIndex), cell_overwrite_ok=True) #create excel sheet
#variables for json output #variables for json output
# -----------------------------------------------------------------------
outputJSON={} outputJSON={}
outputJSONFile=None outputJSONFile=None
numberOfEntities = 0 numberOfEntities = 0
#object that routes the operators in the model #object that routes the operators in the model
#------------------------------------------------------------------------
Router=None Router=None
# -----------------------------------------------------------------------
# define the lists of each object type # define the lists of each object type
# -----------------------------------------------------------------------
SourceList=[] SourceList=[]
MachineList=[] MachineList=[]
ExitList=[] ExitList=[]
...@@ -206,7 +199,6 @@ class SetWipTypeError(Exception): ...@@ -206,7 +199,6 @@ class SetWipTypeError(Exception):
# ======================================================================= # =======================================================================
# method to set-up the entities in the current stations # method to set-up the entities in the current stations
# as Work In Progress # as Work In Progress
# -----------------------------------------
# in this case the current station must be defined! # in this case the current station must be defined!
# otherwise there is no current station but a list of possible stations # otherwise there is no current station but a list of possible stations
# although the entity cannot be in more than one stations # although the entity cannot be in more than one stations
......
...@@ -218,10 +218,8 @@ def createObjectResourcesAndCoreObjects(): ...@@ -218,10 +218,8 @@ def createObjectResourcesAndCoreObjects():
# get the successorList for the 'Frames' # get the successorList for the 'Frames'
coreObject.nextFrameIds=getSuccessorList(element['id'], lambda source, destination, edge_data: edge_data.get('entity') == 'Frame') coreObject.nextFrameIds=getSuccessorList(element['id'], lambda source, destination, edge_data: edge_data.get('entity') == 'Frame')
# -----------------------------------------------------------------------
# loop through all the core objects # loop through all the core objects
# to read predecessors # to read predecessors
# -----------------------------------------------------------------------
for element in G.ObjList: for element in G.ObjList:
#loop through all the nextIds of the object #loop through all the nextIds of the object
for nextId in element.nextIds: for nextId in element.nextIds:
...@@ -244,12 +242,10 @@ def createObjectInterruptions(): ...@@ -244,12 +242,10 @@ def createObjectInterruptions():
#Read the json data #Read the json data
nodes = json_data['nodes'] # read from the dictionary the dicts with key 'nodes' nodes = json_data['nodes'] # read from the dictionary the dicts with key 'nodes'
# -----------------------------------------------------------------------
# loop through all the nodes to # loop through all the nodes to
# search for Event Generator and create them # search for Event Generator and create them
# this is put last, since the EventGenerator # this is put last, since the EventGenerator
# may take other objects as argument # may take other objects as argument
# -----------------------------------------------------------------------
for (element_id, element) in nodes.iteritems(): # use an iterator to go through all the nodes for (element_id, element) in nodes.iteritems(): # use an iterator to go through all the nodes
# the key is the element_id and the second is the # the key is the element_id and the second is the
# element itself # element itself
......
...@@ -202,6 +202,10 @@ class MouldAssembly(MachineJobShop): ...@@ -202,6 +202,10 @@ class MouldAssembly(MachineJobShop):
break break
# create the mould # create the mould
self.createMould(self.mouldToBeCreated) self.createMould(self.mouldToBeCreated)
# check if there is a need for manual processing
self.checkForManualOperation(type='Processing',entity=self.mouldToBeCreated)
# check if there is a need for manual processing
self.checkForManualOperation(type='Setup',entity=self.mouldToBeCreated)
# set the created mould as WIP # set the created mould as WIP
import Globals import Globals
Globals.setWIP([self.mouldToBeCreated]) Globals.setWIP([self.mouldToBeCreated])
...@@ -225,7 +229,6 @@ class MouldAssembly(MachineJobShop): ...@@ -225,7 +229,6 @@ class MouldAssembly(MachineJobShop):
id=component.get('id', 'not found') id=component.get('id', 'not found')
name=component.get('name', 'not found') name=component.get('name', 'not found')
try: try:
# dummy variable that holds the routes of the jobs the route from the JSON file is a sequence of dictionaries # dummy variable that holds the routes of the jobs the route from the JSON file is a sequence of dictionaries
JSONRoute=component.get('route', []) JSONRoute=component.get('route', [])
# variable that holds the argument used in the Job initiation hold None for each entry in the 'route' list # variable that holds the argument used in the Job initiation hold None for each entry in the 'route' list
...@@ -234,27 +237,25 @@ class MouldAssembly(MachineJobShop): ...@@ -234,27 +237,25 @@ class MouldAssembly(MachineJobShop):
firstStep = route.pop(0) firstStep = route.pop(0)
assert (self.id in firstStep.get('stationIdsList',[])),\ assert (self.id in firstStep.get('stationIdsList',[])),\
'the assembler must be in the mould-to-be-created route\' initial step' 'the assembler must be in the mould-to-be-created route\' initial step'
# normal processing operation # normal processing operation
processingTime=firstStep['processingTime'] processingTime=firstStep['processingTime']
processingTime=self.getOperationTime(processingTime)
self.rng=RandomNumberGenerator(self, **processingTime)
self.procTime=self.rng.generateNumber()
# update the activeObject's processing time according to the readings in the mould's route # update the activeObject's processing time according to the readings in the mould's route
processDistType=processingTime.get('distributionType','not found') processDistType=processingTime.get('distributionType','not found')
procTime=float(processingTime.get('mean', 0)) procTime=float(processingTime.get('mean', 0))
processOpType=processingTime.get('operationType','not found') # can be manual/automatic processOpType=processingTime.get('operationType','not found') # can be manual/automatic
processingTime=self.getOperationTime(processingTime)
self.rng=RandomNumberGenerator(self, **processingTime)
self.procTime=self.rng.generateNumber()
# setup operation # setup operation
setupTime=firstStep.get('setupTime',None) setupTime=firstStep.get('setupTime',None)
if setupTime: if setupTime:
setupTime=self.getOperationTime(setupTime)
self.stpRng=RandomNumberGenerator(self, **setupTime)
# update the activeObject's processing time according to the readings in the mould's route # update the activeObject's processing time according to the readings in the mould's route
setupDistType=setupTime.get('distributionType','not found') setupDistType=setupTime.get('distributionType','not found')
setTime=float(setupTime.get('mean', 0)) setTime=float(setupTime.get('mean', 0))
setupOpType=setupTime.get('operationType','not found') # can be manual/automatic setupOpType=setupTime.get('operationType','not found') # can be manual/automatic
setupTime=self.getOperationTime(setupTime)
self.stpRng=RandomNumberGenerator(self, **setupTime)
# update the first step of the route with the activeObjects id as sole element of the stationIdsList # update the first step of the route with the activeObjects id as sole element of the stationIdsList
route.insert(0, {'stationIdsList':[str(self.id)],'processingTime':{'distributionType':str(processDistType),\ route.insert(0, {'stationIdsList':[str(self.id)],'processingTime':{'distributionType':str(processDistType),\
'mean':str(procTime),\ 'mean':str(procTime),\
......
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