remainingProcessingTime used instead of entry and exit

parent 3fb70d2c
......@@ -3,12 +3,13 @@ import json
import time
import random
import operator
from datetime import datetime
import datetime
import copy
from dream.plugins import plugin
from dream.plugins.TimeSupport import TimeSupportMixin
class ReadJSWIP(plugin.InputPreparationPlugin):
class ReadJSWIP(plugin.InputPreparationPlugin, TimeSupportMixin):
""" Input preparation
reads the wip from the spreadsheet and inserts it to the BOM
"""
......@@ -16,6 +17,16 @@ class ReadJSWIP(plugin.InputPreparationPlugin):
def preprocess(self, data):
""" inserts the wip as introduced in the GUI to the BOM
"""
strptime = datetime.datetime.strptime
# read the current date and define dateFormat from it
try:
now = strptime(data['general']['currentDate'], '%Y/%m/%d %H:%M')
data['general']['dateFormat']='%Y/%m/%d %H:%M'
except ValueError:
now = strptime(data['general']['currentDate'], '%Y/%m/%d')
data['general']['dateFormat']='%Y/%m/%d'
self.initializeTimeSupport(data)
WIPdata = data["input"].get("wip_spreadsheet",[])
workPlanData = data["input"].get("workplan_spreadsheet",[])
try:
......@@ -36,37 +47,16 @@ class ReadJSWIP(plugin.InputPreparationPlugin):
operatorID = WIPitem[4]
sequence = WIPitem[1]
WP_id = WIPitem[2]
start = WIPitem[5]
# end = WIPitem[6]
# start = WIPitem[5]
start = self.convertToSimulationTime(strptime("%s %s" % (data['general']['currentDate'], WIPitem[5]), '%Y/%m/%d %H:%M'))
remainingProcessinTime = start - now
wip[partID] = {
"task_id": WP_id,
"operator": operatorID,
"station": stationID,
"entry": start,
"exit": end,
"remainingProcessinTime": remainingProcessing,
"sequence": sequence
}
return data
'''
{
"name": "Part ID",
"type": "string"
}, {
"name": "Sequence",
"type": "string"
}, {
"name": "task ID",
"type": "string"
}, {
"name": "Station ID",
"type": "string"
}, {
"name": "Personnel ID",
"type": "string"
}, {
"name": "Start time",
"type": "string",
"format": "date-time"
}
'''
\ No newline at end of file
\ No newline at end of file
......@@ -19,7 +19,6 @@ class UpdateWIP(plugin.InputPreparationPlugin):
def preprocess(self, data):
""" updates the Work in Process according to what is provided by the BOM, i.e. if a design just exited the last step of it's sequence
"""
currentTime = datetime.datetime.now().time()
self.data = copy(data)
orders = self.data["input"]["BOM"]["orders"]
nodes = self.data["graph"]["node"]
......@@ -43,8 +42,7 @@ class UpdateWIP(plugin.InputPreparationPlugin):
work = wip[componentID]
# # extract WIP information
workStation = work["station"]
entryTime = float(work.pop("entry"),0)
exitTime = float(work.pop("exit", 0))
remainingProcessingTime = float(work.get("remainingProcessingTime",0))
task_id = work["task_id"]
assert len(route)>0, "the OrderComponent must have a route defined with length more than 0"
assert task_id, "there must be a task_id defined for the OrderComponent in the WIP"
......@@ -54,10 +52,7 @@ class UpdateWIP(plugin.InputPreparationPlugin):
last_step = step
break
# # check if the entity has left the station
# the entity is a machine if there is no exitTime
if not exitTime:
# # calculate remaining processing time
remainingProcessingTime = currentTime - entryTime
if remainingProcessingTime:
currentStation = workStation
current_step = last_step
# the entity is in a buffer if the step_index is no larger than the length of the route
......@@ -79,7 +74,7 @@ class UpdateWIP(plugin.InputPreparationPlugin):
wip[componentID]["station"] = currentStation
wip[componentID]["sequence"] = current_step["sequence"]
wip[componentID]["task_id"] = current_step["task_id"]
if not exitTime:
if remainingProcessingTime:
wip[componentID]["remainingProcessingTime"] = {"Fixed": {"mean": remainingProcessingTime}}
# if the entity is not recognized within the current WIP then check if it should be created
# first the flag designComplete and the completedComponents list must be updated
......
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