Debian Codegraph @

docs/source/Tutorials/bankprograms_OO/bank01_OO.py

raw symbols SCIP
1 """ bank01_OO: The single non-random Customer """
2 from SimPy.Simulation import Simulation, Process, hold
3
4
5 ## Model components -----------------------------
6 class Customer(Process):
7 """ Customer arrives, looks around and leaves """
8
9 def visit(self, timeInBank):
10 print("%2.1f %s Here I am" % (self.sim.now(), self.name))
11 yield hold, self, timeInBank
12 print("%2.1f %s I must leave" % (self.sim.now(), self.name))
13
14
15 ## Model ----------------------------------------
16 class BankModel(Simulation):
17 def run(self):
18 """ PEM """
19 c = Customer(name="Klaus", sim=self)
20 self.activate(c, c.visit(timeInBank), at=tArrival)
21 self.simulate(until=maxTime)
22
23 ## Experiment data ------------------------------
24
25 maxTime = 100.0 # minutes
26 timeInBank = 10.0 # minutes
27 tArrival = 5.0 # minutes
28
29 ## Experiment -----------------------------------
30
31 mymodel = BankModel()
32 mymodel.run()