Skip to content

Commit 3608652

Browse files
YasharzfAboudyKreidieh
authored andcommitted
get not departed vehicles (#922)
* added function to kernel/vehicle to get number of not departed vehiles * fixed over indentation of the docstring * indentation edit * pep8 Co-authored-by: AboudyKreidieh <akreidieh@gmail.com>
1 parent 3d16a5a commit 3608652

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

flow/core/kernel/vehicle/traci.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ def update(self, reset):
220220
self.num_not_departed += sim_obs[tc.VAR_LOADED_VEHICLES_NUMBER] - \
221221
sim_obs[tc.VAR_DEPARTED_VEHICLES_NUMBER]
222222

223+
# update the number of not departed vehicles
224+
self.num_not_departed += sim_obs[tc.VAR_LOADED_VEHICLES_NUMBER] - \
225+
sim_obs[tc.VAR_DEPARTED_VEHICLES_NUMBER]
226+
223227
# update the "headway", "leader", and "follower" variables
224228
for veh_id in self.__ids:
225229
try:
@@ -543,6 +547,10 @@ def get_fuel_consumption(self, veh_id, error=-1001):
543547
return [self.get_fuel_consumption(vehID, error) for vehID in veh_id]
544548
return self.__sumo_obs.get(veh_id, {}).get(tc.VAR_FUELCONSUMPTION, error) * ml_to_gallons
545549

550+
def get_num_not_departed(self):
551+
"""See parent class."""
552+
return self.num_not_departed
553+
546554
def get_previous_speed(self, veh_id, error=-1001):
547555
"""See parent class."""
548556
if isinstance(veh_id, (list, np.ndarray)):

0 commit comments

Comments
 (0)