minor bugs in shift and skills plugins corrected

parent fc946a94
...@@ -31,18 +31,19 @@ class ReadShiftFromSpreadsheet(plugin.InputPreparationPlugin): ...@@ -31,18 +31,19 @@ class ReadShiftFromSpreadsheet(plugin.InputPreparationPlugin):
shift_by_station.setdefault(station, []).append( shift_by_station.setdefault(station, []).append(
(start_time, stop_time) ) (start_time, stop_time) )
for line in data['input']['operator_shift_spreadsheet'][1:]: if data['input']['operator_shift_spreadsheet']:
if line[1]: for line in data['input']['operator_shift_spreadsheet'][1:]:
# Get the dates, and convert them to simulation clock time units. if line[1]:
# In this class, time unit is a minute (XXX it can be an option) # Get the dates, and convert them to simulation clock time units.
start_date = strptime("%s %s" % (line[0], line[2]), '%Y/%m/%d %H:%M') # In this class, time unit is a minute (XXX it can be an option)
start_time = (start_date - now).total_seconds() // 60 start_date = strptime("%s %s" % (line[0], line[2]), '%Y/%m/%d %H:%M')
stop_date = strptime("%s %s" % (line[0], line[3]), '%Y/%m/%d %H:%M') start_time = (start_date - now).total_seconds() // 60
stop_time = (stop_date - now).total_seconds() // 60 stop_date = strptime("%s %s" % (line[0], line[3]), '%Y/%m/%d %H:%M')
for station in line[1].split(','): stop_time = (stop_date - now).total_seconds() // 60
station = station.strip() for station in line[1].split(','):
shift_by_station.setdefault(station, []).append( station = station.strip()
(start_time, stop_time) ) shift_by_station.setdefault(station, []).append(
(start_time, stop_time) )
for node, node_data in data['graph']['node'].items(): for node, node_data in data['graph']['node'].items():
if node in shift_by_station: if node in shift_by_station:
......
...@@ -17,6 +17,7 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin): ...@@ -17,6 +17,7 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin):
""" """
PBData=data['input'].get('operator_skill_spreadsheet', None) PBData=data['input'].get('operator_skill_spreadsheet', None)
node=data['graph']['node'] node=data['graph']['node']
operatorPresent = False
if PBData: if PBData:
PBData.pop(0) # pop the column names PBData.pop(0) # pop the column names
for PBitem in PBData: for PBitem in PBData:
...@@ -32,21 +33,23 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin): ...@@ -32,21 +33,23 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin):
"skills":skills, "skills":skills,
"ouputSchedule" : 1 "ouputSchedule" : 1
} }
operatorPresent = True
# for every station that has one or more skilled operators set operation type to MT-Load-Processing # for every station that has one or more skilled operators set operation type to MT-Load-Processing
for stationId in skills: for stationId in skills:
node[stationId]["operationType"]="MT-Load-Processing" node[stationId]["operationType"]="MT-Load-Processing"
# add EventGenerator for the allocation every 10 minutes # add EventGenerator for the allocation every 10 minutes
node['EV123454321']={ #(random id) if operatorPresent:
"name": "Allocator", node['EV123454321']={ #(random id)
"argumentDict": "{}", "name": "Allocator",
"interval": 10, "argumentDict": "{}",
"stop": -1, "interval": 10,
"id": "EV123454321", "stop": -1,
"start": 0, "id": "EV123454321",
"interruptions": {}, "start": 0,
"_class": "Dream.EventGenerator", "interruptions": {},
"method": "Dream.ManPyObject.requestAllocation" "_class": "Dream.EventGenerator",
} "method": "Dream.ManPyObject.requestAllocation"
}
# print '---------------------------------' # print '---------------------------------'
# print data['graph']['node'] # print data['graph']['node']
# print '---------------------------------' # print '---------------------------------'
......
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