Commit c501105b authored by Georgios Dagkakis's avatar Georgios Dagkakis

first version of nonStarvingEntry. Also one test and its dump

parent 1f979770
{
"_class": "Dream.Simulation",
"edges": {
"0": [
"NS1",
"M1",
{}
],
"1": [
"M1",
"E1",
{}
]
},
"general": {
"_class": "Dream.Configuration",
"confidenceLevel": "0.95",
"maxSimTime": "10",
"numberOfReplications": "1",
"trace": "No"
},
"nodes": {
"E1": {
"_class": "Dream.Exit",
"left": 0.5,
"name": "Stock",
"top": 0.10215053763440862
},
"M1": {
"_class": "Dream.Machine",
"failures": {
"failureDistribution": "No"
},
"left": 0.5,
"name": "Moulding",
"processingTime": {
"distributionType": "Fixed",
"mean": 1
},
"top": 0.5
},
"NS1": {
"_class": "Dream.NonStarvingEntry",
"entityData": {
"_class": "Dream.Part"
},
"left": 0.5,
"name": "Raw Material",
"top": 0.8978494623655914
}
}
}
\ 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 8 Nov 2012
@author: George
'''
'''
Models an intro element that is never starved.
In removeEntity, each time it falls below a specific level it creates new Entities
'''
import simpy
from Queue import Queue
# ===========================================================================
# the Queue object
# ===========================================================================
class NonStarvingEntry(Queue):
family='Entry'
def __init__(self, id, name, capacity=float('inf'), entityData={'_class':'Dream.Part'}, threshold=2,
initialWIPLevel=2,**kw):
Queue.__init__(self, id=id,name=name, capacity=capacity)
self.threshold=int(threshold)
self.initialWIPLevel=int(initialWIPLevel)
self.entityData=dict(entityData)
def initialize(self):
Queue.initialize(self)
from Globals import G
import Globals
for i in range(self.initialWIPLevel):
self.createEntity()
def removeEntity(self, entity=None):
activeEntity=Queue.removeEntity(self, entity) #run the default method
activeObjectQueue=self.getActiveObjectQueue()
entityType=self.entityData.get('_class', None)
if len(activeObjectQueue)<self.threshold:
self.createEntity()
return activeEntity
def createEntity(self):
from Globals import G
import Globals
entityType=self.entityData.get('_class', None)
assert entityType, 'the entity type of the non starving buffer could not be identified'
entityType=Globals.getClassFromName(entityType)
Eargs={'id':G.numberOfEntities,
'name':str(entityType)+str(G.numberOfEntities),
'currentStation':self
}
E=entityType(**Eargs)
Globals.setWIP([E])
G.numberOfEntities+=1
if not self.canDispose.triggered:
self.canDispose.succeed(self.env.now)
\ No newline at end of file
{
"_class": "Dream.Simulation",
"elementList": [
{
"_class": "Dream.Exit",
"family": "Exit",
"id": "E1",
"results": {
"lifespan": 5.0,
"takt_time": 1.0,
"throughput": 9
}
},
{
"_class": "Dream.Machine",
"family": "Server",
"id": "M1",
"results": {
"blockage_ratio": 0.0,
"failure_ratio": 0.0,
"waiting_ratio": 0.0,
"working_ratio": 100.0
}
},
{
"_class": "Dream.NonStarvingEntry",
"family": "Entry",
"id": "NS1",
"results": {}
}
],
"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