[英]Make OD file in sumo using Node instead of TAZ
我有一個網絡(siouxfalls)的數據,想在 SUMO 中用它進行模擬。 對於OD文件,我有每個節點之間的需求(不是鏈接): https://github.com/bstabler/TransportationNetworks/blob/master/SiouxFalls/SiouxFalls_trips.tntp
據我所知,要在 SUMO 中制作 OD 文件,我們應該使用 TAZ(不是節點): https://sumo.dlr.de/docs/Demand/Importing_O/D_Matrices.html
所以,這是我的問題:當我有節點之間的需求值時,我如何使用相撲進行旅行和模擬?
您可以構建一個區域 (TAZ) 文件,其中每個 TAZ 將節點的出邊作為源邊,將節點的傳入邊作為輸入。 您可以在此處安全地重用節點 ID 作為 taz id。
<tazs>
<taz id="<TAZ_ID>">
<tazSource id="<EDGE_ID>" weight="<PROBABILITY_TO_USE>"/>
... further source edges ...
<tazSink id="<EDGE_ID>" weight="<PROBABILITY_TO_USE>"/>
... further destination edges ...
</taz>
... further traffic assignment zones (districts) ...
</tazs>
要以編程方式構建它,您可以使用 sumolib 解析網絡(下面的不完整草圖):
import sumolib
net = sumolib.net.readNet('myNet.net.xml')
for node in net.getNodes():
print('<taz id="%s">' % node.getID())
for outEdge in node.getOutgoing():
print('<tazSource id="%s"/>' % outEdge.getID())
for inEdge in node.getOutgoing():
print('<tazSink id="%s"/>' % inEdge.getID())
print('</taz>')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.