sumo会输出一个fcd.xml文件,python处理数据还不太会用,还是转成matlab中进行处理。代码分享给大家
首先需要将sumo/tool/xml 文件夹下面的xml2csv文件复制到你matlab的工作目录下
在tool文件夹下也有自带的plot文件,但是个人认为效果不太好
自己按照你对xml文件的命名修改
同时需要根据你的仿真步长修改一下对应的值,我的
仿真步长:0.05
车辆数:20
根据你的场景对应修改即可
``
plotindex=index;
%speed:7 pos_x:9 pos_y:10
if plotindex==7
table_index = '速度/(m/s)';
elseif plotindex==9
table_index = '纵向位移/(m)';
else plotindex==10
table_index = '横向位移/(m)';
end
% system('python xml2csv.py fcd_fivecar_20car.xml')
% fcdfivecar_id=readmatrix('fcd_fivecar_20car.csv', 'OutputType','char');
% fcdfivecar=readmatrix('fcd_fivecar_20car.csv', 'OutputType', 'doub