Commit c1ba7363 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

JSON main script updated to read/create and activate the maintenance. Also...

JSON main script updated to read/create and activate the maintenance. Also topology 36 added to test it. Need to discuss on JSON notation
parent 67eabf82
{
"_class": "Dream.Simulation",
"edges": {
"0": [
"S1",
"Q1",
{}
],
"1": [
"Q1",
"M1",
{}
],
"2": [
"M1",
"E1",
{}
]
},
"general": {
"_class": "Dream.Configuration",
"confidenceLevel": "0.95",
"maxSimTime": "240",
"numberOfReplications": "1",
"trace": "No"
},
"nodes": {
"E1": {
"_class": "Dream.Exit",
"left": 0.5,
"name": "Stock",
"top": 0.10215053763440862
},
"Q1": {
"_class": "Dream.Queue",
"id": "Q1",
"name": "Queue1",
"isDummy": "0",
"capacity": "-1"
},
"M1": {
"_class": "Dream.Machine",
"failures": {
"failureDistribution": "No"
},
"left": 0.5,
"name": "Moulding",
"processingTime": {
"distributionType": "Fixed",
"mean": "0.25"
},
"scheduledMaintenance": {
"start": "120",
"duration": "60"
},
"top": 0.5
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
},
"left": 0.5,
"name": "Raw Material",
"top": 0.8978494623655914
}
}
}
\ No newline at end of file
......@@ -85,6 +85,7 @@ from OperatedMachine import OperatedMachine
from BatchDecompositionStartTime import BatchDecompositionStartTime
from M3 import M3
from OrderComponent import OrderComponent
from ScheduledMaintenance import ScheduledMaintenance
import ExcelHandler
import time
......@@ -732,6 +733,8 @@ def initializeObjects():
entity.initialize()
for ev in G.EventGeneratorList:
ev.initialize()
for oi in G.ObjectInterruptionList:
oi.initialize()
# ===========================================================================
# activates all the objects
......@@ -746,7 +749,12 @@ def activateObjects():
try:
activate(ev, ev.run())
except AttributeError:
pass
pass
for oi in G.ObjectInterruptionList:
try:
activate(oi, oi.run())
except AttributeError:
pass
# ===========================================================================
# reads the WIP of the stations
......@@ -886,6 +894,26 @@ def createWIP():
object=Globals.findObjectById(element['id'])
P.currentStation=object
# ===========================================================================
# reads the interruptions of the stations
# ===========================================================================
def createObjectInterruptions():
G.ObjectInterruptionList=[]
G.ScheduledMaintenanceList=[]
json_data = G.JSONData
#Read the json data
nodes = json_data['nodes'] # read from the dictionary the dicts with key 'nodes'
for (element_id, element) in nodes.iteritems():
element['id'] = element_id
scheduledMaintenance=element.get('scheduledMaintenance', {})
if len(scheduledMaintenance):
start=float(scheduledMaintenance.get('start', 0))
duration=float(scheduledMaintenance.get('duration', 1))
victim=Globals.findObjectById(element['id'])
SM=ScheduledMaintenance(victim=victim, start=start, duration=duration)
G.ObjectInterruptionList.append(SM)
G.ScheduledMaintenanceList.append(SM)
# ===========================================================================
# used to convert a string read from the input to object type
......@@ -921,7 +949,7 @@ def main(argv=[], input_data=None):
G.JSONData=json.loads(G.InputData) # create the dictionary JSONData
readGeneralInput()
createObjects()
#createWIP()
createObjectInterruptions()
setTopology()
#run the experiment (replications)
......
{
"elementList": [
{
"_class": "Dream.Exit",
"id": "E1",
"results": {
"throughput": 480,
"takt_time": 0.5,
"lifespan": 15.3125
}
},
{
"_class": "Dream.Machine",
"id": "M1",
"results": {
"working_ratio": 50.0,
"blockage_ratio": 0.0,
"failure_ratio": 25.0,
"waiting_ratio": 25.0
}
}
],
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
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