[英]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.