Browse Source

revised comments

master
김선중 1 year ago
parent
commit
26d2af7223
1 changed files with 9 additions and 5 deletions
  1. +9
    -5
      Scripts/preprocess_daily.py

+ 9
- 5
Scripts/preprocess_daily.py View File

@ -799,6 +799,7 @@ class DailyPreprocessor():
continue
inc_edge = self.net.getEdge(inc_edge_id)
out_edge = self.net.getEdge(out_edge_id)
# 신호가 부여되어 있으면 (from, to가 존재하면) G 부여 (우회전 : g, 신호 : G, 그외 : r)
for conn in inc_edge.getConnections(out_edge):
index = conn.getTLLinkIndex()
if index >= 0:
@ -820,31 +821,34 @@ class DailyPreprocessor():
continue
inc_edge = self.net.getEdge(inc_edge_id)
out_edge = self.net.getEdge(out_edge_id)
# 신호가 부여되어 있으면 (from, to가 존재하면) G 부여 (우회전 : g, 신호 : G, 그외 : r)
for conn in inc_edge.getConnections(out_edge):
index = conn.getTLLinkIndex()
if index >= 0:
state_list[index] = 'G'
self.match6.at[i, 'state'] = ''.join(state_list)
# mactch6 : 비보호좌회전 신호 배정
# match6 : 비보호좌회전 신호 배정
for i, row in self.match6[self.match6.node_id.isin(self.parent_ids)].iterrows():
parent_id = row.node_id
state = row.state
UPLindices2inc_edge_ids = self.p2UPLindices2inc_edge_ids[parent_id]
for UPLindex in UPLindices2inc_edge_ids:
# 비보호좌회전 이동류에 대한 진입엣지에 신호가 부여되어 있으면
inc_edge_ids = UPLindices2inc_edge_ids[UPLindex]
if inc_edge_ids:
if inc_edge_id in inc_edge_ids:
# 해당 비보호좌회전 인덱스(UPLindex)에, 해당 진입엣지의 직진신호가 있을 때 g를 부여
state = state[:UPLindex] + 'g' + state[UPLindex+1:]
self.match6.at[i, 'state'] = state
else: # modify_match1.py : self.match1.at[7, 'move_A'] = 17
else: # 직진신호가 없는 비보호좌회전 발생시 멈춤 및 오류메시지 출력
raise Exception(
f"비보호좌회전 신호를 부여할 수 없습니다. \
\
(node_id : {parent_id}, index : {UPLindex})\
(inc_edge_id : {inc_edge_id}) .")
# mactch6 : 유턴 신호가 한번도 배정되지 않은 경우에 대해서는 유턴이동류의 신호를 항상 g로 배정
# match6 : 유턴 신호가 한번도 배정되지 않은 경우에 대해서는 유턴이동류의 신호를 항상 g로 배정
for node_id in self.uturn_ids:
m6 = self.match6[self.match6.node_id==node_id]
if not len(m6):
@ -853,11 +857,11 @@ class DailyPreprocessor():
state = ''.join(state_list)
uindex = self.u2uindex[node_id]
values_at_uindex = [state[uindex] for state in m6.state]
# 유턴신호가 한번도 배정되지 않았으면
uturn_assigned = ('G' in values_at_uindex)
if not uturn_assigned:
print('uturn not assigned')
# 해당 유턴 인덱스(uindex)에 g를 항상 부여
state = state[:uindex] + 'g' + state[uindex+1:]
print(i, state)
self.match6.loc[self.match6.node_id==node_id, 'state'] = state
self.match6 = self.match6.dropna(subset='state')

Loading…
Cancel
Save