Windows系统,在使用SUMO模拟建立模拟网络时,输入以下代码,用以生成route文件
duarouter -n sumotest.net.xml --route-files sumotest.trips.xml -o sumotest.rou.xml --ignore-errors
然而遇到如下报错:
Warning: Environment variable SUMO_HOME is not set, XML validation will fail or use slow website lookups.
Error: invalid document structure
In file 'sumotest.trips.xml'
At line/column 2/1.
Quitting (on error).
从报错中得知SUMO_HOME没有设置,很有可能因此而导致关于xml的错误检查。因为我的这个“sumotest.trips.xml”没有问题,以下是其代码片段
<?xml version="1.0" encoding="UTF-8" ?>
<!-- generated on 2022-12-17 15:19:12.885938 by randomTrips.py v1_15_0+0002-e6790248698
<configuration>
<end value="600"/>
<net-file value="sumotest.net.xml"/>
<output-trip-file value="sumotest.trips.xml"/>
</configuration> -->
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd">
<trip id="0" depart="0.00" from="e24" to="e10"/>
<trip id="1" depart="1.00" from="e16" to="e16"/>
<trip id="2" depart="2.00" from="e3" to="e26"/>
<trip id="3" depart="3.00" from="e7" to="e12"/>
<trip id="4" depart="4.00" from="e2" to="e10"/>
所以我们设置SUMO_HOME,因为是windows系统,所以使用set。路径就是自己安装SUMO的地方去找
// 路径是xml文件夹的上一级就行
set SUMO_HOME=E:/SUMO/sumo-1.15.0/
成功set后不会有报错,重新输入
duarouter -n sumotest.net.xml --route-files sumotest.trips.xml -o sumotest.rou.xml --ignore-errors
成功生成两个route文件:sumotest.rou.xml 和 sumotest.rou.alt.xml
生成时会有一堆Warning,但是不影响文件生成。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)