Debian Codegraph @

docs/source/Tutorials/bankprograms/bank02.py

raw symbols SCIP
1 """ bank02: More Customers """
2 from SimPy.Simulation import *
3
4 ## Model components ------------------------
5
6
7 class Customer(Process):
8 """ Customer arrives, looks around and leaves """
9
10 def visit(self, timeInBank):
11 print("%7.4f %s: Here I am" % (now(), self.name)) # (1)
12 yield hold, self, timeInBank
13 print("%7.4f %s: I must leave" % (now(), self.name)) # (2)
14
15 ## Experiment data -------------------------
16
17 maxTime = 400.0 # minutes # (3)
18
19 ## Model/Experiment ------------------------------
20
21 initialize()
22
23 c1 = Customer(name="Klaus") # (4)
24 activate(c1, c1.visit(timeInBank=10.0), at=5.0)
25 c2 = Customer(name="Tony")
26 activate(c2, c2.visit(timeInBank=7.0), at=2.0)
27 c3 = Customer(name="Evelyn")
28 activate(c3, c3.visit(timeInBank=20.0), at=12.0) # (5)
29
30 simulate(until=maxTime) # (6)