Commit 59be9a14 authored by Georgios Dagkakis's avatar Georgios Dagkakis

further corrections in plugins

parent 5246bfae
...@@ -23,33 +23,23 @@ class CapacityStationWIPSpreadsheet(plugin.InputPreparationPlugin): ...@@ -23,33 +23,23 @@ class CapacityStationWIPSpreadsheet(plugin.InputPreparationPlugin):
if node_data['_class']=='dream.simulation.applications.CapacityStations.CapacityStationBuffer.CapacityStationBuffer': if node_data['_class']=='dream.simulation.applications.CapacityStations.CapacityStationBuffer.CapacityStationBuffer':
node_data['wip']=[] node_data['wip']=[]
# get the number of projects # get the number of projects
numberOfProjects=0 numberOfProjects=len([pr for pr in wipData[0] if (pr and not pr=='Operation')])
for col in range(1,len(wipData[0])):
if wipData[0][col]:
numberOfProjects+=1
else:
break
# get the number of operations # get the number of operations
numberOfOperations=0 numberOfOperations=len([op for op in wipData if (op[0] and not op[0]=='Operation')])
for row in range(1,len(wipData)):
if wipData[row][0]:
numberOfOperations+=1
else:
break
# loop through all the columns>0 # loop through all the columns>0
for col in range(1,numberOfProjects+1): for col in range(1,numberOfProjects+1):
projectId=wipData[0][col] projectId=wipData[0][col]
# loop through all the rows>0 # loop through all the rows>0
for row in range(1,numberOfProjects+1): for row in range(1,numberOfOperations+1):
stationId=wipData[row][0] stationId=wipData[row][0]
assert stationId in node.keys(), 'wip spreadsheet has station id that does not exist in production line' assert stationId in node.keys(), 'wip spreadsheet has station id that does not exist in production line'
requiredCapacity=wipData[row][col] requiredCapacity=float(wipData[row][col])
# if the cell has a requiredCapacity>0 create the entity # if the cell has a requiredCapacity>0 create the entity
if requiredCapacity: if requiredCapacity:
buffer=self.getBuffer(data, stationId) capacityBuffer=self.getBuffer(data, stationId)
data['graph']['node'][buffer]['wip'].append({ data['graph']['node'][capacityBuffer]['wip'].append({
"_class": "dream.simulation.applications.CapacityStations.CapacityEntity.CapacityEntity", "_class": "dream.simulation.applications.CapacityStations.CapacityEntity.CapacityEntity",
"requiredCapacity": float(requiredCapacity), "requiredCapacity": requiredCapacity,
"capacityProjectId": projectId, "capacityProjectId": projectId,
"name": projectId+'_'+stationId+'_'+str(requiredCapacity) "name": projectId+'_'+stationId+'_'+str(requiredCapacity)
}) })
......
...@@ -18,6 +18,9 @@ class CreateCapacityStations(plugin.InputPreparationPlugin): ...@@ -18,6 +18,9 @@ class CreateCapacityStations(plugin.InputPreparationPlugin):
_class=node['_class'] _class=node['_class']
if _class=='dream.simulation.applications.CapacityStations.CapacityStation.CapacityStation': if _class=='dream.simulation.applications.CapacityStations.CapacityStation.CapacityStation':
nextCapacityStationBufferId=self.getSuccessor(data,stationId) nextCapacityStationBufferId=self.getSuccessor(data,stationId)
# the nextCapacityStationBufferId should point to the buffer
if nextCapacityStationBufferId:
nextCapacityStationBufferId+='_B'
stationName=node['name'] stationName=node['name']
# create the CapacityStationBuffer # create the CapacityStationBuffer
bufferName=stationName+'_Buffer' bufferName=stationName+'_Buffer'
...@@ -77,4 +80,3 @@ class CreateCapacityStations(plugin.InputPreparationPlugin): ...@@ -77,4 +80,3 @@ class CreateCapacityStations(plugin.InputPreparationPlugin):
if edgeToErase: if edgeToErase:
data['graph']['edge'].pop(edgeToErase,None) data['graph']['edge'].pop(edgeToErase,None)
return successorId return successorId
\ No newline at end of file
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