Commit d71a5c7e authored by Jérome Perrin's avatar Jérome Perrin

first step of simplifying LineGenerationJSON

Notes:
  * Input format changed (Source.part now is a full name)
  * __init__ must handle complex data structures for processingTime & interarrivalTime instead of having flat parameters
  * type conversion must be performed ("1" != 1), probably we can assume json has correct type and have the gui produce proper json
parent d7ffe32a
......@@ -37,7 +37,7 @@ from CoreObject import CoreObject
class Assembly(CoreObject):
#initialize the object
def __init__(self, id, name, distribution='Fixed', mean=1, stdev=0.1, min=0, max=5):
def __init__(self, id, name, distribution='Fixed', mean=1, stdev=0.1, min=0, max=5, **kw):
CoreObject.__init__(self)
self.id=id
self.objName=name
......@@ -338,4 +338,4 @@ class Assembly(CoreObject):
json['results']['waiting_ratio']['max']=self.Waiting[0]
G.outputJSON['elementList'].append(json)
\ No newline at end of file
......@@ -45,7 +45,7 @@ class BatchDecomposition(CoreObject):
#initialize the id, the capacity of the object and the distribution
# =======================================================================
def __init__(self, id, name, numberOfSubBatches=1, distribution='Fixed', \
mean=1, stdev=0, min=0, max=10,operator='None'):
mean=1, stdev=0, min=0, max=10, operator='None', **kw):
CoreObject.__init__(self)
# hold the id, name, and type of the Machine instance
self.id=id
......
......@@ -46,7 +46,7 @@ class BatchReassembly(CoreObject):
#initialize the id, the capacity of the object and the distribution
# =======================================================================
def __init__(self, id, name, numberOfSubBatches=1, distribution='Fixed', \
mean=1, stdev=0, min=0, max=10,operator='None'):
mean=1, stdev=0, min=0, max=10, operator='None', **kw):
Process.__init__(self)
# hold the id, name, and type of the Machine instance
self.id=id
......
......@@ -41,14 +41,16 @@ class BatchScrapMachine(Machine):
def __init__(self, id, name, capacity=1, \
distribution='Fixed', mean=1, stdev=0, min=0, max=10,\
failureDistribution='No', MTTF=0, MTTR=0, availability=0, repairman='None',\
scrapDistribution='Fixed',scrMean=1,scrStdev=0,scrMin=0,scrMax=10):
scrapDistribution='Fixed',scrMean=1,scrStdev=0,scrMin=0,scrMax=10,
**kw):
# initialize using the default method of the object
Machine.__init__(self,id=id,name=name,\
capacity=capacity,\
distribution=distribution,\
mean=mean,stdev=stdev,min=min,max=max,\
failureDistribution=failureDistribution,MTTF=MTTF,MTTR=MTTR,\
availability=availability, repairman=repairman)
availability=availability,
repairman=repairman, **kw)
self.scrapDistType=scrapDistribution #the distribution that the failure follows
# Sets the attributes of the scrap quantity distribution
......@@ -73,4 +75,4 @@ class BatchScrapMachine(Machine):
activeEntity = self.getActiveObjectQueue()[0]
return self.rng.generateNumber()*activeEntity.numberOfUnits # this is if we have a default processing time for all the entities
\ No newline at end of file
......@@ -25,14 +25,15 @@ Created on 29 Oct 2013
models the source object that generates the Batches Entities
'''
from Source import Source
from Batch import Batch
from Globals import G
from SimPy.Simulation import Process
from RandomNumberGenerator import RandomNumberGenerator
class BatchSource(Source):
def __init__(self, id, name, distribution='Fixed', mean=1, item=Batch, batchNumberOfUnits = 1):
Source.__init__(self, id=id, name=name, distribution=distribution, mean=mean, item=item)
def __init__(self, id, name, distribution='Fixed', mean=1,
item='Dream.Batch', batchNumberOfUnits=1, **kw):
Source.__init__(self, id=id, name=name, distribution=distribution,
mean=mean, item=item, **kw)
self.numberOfUnits = batchNumberOfUnits
......@@ -41,4 +42,4 @@ class BatchSource(Source):
return self.item(id = self.item.type+str(G.numberOfEntities), \
name = self.item.type+str(self.numberOfArrivals), numberOfUnits=self.numberOfUnits)
\ No newline at end of file
......@@ -43,8 +43,10 @@ class ConditionalBuffer(QueueManagedJob):
# the default __init__ method of the QueueManagedJob class
# whereas the default capacity is set to infinity
# =======================================================================
def __init__(self, id, name, capacity=-1, dummy=False, schedulingRule="FIFO"):
QueueManagedJob.__init__(self, id=id, name=name, capacity=capacity, dummy=dummy, schedulingRule=schedulingRule)
def __init__(self, id, name, capacity=-1, isDummy=False,
schedulingRule="FIFO", **kw):
QueueManagedJob.__init__(self, id=id, name=name, capacity=capacity,
isDummy=isDummy, schedulingRule=schedulingRule, **kw)
# =======================================================================
# checks if the Buffer can dispose an entity.
......@@ -140,4 +142,4 @@ class ConditionalBuffer(QueueManagedJob):
activeObjectQueue.sort(key=lambda x: not ((x.componentType=='Basic')\
or ((x.order.basicsEnded)\
and (x.componentType=='Secondary'))))
\ No newline at end of file
......@@ -35,7 +35,7 @@ from CoreObject import CoreObject
#The conveyer object
class Conveyer(CoreObject):
def __init__(self, id, name,length,speed):
def __init__(self, id, name, length, speed, **kw):
CoreObject.__init__(self)
self.id=id
self.objName=name
......@@ -412,4 +412,4 @@ class ConveyerMover(Process):
self.conveyer.call=False #reset call so it will be triggered only when it is needed again
\ No newline at end of file
......@@ -54,6 +54,7 @@ class CoreObject(Process):
def initialize(self):
# XXX why call super.__init__ outside of __init__ ?
Process.__init__(self)
self.Up=True #Boolean that shows if the machine is in failure ("Down") or not ("up")
self.onShift=True
......
......@@ -41,7 +41,8 @@ class Dismantle(CoreObject):
# =======================================================================
# initialize the object
# =======================================================================
def __init__(self, id, name, distribution='Fixed', mean=1, stdev=0.1, min=0, max=5):
def __init__(self, id, name, distribution='Fixed', mean=1, stdev=0.1,
min=0, max=5, **kw):
CoreObject.__init__(self)
self.id=id
self.objName=name
......@@ -383,4 +384,4 @@ class Dismantle(CoreObject):
G.outputJSON['elementList'].append(json)
\ No newline at end of file
......@@ -30,7 +30,8 @@ from SimPy.Simulation import now, hold, Process
from ObjectInterruption import ObjectInterruption
class EventGenerator(ObjectInterruption):
def __init__(self, id=id, name=None, start=None, stop=None, interval=None, duration=None, method=None, argumentDict=None):
def __init__(self, id=id, name=None, start=None, stop=None, interval=None,
duration=None, method=None, argumentDict=None, **kw):
ObjectInterruption.__init__(self)
self.id=id
self.name=name
......@@ -54,4 +55,4 @@ class EventGenerator(ObjectInterruption):
\ No newline at end of file
......@@ -34,14 +34,15 @@ from CoreObject import CoreObject
# ===========================================================================
class Exit(CoreObject):
def __init__(self, id, name):
def __init__(self, id, name=None, **kw):
CoreObject.__init__(self)
Process.__init__(self)
if not name:
name = id
self.predecessorIndex=0 # holds the index of the predecessor from which the Exit will take an entity next
# general properties of the Exit
self.id=id
self.objName=name
self.type="Exit"
self.type="Exit" # XXX needed ?
# # list with routing information
# self.previous=[] # list with the previous objects in the flow
# self.nextIds=[] # list with the ids of the next objects in the flow. For the exit it is always empty!
......
......@@ -100,6 +100,7 @@ def getClassFromName(dotted_name):
# dream.simulation.Something.Something
dream, class_name = dotted_name.split('.')
import dream.simulation as ds
__import__('dream.simulation.%s' % class_name)
return getattr(getattr(ds, class_name), class_name)
# =======================================================================
......
......@@ -98,7 +98,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -64,7 +64,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......@@ -75,7 +75,7 @@
},
"S2": {
"_class": "Dream.Source",
"entity": "Frame",
"entity": "Dream.Frame",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "2"
......
......@@ -85,7 +85,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -99,7 +99,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -97,7 +97,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......@@ -108,7 +108,7 @@
},
"S2": {
"_class": "Dream.Source",
"entity": "Frame",
"entity": "Dream.Frame",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "2"
......
......@@ -117,7 +117,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -101,7 +101,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......@@ -112,7 +112,7 @@
},
"S2": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1"
......
......@@ -118,7 +118,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......@@ -129,7 +129,7 @@
},
"S2": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1"
......@@ -140,7 +140,7 @@
},
"S3": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "2"
......
......@@ -41,7 +41,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -118,7 +118,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......@@ -129,7 +129,7 @@
},
"S2": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1"
......
......@@ -113,7 +113,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -150,7 +150,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -98,7 +98,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......@@ -109,7 +109,7 @@
},
"S2": {
"_class": "Dream.Source",
"entity": "Frame",
"entity": "Dream.Frame",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "2"
......
......@@ -150,7 +150,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......@@ -161,7 +161,7 @@
},
"S2": {
"_class": "Dream.Source",
"entity": "Frame",
"entity": "Dream.Frame",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "2"
......
......@@ -99,7 +99,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -117,7 +117,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -84,7 +84,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"id": "S1",
"interarrivalTime": {
"distributionType": "Fixed",
......
......@@ -68,7 +68,7 @@
"S1": {
"_class": "Dream.BatchSource",
"batchNumberOfUnits": 80,
"entity": "Batch",
"entity": "Dream.Batch",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -128,7 +128,7 @@
"S1": {
"_class": "Dream.BatchSource",
"batchNumberOfUnits": 80,
"entity": "Batch",
"entity": "Dream.Batch",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1.5"
......
......@@ -126,7 +126,7 @@
"S1": {
"_class": "Dream.BatchSource",
"batchNumberOfUnits": 100,
"entity": "Batch",
"entity": "Dream.Batch",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1.5"
......
......@@ -83,7 +83,7 @@
"S1": {
"_class": "Dream.BatchSource",
"batchNumberOfUnits": 100,
"entity": "Batch",
"entity": "Dream.Batch",
"id": "S1",
"interarrivalTime": {
"distributionType": "Fixed",
......
......@@ -152,7 +152,7 @@
"S1": {
"_class": "Dream.BatchSource",
"batchNumberOfUnits": 100,
"entity": "Batch",
"entity": "Dream.Batch",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -89,7 +89,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1"
......
......@@ -74,7 +74,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1.5"
......
......@@ -94,7 +94,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"id": "S1",
"interarrivalTime": {
"distributionType": "Fixed",
......
......@@ -92,7 +92,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -150,7 +150,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -57,7 +57,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "0.5"
......
......@@ -77,7 +77,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "6"
......
......@@ -136,7 +136,7 @@
"S1": {
"_class": "Dream.BatchSource",
"batchNumberOfUnits": 80,
"entity": "Batch",
"entity": "Dream.Batch",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1.5"
......
......@@ -55,7 +55,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1"
......
......@@ -55,7 +55,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1"
......
......@@ -55,7 +55,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1"
......
......@@ -55,7 +55,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1"
......
......@@ -55,7 +55,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"interarrivalTime": {
"distributionType": "Fixed",
"mean": "1"
......
......@@ -91,7 +91,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"id": "S1",
"interarrivalTime": {
"distributionType": "Fixed",
......
......@@ -91,7 +91,7 @@
},
"S1": {
"_class": "Dream.Source",
"entity": "Part",
"entity": "Dream.Part",
"id": "S1",
"interarrivalTime": {
"distributionType": "Fixed",
......
......@@ -33,7 +33,6 @@ from warnings import warn
import logging
logger = logging.getLogger("dream.platform")
try:
import scipy
except ImportError:
......@@ -174,14 +173,22 @@ def createObjects():
G.QueueManagedJobList=[]
G.ModelResourceList=[]
# test that we can instanciate everything.
obj_list = []
for (element_id, element) in nodes.iteritems():
element['id'] = element_id
resourceClass = Globals.getClassFromName(element['_class'])
resource = resourceClass(**element)
resource.nextIds = getSuccessorList(element['id'])
obj_list.append(resource)
# -----------------------------------------------------------------------
# loop through all the model resources
# search for repairmen and operators in order to create them
# read the data and create them
# -----------------------------------------------------------------------
for (element_id, element) in nodes.iteritems(): # use an iterator to go through all the nodes
# the key is the element_id and the second is the
# element itself
element['id'] = element_id # create a new entry for the element (dictionary)
# with key 'id' and value the the element_id
resourceClass = element.get('_class', 'not found') # get the class type of the element
......@@ -244,7 +251,8 @@ def createObjects():
interarrivalTime=element.get('interarrivalTime',{})
distributionType=interarrivalTime.get('distributionType', 'not found')
mean=float(interarrivalTime.get('mean') or 0)
entity=str_to_class(element['entity']) # initialize entity
#entity=str_to_class(element['entity']) # initialize entity
entity=element['entity']
S=Source(id, name, distributionType, mean, entity) # initialize Source
S.nextIds=getSuccessorList(id)
G.SourceList.append(S)
......@@ -256,7 +264,8 @@ def createObjects():
interarrivalTime=element.get('interarrivalTime',{})
distributionType=interarrivalTime.get('distributionType', 'not found')
mean=float(interarrivalTime.get('mean') or 0)
entity=str_to_class(element['entity'])
#entity=str_to_class(element['entity'])
entity=(element['entity'])
batchNumberOfUnits=int(element.get('batchNumberOfUnits', 'not found'))
S=BatchSource(id, name, distributionType, mean, entity, batchNumberOfUnits)
S.nextIds=getSuccessorList(id)
......@@ -1309,6 +1318,8 @@ def createObjectInterruptions():
# used to convert a string read from the input to object type
# ===========================================================================
def str_to_class(str):
str = str.replace("Dream.", "") # XXX temporary.
# actuall this method can be dropped in favor of getClassFromName
return getattr(sys.modules[__name__], str)
# ===========================================================================
......
......@@ -49,7 +49,7 @@ class Machine(CoreObject):
operatorPool='None',operationType='None',\
loadDistribution="No",loadMean=0, loadStdev=0, loadMin=0, loadMax=10,
setupDistribution="No",setupMean=0, setupStdev=0, setupMin=0, setupMax=10,
isPreemptive=False, resetOnPreemption=False):
isPreemptive=False, resetOnPreemption=False, **kw):
CoreObject.__init__(self)
# hold the id, name, and type of the Machine instance
self.id=id
......@@ -77,6 +77,7 @@ class Machine(CoreObject):
the list of operators provided
if the list is empty create operator pool with empty list
'''
# XXX operatorPool is not None ?
if (type(operatorPool) is list) and len(operatorPool)>0:
id = id+'_OP'
name=self.objName+'_operatorPool'
......@@ -911,4 +912,4 @@ class Machine(CoreObject):
json['results']['off_shifts_ratio']['max']=self.OffShift[0]
G.outputJSON['elementList'].append(json)
\ No newline at end of file
......@@ -44,8 +44,10 @@ class MouldAssemblyBuffer(QueueManagedJob):
# the default __init__ method of the QueueManagedJob class
# whereas the default capacity is set to infinity
# =======================================================================
def __init__(self, id, name, capacity=-1, dummy=False, schedulingRule="FIFO"):
QueueManagedJob.__init__(self, id=id, name=name, capacity=capacity, dummy=dummy, schedulingRule=schedulingRule)
def __init__(self, id, name, capacity=-1, isDummy=False,
schedulingRule="FIFO", **kw):
QueueManagedJob.__init__(self, id=id, name=name, capacity=capacity,
isDummy=isDummy, schedulingRule=schedulingRule, **kw)
# =======================================================================
# Sort the entities of the activeQ
......@@ -181,4 +183,4 @@ class MouldAssemblyBuffer(QueueManagedJob):
else:
return thecaller is activeObject.receiver\
and receiverQueue[0].order is activeObjectQueue[0].order\
and activeEntity.order.componentsReadyForAssembly
\ No newline at end of file
and activeEntity.order.componentsReadyForAssembly
......@@ -23,7 +23,7 @@ Created on 22 Nov 2012
'''
'''
models a repairman that can fix a machine when it gets failures
models an operator that operates a machine
'''
from SimPy.Simulation import Resource, now
......@@ -32,10 +32,10 @@ from Repairman import Repairman
# ===========================================================================
# the resource that operates the machines
# ===========================================================================
class Operator(Repairman):
class Operator(Repairman): # XXX isn't it the other way around ?
def __init__(self, id, name, capacity=1):
Repairman.__init__(self,id=id,name=name,capacity=capacity)
def __init__(self, id, name, capacity=1, **kw):
Repairman.__init__(self,id=id,name=name,capacity=capacity, **kw)
self.type="Operator"
......@@ -37,8 +37,11 @@ from Operator import Operator
# ===========================================================================
class OperatorPool(ObjectResource):
def __init__(self, id, name, capacity=1,operatorsList='None'):
self.id=id
def __init__(self, id, name, capacity=1, operatorsList='None', **kw):
capacity = int(capacity or 1)
self.id=id
self.objName=name
self.type="OperatorPool"
......@@ -133,4 +136,4 @@ class OperatorPool(ObjectResource):
return operator.getResourceQueue()
\ No newline at end of file
......@@ -48,7 +48,7 @@ class MouldComponentException(Exception):
# the Order-Decomposition Object
# ===========================================================================
class OrderDecomposition(CoreObject):
def __init__(self, id, name):
def __init__(self, id, name, **kw):
CoreObject.__init__(self)
self.id=id
self.objName=name
......@@ -279,4 +279,4 @@ class OrderDecomposition(CoreObject):
# print 'Mould component exception: {0}'.format(mouldException)
# print 'the component of the order', self.orderToBeDecomposed.name, 'is of type Mould \
# and thus nothing is created', 'time', now()
\ No newline at end of file
......@@ -34,7 +34,7 @@ from CoreObject import CoreObject
# ===========================================================================
class Queue(CoreObject):
def __init__(self, id, name, capacity=1, dummy=False, schedulingRule="FIFO"):
def __init__(self, id, name, capacity=1, isDummy=False, schedulingRule="FIFO", **kw):
CoreObject.__init__(self)
# Process.__init__(self)
# used for the routing of the entities
......@@ -61,7 +61,7 @@ class Queue(CoreObject):
# self.nextIds=[] #list with the ids of the next objects in the flow
# self.previousIds=[] #list with the ids of the previous objects in the flow
self.isDummy=dummy #Boolean that shows if it is the dummy first Queue
self.isDummy=isDummy #Boolean that shows if it is the dummy first Queue
self.schedulingRule=schedulingRule #the scheduling rule that the Queue follows
self.multipleCriterionList=[] #list with the criteria used to sort the Entities in the Queue
SRlist = [schedulingRule]
......
......@@ -36,7 +36,7 @@ from ObjectResource import ObjectResource
# ===========================================================================
class Repairman(ObjectResource):
def __init__(self, id, name, capacity=1):
def __init__(self, id, name, capacity=1, **kw):
ObjectResource.__init__(self)
self.id=id
self.objName=name
......
......@@ -27,15 +27,15 @@ models the source object that generates the entities
'''
from SimPy.Simulation import now, Process, Resource, infinity, hold
from Part import Part
from RandomNumberGenerator import RandomNumberGenerator
from CoreObject import CoreObject
from Globals import G
import Globals
#============================================================================
# The Source object is a Process
#============================================================================
class Source(CoreObject):
def __init__(self, id, name, distribution='Fixed', mean=1, item=Part):
def __init__(self, id, name, distribution='Fixed', mean=1, item='Dream.Part', **kw):
CoreObject.__init__(self)
# Process.__init__(self)
# general properties
......@@ -53,7 +53,7 @@ class Source(CoreObject):
self.type="Source" #String that shows the type of object
self.rng=RandomNumberGenerator(self, self.distType)
self.rng.avg=mean
self.item=item #the type of object that the Source will generate
self.item=Globals.getClassFromName(item) #the type of object that the Source will generate
def initialize(self):
# using the Process __init__ and not the CoreObject __init__
......
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