Commit 5b3282e1 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Sebastien Robin

Job object added and some cleanup in Part and Frame.

parent e277bbcf
......@@ -27,9 +27,9 @@ Class that acts as an abstract. It should have no instances. All the Entities sh
#The entity object
class Entity(object):
type="Entity"
def __init__(self, name):
self.type="Entity"
self.name=name
self.currentStop=None #contains the current object that the material is in
self.creationTime=0
......
......@@ -36,11 +36,8 @@ class Frame(Entity):
numOfParts=4 #the number of parts that the frame can take
def __init__(self, name):
self.type="Frame"
self.name=name
self.currentStop=None #contains the current object that the material is in
self.creationTime=0
self.startTime=0 #holds the startTime for the lifespan
Entity.__init__(self, name)
self.Res=Resource(self.numOfParts)
#dimension data
self.width=2.0
......
{
"_class": "Dream.Simulation",
"general": {
"_class": "Dream.Configuration",
"numberOfReplications": "1",
"maxSimTime": "1000",
"trace": "Yes",
"confidenceLevel": "0.95"
},
"elementList": [
{
"_class": "Dream.Machine",
"id": "M1",
"name": "Machine1",
"processingTime": {
"distributionType": "Fixed",
"mean": "0.25"
},
"failures": {
"failureDistribution": "No",
"MTTF": "60",
"MTTR": "5"
},
"successorList": []
},
{
"_class": "Dream.Machine",
"id": "M2",
"name": "Machine2",
"processingTime": {
"distributionType": "Fixed",
"mean": "1.5"
},
"failures": {
"failureDistribution": "No",
"MTTF": "40",
"MTTR": "10"
},
"successorList": []
},
{
"_class": "Dream.Machine",
"id": "M3",
"name": "Machine3",
"processingTime": {
"distributionType": "Fixed",
"mean": "1.5"
},
"failures": {
"failureDistribution": "No",
"MTTF": "40",
"MTTR": "10"
},
"successorList": []
},
{
"_class": "Dream.Queue",
"id": "Q1",
"name": "Queue1",
"isDummy": "0",
"capacity": "1000",
"successorList": [
"M1"
]
},
{
"_class": "Dream.Queue",
"id": "Q2",
"name": "Queue2",
"isDummy": "0",
"capacity": "1000",
"successorList": [
"M2"
]
},
{
"_class": "Dream.Queue",
"id": "Q3",
"name": "Queue3",
"isDummy": "0",
"capacity": "1000",
"successorList": [
"M3"
]
},
{
"_class": "Dream.Exit",
"id": "E1",
"name": "Exit"
},
{
"_class": "Dream.Job",
"id": "J1",
"name": "Job1",
"route": [
{
"stationId": "Q1",
"processingTime": {
"distributionType": "Fixed",
"mean": "1"
}
},
{
"stationId": "Q3",
"processingTime": {
"distributionType": "Fixed",
"mean": "3"
}
},
{
"stationId": "Q2",
"processingTime": {
"distributionType": "Fixed",
"mean": "2"
}
},
{
"stationId": "E1",
"processingTime": {
"distributionType": "Fixed",
"mean": "0"
}
}
]
}
]
}
\ No newline at end of file
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 01 Oct 2013
@author: George
'''
'''
Job is an Entity that implements the logic of a job shop. Job carries attributes for its route
in the system and also in the processing times at each station
'''
from Globals import G
from Entity import Entity
#The part object
class Job(Entity):
type="Job"
def __init__(self, name, id, route):
Entity.__init__(self, name)
self.id=id
self.fullRoute=route #the route that the job follows, also contains the processing times in each station
self.remainingRoute=route #the remaining route. in the beginning this should be the same as the full route
self.currentStop=route[0][0] #the starting stop should be the first in the route
\ No newline at end of file
......@@ -237,6 +237,23 @@ def createObjects():
G.ObjList.append(C)
G.ConveyerList.append(C)
elif objClass=='Dream.Job':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
JSONRoute=element.get('route', [])
route=[]
for routeElement in JSONRoute:
print routeElement
nextId=routeElement.get('stationId', 'not found')
processingTime=routeElement.get('processingTime', 'not found')
distributionType=processingTime.get('distributionType', 'not found')
mean=int(processingTime.get('mean', 'not found'))
print nextId, distributionType, mean
route.append([nextId, mean])
print route[0][0]
#loop through all the core objects
#to read predecessors
for element in G.ObjList:
......@@ -384,19 +401,7 @@ def main(argv=[], input_data=None):
outputJSONString=json.dumps(G.outputJSON, indent=True)
G.outputJSONFile.write(outputJSONString)
'''
#output data to excel for every object in the topology
for core_object in G.ObjList:
core_object.outputResultsXL(G.maxSimTime)
#output data to excel for every resource in the topology
for model_resource in G.RepairmanList:
model_resource.outputResultsXL(G.maxSimTime)
G.outputFile.save("output.xls")
'''
logger.info("execution time="+str(time.time()-start))
if input_data:
return outputJSONString
......
......@@ -27,25 +27,15 @@ models a part entity that flows through the system
'''
from SimPy.Simulation import *
from Globals import G
from Entity import Entity
#The entity object
#The part object
class Part(Entity):
type="Part"
def __init__(self, name):
self.name=name
self.currentStop=None #contains the current object that the material is in
self.creationTime=0
self.startTime=0 #holds the startTime for the lifespan
#dimension data
self.width=1.0
self.height=1.0
self.length=1.0
def __del__(self):
pass
Entity.__init__(self, name)
#print self.name, now()
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