1、概览
sumo-gui和sumo有着相同的功能,仅仅是拥有图形化的界面。
目的:仿真一个特定的脚本
系统:在Linux/windows上测试过,打开一个窗口
输入:sumo的配置文件
输出:和sumo的生成文件一样
编程语言:C++
2、用法描述
上图为sumo-gui的初始化界面
其实在windows下界面很常见。这里主要说一下主要用到的功能:time,点击这个按钮可以实现在秒和时分秒之间的显示转换。delay,可以设置延迟,能够放缓仿真的运行,相当于视频播放器的放慢和快进功能,车辆的仿真不受影响,就是仿真演示速度快了。默认的状态是delay为0,即不放慢。有可能仿真很快,你还没看到车辆就结束了,这时你只要调大delay值就能看到详细过程。【在运行过程中,我发现将delay设置为1000,那么仿真就是和真实时间是同步的,即每秒更新一次】
操作:鼠标右键和活动轮进行缩放,左键进行平移。
3、与视图的交互
3.1基本的导航
一旦一个网络被加载那么就可以进行交互。鼠标右键和活动轮进行缩放,左键进行平移。或者按住ctrl或者shift键,滑动滑动轮。缩放集中在屏幕的中心或光标位置上。
您还可以控制网络的哪个部分是可见的,通过直接设置的网络坐标,这将是在屏幕的中心随着变焦。
3.2键盘快捷键
有很多菜单的选项可以通过快捷键实现:
ctrl-左击:光标下的对象的选择状态
箭头键:移动视口
ctrl+箭头键:少量移动视口
PageUp/PageDown:大量上下移动窗口
shift+ PageUp/PageDown:左右大幅度移动窗口
+/-:放大/缩小
Home键:将加载路网中心对齐
ctrl+v:打开设置窗口
3.3改变模拟的外观/可视化
通过ctrl+v或者打开第三行从右数第二个七彩盘的按钮,调用出设置界面。
除了默认的显示,你可以修改一些显示,比如背景颜色、车辆和道路的形状或者兴趣点的可视化。可以保存或者删除相应的设置。
3.3.1车辆的可视化设置
首先是车辆形状的设置:
Name | Description |
triangle | All vehicles are shaped triangular全是三角形 |
boxes | All vehicles are shaped square全是长方形 |
simple shapes | All vehicles have simple car shape全是普通车的形状 |
raster images | All vehicles are drawn with a loaded bitmap defined for their type using attribute imgFile (usingsimple shapes as fallback)细节比较丰富,还带转向灯哦! |
第二个就是车辆的颜色设置。这个有特别多的选项:
Name | Measure | Description |
given vehicle/type/route color | - | The color given within the vehicle definition with fallback to type and then to route color |
uniform | - | All vehicles are colored uniformly |
given/assigned vehicle color | - | The color given within the vehicle definition |
given/assigned type color | - | The color given within the vehicle type definition |
given/assigned route color | - | The color given within the vehicle route definition |
depart position as HSV | - | The depart position of each vehicle, relative to the network center, is used to color the vehicle. Direction will be used as H(ue), distance from the center as S(aturation), V(alue) is always 1. |
arrival position as HSV | - | The arrival position of each vehicle, relative to the network center, is used to color the vehicle. Direction will be used as H(ue), distance from the center as S(aturation), V(alue) is always 1. |
direction/distance as HSV | - | The direction and distance between a vehicle's departure and arrival position, are used to color the vehicle. Direction will be used as H(ue), distance from the center as S(aturation), V(alue) is always 1. |
by speed | m/s | The current vehicle speed |
by waiting time | s | The time for which a vehicle is halting |
by time since last lanechange | s | The time since the last lane change. The color also indicates the direction of the last lane-change. |
by max speed | m/s | Vehicle's maximum velocity |
by CO2 emissions | g/s | The amount of CO2 currently emitted by the vehicle |
by CO emissions | g/s | The amount of CO currently emitted by the vehicle |
by PMx emissions | g/s | The amount of PMx currently emitted by the vehicle |
by NOx emissions | g/s | The amount of NOx currently emitted by the vehicle |
by HC emissions | g/s | The amount of HC currently emitted by the vehicle |
by fuel consumption | l/s | The consumed fuel |
by electricity consumption | kWh/s | The consumed electricity (for electric vehicles only) |
by noise emissions | dbA | The noise produced by the vehicle |
by reroute number | count | The number of times this vehicle has bee rerouted |
by selection | - | Colors selected and unselected vehicles differently |
by offset from best lane | count | By the number of immediate lane changes the vehicle must perform in order to follow its route |
by accleration | m/s^2 |
|
by time gap | s | By the time to collide with the leader vehicle assuming constant speeds |
除此之外,车辆的闪光灯、刹车、安全距离和车辆名字都能显示出来。车辆名字始终保持固定大小,不管如何缩放地图。
3.3.2道路/车道可视化设置
车道的着色方案:
Name | Measure | Description |
uniform | - | All road edges are drawn using the same color. Bicycle lanes are drawn in brown, sidewalks in grey and prohibited lanes (allowing no vehicle classes) are transparent. |
by selection (lane-/streetwise) | - | selected lanes are drawn different than those that are not |
by permission code | - | all lanes are colored according to the permitted vehicle classes. The code for each lane can be retrieved from the lane parameter dialog (permission code). |
by allowed speed (lanewise) | m/s | The maximum velocity allowed on this lane |
by current occupancy (lanewise, brutto) | % / 100 | By the amount of place that is covered by vehicles (including minGap) |
by current occupancy (lanewise, netto) | % / 100 | By the amount of place that is covered by vehicles (excluding minGap) |
by first vehicle waiting time (lanewise) | s | By the time the first vehicle on the lane waits |
by lane number (streetwise) | - | By the number of lanes this edge has |
by CO2 emissions | g/s | The mean amount of CO2 emitted per a lane's meter |
by CO emissions | g/s | The mean amount of CO emitted per a lane's meter |
by PMx emissions | g/s | The mean amount of PMx emitted per a lane's meter |
by NOx emissions | g/s | The mean amount of NOx emitted per a lane's meter |
by HC emissions | g/s | The mean amount of HC emitted per a lane's meter |
by fuel consumption | l/s | The mean amount of consumed fuel per a lane's meter |
by electricity consumption | kWh/s | The mean amount of consumed electricity per a lane's meter |
by noise emission | dBa | The noise generated by the vehicles on the lane |
by global travel time | s | The travel time on that edge loaded from a weight file |
by global speed percentage | % | By the fraction of the maximum speed that the edge allows based on travel times from a loaded weight file |
by given length/geometrical length |
| The factor by which the geometrical length differs from the user-specified edge length |
by angle |
| The angle of the edge measured from start to end (excluding in-between geometry) |
by loaded weight |
| By the value loaded using options --weight-files, --weight-attribute |
by priority |
| By the right-of-way priority using during network building |
by height at start | m | By the z-coordinate at the start of the lane |
by height at segment start | m | By the z-coordinate at the start of each geometry segment |
by inclination | % | By the average change in height between start and end of the lane per m |
by segment inclination | % | By the average change in height between start and end of each geometry segment |
by average speed | m/s | By the average speed of vehicles on the lane |
by average relative speed | % | By the average speed of vehicles on the lane as percentage of the allowed speed |
车道调整计划:
Name | Measure | Description |
by selection (lane-/streetwise) | - | selected lanes are drawn different than those that are not |
by allowed speed (lanewise) | m/s | The maximum velocity allowed on this lane |
by current occupancy (lanewise, brutto) | % / 100 | By the amount of place that is covered by vehicles (including minGap) |
by current occupancy (lanewise, netto) | % / 100 | By the amount of place that is covered by vehicles (excluding minGap) |
by first vehicle waiting time (lanewise) | s | By the time the first vehicle on the lane waits |
by lane number (streetwise) | - | By the number of lanes this edge has |
by CO2 emissions | g/s | The mean amount of CO2 emitted per a lane's meter |
by CO emissions | g/s | The mean amount of CO emitted per a lane's meter |
by PMx emissions | g/s | The mean amount of PMx emitted per a lane's meter |
by NOx emissions | g/s | The mean amount of NOx emitted per a lane's meter |
by HC emissions | g/s | The mean amount of HC emitted per a lane's meter |
by fuel consumption | l/s | The mean amount of consumed fuel per a lane's meter |
by electricity consumption | kWh/s | The mean amount of consumed electricity per a lane's meter |
by noise emission | dBa | The noise generated by the vehicles on the lane |
by global travel time | s | The travel time on that edge loaded from a weight file |
by global speed percentage | % | By the fraction of the maximum speed that the edge allows based on travel times from a loaded weight file |
by given length/geometrical length |
| The factor by which the geometrical length differs from the user-specified edge length |
by angle |
| The angle of the edge measured from start to end (excluding in-between geometry) |
by loaded weight |
| By the value loaded using options--weight-files, --weight-attribute |
by priority |
| By the right-of-way priority using during network building |
by average speed | m/s | By the average speed of vehicles on the lane |
by average relative speed | % | By the average speed of vehicles on the lane as percentage of the allowed speed |
除了颜色外,还能够设置车道边界、连接贴花、钢轨、道路的名字、内部道路的名字和隐藏宏连接器。同上,名字的显示也是固定大小。
3.4在sumo-gui中使用贴花(decals)
打开设置页面,选择background就会看到相应的设置。
可以看到上图的列表中有: picture file, center x, center y, width, height, 和 rotation。现在,现在,如果你点击第一行的picture file,你应该能够输入一个图像文件的完整路径。确保路径正确,然后按下enter键确认。随后,将会在视口中显示响应的文件,正如下图所示:
上图是在路网的基础上添加了一张坐标图的图片,如下如所示:
目前,SUMO_GUI可以加载gif和bmp图片【测试其他类型图片也可以,这句话针对的老版本,忽略它】。要注意,图片的长长宽应该为2的幂次方。这意味着这个图片必须是2,4,8,16,32,64,…..像素。这是由于OpenGL中的限制【这个不清楚】。自从sumo的0.11.0版本,sumo-gui自动调整图片值向邻近的2的幂次方值,并且支持的格式也比较多。包括pcx,ico和tag,png,JPG,tif。关于更多的格式问题,查看FOX的更新状况。【因为sumo的GUI都是基于FOX实现的,因此需要FOX的支持】。
现在,你可以放置/缩放/旋转图片,通过属性:center X,center Y,width,heigh和rotation。当设置relation为1时,position和size的值将会采用屏幕的像素值,并不是网络相关的值。再对齐后你可以保存相应的贴花。你也可以自己定义:
<decalfilename="background.gif" centerX="550.00"centerY="1530.00" width="64.00" height="64.00"rotation="0.00"/>
以下的参数选项:
ttribute Name | Value Type | Description |
filename | path (string) | picture file, the full name of the background image 贴花的完全路径。 |
centerX | float | center x, the x-position of the center of the image in network coordinates (in meters)x轴的中心 |
centerY | float | center y, the y-position of the center of the image in network coordinates (in meters)y轴的中心 |
width | float | The width of the image in network coordinates (in meters) 在网络坐标中的宽度,单位米 |
height | float | The height of the image in network coordinates (in meters) 在网络坐标中的高度,单位米 |
rotation | float | The angle of the image in degrees 图片的角度 |
layer | float | The layer at which the image in drawn in meters over ground 在地面绘制的图像的图层 |
screenRelative | bool | relative, whether the position and size are pixel coordinates relative to the screen rather then the network coordinates 根据屏幕像素确定位置。 |
centerZ | float | The z-position of the center of the object in network coordinates (in meters), only used in 3D visualization instead of layer 只适用于3D可视化。z轴方向的中心位置。 |
tilt | float | The tilt angle of the object, only used in 3D visualization 物体的倾斜角度 |
roll | float | The roll angle of the object, only used in 3D visualization 物体的滚动角度 |
有关贴花的跟多内容,可以参考:Configuration Files
3.4.1有关贴花(decals)的问题
是不是贴花的大小必须符合net的大小?
不需要,贴花必须手动调整。它可以覆盖任何区域。
3.5影响模拟
目前,你仅仅可以进行少量的交互,看完下面的内容就不会这样了!开启新的内容吧。
3.5.1切换交通灯
右键点击红绿信号灯的颜色条,弹出菜单包含很多信息内容,这个特殊的程序off总是可用的,可以用来切换到一个优先权交叉口。【就是右键有一个off功能】
3.5.2关闭或者打开道路或者车道
右键,也有相应的关闭车道或者关闭道路的选项。同样,也可以打开。
3.5.3计划的作用
将来会有更多的交互会实现:
l 动态的修改仿真选项
l 增加交通
l 改变车辆或车辆类型参数
l 测试Traci函数调用
4、理解你所看到的
4.1道路优先级
在每条路的结尾,都会是个节点,交点处有一个颜色条(信号灯)表明了道路的优先行驶权。不同的颜色有不同的定义:
注意:【没看懂】
如果一辆汽车在模拟制动,相应的限制车辆【不知道翻译是否准确,应该就是妨碍的车辆】也会采取响应的步骤:
设置响应的颜色
右键单击“制动车辆”,然后单击“选择敌人”
The foe vehicles will then be color withthe selection color (typically blue).
5、选择对象
SUMO-GUI允许net文件的任何元素包括道路、车道和节点,能够保存到单独的文件中用于后续处理。通过右键,会有一个“Add To Select”的选项。
这些选择的属性,能够被保存或者加载。从“编辑菜单”中的“编辑选择Edit Chosen”对话框中看。点开以后就能看到你选择过的列表。
6、配置文件
sumo-gui使用和sumo相同的配置文件。可以通过—sumo–help查看相应的选项,或者你可以通过sumo –save—template <file> --save-commented来保存。选项gui-settings-file专门针对sumo-gui。它允许你加载以前用过的配置文件。获取gui-setting文件的最简单的方法就是通过界面设置保存。
注意,gui-setting文件保存的只有视口、延迟和贴花的相关信息。你可以手动编辑。相关的使用示例:
example.sumocfg
<configuration>
<net-file value="yournetwork.net.xml"/>
<gui-settings-file value="gui-settings.cfg"/>
</configuration>
gui-settings.cfg
<viewsettings>
<scheme name="...
...
</scheme>
<viewport zoom="200" x="100" y="-100"/>
<delay value="42"/>
<decal filename="background.gif" centerX="550.00" centerY="1530.00" width="64.00" height="64.00" rota tion="0.00"/>
<breakpoints-file value="breakpoints.txt"/>
</viewsettings>
关于断点文件(breakpoint)可以通过Edit->Edit Breakpoint->save生成。
你可能通过窗口加载配置文件,或者通过命令行sumo –c example.sumocfg。
并且会有专门的验证文件:sumoConfiguration.xsd。
当然你也可以使用自己提前定义好的验证文件(但是不建议这么做):
<viewsettings>
<scheme name="real world/>
</viewsettings>
7、多视口
点击窗口的多视口按钮,可以生成新的窗口。可以通过window->相应的窗口编号进行操作。
8、更多信息
Using additional Polygons and POIs withinthe Simulation:阅读更多
后话:
这部分翻译的比较粗糙,因为好多细节需要截图,并且都是一些基本操作的问题。
如果有不懂的欢迎留言或者阅读官方文档