Commit 605285e8 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Sebastien Robin

More cleanup in source. Batch and SubBatch Entities created

parent 12a91ca1
# ===========================================================================
# 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 22 Oct 2013
@author: George
'''
'''
Batch is an Entity that contains a number of units
'''
from Entity import Entity
#The batch object
class Batch(Entity):
type="Batch"
def __init__(self, id, name, numberOfUnits=1):
Entity.__init__(self, name)
self.id=id
self.numberOfUnits=numberOfUnits
\ No newline at end of file
......@@ -84,21 +84,23 @@ class Source(CoreObject):
activeObject=self.getActiveObject()
activeObjectQueue=self.getActiveObjectQueue()
i=0
while 1:
entity=self.createEntity() #create the Entity object and assign its name
self.numberOfArrivals+=1 #we have one new arrival
entity=self.item(self.item.type+"_"+self.objName+"_"+str(i)) #create the Entity object and assign its name
entity.creationTime=now() #assign the current simulation time as the Entity's creation time
entity.startTime=now() #assign the current simulation time as the Entity's start time
self.outputTrace(self.item.type+"_"+self.objName+"_"+str(i)) #output the trace
self.outputTrace(self.item.type+str(self.numberOfArrivals)) #output the trace
activeObjectQueue.append(entity) #append the entity to the resource
i+=1
yield hold,self,self.calculateInterarrivalTime() #wait until the next arrival
#sets the routing out element for the Source
def defineRouting(self, successorList=[]):
self.next=successorList
#creates an Entity
def createEntity(self):
return self.item(self.item.type+str(self.numberOfArrivals)) #return the newly created Entity
#calculates the processing time
def calculateInterarrivalTime(self):
return self.rng.generateNumber() #this is if we have a default interarrival time for all the entities
......
# ===========================================================================
# 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 22 Oct 2013
@author: George
'''
'''
Batch is an Entity that contains a number of units
'''
from Entity import Entity
#The batch object
class SubBatch(Entity):
type="SubBatch"
def __init__(self, id, name, batchId, numberOfUnits=1):
Entity.__init__(self, name)
self.id=id
self.numberOfUnits=numberOfUnits
self.batchId=batchId
\ 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