Commit 10b97050 authored by Georgios Dagkakis's avatar Georgios Dagkakis

single server example running

parent bda75a38
from dream.simulation.imports import Machine, Source, Exit, Part, G from dream.simulation.imports import Machine, Source, Exit, Part, G
from dream.simulation.imports import simulate, activate, initialize 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 #define the objects of the model
S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part') S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
...@@ -12,21 +15,20 @@ G.ObjList=[S,M,E] #add all the objects in G.ObjList so that they can be easier ...@@ -12,21 +15,20 @@ G.ObjList=[S,M,E] #add all the objects in G.ObjList so that they can be easier
S.defineRouting(successorList=[M]) S.defineRouting(successorList=[M])
M.defineRouting(predecessorList=[S],successorList=[E]) M.defineRouting(predecessorList=[S],successorList=[E])
E.defineRouting(predecessorList=[M]) E.defineRouting(predecessorList=[M])
def main(): def main():
initialize() #initialize the simulation (SimPy method)
#initialize all the objects #initialize all the objects
for object in G.ObjList: for object in G.ObjList:
object.initialize() object.initialize()
#activate all the objects #activate all the objects
for object in G.ObjList: for object in G.ObjList:
activate(object, object.run()) G.env.process(object.run())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day) G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
simulate(until=G.maxSimTime) #run the simulation G.env.run(G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology #carry on the post processing operations for every object in the topology
for object in G.ObjList: for object in G.ObjList:
......
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