-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpypml.ParkingMonitor.html
249 lines (221 loc) · 21 KB
/
pypml.ParkingMonitor.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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: class ParkingMonitor</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><strong>pypml.ParkingMonitor</strong> = <a name="pypml.ParkingMonitor">class ParkingMonitor</a>(<a href="traci.html#StepListener">traci.StepListener</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>pypml.ParkingMonitor(traci_handler, options)<br>
<br>
SUMO StepListener class for the parking monitoring.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="pypml.pypml.html#ParkingMonitor">ParkingMonitor</a></dd>
<dd><a href="traci.html#StepListener">traci.StepListener</a></dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="ParkingMonitor-__init__"><strong>__init__</strong></a>(self, traci_handler, options)</dt><dd><tt>Initialize the knowlegde base for the parking monitor.<br>
<br>
traci_handler: already initialized TraCI socket that is going to be used by PyPML<br>
options: in order to reduce the number of parameters and increase the flexibility,<br>
the complete initialization is done using a dict()<br>
<br>
Options format:<br>
{<br>
'seed': Integer. Initialization seed for numpy.random.RandomState.<br>
'addStepListener': Boolean. Ff True, pypml is added as step listener in SUMO.<br>
In case it's False the function <a href="#pypml.ParkingMonitor-step">step</a>() must be called by hand every<br>
simulation step.<br>
'logging': {<br>
'stdout': Boolean. If True, the logging will be both file and stdout.<br>
'filename': String. Name of the logging file.<br>
'level': Logging level as defined in the logging library. E.g.: logging.DEBUG<br>
},<br>
'sumo_parking_file': String. Path and file name of the SUMO additional file defining the<br>
parkings.<br>
'blacklist': List of strings. List of the parking IDS ans defined in sumo that must be<br>
excluded from the monitoring.<br>
'vclasses': Set of strings. Set of vTypes, as defined in SUMO, comprehensive of all the<br>
vehicles used in the simulation.<br>
'generic_conf': List. List of generic configuration applied to all the parking areas.<br>
'specific_conf': Dictionary. Dictionary of configuration applied to specific parking<br>
areas.<br>
'subscriptions': {<br>
'only_parkings': Boolean. If True, PyPML subscribes only to the vehicles that have<br>
a <stop> define at the beginning of the simulation.<br>
},<br>
}<br>
<br>
Example of generic_conf:<br>
'cond' is an expression (prefix notation) that is going to be evaluate agains all the<br>
parking areas.<br>
'set_to' is a list of 'parameter' -> {value/expression} that are going to be applied if<br>
'cond' is true.<br>
[<br>
{<br>
'cond': ['>', 'total_capacity', 50],<br>
'set_to': [<br>
['uncertainty', {<br>
'mu': 0.0,<br>
'sigma': ['*', 'total_capacity', 0.20]<br>
}<br>
],<br>
],<br>
},<br>
]<br>
In this example, every parkign area with more than 50 places will have an uncertainty with<br>
sigma equal to 20% of the capacity.<br>
<br>
Example of specific_conf:<br>
Each parking area needs a specific entry in the dictionary.<br>
The values that can be set are:<br>
'capacity_by_class'<br>
'subscriptions_by_class'<br>
'uncertainty'<br>
and the values are assigned, so they must be complete.<br>
<br>
{<br>
'parking_id': {<br>
'capacity_by_class': {<br>
'vType': number,<br>
...<br>
'vType': number,<br>
},<br>
},<br>
}</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-compute_parking_travel_time"><strong>compute_parking_travel_time</strong></a>(self)</dt><dd><tt>For each parking, saves the parkings reachable by 'passenger' vClass where the weight<br>
is the travel time at the current stage of the simulation.<br>
Each call of the funcion destroy the previous state.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_closest_parkings"><strong>get_closest_parkings</strong></a>(self, parking, num=None)</dt><dd><tt>Return the 'num' closest parkings by travel time from the requested parking.<br>
It requires the travel time structure initialization using<br>
<a href="#pypml.ParkingMonitor-compute_parking_travel_time">compute_parking_travel_time</a>(), it raises an Exception if the structure is not yet<br>
initialized.<br>
<br>
parking: String. Parking area ID as defined in SUMO.<br>
num: Int. Number of element to be returned.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_free_places"><strong>get_free_places</strong></a>(self, parking, with_uncertainty=False, vclass=None, with_projections=False, with_subscriptions=False)</dt><dd><tt>Returns the free places in a given parking area.<br>
Raises an Exception if the requested parking area does not exist.<br>
<br>
parking: String. Parking area ID as defined in SUMO.<br>
with_uncertainty: Boolean. If True, uncertainty is applied.<br>
vclass: String. If set, returns values only for the specified vType.<br>
with_projections: Boolean. If True, projections are taken into account.<br>
with_subscriptions: Boolean. If True, subscriptions are taken into account.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_parking"><strong>get_parking</strong></a>(self, parking)</dt><dd><tt>Return the parking area with the given ID or None if not existent.<br>
<br>
parking: String. Parking area ID as defined in SUMO.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_parking_access"><strong>get_parking_access</strong></a>(self, parking)</dt><dd><tt>Given a parking ID, returns the lane information.<br>
Raise an Exception in canse the requested parking id does not exist.<br>
<br>
parking: String. Parking area ID as defined in SUMO.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_parking_capacity_vclass"><strong>get_parking_capacity_vclass</strong></a>(self, parking)</dt><dd><tt>Given a parking ID, returns the capacity by vclass information.<br>
Raises an Exception if the requested parking area does not exist.<br>
<br>
parking: String. Parking area ID as defined in SUMO.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_parking_iterator"><strong>get_parking_iterator</strong></a>(self)</dt><dd><tt>Return the parking iterator.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_parking_projections"><strong>get_parking_projections</strong></a>(self, parking)</dt><dd><tt>Given a parking ID, returns the projections information.<br>
Raises an Exception if the requested parking area does not exist.<br>
<br>
parking: String. Parking area ID as defined in SUMO.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_parking_subscriptions"><strong>get_parking_subscriptions</strong></a>(self, parking)</dt><dd><tt>Given a parking ID, returns the subscriptions information.<br>
Raises an Exception if the requested parking area does not exist.<br>
<br>
parking: String. Parking area ID as defined in SUMO.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_passenger_iterator"><strong>get_passenger_iterator</strong></a>(self)</dt><dd><tt>Return the passenger iterator.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_rerouter_iterator"><strong>get_rerouter_iterator</strong></a>(self, step)</dt><dd><tt>Return the rerouter info for the given step.<br>
<br>
step: Float. Simulation time in seconds.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_traci_simulation_subscriptions"><strong>get_traci_simulation_subscriptions</strong></a>(self)</dt><dd><tt>Return TraCI simulation subscriptions for the last simulation-step.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_traci_vehicle_subscriptions"><strong>get_traci_vehicle_subscriptions</strong></a>(self)</dt><dd><tt>Return TraCI vehicle subscriptions for the last simulation-step.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_vehicle"><strong>get_vehicle</strong></a>(self, vehicle)</dt><dd><tt>Return the vehicle with the given ID or None if not existent.<br>
<br>
vehicle: String. Vehicle ID as defined in SUMO.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-get_vehicle_iterator"><strong>get_vehicle_iterator</strong></a>(self)</dt><dd><tt>Return the vehicle info.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-remove_subscribed_vehicle"><strong>remove_subscribed_vehicle</strong></a>(self, parking, vclass, vehicle)</dt><dd><tt>Remove the vehicles from the subscriptions of the given parking id.<br>
Raises an Exception if the requested parking area does not exist or<br>
if the subscriptions are not initialized.<br>
<br>
parking: String. Parking area ID as defined in SUMO.<br>
vclass: String. vType as defined in SUMO.<br>
vehicle: String. Vehicle ID as defined in SUMO.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-set_parking_capacity_vclass"><strong>set_parking_capacity_vclass</strong></a>(self, parking, capacities)</dt><dd><tt>Set the given capacity by vclass to the parking id.<br>
Raises an Exception if the requested parking area does not exist or<br>
if the capacities are not in a valid format.<br>
<br>
parking: String. Parking area ID as defined in SUMO.<br>
capacities: Dict. { 'vType': int, .., 'vType': int }</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-set_parking_subscriptions"><strong>set_parking_subscriptions</strong></a>(self, parking, subscriptions)</dt><dd><tt>Set the given subsctiption to the parking id.<br>
Raises an Exception if the requested parking area does not exist or<br>
if the subscriptions are not in a valid format.<br>
<br>
parking: String. Parking area ID as defined in SUMO.<br>
subscriptions: Dict. { 'vType': int, .., 'vType': int }</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-set_vehicle_param"><strong>set_vehicle_param</strong></a>(self, vehicle, param, value)</dt><dd><tt>Set the param=value in the vehicle with the given ID.<br>
Returns False if the vehicle does not exist.<br>
<br>
vehicle: String. Vehicle ID as defined in SUMO.<br>
param: String. Parameters name.<br>
value: Any. Value for the parameter.</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-step"><strong>step</strong></a>(self, t=0)</dt><dd><tt>TraCI StepListener caller.<br>
<br>
In order to be independent from the call, t is not used and the time is directly<br>
retrieved using simulation.getTime().</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-subscribe_vehicle_to_parking"><strong>subscribe_vehicle_to_parking</strong></a>(self, parking, vclass, vehicle)</dt><dd><tt>Add the vehicle to the subscription list of the parking area.<br>
Returns False iif the number of already subscribed vehicles is equal to the number<br>
of spots available for that specific vclass.<br>
Raises an Exception if the requested parking area does not exist or<br>
if the subscriptions are not initialized.<br>
<br>
parking: String. Parking area ID as defined in SUMO.<br>
vclass: String. vType as defined in SUMO.<br>
vehicle: String. Vehicle ID as defined in SUMO.</tt></dd></dl>
<hr>
Static methods defined here:<br>
<dl><dt><a name="ParkingMonitor-is_parking_area"><strong>is_parking_area</strong></a>(flags)</dt><dd><tt>isStoppedParking(string) -> bool<br>
Return whether the vehicle is parking (implies stopped)<br>
<br>
The flags integer is defined as<br>
1 * stopped +<br>
2 * parking +<br>
4 * personTriggered +<br>
8 * containerTriggered +<br>
16 * isBusStop +<br>
32 * isContainerStop +<br>
64 * chargingStation +<br>
128 * parkingarea<br>
with each of these flags defined as 0 or 1</tt></dd></dl>
<hr>
Methods inherited from <a href="traci.html#StepListener">traci.StepListener</a>:<br>
<dl><dt><a name="ParkingMonitor-cleanUp"><strong>cleanUp</strong></a>(self)</dt><dd><tt><a href="#pypml.ParkingMonitor-cleanUp">cleanUp</a>() -> None<br>
<br>
This method is called at removal of the stepListener, allowing to schedule some final actions</tt></dd></dl>
<dl><dt><a name="ParkingMonitor-getID"><strong>getID</strong></a>(self)</dt></dl>
<dl><dt><a name="ParkingMonitor-setID"><strong>setID</strong></a>(self, ID)</dt></dl>
<hr>
Data descriptors inherited from <a href="traci.html#StepListener">traci.StepListener</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<hr>
Data and other attributes inherited from <a href="traci.html#StepListener">traci.StepListener</a>:<br>
<dl><dt><strong>__metaclass__</strong> = <class 'abc.ABCMeta'><dd><tt>Metaclass for defining Abstract Base Classes (ABCs).<br>
<br>
Use this metaclass to create an ABC. An ABC can be subclassed<br>
directly, and then acts as a mix-in class. You can also register<br>
unrelated concrete classes (even built-in classes) and unrelated<br>
ABCs as 'virtual subclasses' -- these and their descendants will<br>
be considered subclasses of the registering ABC by the built-in<br>
issubclass() function, but the registering ABC won't show up in<br>
their MRO (Method Resolution Order) nor will method<br>
implementations defined by the registering ABC be callable (not<br>
even via super()).</tt></dl>
</td></tr></table>
</body></html>