Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
toruseo committed Mar 21, 2024
1 parent 07f2e69 commit 82873fe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
9 changes: 5 additions & 4 deletions demos_and_examples/uxsim/uxsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_verification_straight_road.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions uxsim/uxsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 82873fe

Please sign in to comment.