Commit acc2fa6f authored by Georgios Dagkakis's avatar Georgios Dagkakis

CapacityStationController to read in new way

parent 833e4c02
......@@ -32,8 +32,8 @@ from CapacityEntity import CapacityEntity
from Globals import G
class CapacityStationController(EventGenerator):
def __init__(self, id=id, name=None, start=None, stop=None, interval=None,
duration=None, method=None, argumentDict=None, dueDateThreshold=float('inf'), prioritizeIfCanFinish=False):
def __init__(self, id=id, name=None, start=0, stop=float('inf'), interval=1,
duration=0, method=None, argumentDict=None, dueDateThreshold=float('inf'), prioritizeIfCanFinish=False):
EventGenerator.__init__(self, id, name, start, stop, interval,
duration, method, argumentDict)
# attribute used by optimization in calculateWhatIsToBeProcessed
......
......@@ -197,9 +197,6 @@
"CSC": {
"_class": "Dream.CapacityStationController",
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None"
}
"interval": "1" }
}
}
\ No newline at end of file
......@@ -161,7 +161,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"prioritizeIfCanFinish": 1,
"dueDateThreshold": 7
}
......
......@@ -200,7 +200,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"dueDateThreshold":7
}
}
......
......@@ -200,7 +200,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"dueDateThreshold":7
}
}
......
......@@ -200,7 +200,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"dueDateThreshold":14
}
}
......
......@@ -100,7 +100,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"dueDateThreshold": 7
}
}
......
......@@ -100,7 +100,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"dueDateThreshold": 7
}
}
......
......@@ -201,8 +201,7 @@
"_class": "Dream.CapacityStationController",
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None"
}
"interval": "1"
}
}
}
\ No newline at end of file
......@@ -204,8 +204,7 @@
"_class": "Dream.CapacityStationController",
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None"
"interval": "1"
}
}
}
\ No newline at end of file
......@@ -100,7 +100,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"prioritizeIfCanFinish": 1,
"dueDateThreshold": 7
}
......
......@@ -100,7 +100,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"prioritizeIfCanFinish": 1,
"dueDateThreshold": 7
}
......
......@@ -100,7 +100,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"prioritizeIfCanFinish": 1,
"dueDateThreshold": 7
}
......
......@@ -123,7 +123,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"prioritizeIfCanFinish": 1,
"dueDateThreshold": 7
}
......
......@@ -131,7 +131,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"prioritizeIfCanFinish": 1,
"dueDateThreshold": 7
}
......
......@@ -124,7 +124,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"prioritizeIfCanFinish": 1,
"dueDateThreshold": 7
}
......
......@@ -138,7 +138,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"prioritizeIfCanFinish": 1,
"dueDateThreshold": 7
}
......
......@@ -137,7 +137,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"prioritizeIfCanFinish": 1,
"dueDateThreshold": 7
}
......
......@@ -133,7 +133,6 @@
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None",
"prioritizeIfCanFinish": 1,
"dueDateThreshold": 7
}
......
......@@ -198,8 +198,7 @@
"_class": "Dream.CapacityStationController",
"name": "CSC",
"start": "0",
"interval": "1",
"method": "Dream.None"
}
"interval": "1"
}
}
}
\ No newline at end of file
......@@ -704,33 +704,33 @@ def createObjectInterruptions():
# from CoreObject import CoreObject
# if issubclass(objectType, CoreObject):
if objClass=='Dream.EventGenerator': # check the object type
inputDict=dict(element)
# create the CoreObject
if objClass in ['Dream.EventGenerator', 'Dream.CapacityStationController']: # check the object type
inputDict=dict(element)
# create the ObjectInterruption
objectInterruption=objectType(**inputDict)
G.ObjectInterruptionList.append(objectInterruption)
elif objClass=='Dream.CapacityStationController': # check the object type
id = element.get('id', 'not found') # get the id of the element / default 'not_found'
name = element.get('name', 'not found') # get the name of the element / default 'not_found'
start = float(element.get('start') or 0)
stop = float(element.get('stop') or -1)
# infinity (had to be done to make it as float)
if stop<0:
stop=float('inf')
interval = float(element.get('interval') or 1)
duration = float(element.get('duration') or 0)
dueDateThreshold = float(element.get('dueDateThreshold') or float('inf'))
prioritizeIfCanFinish = bool(element.get('prioritizeIfCanFinish', 0))
argumentDict=(element.get('argumentDict', {})) # get the arguments of the method as a dict / default {}
# create the CapacityStationController object
CSC = CapacityStationController(id, name, start=start, stop=stop, interval=interval,
duration=duration, argumentDict=argumentDict, dueDateThreshold=dueDateThreshold,
prioritizeIfCanFinish=prioritizeIfCanFinish)
G.EventGeneratorList.append(CSC)
G.CapacityStationControllerList.append(CSC)
G.ObjectInterruptionList.append(CSC)
# elif objClass=='Dream.CapacityStationController': # check the object type
# id = element.get('id', 'not found') # get the id of the element / default 'not_found'
# name = element.get('name', 'not found') # get the name of the element / default 'not_found'
# start = float(element.get('start') or 0)
# stop = float(element.get('stop') or -1)
# # infinity (had to be done to make it as float)
# if stop<0:
# stop=float('inf')
# interval = float(element.get('interval') or 1)
# duration = float(element.get('duration') or 0)
# dueDateThreshold = float(element.get('dueDateThreshold') or float('inf'))
# prioritizeIfCanFinish = bool(element.get('prioritizeIfCanFinish', 0))
# argumentDict=(element.get('argumentDict', {})) # get the arguments of the method as a dict / default {}
#
# # create the CapacityStationController object
# CSC = CapacityStationController(id, name, start=start, stop=stop, interval=interval,
# duration=duration, argumentDict=argumentDict, dueDateThreshold=dueDateThreshold,
# prioritizeIfCanFinish=prioritizeIfCanFinish)
# G.EventGeneratorList.append(CSC)
# G.CapacityStationControllerList.append(CSC)
# G.ObjectInterruptionList.append(CSC)
# for the elements in the nodes dict
for (element_id, element) in nodes.iteritems():
......
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