/usr/share/doc/python-simpy-doc/html/Manuals/SimRTManual.html is in python-simpy-doc 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simulation with Real Time Synchronization — SimPy 2.3.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '2.3.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="SimPy 2.3.1 documentation" href="../index.html" />
<link rel="up" title="Manuals" href="../Manuals.html" />
<link rel="next" title="Simulation with Event Stepping" href="SimStepManual.html" />
<link rel="prev" title="Simulation with Tracing" href="Tracing.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="SimStepManual.html" title="Simulation with Event Stepping"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="Tracing.html" title="Simulation with Tracing"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">SimPy 2.3.1 documentation</a> »</li>
<li><a href="../Manuals.html" accesskey="U">Manuals</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="simulation-with-real-time-synchronization">
<h1><a class="toc-backref" href="#id1">Simulation with Real Time Synchronization</a><a class="headerlink" href="#simulation-with-real-time-synchronization" title="Permalink to this headline">¶</a></h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Authors:</th><td class="field-body"><ul class="first simple">
<li>Klaus Muller <<a class="reference external" href="mailto:Muller%40users.sourceforge.net">Muller<span>@</span>users<span>.</span>sourceforge<span>.</span>net</a>></li>
<li>Tony Vignaux <<a class="reference external" href="mailto:Vignaux%40users.sourceforge.net">Vignaux<span>@</span>users<span>.</span>sourceforge<span>.</span>net</a>></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">SimPy release:</th><td class="field-body"><p class="first">2.3.1</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Web-site:</th><td class="field-body"><p class="first"><a class="reference external" href="http://simpy.sourceforge.net/">http://simpy.sourceforge.net/</a></p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Python-Version:</th><td class="field-body"><p class="first">2.6+</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Date:</th><td class="field-body"><p class="first last">December 2011</p>
</td>
</tr>
</tbody>
</table>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#simulation-with-real-time-synchronization" id="id1">Simulation with Real Time Synchronization</a><ul>
<li><a class="reference internal" href="#acknowledgement" id="id2">Acknowledgement</a></li>
<li><a class="reference internal" href="#synchronizing-with-wall-clock-time" id="id3">Synchronizing with wall clock time</a></li>
<li><a class="reference internal" href="#changing-the-execution-speed-during-a-simulation-run" id="id4">Changing the execution speed during a simulation run</a></li>
<li><a class="reference internal" href="#limitations" id="id5">Limitations</a></li>
<li><a class="reference internal" href="#the-simulationrt-api" id="id6">The SimulationRT API</a><ul>
<li><a class="reference internal" href="#structure" id="id7">Structure</a></li>
<li><a class="reference internal" href="#simulate" id="id8"><strong>simulate</strong></a></li>
<li><a class="reference internal" href="#rtset" id="id9"><strong>rtset</strong></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<p>This manual describes <strong>SimulationRT</strong>, a SimPy module which supports
synchronizing the execution of simulation models with real (wallclock) time.</p>
<div class="section" id="acknowledgement">
<h2><a class="toc-backref" href="#id2">Acknowledgement</a><a class="headerlink" href="#acknowledgement" title="Permalink to this headline">¶</a></h2>
<p>SimulationRT is based on an idea by Geoff Jarrad of CSIRO (Australia). He
contributed a lot to its development and testing on Windows and Unix.</p>
<p>The code for the adjustment of the execution speed during the simulation run
was contributed by Robert C. Ramsdell.</p>
</div>
<div class="section" id="synchronizing-with-wall-clock-time">
<h2><a class="toc-backref" href="#id3">Synchronizing with wall clock time</a><a class="headerlink" href="#synchronizing-with-wall-clock-time" title="Permalink to this headline">¶</a></h2>
<p>SimulationRT allows synchronizing simulation time and real (wallclock) time.
This capability can be used to implement e.g. interactive game applications or
to demonstrate a model’s execution in real time.</p>
<p>It is identical to Simulation, except for the <em>simulate</em> function which takes
an additional parameter controlling real-time execution speed.</p>
<p>Here is an example:</p>
<div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25</pre></div></td><td class="code"><div class="highlight"><pre><span class="sd">""" RealTimeFireworks.py """</span>
<span class="kn">from</span> <span class="nn">SimPy.SimulationRT</span> <span class="kn">import</span> <span class="o">*</span>
<span class="kn">from</span> <span class="nn">random</span> <span class="kn">import</span> <span class="o">*</span>
<span class="kn">import</span> <span class="nn">time</span>
<span class="c">## Model components -----------------------------------------------------------</span>
<span class="k">class</span> <span class="nc">Launcher</span><span class="p">(</span><span class="n">Process</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">launch</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
<span class="k">print</span> <span class="s">"Launch at </span><span class="si">%2.2f</span><span class="s">; wallclock: </span><span class="si">%2.2f</span><span class="s">"</span><span class="o">%</span><span class="p">(</span><span class="n">now</span><span class="p">(),</span><span class="n">time</span><span class="o">.</span><span class="n">clock</span><span class="p">()</span><span class="o">-</span><span class="n">startTime</span><span class="p">)</span>
<span class="k">yield</span> <span class="n">hold</span><span class="p">,</span><span class="bp">self</span><span class="p">,</span><span class="n">uniform</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="n">maxFlightTime</span><span class="p">)</span>
<span class="k">print</span> <span class="s">"Boom!!! Aaaah!! at </span><span class="si">%2.2f</span><span class="s">; wallclock: </span><span class="si">%2.2f</span><span class="s">"</span>\
<span class="o">%</span><span class="p">(</span><span class="n">now</span><span class="p">(),</span><span class="n">time</span><span class="o">.</span><span class="n">clock</span><span class="p">()</span><span class="o">-</span><span class="n">startTime</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">model</span><span class="p">():</span>
<span class="n">initialize</span><span class="p">()</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">nrLaunchers</span><span class="p">):</span>
<span class="n">lau</span><span class="o">=</span><span class="n">Launcher</span><span class="p">()</span>
<span class="n">activate</span><span class="p">(</span><span class="n">lau</span><span class="p">,</span><span class="n">lau</span><span class="o">.</span><span class="n">launch</span><span class="p">())</span>
<span class="n">simulate</span><span class="p">(</span><span class="n">real_time</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span><span class="n">rel_speed</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span><span class="n">until</span><span class="o">=</span><span class="mi">20</span><span class="p">)</span> <span class="c">##unit sim time = 1 sec clock</span>
<span class="c">## Experiment data ----------------------------------------------------------- </span>
<span class="n">nrLaunchers</span><span class="o">=</span><span class="mi">2</span>
<span class="n">maxFlightTime</span><span class="o">=</span><span class="mf">5.0</span>
<span class="n">startTime</span><span class="o">=</span><span class="n">time</span><span class="o">.</span><span class="n">clock</span><span class="p">()</span>
<span class="n">seed</span><span class="p">(</span><span class="mi">1234567</span><span class="p">)</span>
<span class="c">## Experiment ----------------------------------------------------------------- </span>
<span class="n">model</span><span class="p">()</span>
</pre></div>
</td></tr></table></div>
<p><em>rel_speed</em> is the ratio <strong>simulated time/wallclock time</strong>. <em>rels_speed=1</em> sets the synchronization so that 1 simulation time unit
is executed in approximately 1 second of wallclock time.
Run under Python 2.6 on a Windows Vista-box (2.3 GHz), this output resulted
over about 17.5 seconds of wallclock time:</p>
<div class="highlight-python"><pre>Launch at 0.00; wallclock: 0.00
Launch at 0.00; wallclock: 0.00
Boom!!! Aaaah!! at 3.04; wallclock: 3.03
Launch at 3.04; wallclock: 3.03
Boom!!! Aaaah!! at 3.90; wallclock: 3.90
Launch at 3.90; wallclock: 3.90
Boom!!! Aaaah!! at 5.47; wallclock: 5.47
Launch at 5.47; wallclock: 5.47
Boom!!! Aaaah!! at 6.50; wallclock: 6.50
Launch at 6.50; wallclock: 6.50
Boom!!! Aaaah!! at 7.35; wallclock: 7.35
Launch at 7.35; wallclock: 7.35
Boom!!! Aaaah!! at 9.88; wallclock: 9.87
Launch at 9.88; wallclock: 9.87
Boom!!! Aaaah!! at 10.71; wallclock: 10.70
Launch at 10.71; wallclock: 10.70
Boom!!! Aaaah!! at 11.84; wallclock: 11.84
Launch at 11.84; wallclock: 11.84
Boom!!! Aaaah!! at 12.17; wallclock: 12.16
Launch at 12.17; wallclock: 12.16
Boom!!! Aaaah!! at 13.78; wallclock: 13.78
Launch at 13.78; wallclock: 13.78
Boom!!! Aaaah!! at 14.63; wallclock: 14.62
Launch at 14.63; wallclock: 14.62
Boom!!! Aaaah!! at 17.30; wallclock: 17.29
Launch at 17.30; wallclock: 17.29
Boom!!! Aaaah!! at 17.32; wallclock: 17.31
Launch at 17.32; wallclock: 17.31
</pre>
</div>
<p>Clearly, the wallclock time does not deviate significantly from the simulation time.</p>
</div>
<div class="section" id="changing-the-execution-speed-during-a-simulation-run">
<h2><a class="toc-backref" href="#id4">Changing the execution speed during a simulation run</a><a class="headerlink" href="#changing-the-execution-speed-during-a-simulation-run" title="Permalink to this headline">¶</a></h2>
<p>By calling method <em>rtset</em> with a parameter, the ratio simulated time to wallclock time
can be changed during a run.</p>
<p>Here is an example:</p>
<div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40</pre></div></td><td class="code"><div class="highlight"><pre><span class="sd">"""variableTimeRatio.py</span>
<span class="sd">Shows the SimulationRT capability to change the ratio simulation</span>
<span class="sd">time to wallclock time during the run of a simulation.</span>
<span class="sd">"""</span>
<span class="kn">from</span> <span class="nn">SimPy.SimulationRT</span> <span class="kn">import</span> <span class="o">*</span>
<span class="k">class</span> <span class="nc">Changer</span><span class="p">(</span><span class="n">Process</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">change</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">when</span><span class="p">,</span><span class="n">rat</span><span class="p">):</span>
<span class="k">global</span> <span class="n">ratio</span>
<span class="k">yield</span> <span class="n">hold</span><span class="p">,</span><span class="bp">self</span><span class="p">,</span><span class="n">when</span>
<span class="n">rtset</span><span class="p">(</span><span class="n">rat</span><span class="p">)</span>
<span class="n">ratio</span><span class="o">=</span><span class="n">rat</span>
<span class="k">class</span> <span class="nc">Series</span><span class="p">(</span><span class="n">Process</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">tick</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">nrTicks</span><span class="p">):</span>
<span class="n">oldratio</span><span class="o">=</span><span class="n">ratio</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">nrTicks</span><span class="p">):</span>
<span class="n">tLastSim</span><span class="o">=</span><span class="n">now</span><span class="p">()</span>
<span class="n">tLastWallclock</span><span class="o">=</span><span class="n">wallclock</span><span class="p">()</span>
<span class="k">yield</span> <span class="n">hold</span><span class="p">,</span><span class="bp">self</span><span class="p">,</span><span class="mi">1</span>
<span class="n">diffSim</span><span class="o">=</span><span class="n">now</span><span class="p">()</span><span class="o">-</span><span class="n">tLastSim</span>
<span class="n">diffWall</span><span class="o">=</span><span class="n">wallclock</span><span class="p">()</span><span class="o">-</span><span class="n">tLastWallclock</span>
<span class="k">print</span> <span class="s">"now(): </span><span class="si">%s</span><span class="s">, sim. time elapsed: </span><span class="si">%s</span><span class="s">, wall clock elapsed: "</span>\
<span class="s">"</span><span class="si">%6.3f</span><span class="s">, sim/wall time ratio: </span><span class="si">%6.3f</span><span class="s">"</span>\
<span class="o">%</span><span class="p">(</span><span class="n">now</span><span class="p">(),</span><span class="n">diffSim</span><span class="p">,</span><span class="n">diffWall</span><span class="p">,</span><span class="n">diffSim</span><span class="o">/</span><span class="n">diffWall</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">ratio</span><span class="o">==</span><span class="n">oldratio</span><span class="p">:</span>
<span class="k">print</span> <span class="s">"At simulation time </span><span class="si">%s</span><span class="s">: ratio simulation/wallclock "</span>\
<span class="s">"time now changed to </span><span class="si">%s</span><span class="s">"</span><span class="o">%</span><span class="p">(</span><span class="n">now</span><span class="p">(),</span><span class="n">ratio</span><span class="p">)</span>
<span class="n">oldratio</span><span class="o">=</span><span class="n">ratio</span>
<span class="n">initialize</span><span class="p">()</span>
<span class="n">ticks</span><span class="o">=</span><span class="mi">15</span>
<span class="n">s</span><span class="o">=</span><span class="n">Series</span><span class="p">()</span>
<span class="n">activate</span><span class="p">(</span><span class="n">s</span><span class="p">,</span><span class="n">s</span><span class="o">.</span><span class="n">tick</span><span class="p">(</span><span class="n">nrTicks</span><span class="o">=</span><span class="n">ticks</span><span class="p">))</span>
<span class="n">c</span><span class="o">=</span><span class="n">Changer</span><span class="p">()</span>
<span class="n">activate</span><span class="p">(</span><span class="n">c</span><span class="p">,</span><span class="n">c</span><span class="o">.</span><span class="n">change</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">5</span><span class="p">))</span>
<span class="n">c</span><span class="o">=</span><span class="n">Changer</span><span class="p">()</span>
<span class="n">activate</span><span class="p">(</span><span class="n">c</span><span class="p">,</span><span class="n">c</span><span class="o">.</span><span class="n">change</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span><span class="mi">10</span><span class="p">))</span>
<span class="n">ratio</span><span class="o">=</span><span class="mi">1</span>
<span class="k">print</span> <span class="s">"At simulation time </span><span class="si">%s</span><span class="s">: set ratio simulation/wallclock time to </span><span class="si">%s</span><span class="s">"</span>\
<span class="o">%</span><span class="p">(</span><span class="n">now</span><span class="p">(),</span><span class="n">ratio</span><span class="p">)</span>
<span class="n">simulate</span><span class="p">(</span><span class="n">until</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span><span class="n">real_time</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span><span class="n">rel_speed</span><span class="o">=</span><span class="n">ratio</span><span class="p">)</span>
</pre></div>
</td></tr></table></div>
<p>The program changes the time ratio twice, at simulation times 5 and 10.</p>
<p>When run on a Windows Vista computer under Python 2.6, this results in this output:</p>
<div class="highlight-python"><pre>At simulation time 0: set ratio simulation/wallclock time to 1
now(): 1, sim. time elapsed: 1, wall clock elapsed: 0.998, sim/wall time ratio: 1.002
now(): 2, sim. time elapsed: 1, wall clock elapsed: 0.999, sim/wall time ratio: 1.001
now(): 3, sim. time elapsed: 1, wall clock elapsed: 0.999, sim/wall time ratio: 1.001
now(): 4, sim. time elapsed: 1, wall clock elapsed: 0.999, sim/wall time ratio: 1.001
now(): 5, sim. time elapsed: 1, wall clock elapsed: 0.999, sim/wall time ratio: 1.001
At simulation time 5: ratio simulation/wallclock time now changed to 5
now(): 6, sim. time elapsed: 1, wall clock elapsed: 0.199, sim/wall time ratio: 5.027
now(): 7, sim. time elapsed: 1, wall clock elapsed: 0.199, sim/wall time ratio: 5.025
now(): 8, sim. time elapsed: 1, wall clock elapsed: 0.199, sim/wall time ratio: 5.026
now(): 9, sim. time elapsed: 1, wall clock elapsed: 0.199, sim/wall time ratio: 5.026
now(): 10, sim. time elapsed: 1, wall clock elapsed: 0.199, sim/wall time ratio: 5.024
At simulation time 10: ratio simulation/wallclock time now changed to 10
now(): 11, sim. time elapsed: 1, wall clock elapsed: 0.099, sim/wall time ratio: 10.108
now(): 12, sim. time elapsed: 1, wall clock elapsed: 0.099, sim/wall time ratio: 10.105
now(): 13, sim. time elapsed: 1, wall clock elapsed: 0.099, sim/wall time ratio: 10.102
now(): 14, sim. time elapsed: 1, wall clock elapsed: 0.099, sim/wall time ratio: 10.104
now(): 15, sim. time elapsed: 1, wall clock elapsed: 0.099, sim/wall time ratio: 10.104
</pre>
</div>
</div>
<div class="section" id="limitations">
<h2><a class="toc-backref" href="#id5">Limitations</a><a class="headerlink" href="#limitations" title="Permalink to this headline">¶</a></h2>
<p>This module works much better under Windows than under Unix or Linux, i.e., it gives
much closer synchronization.
Unfortunately, the handling of time in Python is not platform-independent at all.
Here is a quote from the documentation of the <em>time</em> module:</p>
<div class="highlight-python"><pre>"clock()
On Unix, return the current processor time as a floating point number expressed in seconds.
The precision, and in fact the very definition of the meaning of ``processor time'' , depends
on that of the C function of the same name, but in any case, this is the function to use for
benchmarking Python or timing algorithms.
On Windows, this function returns wall-clock seconds elapsed since the first call to this
function, as a floating point number, based on the Win32 function QueryPerformanceCounter().
The resolution is typically better than one microsecond.
"</pre>
</div>
</div>
<div class="section" id="the-simulationrt-api">
<h2><a class="toc-backref" href="#id6">The SimulationRT API</a><a class="headerlink" href="#the-simulationrt-api" title="Permalink to this headline">¶</a></h2>
<div class="section" id="structure">
<h3><a class="toc-backref" href="#id7">Structure</a><a class="headerlink" href="#structure" title="Permalink to this headline">¶</a></h3>
<p>Basically, SimulationStep has the same API as Simulation, but with:</p>
<blockquote>
<div><ul class="simple">
<li>a change in the definition of simulate, and</li>
<li>an additional method to change execution speed during a simulation
run.</li>
</ul>
</div></blockquote>
</div>
<div class="section" id="simulate">
<h3><a class="toc-backref" href="#id8"><strong>simulate</strong></a><a class="headerlink" href="#simulate" title="Permalink to this headline">¶</a></h3>
<p>Executes the simulation model.</p>
<p>Call:</p>
<blockquote>
<div><strong>simulate(<optional parameters>)</strong></div></blockquote>
<dl class="docutils">
<dt>Mandatory parameters:</dt>
<dd>None.</dd>
<dt>Optional parameters:</dt>
<dd><ul class="first last simple">
<li><strong>until=0</strong> : the maximum simulation (end) time (positive floating point number; default: 0)</li>
<li><strong>real_time=False</strong> : flag to switch real time synchronization on or off (boolean; default: False, meaning no synchronization)</li>
<li><strong>rel_speed=1</strong> : ratio simulation time over wallclock time; example: <em>rel_speed=200</em> executes 200 units of simulation time in about one second (positive floating point number; default: 1, i.e. 1 sec of simulation time is executed in about 1 sec of wallclock time)</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>Simulation status at exit.</dd>
</dl>
</div>
<div class="section" id="rtset">
<h3><a class="toc-backref" href="#id9"><strong>rtset</strong></a><a class="headerlink" href="#rtset" title="Permalink to this headline">¶</a></h3>
<p>Changes the ratio simulation time over wall clock time.</p>
<p>Call:</p>
<blockquote>
<div><strong>rtset(<new ratio>)</strong></div></blockquote>
<dl class="docutils">
<dt>Mandatory parameters:</dt>
<dd>None</dd>
<dt>Optional parameters:</dt>
<dd><ul class="first last simple">
<li><strong>rel_speed=1</strong> : ratio simulation time over wallclock time; example: <em>rel_speed=200</em> executes 200 units of simulation time in about one second (positive floating point number; default: 1, i.e. 1 sec of simulation time is executed in about 1 sec of wallclock time)</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>None</dd>
</dl>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/sm_SimPy_Logo.png" alt="Logo"/>
</a></p>
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Simulation with Real Time Synchronization</a><ul>
<li><a class="reference internal" href="#acknowledgement">Acknowledgement</a></li>
<li><a class="reference internal" href="#synchronizing-with-wall-clock-time">Synchronizing with wall clock time</a></li>
<li><a class="reference internal" href="#changing-the-execution-speed-during-a-simulation-run">Changing the execution speed during a simulation run</a></li>
<li><a class="reference internal" href="#limitations">Limitations</a></li>
<li><a class="reference internal" href="#the-simulationrt-api">The SimulationRT API</a><ul>
<li><a class="reference internal" href="#structure">Structure</a></li>
<li><a class="reference internal" href="#simulate"><strong>simulate</strong></a></li>
<li><a class="reference internal" href="#rtset"><strong>rtset</strong></a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="Tracing.html"
title="previous chapter">Simulation with Tracing</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="SimStepManual.html"
title="next chapter">Simulation with Event Stepping</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/Manuals/SimRTManual.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="SimStepManual.html" title="Simulation with Event Stepping"
>next</a> |</li>
<li class="right" >
<a href="Tracing.html" title="Simulation with Tracing"
>previous</a> |</li>
<li><a href="../index.html">SimPy 2.3.1 documentation</a> »</li>
<li><a href="../Manuals.html" >Manuals</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2002-2011, Klaus Müller, Tony Vignaux, Ontje Lünsdorf, Stefan Scherfke.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>
|