minor corrections to comply with the new schema definition (graph>node/edge

parent e1c4d2a2
...@@ -377,8 +377,9 @@ class Simulation(object): ...@@ -377,8 +377,9 @@ class Simulation(object):
"""Preprocess the data, for instance reading spreadsheet. """Preprocess the data, for instance reading spreadsheet.
""" """
# by default we add an event generator if using queue stats # by default we add an event generator if using queue stats
if self.getConfigurationDict()["Dream-Configuration"]["gui"]["queue_stat"]: # if self.getConfigurationDict()["Dream-Configuration"]["gui"]["queue_stat"]:
for node in data["nodes"].values(): if data["application_configuration"]["output"]["view_queue_stats"]:
for node in data["graph"]["node"].values():
if node['_class'] in ('Dream.Queue', ): if node['_class'] in ('Dream.Queue', ):
node['gatherWipStat'] = 1 node['gatherWipStat'] = 1
return data return data
......
...@@ -75,8 +75,9 @@ def createObjectResourcesAndCoreObjects(): ...@@ -75,8 +75,9 @@ def createObjectResourcesAndCoreObjects():
json_data = G.JSONData json_data = G.JSONData
#Read the json data #Read the json data
nodes = json_data['nodes'] # read from the dictionary the dicts with key 'nodes' # nodes = json_data['nodes'] # read from the dictionary the dicts with key 'nodes'
edges = json_data['edges'] # read from the dictionary the dicts with key 'edges' nodes = json_data['graph']["node"] # read from the dictionary the dicts with key 'nodes'
edges = json_data['graph']["edge"] # read from the dictionary the dicts with key 'edges'
''' '''
...@@ -241,7 +242,7 @@ def createObjectInterruptions(): ...@@ -241,7 +242,7 @@ def createObjectInterruptions():
G.PeriodicMaintenanceList=[] G.PeriodicMaintenanceList=[]
json_data = G.JSONData json_data = G.JSONData
#Read the json data #Read the json data
nodes = json_data['nodes'] # read from the dictionary the dicts with key 'nodes' nodes = json_data['graph']["node"] # read from the dictionary the dicts with key 'nodes'
# loop through all the nodes to # loop through all the nodes to
# search for Event Generator and create them # search for Event Generator and create them
...@@ -389,7 +390,7 @@ def createWIP(): ...@@ -389,7 +390,7 @@ def createWIP():
G.OrderList.append(O) G.OrderList.append(O)
# read from the dictionary the dicts with key 'nodes' # read from the dictionary the dicts with key 'nodes'
nodes = json_data['nodes'] nodes = json_data["graph"]['node']
for (element_id, element) in nodes.iteritems(): for (element_id, element) in nodes.iteritems():
element['id'] = element_id element['id'] = element_id
wip=element.get('wip', []) wip=element.get('wip', [])
......
...@@ -58,11 +58,11 @@ class Machine(CoreObject): ...@@ -58,11 +58,11 @@ class Machine(CoreObject):
self.type="Machine" #String that shows the type of object self.type="Machine" #String that shows the type of object
CoreObject.__init__(self, id, name) CoreObject.__init__(self, id, name)
from Globals import G from Globals import G
processingTime=self.getOperationTime(time=processingTime) processingTime=self.getOperationTime(time=processingTime)
setupTime=self.getOperationTime(time=setupTime) setupTime=self.getOperationTime(time=setupTime)
loadTime=self.getOperationTime(time=loadTime) loadTime=self.getOperationTime(time=loadTime)
# holds the capacity of the machine # holds the capacity of the machine
...@@ -192,6 +192,18 @@ class Machine(CoreObject): ...@@ -192,6 +192,18 @@ class Machine(CoreObject):
@staticmethod @staticmethod
def getOperationTime(time): def getOperationTime(time):
def refactorTime(time):
if time:
if time["distribution"]:
time["distributionType"] = time["distribution"]
for key in time[time["distribution"]]:
time[key] = time[time["distribution"]][key]
del time[time["distribution"]]
del time["distribution"]
return time
# XXX update time to comply with old definition
time = refactorTime(time)
'''returns the dictionary updated''' '''returns the dictionary updated'''
if not time: if not time:
time = { 'distributionType': 'Fixed', time = { 'distributionType': 'Fixed',
......
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