Commit e53c6727 authored by Sebastien Robin's avatar Sebastien Robin

PartJobShop: work in progress on Part Job Shop, with associated json

parent 3047d1a7
{
"nodes": {
"E1": {
"_class": "Dream.ExitJobShop",
"element_id": "DreamNode_1"
},
"QStart": {
"_class": "Dream.QueueManagedJob",
"element_id": "DreamNode_2",
"name": "QStart",
"capacity": "1",
"isDummy": "0",
"schedulingRule": "FIFO"
},
"CAD1": {
"_class": "Dream.MachineJobShop",
"element_id": "DreamNode_3",
"name": "CAD1",
"processingTime": {
"mean": "0.9",
"distributionType": "Fixed",
"stdev": "0.1",
"min": "0.1",
"max": "1"
},
"failures": {
"failureDistribution": "No",
"MTTF": "40",
"MTTR": "10",
"repairman": "None"
}
},
"CAD2": {
"_class": "Dream.MachineJobShop",
"element_id": "DreamNode_4",
"name": "CAD2",
"processingTime": {
"mean": "0.9",
"distributionType": "Fixed",
"stdev": "0.1",
"min": "0.1",
"max": "1"
},
"failures": {
"failureDistribution": "No",
"MTTF": "40",
"MTTR": "10",
"repairman": "None"
}
},
"Dream-OrderDecomposition_1": {
"_class": "Dream.OrderDecomposition",
"element_id": "DreamNode_5"
},
"QCAM": {
"_class": "Dream.QueueManagedJob",
"element_id": "DreamNode_6",
"name": "Dream-QueueManagedJob_1",
"capacity": "1",
"isDummy": "0",
"schedulingRule": "FIFO"
},
"CAM1": {
"_class": "Dream.MachineJobShop",
"element_id": "DreamNode_7",
"name": "CAM1",
"processingTime": {
"mean": "0.9",
"distributionType": "Fixed",
"stdev": "0.1",
"min": "0.1",
"max": "1"
},
"failures": {
"failureDistribution": "No",
"MTTF": "40",
"MTTR": "10",
"repairman": "None"
}
},
"CAM2": {
"_class": "Dream.MachineJobShop",
"element_id": "DreamNode_8",
"name": "CAM2",
"processingTime": {
"mean": "0.9",
"distributionType": "Fixed",
"stdev": "0.1",
"min": "0.1",
"max": "1"
},
"failures": {
"failureDistribution": "No",
"MTTF": "40",
"MTTR": "10",
"repairman": "None"
}
}
},
"edges": {
"con_5": [
"CAD1",
"Dream-OrderDecomposition_1",
{}
],
"con_10": [
"CAD2",
"Dream-OrderDecomposition_1",
{}
],
"con_15": [
"QStart",
"CAD1",
{}
],
"con_20": [
"QStart",
"CAD2",
{}
],
"con_25": [
"Dream-OrderDecomposition_1",
"QCAM",
{}
],
"con_30": [
"QCAM",
"CAM1",
{}
],
"con_35": [
"QCAM",
"CAM2",
{}
]
},
"preference": {
"coordinates": {
"E1": {
"top": 0.37504626611342784,
"left": 0.864763881619618
},
"QStart": {
"left": 0.13565460363009282,
"top": 0.16642106881541613
},
"CAD1": {
"top": 0.49363124284218185,
"left": 0.141694796524387
},
"CAD2": {
"top": 0.4960899425191736,
"left": 0.30341115093502347
},
"Dream-OrderDecomposition_1": {
"top": 0.781109974305828,
"left": 0.27829062765763835
},
"QCAM": {
"top": 0.8881579756271594,
"left": 0.4730332343902185
},
"CAM1": {
"top": 0.4709355535161045,
"left": 0.600132859916806
},
"CAM2": {
"top": 0.7073489839960767,
"left": 0.6843357695194952
}
},
"zoom_level": 0.99999
},
"general": {
"numberOfReplications": "1",
"maxSimTime": "-1",
"confidenceLevel": "0.95",
"processTimeout": "2000",
"currentDate": "",
"numberOfGenerations": "10",
"numberOfAntsPerGenerations": "20",
"numberOfSolutions": "4"
},
"wip_spreadsheet": [
[
"Jobs",
"ID",
"Order Date",
"Due Date",
"Priority",
"Material",
"Sequence",
"Processing Times"
],
[
null,
null,
null,
null,
null,
null,
null,
null
]
],
"wip_part_spreadsheet": [
[
"Order ID",
"Due Date",
"Priority",
"Project Manager",
"Parts",
"Part Type",
"Sequence",
"Processing Times",
"Electrodes Needed"
],
[
"Order 1",
"2014/03/15",
"1",
"PM1",
"Mould1 Design",
"Design",
"CAD",
"6",
null
],
[
null,
null,
null,
null,
"Part1",
"Basic",
"CAM",
"3",
null
],
[
null,
null,
null,
null,
"Part2",
"Basic",
"CAM",
"2",
null
],
[
null,
null,
null,
null,
null,
null,
null,
null,
null
]
]
}
\ No newline at end of file
from copy import copy
import json
import time
import random
import operator
from datetime import datetime
from dream.simulation.GUI import ACO
from dream.simulation.GUI.Default import schema
class Simulation(ACO.Simulation):
def getConfigurationDict(self):
conf = ACO.Simulation.getConfigurationDict(self)
conf["Dream-MachineJobShop"] = {
"property_list": [
schema["processingTime"],
schema["failures"]
],
"_class": 'Dream.MachineJobShop',
"name": 'Machine'
}
conf["Dream-QueueManagedJob"] = {
"property_list": [
schema["capacity"],
schema["isDummy"],
schema["schedulingRule"]
],
"_class": 'Dream.QueueManagedJob',
"name": 'Queue'
}
conf["Dream-ConditionalBuffer"] = {
"property_list": [
schema["capacity"],
schema["isDummy"],
schema["schedulingRule"]
],
"_class": 'Dream.ConditionalBuffer',
"name": 'Buffer'
}
conf["Dream-ExitJobShop"] = {
"_class": 'Dream.ExitJobShop',
"name": 'Exit'
}
conf["Dream-OrderDecomposition"] = {
"_class": 'Dream.OrderDecomposition',
"name": 'Decompo'
}
# XXX remove default machines etc ?
conf["Dream-Configuration"]["gui"]["wip_part_spreadsheet"] = 1
conf["Dream-Configuration"]["gui"]["job_schedule_spreadsheet"] = 1
conf["Dream-Configuration"]["gui"]["job_gantt"] = 1
conf["Dream-Configuration"]["gui"]["debug_json"] = 1
# remove tools that does not make sense here
conf.pop('Dream-Machine')
conf.pop('Dream-Queue')
conf.pop('Dream-Exit')
return conf
def _preprocess(self, in_data):
""" Set the WIP in queue from spreadsheet data.
"""
data = copy(in_data)
now = datetime.now()
if data['general']['currentDate']:
now = datetime.strptime(data['general']['currentDate'], '%Y/%m/%d')
if 'wip_part_spreadsheet' in data:
# Data is presented as follow, with first line the order, then only parts of this order
# Order ID | Due Date | Priority | Project Manager | Parts | Part Type | Sequence | Processing Time | Electrodes needed
# Order 1 | 2013/02/15 | 1 | PM1 | P1 | type1 | Mach1-Mach2 | 3-5 |
wip_dict = {}
print "wip part data : %r" % (data['wip_part_spreadsheet'],)
for value_list in data['wip_part_spreadsheet']:
print "first value_list: %r" % (value_list,)
if value_list[0] == 'Order ID' or not value_list[4]:
continue
print "still there after first continue"
order_id, due_date, priority, project_manager, part, part_type,\
sequence_list, processing_time_list, electrode_needed = value_list
due_date = (datetime.strptime(due_date, '%Y/%m/%d') - now).days
sequence_list = sequence_list.split('-')
processing_time_list = processing_time_list.split('-')
wip_dict.setdefault(sequence_list[0], []).append(
{
"_class": "Dream.Job",
"id": value_list[1],
"name": value_list[0],
"dueDate": dueDate,
"route": [
{
"processingTime": {
"distributionType": "Fixed",
"mean": processing_time_list[i],
},
"stationIdsList": sequence_list[i].split(','),
"stepNumber": i
} for i in xrange(len(sequence_list))]
}
)
for node_id in data['nodes'].keys():
if node_id in wip_dict:
data['nodes'][node_id]['wip'] = wip_dict[node_id]
del(data['wip_part_spreadsheet'])
return data
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