Two Servers With Failures

In this model we have two Machines and a Queue between them. The Machines are vulnerable to failures and when a failure happens then they need a repairman to get fixed. The representation is given in the figure below:

In this model we have two Machines and a Queue between them. The Machines are vulnerable to failures and when a failure happens then they need a repairman to get fixed. In our model there is only one repairman named Bob available. We have the following data:

The source produces parts. One part is produced every 30 seconds.

For Machine1:
  • Processing time is Fixed to 15 seconds
  • MTTF is 1 hour
  • MTTR is 5 minutes
For Machine2:
  • Processing time is Fixed to 90 seconds
  • MTTF is 40 minute
  • MTTR is 10 minute

The capacity of the Queue is 1.

We want to study the system in a 24 hours period and identify the number of items that are produced, the blockage ratio in Machine1 and the working ration of the repairman.

The code for the model is given below. Note that:
  • In the Failure type we define the Machine that gets the failure as victim and the repairman resource (if any) that is needed to fix the failure as repairman
  • For Machine1
In [8]:
from dream.simulation.imports import Machine, Source, Exit, Part, Repairman, Queue, Failure 
from dream.simulation.Globals import runSimulation

#define the objects of the model
R=Repairman('R1', 'Bob')
S=Source('S1','Source', interArrivalTime={'Fixed':{'mean':0.5}}, entity='Dream.Part')
M1=Machine('M1','Machine1', processingTime={'Fixed':{'mean':0.25}})
Q=Queue('Q1','Queue')
M2=Machine('M2','Machine2', processingTime={'Fixed':{'mean':1.5}})
E=Exit('E1','Exit')  
#create failures
F1=Failure(victim=M1, distribution={'TTF':{'Fixed':{'mean':60.0}},'TTR':{'Fixed':{'mean':5.0}}}, repairman=R) 
F2=Failure(victim=M2, distribution={'TTF':{'Fixed':{'mean':40.0}},'TTR':{'Fixed':{'mean':10.0}}}, repairman=R)

#define predecessors and successors for the objects    
S.defineRouting([M1])
M1.defineRouting([S],[Q])
Q.defineRouting([M1],[M2])
M2.defineRouting([Q],[E])
E.defineRouting([M2])
  
# add all the objects in a list
objectList=[S,M1,M2,E,Q,R,F1,F2]  
# set the length of the experiment  
maxSimTime=1440.0
# call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime)

# calculate metrics
blockage_ratio = (M1.totalBlockageTime/maxSimTime)*100
working_ratio = (R.totalWorkingTime/maxSimTime)*100    

#print the results
print "the system produced", E.numOfExits, "parts"
print "the blockage ratio of", M1.objName,  "is", blockage_ratio, "%"
print "the working ratio of", R.objName,"is", working_ratio, "%"
the system produced 732 parts
the blockage ratio of Machine1 is 78.1770833333 %
the working ratio of Bob is 26.7361111111 %