1
2 from SimPy.SimulationRT import *
3 """testRT_Behavior_OO.py
4 Tests SimulationRT for degree to which simulation time
5 and wallclock time can be synchronized.
6
7 OO API.
8 """
9
10
11 print "Under test: SimulationRT.py %s"% version
12 __version__ = '2.0 $Revision: 295 $ $Date: 2009-03-30 14:26:20 +0200 (Mo, 30 Mrz 2009) $ '
13 print 'testRT_Behavior.py %s'%__version__
14
23
24 s=SimulationRT()
25 s.initialize()
26 t=Ticker(sim=s)
27 s.activate(t,t.tick())
28 s.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 s1=SimulationRT()
36 s1.initialize()
37 t=Ticker(sim=s1)
38 s1.activate(t,t.tick())
39 s1.simulate(until=10,real_time=True,rel_speed=5)
40
41 print
42 print "Speed ratio set: 5"
43 print "------------------"
44 for tSim,tRT in t.timing:
45 print "tSim:%s, tRT:%s, speed ratio:%s"%(tSim,tRT,tSim/tRT)
46