如何在相扑网文件中添加variable/entity *.net.xml
How to add a variable/entity in the sumo net file *.net.xml
您好,我正在使用 sumo 生成流量,并试图找到一种方便地调整参数的方法。所以想用一个变量来代替net文件body中的参数。从网上,我发现实体可能有帮助,但似乎我犯了一些错误。代码var_test.net.xml如下。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE net[
<!ENTITY pos "100.00">
]>
<net version="0.27" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/net_file.xsd">
<location netOffset="0.00,0.00" convBoundary="0.00,0.00,&pos;,0.00" origBoundary="10000000000.00,10000000000.00,-10000000000.00,-10000000000.00" projParameter="!"/>
<edge id="gneE0" from="gneJ0" to="gneJ1" priority="1">
<lane id="gneE0_0" index="0" speed="13.89" length="&pos;" shape="0.00,-1.65 &pos;,-1.65"/>
</edge>
<junction id="gneJ0" type="dead_end" x="0.00" y="0.00" incLanes="" intLanes="" shape="0.00,-0.05 0.00,-3.25"/>
<junction id="gneJ1" type="dead_end" x="&pos;" y="0.00" incLanes="gneE0_0" intLanes="" shape="&pos;,-3.25 100.00,-0.05"/>
</net>
在代码中,我试图生成一条长度为 100 m 的道路,我想将其设置为一个实体。但是,当使用 netedit
netedit -s var_test.net.xml
打开文件,它说:
Error: entity 'pos' not found
In file 'var_test.net.xml'
At line/column 8/66.
Error: entity 'pos' not found
In file 'var_test.net.xml'
At line/column 8/66.
Error: No nodes loaded.
Error: Failed to build network.
我是 XML 的新手,不知道这是什么原因。谁能告诉我如何更正我的代码,如何在 sumo 的 net 文件中使用变量,或者我应该首先学习什么?非常感谢!!!
首先是警告:"Here be dragons"。强烈建议不要手动编辑 SUMO 网络。首选方法是使用 plain XML format(手动 prepared/scripted,或由 netedit 或 netconvert 的纯导出生成),编辑生成的文件并通过 netconvert 传递它们,如下所示:
netconvert -s input.net.xml --plain plain
<editor> plain.nod.xml plain.edg.xml
netconvert --node-files=plain.nod.xml --edge-files=plain.edg.xml --output-file=output.net.xml
但是如果你真的坚持自己破解网络,你的 XML 是正确的,问题是,SUMO 默认使用一个优化的网络解析器,它不会扩展实体。如果您启用 XML 验证,您会得到一个按预期工作的较慢的解析器:
netedit -s var_test.net.xml --xml-validation.net always
您好,我正在使用 sumo 生成流量,并试图找到一种方便地调整参数的方法。所以想用一个变量来代替net文件body中的参数。从网上,我发现实体可能有帮助,但似乎我犯了一些错误。代码var_test.net.xml如下。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE net[
<!ENTITY pos "100.00">
]>
<net version="0.27" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/net_file.xsd">
<location netOffset="0.00,0.00" convBoundary="0.00,0.00,&pos;,0.00" origBoundary="10000000000.00,10000000000.00,-10000000000.00,-10000000000.00" projParameter="!"/>
<edge id="gneE0" from="gneJ0" to="gneJ1" priority="1">
<lane id="gneE0_0" index="0" speed="13.89" length="&pos;" shape="0.00,-1.65 &pos;,-1.65"/>
</edge>
<junction id="gneJ0" type="dead_end" x="0.00" y="0.00" incLanes="" intLanes="" shape="0.00,-0.05 0.00,-3.25"/>
<junction id="gneJ1" type="dead_end" x="&pos;" y="0.00" incLanes="gneE0_0" intLanes="" shape="&pos;,-3.25 100.00,-0.05"/>
</net>
在代码中,我试图生成一条长度为 100 m 的道路,我想将其设置为一个实体。但是,当使用 netedit
netedit -s var_test.net.xml
打开文件,它说:
Error: entity 'pos' not found
In file 'var_test.net.xml'
At line/column 8/66.
Error: entity 'pos' not found
In file 'var_test.net.xml'
At line/column 8/66.
Error: No nodes loaded.
Error: Failed to build network.
我是 XML 的新手,不知道这是什么原因。谁能告诉我如何更正我的代码,如何在 sumo 的 net 文件中使用变量,或者我应该首先学习什么?非常感谢!!!
首先是警告:"Here be dragons"。强烈建议不要手动编辑 SUMO 网络。首选方法是使用 plain XML format(手动 prepared/scripted,或由 netedit 或 netconvert 的纯导出生成),编辑生成的文件并通过 netconvert 传递它们,如下所示:
netconvert -s input.net.xml --plain plain
<editor> plain.nod.xml plain.edg.xml
netconvert --node-files=plain.nod.xml --edge-files=plain.edg.xml --output-file=output.net.xml
但是如果你真的坚持自己破解网络,你的 XML 是正确的,问题是,SUMO 默认使用一个优化的网络解析器,它不会扩展实体。如果您启用 XML 验证,您会得到一个按预期工作的较慢的解析器:
netedit -s var_test.net.xml --xml-validation.net always