[英]How to add a variable/entity in the sumo net file *.net.xml
嗨,我正在使用相撲來生成交通流,並試圖找到一種方便地調整參數的方法。 因此,我想使用一個變量替換凈文件正文中的參數。 通過網絡,我發現實體可能會有所幫助,但似乎我犯了一些錯誤。 代碼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的網絡文件中使用變量或我應該首先學習什么? 非常感謝你!!!
首先警告:“這是龍”。 強烈建議不要手動編輯SUMO網絡。 首選方法是使用純XML格式 (手動准備/編寫腳本,或由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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.