Commit 26e6122b authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

cleanup in code

parent 618c5ba1
...@@ -42,10 +42,23 @@ class CapacityStationBuffer(Queue): ...@@ -42,10 +42,23 @@ class CapacityStationBuffer(Queue):
self.requireFullProject=requireFullProject # flag that shows if here the whole project is assembled self.requireFullProject=requireFullProject # flag that shows if here the whole project is assembled
from dream.simulation.Globals import G from dream.simulation.Globals import G
G.CapacityStationBufferList.append(self) G.CapacityStationBufferList.append(self)
self.notRequiredOperations=notRequiredOperations self.notRequiredOperations=notRequiredOperations # operations that are not required to be assembled
def initialize(self): def initialize(self):
Queue.initialize(self) Queue.initialize(self)
import dream.simulation.Globals as Globals
# identify the notRequiredOperations
# input gives only stationId, buffer and exit should be identified
notRequiredOperations=[]
for id in self.notRequiredOperations:
station=Globals.findObjectById(id)
notRequiredOperations.append(station.id)
bufferId=station.previous[0].id
notRequiredOperations.append(bufferId)
exitId=station.next[0].id
notRequiredOperations.append(exitId)
self.notRequiredOperations=notRequiredOperations
self.isLocked=True self.isLocked=True
def canAccept(self, callerObject=None): def canAccept(self, callerObject=None):
......
...@@ -460,24 +460,12 @@ class CapacityStationController(EventGenerator): ...@@ -460,24 +460,12 @@ class CapacityStationController(EventGenerator):
# checks if the given project is all in the buffer # checks if the given project is all in the buffer
def checkIfProjectAssembledInBuffer(self, project, buffer): def checkIfProjectAssembledInBuffer(self, project, buffer):
import dream.simulation.Globals as Globals
# find the ids that are in the notRequiredOperations
notRequiredList=[]
if buffer.notRequiredOperations:
for id in buffer.notRequiredOperations:
station=Globals.findObjectById(id)
notRequiredList.append(station.id)
bufferId=station.previous[0].id
notRequiredList.append(bufferId)
exitId=station.next[0].id
notRequiredList.append(exitId)
# loop through all the stations of the system
for object in G.CapacityStationList+G.CapacityStationBufferList+G.CapacityStationExitList: for object in G.CapacityStationList+G.CapacityStationBufferList+G.CapacityStationExitList:
# skip the given buffer # skip the given buffer
if object is buffer: if object is buffer:
continue continue
# skip not required operations # skip not required operations
if object.id in notRequiredList: if object.id in buffer.notRequiredOperations:
continue continue
# if there is one entity from the same project which we check somewhere else return false # if there is one entity from the same project which we check somewhere else return false
for entity in object.getActiveObjectQueue(): for entity in object.getActiveObjectQueue():
......
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