1
2
3 from SimPy.SimulationRT import *
4 """testRT_Behavior_OO.py
5 Tests SimulationRT for degree to which simulation time
6 and wallclock time can be synchronized.
7
8 Non-OO API.
9 """
10
11
12 print "Under test: SimulationRT.py %s"% version
13 __version__ = '2.1 $Revision: 419 $ $Date: 2010-03-29 16:03:43 +0200 (Mon, 29 Mar 2010) $ '
14 print 'testRT_Behavior.py %s'%__version__
15
24
25 initialize()
26 t=Ticker()
27 activate(t,t.tick())
28 simulate(until=10,real_time=True,rel_speed=1)
29
30 print "Speed ratio set: 1"
31 print "------------------"
32 for tSim,tRT in t.timing:
33 print "tSim:%s, tRT:%s, speed ratio:%s"%(tSim,tRT,tSim/tRT)
34
35 initialize()
36 t=Ticker()
37 activate(t,t.tick())
38 simulate(until=10,real_time=True,rel_speed=5)
39
40 print
41 print "Speed ratio set: 5"
42 print "------------------"
43 for tSim,tRT in t.timing:
44 print "tSim:%s, tRT:%s, speed ratio:%s"%(tSim,tRT,tSim/tRT)
45