From 82873fed0976bedb8a6bfed5dc1406163d86ade3 Mon Sep 17 00:00:00 2001 From: Toru Seo <34780089+toruseo@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:55:16 +0900 Subject: [PATCH] minor --- demos_and_examples/uxsim/uxsim.py | 9 +++++---- tests/test_verification_straight_road.py | 4 ++-- uxsim/uxsim.py | 5 ++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/demos_and_examples/uxsim/uxsim.py b/demos_and_examples/uxsim/uxsim.py index 9434168..d03a3bf 100644 --- a/demos_and_examples/uxsim/uxsim.py +++ b/demos_and_examples/uxsim/uxsim.py @@ -339,6 +339,8 @@ def __init__(s, W, name, start_node, end_node, length, free_flow_speed, jam_dens s.w = 1/s.tau/s.kappa s.capacity = s.u*s.w*s.kappa/(s.u+s.w) s.delta = 1/s.kappa + s.q_star = s.capacity #flow capacity + s.k_star = s.capacity/s.u #critical density #合流時優先度 s.merge_priority = merge_priority @@ -657,7 +659,7 @@ def __init__(s, W, orig, dest, departure_time, name=None, route_pref=None, route s.dest = s.W.get_node(dest) #出発・到着時刻 - if departure_time_is_time_step:#互換性のため,タイムステップ表記 + if departure_time_is_time_step:#互換性のため,departure_timeは常にタイムステップ表記 -> TODO: 要訂正! s.departure_time = departure_time else: s.departure_time = int(departure_time/s.W.DELTAT) @@ -710,8 +712,7 @@ def __init__(s, W, orig, dest, departure_time, name=None, route_pref=None, route s.log_v = [] #現在速度 s.color = (random.random(), random.random(), random.random()) - s.log_t_link = [[s.departure_time, "home"]] #新たなリンクに入った時にその時刻とリンクのみを保存.経路分析用 - #todo: s.departure_timeがタイムステップ表記の事がある + s.log_t_link = [[int(s.departure_time*s.W.DELTAT), "home"]] #新たなリンクに入った時にその時刻とリンクのみを保存.経路分析用 s.attribute = attribute @@ -793,7 +794,7 @@ def end_trip(s): s.link.vehicles.popleft() s.link = None s.x = 0 - s.arrival_time = s.W.T + s.arrival_time = s.W.T #TODO: arrival_timeもタイムステップ表記.要修正 s.travel_time = (s.arrival_time - s.departure_time)*s.W.DELTAT s.W.VEHICLES_RUNNING.pop(s.name) s.W.VEHICLES_LIVING.pop(s.name) diff --git a/tests/test_verification_straight_road.py b/tests/test_verification_straight_road.py index 7421796..1330f69 100644 --- a/tests/test_verification_straight_road.py +++ b/tests/test_verification_straight_road.py @@ -924,12 +924,12 @@ def rigorous_verification_of_KW_theory_cumulative_curves_and_travel_time(deltan) traveltime_from_log_t_onlink = W.VEHICLES[vehid].log_t[-1] - W.VEHICLES[vehid].log_t[link_enter_timestep] + W.DELTAT #trip travel time including waiting at the vertical queue - assert traveltime_recorded_by_vehicle >= link1.length/link1.u + assert traveltime_recorded_by_vehicle >= traveltime_from_log_state_onlink assert traveltime_recorded_by_vehicle == traveltime_from_log_state assert traveltime_recorded_by_vehicle == traveltime_from_log_t #within link travel time - assert traveltime_recorded_by_vehicle >= traveltime_from_log_state_onlink + assert traveltime_from_log_state_onlink >= link1.length/link1.u assert traveltime_from_log_state_onlink == traveltime_from_log_t_onlink assert equal_tolerance(traveltime_from_log_state_onlink, traveltime_from_cumulative_curves_onlink, abs_tol=W.DELTAT) #cumulative curve is approximation diff --git a/uxsim/uxsim.py b/uxsim/uxsim.py index 9b82cbb..d03a3bf 100644 --- a/uxsim/uxsim.py +++ b/uxsim/uxsim.py @@ -659,7 +659,7 @@ def __init__(s, W, orig, dest, departure_time, name=None, route_pref=None, route s.dest = s.W.get_node(dest) #出発・到着時刻 - if departure_time_is_time_step:#互換性のため,departure_timeは常にタイムステップ表記 + if departure_time_is_time_step:#互換性のため,departure_timeは常にタイムステップ表記 -> TODO: 要訂正! s.departure_time = departure_time else: s.departure_time = int(departure_time/s.W.DELTAT) @@ -713,7 +713,6 @@ def __init__(s, W, orig, dest, departure_time, name=None, route_pref=None, route s.color = (random.random(), random.random(), random.random()) s.log_t_link = [[int(s.departure_time*s.W.DELTAT), "home"]] #新たなリンクに入った時にその時刻とリンクのみを保存.経路分析用 - #todo: s.departure_timeはタイムステップ表記 s.attribute = attribute @@ -795,7 +794,7 @@ def end_trip(s): s.link.vehicles.popleft() s.link = None s.x = 0 - s.arrival_time = s.W.T + s.arrival_time = s.W.T #TODO: arrival_timeもタイムステップ表記.要修正 s.travel_time = (s.arrival_time - s.departure_time)*s.W.DELTAT s.W.VEHICLES_RUNNING.pop(s.name) s.W.VEHICLES_LIVING.pop(s.name)