ATP資料分析

報告者:王禮恩

報告內容
.計畫緣起
.計畫簡介
.計畫目標
.ATP封包資料分析
.個人研究方向

計畫緣起
台鐵並沒有強制運轉方法之規定
然而僅用ATP有無介入不足以判斷司機員駕駛品質好壞
如目標指示後減速、注意號誌超速等行為也攸關駕駛品質


1
計畫緣起
引入各項違規行為,建立駕駛/路段的風險因子
核心發現:多數風險集中在少數駕駛/少數路段
改善核心問題才能有效降低風險

source: 《以ATP資料辨識高風險駕駛行為及高風險路段》,陳昱甫、薛功囷、賴勇成

2
系統簡介
游登峻學長所製作之行車速度曲線視覺化程式(V0.29.5)
製造商(Bombardier)系統功能完善但不敷使用
藉由解讀ATP封包之訊息繪製速度曲線

3
計畫目標
(1)優化、改善程式功能
(2)統計、分析所得數據
(3)自動判別駕駛品質
4



➔ 我能協助的部分
ATP封包資料分析
ATP封包為16進位,須將內容按照一定方法轉譯以取得需要資訊
def tran_16_2(code):
index = "0123456789ABCDEF"
result = 0
for a in range(len(code)):
pointer = 0
for b in index:
if code[a] == b:
if a == 0:
result += (pointer * 16)
if a == 1:
result += pointer
pointer += 1
if result < 10:
return "0" + str(result)
else:
return str(result)5
ATP封包資料分析
class package():
def __init__(self, TYPE, DATE, TIME, POSITION, VELOCITY, LENGTH, PACK):
self.TYPE = TYPE
self.DATE = DATE
self.TIME = TIME
self.POSITION = POSITION
self.VELOCITY = VELOCITY
self.LENGTH = LENGTH
self.PACK = PACK
6

ATP封包資料分析
def code_translate(code):
decode = package([], [], [], [], [], [], [])
step = 0
for a in range(int(len(code) / 2)):
if step % 7 == 0: #解讀封包類別
decode.TYPE.append(tran_16_2(code[2 * a] + code[2 * a + 1]))
step += 1
date_counter = 0
date = "20"
elif step % 7 == 1: #解讀封包日期
if date_counter != 2:
date += (tran_16_2(code[2 * a] + code[2 * a + 1]) + "-")
date_counter += 1
else:
date += (tran_16_2(code[2 * a] + code[2 * a + 1]))
decode.DATE.append(date)
step += 1
time_counter = 0
time = ""
elif step % 7 == 2: #解讀封包時間
if time_counter != 2:
time += (tran_16_2(code[2 * a] + code[2 * a + 1]) + "-")
time_counter += 1
else:
time += (tran_16_2(code[2 * a] + code[2 * a + 1]))
decode.TIME.append(time)
step += 1
position_counter = 0
position = ""
elif step % 7 == 3: #解讀列車位置
position += (code[2 * a] + code[2 * a + 1])
if position_counter != 3:
position_counter += 1
else:
decode.POSITION.append(tran_16_8(position))
step += 1
velocity_counter = 0
velocity = ""
elif step % 7 == 4: #解讀列車速度(cm/s)
velocity += (code[2 * a] + code[2 * a + 1])
if velocity_counter != 3:
velocity_counter += 1
else:
decode.VELOCITY.append(tran_16_8(velocity))
step += 1
elif step % 7 == 5: #解讀封包長度
length = tran_16_2(code[2 * a] + code[2 * a + 1])
decode.LENGTH.append(length)
if length == "00":
step += 2
decode.PACK.append("")
else:
step += 1
pack_counter = 1
pack = ""
else: #儲存封包內容
pack += code[2 * a] + code[2 * a + 1]
if pack_counter < int(length):
pack_counter += 1
else:
decode.PACK.append(pack)
step += 1
for a in range(len(decode.TYPE)):
print(decode.TYPE[a], decode.DATE[a], decode.TIME[a], decode.POSITION[a], decode.VELOCITY[a], decode.LENGTH[a], decode.PACK[a], "\n")7
ATP封包資料分析
8


個人研究方向
.數據分析層面-嘗試利用運轉規章及風險因子等參變數建立最佳化 行車模型,補足「沒有強制運轉」的問題
.先從小目標開始執行,例如針對高風險路段提供安全建議
.人為設定速度太複雜,或許可以利用AI訓練?
9


個人研究方向
.自動偵測層面-圖像辨識或是數據特徵分析
.首要問題是單純以現有資料進行判讀是否能保證安全性
.與數據分析工作的交叉比對可成為某種指標
.不同車種、不同路段行為模式迥異,執行上或有困難(仍須從特定 路段開始測試)
10


感謝聆聽

9/12 ATP資料分析
By spacezpr
9/12 ATP資料分析
- 21