Commit 3b91572e authored by Georgios Dagkakis's avatar Georgios Dagkakis

Merge branch 'CapacityStationPlugins' into renderjsie_merged

parents a25184c1 621ee478
from copy import copy
import json
import time
import random
import operator
import datetime
from dream.plugins import plugin
class AvailableCapacitySpreadsheet(plugin.InputPreparationPlugin):
""" Input prepration
read capacity data and update the capacity property of the stations.
"""
def preprocess(self, data):
strptime = datetime.datetime.strptime
capacityData=data['input'].get('available_capacity_spreadsheet', None)
node=data['graph']['node']
now = strptime(data['general']['currentDate'], '%Y/%m/%d')
if capacityData:
numberOfStations=len(capacityData[0])-1
numberOfExceptions=len(capacityData)
# loop through stations
for col in range(numberOfStations):
stationId=capacityData[0][col+1]
assert stationId in data['graph']['node'].keys(), 'available capacity spreadsheet has station id that does not exist in production line'
# for every station read the interval capacity (Monday to Sunday)
intervalCapacity=[]
for row in range(7):
intervalCapacity.append(float(capacityData[row+1][col+1]))
node[stationId]['intervalCapacity']=intervalCapacity
# for every station read the interval capacity exceptions
for row in range(8,len(capacityData)):
if not capacityData[row][0]:
break
exeptionDate=strptime(capacityData[row][0], '%Y/%m/%d')
dayDifference=(exeptionDate-now).days
assert dayDifference>=0, 'exception date for past day given'
intervalCapacityExceptions=node[stationId].get('intervalCapacityExceptions',{})
if not intervalCapacityExceptions:
node[stationId]['intervalCapacityExceptions']={}
node[stationId]['intervalCapacityExceptions'][str(float(dayDifference))]=float(capacityData[row][col+1])
# set the interval capacity start
node[stationId]['intervalCapacityStart']=now.weekday()
return data
\ No newline at end of file
from copy import copy
import json
import time
import random
import operator
import datetime
from dream.plugins import plugin
class CapacityProjectSpreadsheet(plugin.InputPreparationPlugin):
""" Input prepration
read the capacity projects from the spreadsheet
"""
def preprocess(self, data):
strptime = datetime.datetime.strptime
projectData=data['input'].get('projects_spreadsheet', None)
data['input']['BOM']={} # Put the projects in BOM. Discuss this!
node=data['graph']['node']
now = strptime(data['general']['currentDate'], '%Y/%m/%d')
if projectData:
for row in range(1, len(projectData)):
if projectData[row][0]:
projectId=projectData[row][0]
orderDate=strptime(projectData[row][1], '%Y/%m/%d')
orderDate=(orderDate-now).days
try:
dueDate=strptime(projectData[row][2], '%Y/%m/%d')
dueDate=(dueDate-now).days
# if no due date is given set it to 180 (about 6 months)
except ValueError:
dueDate=180
assemblySpaceRequirement=float(projectData[row][3])
capacityRequirementDict={}
earliestStartDict={}
# get the number of operations of the project
numberOfOperations=1
i=1
while not projectData[row+i][0]:
# if a completely empty line is found break
if all(v is None for v in projectData[row+i]):
break
numberOfOperations+=1
i+=1
# for every operation get capacityRequirementDict and earliestStartDict
for stationRecord in range(numberOfOperations):
stationId=projectData[row+stationRecord][4]
requiredCapacity=projectData[row+stationRecord][5]
earliestStart=projectData[row+stationRecord][6]
capacityRequirementDict[stationId]=float(requiredCapacity)
if earliestStart:
earliestStart=strptime(earliestStart, '%Y/%m/%d')
earliestStartDict[stationId]=(earliestStart-now).days
# define the order in BOM
data['input']['BOM'][projectId]={
'orderDate':orderDate,
'dueDate':dueDate,
'assemblySpaceRequirement':assemblySpaceRequirement,
'capacityRequirementDict':capacityRequirementDict,
'earliestStartDict':earliestStartDict
}
print data['input']['BOM']
return data
\ No newline at end of file
...@@ -54,11 +54,11 @@ class PluginRegistry(object): ...@@ -54,11 +54,11 @@ class PluginRegistry(object):
def __init__(self, logger, data): def __init__(self, logger, data):
self.input_preparation_list = [] self.input_preparation_list = []
for plugin_data in data['application_configuration']['pre_processing_plugin_list']: for plugin_data in data['application_configuration']['pre_processing']['plugin_list']:
self.input_preparation_list.append(resolve(plugin_data['_class'])(logger, plugin_data)) self.input_preparation_list.append(resolve(plugin_data['_class'])(logger, plugin_data))
self.output_preparation_list = [] self.output_preparation_list = []
for plugin_data in data['application_configuration']['post_processing_plugin_list']: for plugin_data in data['application_configuration']['post_processing']['plugin_list']:
self.output_preparation_list.append(resolve(plugin_data['_class'])(logger, plugin_data)) self.output_preparation_list.append(resolve(plugin_data['_class'])(logger, plugin_data))
plugin_data = data['application_configuration']['processing_plugin'] plugin_data = data['application_configuration']['processing_plugin']
......
...@@ -261,8 +261,13 @@ ...@@ -261,8 +261,13 @@
"type": "object_view" "type": "object_view"
} }
}, },
"post_processing_plugin_list": [], "post_processing": {
"pre_processing_plugin_list": [ "description" : "",
"plugin_list" : []
},
"pre_processing": {
"description" : "",
"plugin_list" : [
{ {
"_class": "dream.plugins.GatherWIPStat.GatherWIPStat", "_class": "dream.plugins.GatherWIPStat.GatherWIPStat",
"input_id": "WIPStat" "input_id": "WIPStat"
...@@ -283,8 +288,10 @@ ...@@ -283,8 +288,10 @@
"_class": "dream.plugins.ReadShiftFromSpreadsheet.ReadShiftFromSpreadsheet", "_class": "dream.plugins.ReadShiftFromSpreadsheet.ReadShiftFromSpreadsheet",
"input_id": "ShiftSpreadsheet" "input_id": "ShiftSpreadsheet"
} }
], ]
},
"processing_plugin": { "processing_plugin": {
"description" : "",
"_class": "dream.plugins.plugin.DefaultExecutionPlugin" "_class": "dream.plugins.plugin.DefaultExecutionPlugin"
} }
}, },
......
This diff is collapsed.
...@@ -314,25 +314,14 @@ ...@@ -314,25 +314,14 @@
] ]
}, },
"_operationType": { "_operationType": {
"_class": "Dream.PropertyList",
"name": "Operation type",
"id": "operationType",
"description": "the type of operations that are performed manually in the machine", "description": "the type of operations that are performed manually in the machine",
"properties": { "default": "Automatic",
"operationType": {
"type": "string", "type": "string",
"enum": [ "enum" : [
"Load", "Automatic",
"Setup", "Manual"
"Processing",
"MT-Load",
"MT-Load-Setup",
"MT-Load-Setup-Processing",
"MT-Setup-Processing"
] ]
} }
}
}
}, },
"edge": { "edge": {
"description": "Base definition for edge", "description": "Base definition for edge",
...@@ -479,6 +468,34 @@ ...@@ -479,6 +468,34 @@
"default": "M", "default": "M",
"required": true "required": true
}, },
"operationType": {
"description": "Type Of Operation",
"name" : "Operation Type",
"type": "object",
"properties" : {
"load": {
"description": "Operation type for loading",
"$ref": "#/definitions/_operationType"
},
"setup": {
"description": "Operation type for setup",
"$ref": "#/definitions/_operationType",
},
"processing": {
"description": "Operation type for processing",
"$ref": "#/definitions/_operationType",
}
}
"required" : ["load", "setup", "processing"]
},
"loadTime": {
"$ref": "#/definitions/_dist",
"required": true
},
"setupTime": {
"$ref": "#/definitions/_dist",
"required": true
},
"processingTime": { "processingTime": {
"$ref": "#/definitions/_dist", "$ref": "#/definitions/_dist",
"required": true "required": true
...@@ -772,27 +789,26 @@ ...@@ -772,27 +789,26 @@
} }
} }
}, },
"preprocessing": { "pre_processing": {
"description" : "",
"plugin_list": [ "plugin_list": [
{ {
"plugin": "GatherWIPStat.GatherWIPStat", "_class": "dream.plugins.GatherWIPStat.GatherWIPStat",
"input_id": "WIPStat" "input_id": "WIPStat"
}, },
{ {
"plugin": "WIPSpreadsheet.WIPSpreadsheet", "_class": "dream.plugins.WIPSpreadsheet.WIPSpreadsheet",
"input_id": "WIPdata" "input_id": "WIPdata"
} }
] ]
}, },
"processing": { "processing_plugin": {
"plugin_list": [ "description" : "",
{ "_class": "dream.plugins.plugin.DefaultExecutionPlugin",
"plugin": "plugin.DefaultExecutionPlugin",
"input_id": "Simulation" "input_id": "Simulation"
}
]
}, },
"postprocessing": { "post_processing": {
"description" : "",
"plugin_list": [] "plugin_list": []
}, },
"general": { "general": {
......
...@@ -838,25 +838,32 @@ ...@@ -838,25 +838,32 @@
} }
} }
}, },
"preprocessing" : { "pre_processing" : {
"description" : "",
"plugin_list" : [{ "plugin_list" : [{
"plugin" : "PartJobShop", "_class" : "dream.plugins.PartJobShop.PartJobShop",
"input_id" : "Simulation" "input_id" : "Simulation"
}, { }, {
"plugin" : "ReadShiftFromSpreadsheet", "_class" : "dream.plugins.ReadShiftFromSpreadsheet.ReadShiftFromSpreadsheet",
"input_id" : "ShiftSpreadsheet" "input_id" : "ShiftSpreadsheet"
}, { }, {
"plugin" : "ReadWipFromSpreadsheet", "_class" : "dream.plugins.ReadWipFromSpreadsheet.ReadWipFromSpreadsheet",
"input_id" : "WipSpreadsheet" "input_id" : "WipSpreadsheet"
}, { }, {
"plugin" : "ReadRouteFromSpreadsheet", "_class" : "dream.plugins.ReadRouteFromSpreadsheet.ReadRouteFromSpreadsheet",
"input_id" : "RouteSpreadsheet" "input_id" : "RouteSpreadsheet"
} }
] ]
}, },
"postprocessing" : { "processing_plugin" : {
"description" : "",
"_class" : "",
"input_id" : ""
}
"post_processing" : {
"description" : "",
"plugin_list" : [{ "plugin_list" : [{
"plugin" : "CalculateConfidenceIntervals" "_class" : "dream.plugins.CalculateConfidenceIntervals.CalculateConfidenceIntervals"
}] }]
}, },
"general" : { "general" : {
......
...@@ -810,7 +810,9 @@ ...@@ -810,7 +810,9 @@
} }
} }
}, },
"pre_processing_plugin_list": [ "pre_processing": {
"description" : "",
"_plugin_list": [
{ {
"_class": "dream.plugins.Debug.Debug", "_class": "dream.plugins.Debug.Debug",
"argument": "Argument Value" "argument": "Argument Value"
...@@ -819,11 +821,16 @@ ...@@ -819,11 +821,16 @@
"_class": "dream.plugins.OldStylePartJobShopWIP.OldStylePartJobShopWIP", "_class": "dream.plugins.OldStylePartJobShopWIP.OldStylePartJobShopWIP",
"input_id": "old_style_part_jobshop_spreadsheet" "input_id": "old_style_part_jobshop_spreadsheet"
} }
], ]
},
"processing_plugin": { "processing_plugin": {
"description": "",
"_class": "dream.plugins.ACO.ACO" "_class": "dream.plugins.ACO.ACO"
}, },
"post_processing_plugin_list": [], "post_processing": {
"description": "",
"plugin_list": []
},
"general": { "general": {
"properties": { "properties": {
"numberOfReplications": { "numberOfReplications": {
......
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