Commit 618b8084 authored by Georgios Dagkakis's avatar Georgios Dagkakis

TwoServersStochastic example updated to match the new notation. Also in the documentation

parent 99719b39
No preview for this file type
No preview for this file type
from dream.simulation.imports import Machine, Source, Exit, Part, G, Repairman, Queue, Failure
from dream.simulation.imports import simpy
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model
R=Repairman('R1', 'Bob')
S=Source('S1','Source', interarrivalTime={'distributionType':'Exp','mean':0.5}, entity='Dream.Part')
......@@ -31,10 +28,16 @@ G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
G.numberOfReplications=10 #set 10 replications
G.confidenceLevel=0.99 #set the confidence level. 0.99=99%
#run the replications
for i in range(G.numberOfReplications):
def main():
throughputList=[] # a list to hold the throughput of each replication
#run the replications
for i in range(G.numberOfReplications):
G.seed+=1 #increment the seed so that we get different random numbers in each run.
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#initialize all the objects
for object in G.ObjList:
object.initialize()
......@@ -61,10 +64,21 @@ for i in range(G.numberOfReplications):
for objectResource in G.ObjectResourceList:
objectResource.postProcessing()
#output data to excel for every object
for object in G.ObjList:
object.outputResultsXL()
R.outputResultsXL()
# append the numbe of exits in the throughputList
throughputList.append(E.numOfExits)
print 'The exit of each replication is:'
print throughputList
G.outputFile.save("output.xls")
# calculate confidence interval using the Knowledge Extraction tool
from dream.KnowledgeExtraction.ConfidenceIntervals import Intervals
from dream.KnowledgeExtraction.StatisticalMeasures import BasicStatisticalMeasures
BSM=BasicStatisticalMeasures()
lb, ub = Intervals().ConfidIntervals(throughputList, 0.95)
print 'the 95% confidence interval for the throughput is:'
print 'lower bound:', lb
print 'mean:', BSM.mean(throughputList)
print 'upper bound:', ub
if __name__ == '__main__':
main()
\ 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