From c02aa9fedb17f1819b87569fea083b610dad0fd9 Mon Sep 17 00:00:00 2001 From: Pengyuan Zhou Date: Fri, 12 Jun 2020 13:31:41 +0300 Subject: [PATCH 1/3] add emergencydecel_warning_threshold parameter --- flow/core/kernel/simulation/traci.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flow/core/kernel/simulation/traci.py b/flow/core/kernel/simulation/traci.py index 2cd109024..4443e128d 100644 --- a/flow/core/kernel/simulation/traci.py +++ b/flow/core/kernel/simulation/traci.py @@ -109,6 +109,11 @@ def start_simulation(self, network, sim_params): sumo_call.append("--lateral-resolution") sumo_call.append(str(sim_params.lateral_resolution)) + # disable emergencydecel warning (if requested) + if sim_params.emergencydecel_warning_threshold is not None: + sumo_call.append("--emergencydecel.warning-threshold") + sumo_call.append(str(sim_params.emergencydecel_warning_threshold)) + # add the emission path to the sumo command (if requested) if sim_params.emission_path is not None: ensure_dir(sim_params.emission_path) From 6d98f1014e55a97e3d1dc5a1713a2cded97577ac Mon Sep 17 00:00:00 2001 From: Pengyuan Zhou Date: Fri, 12 Jun 2020 13:34:21 +0300 Subject: [PATCH 2/3] add emergencydecel_warning_threshold to param.py --- flow/core/params.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flow/core/params.py b/flow/core/params.py index 79ad8d689..e3804ac62 100755 --- a/flow/core/params.py +++ b/flow/core/params.py @@ -543,6 +543,9 @@ class SumoParams(SimParams): width of the divided sublanes within a lane, defaults to None (i.e. no sublanes). If this value is specified, the vehicle in the network cannot use the "LC2013" lane change model. + emergencydecel_warning_threshold: float, optional + Sets the fraction of emergency decel capability that must be used + to trigger a warning.; default: 1 no_step_log : bool, optional specifies whether to add sumo's step logs to the log file, and print them into the terminal during runtime, defaults to True @@ -595,6 +598,7 @@ def __init__(self, sim_step=0.1, emission_path=None, lateral_resolution=None, + emergencydecel_warning_threshold=1, no_step_log=True, render=False, save_render=False, @@ -616,6 +620,7 @@ def __init__(self, sight_radius, show_radius, pxpm, force_color_update) self.port = port self.lateral_resolution = lateral_resolution + self.emergencydecel_warning_threshold = emergencydecel_warning_threshold self.no_step_log = no_step_log self.seed = seed self.overtake_right = overtake_right From 8d192ad868262ba0eebb69bfee2814ab4434d159 Mon Sep 17 00:00:00 2001 From: Pengyuan Zhou Date: Fri, 12 Jun 2020 14:10:05 +0300 Subject: [PATCH 3/3] add emergencydecel_warning_threshold to test --- tests/fast_tests/test_params.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/fast_tests/test_params.py b/tests/fast_tests/test_params.py index df4794d28..c4903dfd6 100644 --- a/tests/fast_tests/test_params.py +++ b/tests/fast_tests/test_params.py @@ -87,6 +87,7 @@ def test_params(self): sim_step=0.125, emission_path=None, lateral_resolution=None, + emergencydecel_warning_threshold=1, no_step_log=False, render=True, save_render=True, @@ -104,6 +105,7 @@ def test_params(self): self.assertEqual(params.sim_step, 0.125) self.assertEqual(params.emission_path, None) self.assertEqual(params.lateral_resolution, None) + self.assertEqual(params.emergencydecel_warning_threshold, 1) self.assertEqual(params.no_step_log, False) self.assertEqual(params.render, True) self.assertEqual(params.save_render, True)