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):
def __init__(self, logger, data):
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.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))
plugin_data = data['application_configuration']['processing_plugin']
......
......@@ -261,30 +261,37 @@
"type": "object_view"
}
},
"post_processing_plugin_list": [],
"pre_processing_plugin_list": [
{
"_class": "dream.plugins.GatherWIPStat.GatherWIPStat",
"input_id": "WIPStat"
},
{
"_class": "dream.plugins.ReadEntryData.ReadEntryData",
"input_id": "EntryData"
},
{
"_class": "dream.plugins.BatchesWIPSpreadsheet.BatchesWIPSpreadsheet",
"input_id": "WipSpreadsheet"
},
{
"_class": "dream.plugins.ReadSkilledOperators.ReadSkilledOperators",
"input_id": "SkilledOperatorsSpreadsheet"
},
{
"_class": "dream.plugins.ReadShiftFromSpreadsheet.ReadShiftFromSpreadsheet",
"input_id": "ShiftSpreadsheet"
}
],
"post_processing": {
"description" : "",
"plugin_list" : []
},
"pre_processing": {
"description" : "",
"plugin_list" : [
{
"_class": "dream.plugins.GatherWIPStat.GatherWIPStat",
"input_id": "WIPStat"
},
{
"_class": "dream.plugins.ReadEntryData.ReadEntryData",
"input_id": "EntryData"
},
{
"_class": "dream.plugins.BatchesWIPSpreadsheet.BatchesWIPSpreadsheet",
"input_id": "WipSpreadsheet"
},
{
"_class": "dream.plugins.ReadSkilledOperators.ReadSkilledOperators",
"input_id": "SkilledOperatorsSpreadsheet"
},
{
"_class": "dream.plugins.ReadShiftFromSpreadsheet.ReadShiftFromSpreadsheet",
"input_id": "ShiftSpreadsheet"
}
]
},
"processing_plugin": {
"description" : "",
"_class": "dream.plugins.plugin.DefaultExecutionPlugin"
}
},
......
This diff is collapsed.
......@@ -314,24 +314,13 @@
]
},
"_operationType": {
"_class": "Dream.PropertyList",
"name": "Operation type",
"id": "operationType",
"description": "the type of operations that are performed manually in the machine",
"properties": {
"operationType": {
"type": "string",
"enum": [
"Load",
"Setup",
"Processing",
"MT-Load",
"MT-Load-Setup",
"MT-Load-Setup-Processing",
"MT-Setup-Processing"
]
}
}
"default": "Automatic",
"type": "string",
"enum" : [
"Automatic",
"Manual"
]
}
},
"edge": {
......@@ -479,6 +468,34 @@
"default": "M",
"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": {
"$ref": "#/definitions/_dist",
"required": true
......@@ -772,27 +789,26 @@
}
}
},
"preprocessing": {
"pre_processing": {
"description" : "",
"plugin_list": [
{
"plugin": "GatherWIPStat.GatherWIPStat",
"_class": "dream.plugins.GatherWIPStat.GatherWIPStat",
"input_id": "WIPStat"
},
{
"plugin": "WIPSpreadsheet.WIPSpreadsheet",
"_class": "dream.plugins.WIPSpreadsheet.WIPSpreadsheet",
"input_id": "WIPdata"
}
]
},
"processing": {
"plugin_list": [
{
"plugin": "plugin.DefaultExecutionPlugin",
"input_id": "Simulation"
}
]
"processing_plugin": {
"description" : "",
"_class": "dream.plugins.plugin.DefaultExecutionPlugin",
"input_id": "Simulation"
},
"postprocessing": {
"post_processing": {
"description" : "",
"plugin_list": []
},
"general": {
......
......@@ -838,25 +838,32 @@
}
}
},
"preprocessing" : {
"pre_processing" : {
"description" : "",
"plugin_list" : [{
"plugin" : "PartJobShop",
"_class" : "dream.plugins.PartJobShop.PartJobShop",
"input_id" : "Simulation"
}, {
"plugin" : "ReadShiftFromSpreadsheet",
"_class" : "dream.plugins.ReadShiftFromSpreadsheet.ReadShiftFromSpreadsheet",
"input_id" : "ShiftSpreadsheet"
}, {
"plugin" : "ReadWipFromSpreadsheet",
"_class" : "dream.plugins.ReadWipFromSpreadsheet.ReadWipFromSpreadsheet",
"input_id" : "WipSpreadsheet"
}, {
"plugin" : "ReadRouteFromSpreadsheet",
"_class" : "dream.plugins.ReadRouteFromSpreadsheet.ReadRouteFromSpreadsheet",
"input_id" : "RouteSpreadsheet"
}
]
},
"postprocessing" : {
"processing_plugin" : {
"description" : "",
"_class" : "",
"input_id" : ""
}
"post_processing" : {
"description" : "",
"plugin_list" : [{
"plugin" : "CalculateConfidenceIntervals"
"_class" : "dream.plugins.CalculateConfidenceIntervals.CalculateConfidenceIntervals"
}]
},
"general" : {
......
......@@ -810,20 +810,27 @@
}
}
},
"pre_processing_plugin_list": [
{
"_class": "dream.plugins.Debug.Debug",
"argument": "Argument Value"
},
{
"_class": "dream.plugins.OldStylePartJobShopWIP.OldStylePartJobShopWIP",
"input_id": "old_style_part_jobshop_spreadsheet"
}
],
"pre_processing": {
"description" : "",
"_plugin_list": [
{
"_class": "dream.plugins.Debug.Debug",
"argument": "Argument Value"
},
{
"_class": "dream.plugins.OldStylePartJobShopWIP.OldStylePartJobShopWIP",
"input_id": "old_style_part_jobshop_spreadsheet"
}
]
},
"processing_plugin": {
"description": "",
"_class": "dream.plugins.ACO.ACO"
},
"post_processing_plugin_list": [],
"post_processing": {
"description": "",
"plugin_list": []
},
"general": {
"properties": {
"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