minor bugs in shift and skills plugins corrected

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