-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.routemobi.html
648 lines (549 loc) · 31.8 KB
/
node.routemobi.html
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
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>node.routemobi module — PyMoSim v0.8 Manual</title>
<link href="_static/css/theme.css" rel="stylesheet" />
<link href="_static/css/index.c5995385ac14fb8791e8eb36b4908be2.css" rel="stylesheet" />
<link rel="stylesheet"
href="_static/vendor/fontawesome/5.13.0/css/all.min.css">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/basic.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
<link rel="preload" as="script" href="_static/js/index.1c5a1a01449ed65a7b51.js">
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="node.timer module" href="node.timer.html" />
<link rel="prev" title="node.obstacle module" href="node.obstacle.html" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="docsearch:language" content="en" />
</head>
<body data-spy="scroll" data-target="#bd-toc-nav" data-offset="80">
<div class="container-fluid" id="banner"></div>
<nav class="navbar navbar-light navbar-expand-lg bg-light fixed-top bd-navbar" id="navbar-main"><div class="container-xl">
<div id="navbar-start">
<a class="navbar-brand" href="index.html">
<img src="_static/icon.png" class="logo" alt="logo">
</a>
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-collapsible" aria-controls="navbar-collapsible" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar-collapsible" class="col-lg-9 collapse navbar-collapse">
<div id="navbar-center" class="mr-auto">
<div class="navbar-center-item">
<ul id="navbar-main-elements" class="navbar-nav">
<li class="toctree-l1 nav-item">
<a class="reference internal nav-link" href="comm.html">
comm package
</a>
</li>
<li class="toctree-l1 current active nav-item">
<a class="reference internal nav-link" href="node.html">
node package
</a>
</li>
<li class="toctree-l1 nav-item">
<a class="reference internal nav-link" href="sim.html">
sim package
</a>
</li>
<li class="toctree-l1 nav-item">
<a class="reference internal nav-link" href="map.html">
map package
</a>
</li>
</ul>
</div>
</div>
<div id="navbar-end">
<div class="navbar-end-item">
<form class="bd-search d-flex align-items-center" action="search.html" method="get">
<i class="icon fas fa-search"></i>
<input type="search" class="form-control" name="q" id="search-input" placeholder="Search the docs ..." aria-label="Search the docs ..." autocomplete="off" >
</form>
</div>
<div class="navbar-end-item">
<ul id="navbar-icon-links" class="navbar-nav" aria-label="Icon Links">
<li class="nav-item">
<a class="nav-link" href="https://github.com/cfoh/pymosim" rel="noopener" target="_blank" title="GitHub">
<span><i class="fab fa-github-square"></i></span>
<label class="sr-only">GitHub</label>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</nav>
<div class="container-xl">
<div class="row">
<!-- Only show if we have sidebars configured, else just a small margin -->
<div class="col-12 col-md-3 bd-sidebar"><form class="bd-search d-flex align-items-center" action="search.html" method="get">
<i class="icon fas fa-search"></i>
<input type="search" class="form-control" name="q" id="search-input" placeholder="Search the docs ..." aria-label="Search the docs ..." autocomplete="off" >
</form><nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation">
<div class="bd-toc-item active">
<ul class="current nav bd-sidenav">
<li class="toctree-l1">
<a class="reference internal" href="node.draw.html">
node.draw module
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="node.mobility.html">
node.mobility module
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="node.mobility2.html">
node.mobility2 module
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="node.mobility2b.html">
node.mobility2b module
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="node.mobility3.html">
node.mobility3 module
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="node.node.html">
node.node module
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="node.obstacle.html">
node.obstacle module
</a>
</li>
<li class="toctree-l1 current active">
<a class="current reference internal" href="#">
node.routemobi module
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="node.timer.html">
node.timer module
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="node.type.html">
node.type module
</a>
</li>
</ul>
</div>
</nav>
</div>
<div class="d-none d-xl-block col-xl-2 bd-toc">
<div class="toc-item">
<nav id="bd-toc-nav">
</nav>
</div>
<div class="toc-item">
</div>
</div>
<main class="col-12 col-md-9 col-xl-7 py-md-5 pl-md-5 pr-md-4 bd-content" role="main">
<div>
<div class="section" id="module-node.routemobi">
<span id="node-routemobi-module"></span><h1>node.routemobi module<a class="headerlink" href="#module-node.routemobi" title="Permalink to this headline">¶</a></h1>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>This is an experimental code attempting to implement multi-lanes
and car merger. The implementation has yet to be tested fully. Do
not use this module.</p>
</div>
<p>Module <cite>routemobi</cite> contains node mobility for cars moving on a map.</p>
<p>Every mobility instance for a vehicle is described by a <cite>route</cite>, which is a
list of road segments. <a class="reference internal" href="#node.routemobi.RoutePath" title="node.routemobi.RoutePath"><code class="xref py py-class docutils literal notranslate"><span class="pre">node.routemobi.RoutePath</span></code></a> is the class desribing
a route. We also define the following:</p>
<ul class="simple">
<li><p>road segment: a tuple (start_loc, end_loc, speed, street_id).</p></li>
<li><p>segment list: an ordered list of road segments forming a route.</p></li>
<li><p>_RoutePoint: a internal class desribing a point on a route. It contains the location
of the point, and segment index pointing to the segment in the segment list
where this point is currently on. Each mobility records two route points,
<cite>head</cite> and <cite>tail</cite> points of the vehicle.</p></li>
</ul>
<dl class="py class">
<dt id="node.routemobi.RouteHandler">
<em class="property">class </em><code class="sig-prename descclassname">node.routemobi.</code><code class="sig-name descname">RouteHandler</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">scenario</span></em>, <em class="sig-param"><span class="n">map</span></em><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RouteHandler" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>This is the route handler to manage node movement on a given map,
all nodes moving on the same map should use the same route handler. The
handler is needed for <a class="reference internal" href="#node.routemobi.RoutePath" title="node.routemobi.RoutePath"><code class="xref py py-class docutils literal notranslate"><span class="pre">node.routemobi.RoutePath</span></code></a>.</p>
<p>To make sure a vehicle can follow another vehicle in front, it needs to find
which other vehicles are potentially in front of itself. With hundreds
of vehicles on the map, checking individual vehicle for their location to
find one that is in front of a vehicle can be inefficiency. Here We use
a lookup table to efficiently narrow down to vehicles on the same street_id for
the checking. This class handles the lookup and perform the search for a
vehicle in front.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl>
<dt><strong>scenario</strong><span class="classifier"><a class="reference internal" href="sim.scenario.html#sim.scenario.BaseScenario" title="sim.scenario.BaseScenario"><code class="xref py py-class docutils literal notranslate"><span class="pre">sim.scenario.BaseScenario</span></code></a> subclass</span></dt><dd><p>The scenario that hosts this handler.</p>
</dd>
<dt><strong>map</strong><span class="classifier"><a class="reference internal" href="map.mapinfo.html#map.mapinfo.MapInfo" title="map.mapinfo.MapInfo"><code class="xref py py-class docutils literal notranslate"><span class="pre">map.mapinfo.MapInfo</span></code></a></span></dt><dd><p>The map to be used for the mobility.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Methods</p>
<table class="longtable table autosummary">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#node.routemobi.RouteHandler.get_next_route_id" title="node.routemobi.RouteHandler.get_next_route_id"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_next_route_id</span></code></a>(head_point)</p></td>
<td><p>This method get the next route’s route_id Returns ——- : route_id</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#node.routemobi.RouteHandler.give_way" title="node.routemobi.RouteHandler.give_way"><code class="xref py py-obj docutils literal notranslate"><span class="pre">give_way</span></code></a>(next_route_id)</p></td>
<td><p>This method determines whether a node is merging into a single lane Returns ——- : True or False</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#node.routemobi.RouteHandler.is_ready" title="node.routemobi.RouteHandler.is_ready"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_ready</span></code></a>()</p></td>
<td><p>Test if the handler is ready for use.</p></td>
</tr>
</tbody>
</table>
<dl class="py method">
<dt id="node.routemobi.RouteHandler.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">scenario</span></em>, <em class="sig-param"><span class="n">map</span></em><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RouteHandler.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>This is the constructor.</p>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RouteHandler.is_ready">
<code class="sig-name descname">is_ready</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → bool<a class="headerlink" href="#node.routemobi.RouteHandler.is_ready" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if the handler is ready for use. The readiness of the handler
mainly depends on the readiness of the map. If the handler is not ready,
none of its methods will work properly. To improve execution efficiency,
the user simulation should ensure the handler is ready which is a one-time
check. Indiviual methods will not repeatedly check for readiness.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><dl class="simple">
<dt>bool</dt><dd><p>It returns whether this instance is ready to use.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RouteHandler.get_next_route_id">
<code class="sig-name descname">get_next_route_id</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">head_point</span></em><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RouteHandler.get_next_route_id" title="Permalink to this definition">¶</a></dt>
<dd><p>This method get the next route’s route_id
Returns
——-
: route_id</p>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RouteHandler.give_way">
<code class="sig-name descname">give_way</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">next_route_id</span></em><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RouteHandler.give_way" title="Permalink to this definition">¶</a></dt>
<dd><p>This method determines whether a node is merging into a single lane
Returns
——-
: True or False</p>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt id="node.routemobi.RoutePath">
<em class="property">class </em><code class="sig-prename descclassname">node.routemobi.</code><code class="sig-name descname">RoutePath</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">handler</span></em>, <em class="sig-param"><span class="n">start_pin</span></em>, <em class="sig-param"><span class="n">end_pin</span></em>, <em class="sig-param"><span class="n">delay_start</span></em>, <em class="sig-param"><span class="n">lane</span></em><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="node.mobility.html#node.mobility.BaseMobility" title="node.mobility.BaseMobility"><code class="xref py py-class docutils literal notranslate"><span class="pre">node.mobility.BaseMobility</span></code></a></p>
<p>This class provides a specification of a route for a node to move with
other vehicles on the same route. The mobility observes lanes, junctions and
the vehicles in front. The mobility algorithm implements a specific car-following
model.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The current version implemented the following of a vehicle in front assuming
the road has one lane. Observing lanes and junctions will be next features
to add.</p>
</div>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl>
<dt><strong>handler</strong><span class="classifier"><a class="reference internal" href="#node.routemobi.RouteHandler" title="node.routemobi.RouteHandler"><code class="xref py py-class docutils literal notranslate"><span class="pre">node.routemobi.RouteHandler</span></code></a></span></dt><dd><p>The route handler which contains the map for the node to move on. The
method assumes that the handler is ready for use. Otherwise, the method
may throw a run-time error.</p>
</dd>
<dt><strong>start_pin</strong><span class="classifier">str</span></dt><dd><p>The unique name of the starting location.</p>
</dd>
<dt><strong>end_pin</strong><span class="classifier">str</span></dt><dd><p>The unique name of the ending location.</p>
</dd>
<dt><strong>delay_start</strong><span class="classifier">float</span></dt><dd><p>Apply a delay start to the mobility based on this input.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Methods</p>
<table class="longtable table autosummary">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#node.routemobi.RoutePath.assign_speed" title="node.routemobi.RoutePath.assign_speed"><code class="xref py py-obj docutils literal notranslate"><span class="pre">assign_speed</span></code></a>(road_segment_index, speed)</p></td>
<td><p>Use this method to assign a speed for the node to move on a specific road segment.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#node.routemobi.RoutePath.get_dir" title="node.routemobi.RoutePath.get_dir"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_dir</span></code></a>()</p></td>
<td><p>See the base class for details.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_displacement</span></code>()</p></td>
<td><p>This method returns the displacement of the node in the last simulation time step.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#node.routemobi.RoutePath.get_loc" title="node.routemobi.RoutePath.get_loc"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_loc</span></code></a>()</p></td>
<td><p>Get the head location of the node.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#node.routemobi.RoutePath.get_name" title="node.routemobi.RoutePath.get_name"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_name</span></code></a>()</p></td>
<td><p>Call this method to get the name of this class.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_node</span></code>()</p></td>
<td><p>Get the node that uses this mobility instance.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#node.routemobi.RoutePath.get_road_segment_list" title="node.routemobi.RoutePath.get_road_segment_list"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_road_segment_list</span></code></a>()</p></td>
<td><p>Get the establish route which is a list of tuples describing the road segments: <cite>(start_location,end_location,speed,street_id)</cite>.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#node.routemobi.RoutePath.get_speed" title="node.routemobi.RoutePath.get_speed"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_speed</span></code></a>()</p></td>
<td><p>See the base class for details.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#node.routemobi.RoutePath.is_active" title="node.routemobi.RoutePath.is_active"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_active</span></code></a>()</p></td>
<td><p>This method returns whether the node on this route is active.</p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_pause</span></code>()</p></td>
<td><p>Check if the movement of the node is paused.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">pause</span></code>([pause_flag])</p></td>
<td><p>Apply a pause to the movement of the node, or resume the movement from a pause.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#node.routemobi.RoutePath.restart" title="node.routemobi.RoutePath.restart"><code class="xref py py-obj docutils literal notranslate"><span class="pre">restart</span></code></a>([delay_start])</p></td>
<td><p>Use this method to restart the mobility.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#node.routemobi.RoutePath.set_dir" title="node.routemobi.RoutePath.set_dir"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_dir</span></code></a>(direction)</p></td>
<td><p>The method in this class will not do anything, since the direction is calculated automatically based on the moving direction.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#node.routemobi.RoutePath.sim__do_move" title="node.routemobi.RoutePath.sim__do_move"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sim__do_move</span></code></a>(time_step)</p></td>
<td><p>This method is used within the simulation engine, not for user simulation.</p></td>
</tr>
</tbody>
</table>
<table class="table">
<colgroup>
<col style="width: 67%" />
<col style="width: 33%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><strong>change_lane</strong></p></td>
<td></td>
</tr>
<tr class="row-even"><td><p><strong>init_single_lane</strong></p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p><strong>merge_lane</strong></p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="py method">
<dt id="node.routemobi.RoutePath.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">handler</span></em>, <em class="sig-param"><span class="n">start_pin</span></em>, <em class="sig-param"><span class="n">end_pin</span></em>, <em class="sig-param"><span class="n">delay_start</span></em>, <em class="sig-param"><span class="n">lane</span></em><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>This is the constructor.</p>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.get_road_segment_list">
<code class="sig-name descname">get_road_segment_list</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.get_road_segment_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the establish route which is a list of tuples describing the road segments:
<cite>(start_location,end_location,speed,street_id)</cite>. The speed is set
to -1 initially for user simulation to fill in. A negative speed means
the mobility engine will later replace it with some speed which can be a
random or the maximum speed specified by the <cite>street_id</cite>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The user simulation should not modify the locations and <cite>street_id</cite>, but
may specify a desired <cite>speed</cite> directly into the tuple or use the method
<cite>assign_speed()</cite> to do so.</p>
</div>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><dl>
<dt>List of Tuples</dt><dd><p>It returns route or an empty list if no route is established. The route is a
list of tuples:
(start_location:<a class="reference internal" href="sim.loc.html#sim.loc.LOC" title="sim.loc.LOC"><code class="xref py py-class docutils literal notranslate"><span class="pre">sim.loc.LOC</span></code></a>,end_location:<a class="reference internal" href="sim.loc.html#sim.loc.LOC" title="sim.loc.LOC"><code class="xref py py-class docutils literal notranslate"><span class="pre">sim.loc.LOC</span></code></a>,</p>
<blockquote>
<div><p>speed:float,street_id:int).</p>
</div></blockquote>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.assign_speed">
<code class="sig-name descname">assign_speed</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">road_segment_index</span></em>, <em class="sig-param"><span class="n">speed</span></em><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.assign_speed" title="Permalink to this definition">¶</a></dt>
<dd><p>Use this method to assign a speed for the node to move on a specific road segment.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>road_segment_index</strong><span class="classifier">int</span></dt><dd><p>The index of the road segment given in the road segment list.</p>
</dd>
<dt><strong>speed</strong><span class="classifier">float</span></dt><dd><p>The speed for the node to move on the road segment (in km/h).</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.get_name">
<code class="sig-name descname">get_name</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.get_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Call this method to get the name of this class.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><dl class="simple">
<dt>str</dt><dd><p>This class returns “route”.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.is_active">
<code class="sig-name descname">is_active</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.is_active" title="Permalink to this definition">¶</a></dt>
<dd><p>This method returns whether the node on this route is active. the node
is considered active if it has started to move (i.e. passed the delayed start)
and yet to reach the final destination.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><dl class="simple">
<dt>boolean</dt><dd><p>It returns whether the node on this route is active.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.init_single_lane">
<code class="sig-name descname">init_single_lane</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">single_line_list</span></em><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.init_single_lane" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.merge_lane">
<code class="sig-name descname">merge_lane</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.merge_lane" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.sim__do_move">
<code class="sig-name descname">sim__do_move</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">time_step</span></em><span class="sig-paren">)</span> → bool<a class="headerlink" href="#node.routemobi.RoutePath.sim__do_move" title="Permalink to this definition">¶</a></dt>
<dd><p>This method is used within the simulation engine, not for user simulation.
This method to used by the simulation engine to make this node to move
over a <cite>time_step</cite>. See the base class for details.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>time_step</strong><span class="classifier">float</span></dt><dd><p>The time to move forward to (in seconds).</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt>boolean</dt><dd><p>Whether the mobility has reached an end. It always returns <cite>False</cite>
when the movement is paused.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.change_lane">
<code class="sig-name descname">change_lane</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.change_lane" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.get_speed">
<code class="sig-name descname">get_speed</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.get_speed" title="Permalink to this definition">¶</a></dt>
<dd><p>See the base class for details.</p>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.get_loc">
<code class="sig-name descname">get_loc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.get_loc" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the head location of the node. See the base class for details.</p>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.set_dir">
<code class="sig-name descname">set_dir</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">direction</span></em><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.set_dir" title="Permalink to this definition">¶</a></dt>
<dd><p>The method in this class will not do anything, since the direction
is calculated automatically based on the moving direction.</p>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.get_dir">
<code class="sig-name descname">get_dir</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.get_dir" title="Permalink to this definition">¶</a></dt>
<dd><p>See the base class for details.</p>
</dd></dl>
<dl class="py method">
<dt id="node.routemobi.RoutePath.restart">
<code class="sig-name descname">restart</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">delay_start</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#node.routemobi.RoutePath.restart" title="Permalink to this definition">¶</a></dt>
<dd><p>Use this method to restart the mobility.</p>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt id="node.routemobi.mutex_lock">
<em class="property">class </em><code class="sig-prename descclassname">node.routemobi.</code><code class="sig-name descname">mutex_lock</code><a class="headerlink" href="#node.routemobi.mutex_lock" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Attributes</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>state</strong></dt><dd></dd>
</dl>
</dd>
</dl>
<dl class="py attribute">
<dt id="node.routemobi.mutex_lock.state">
<code class="sig-name descname">state</code><em class="property"> = None</em><a class="headerlink" href="#node.routemobi.mutex_lock.state" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt id="node.routemobi.mutex_lock.time">
<code class="sig-name descname">time</code><em class="property"> = 0</em><a class="headerlink" href="#node.routemobi.mutex_lock.time" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt id="node.routemobi.mutex_Handler">
<em class="property">class </em><code class="sig-prename descclassname">node.routemobi.</code><code class="sig-name descname">mutex_Handler</code><a class="headerlink" href="#node.routemobi.mutex_Handler" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<dl class="py attribute">
<dt id="node.routemobi.mutex_Handler.single_lane_dic">
<code class="sig-name descname">single_lane_dic</code><em class="property"> = {}</em><a class="headerlink" href="#node.routemobi.mutex_Handler.single_lane_dic" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</main>
</div>
</div>
<script src="_static/js/index.1c5a1a01449ed65a7b51.js"></script>
<footer class="footer mt-5 mt-md-0">
<div class="container">
<div class="footer-item">
<p class="copyright">
© Copyright 2021, cfoh.<br/>
</p>
</div>
<div class="footer-item">
<p class="sphinx-version">
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.4.3.<br/>
</p>
</div>
</div>
</footer>
</body>
</html>