SUMO应用工具:SUMO-GUI

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 filecenter xcenter ywidthheight, 和 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:阅读更多


后话:

这部分翻译的比较粗糙,因为好多细节需要截图,并且都是一些基本操作的问题。

如果有不懂的欢迎留言或者阅读官方文档

  • 2
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
### 回答1: Sumo是一个流行的交通仿真软件,它提供了一个图形用户界面(GUI)用于可视化仿真过程和结果。但有时,用户可能需要根据自己的需求对Sumo的GUI进行二次开发。 首先,二次开发Sumo的GUI可以通过修改和优化现有的用户界面来实现更好的用户体验。用户可以根据自己的偏好和需求,调整界面的布局、颜色和图标,以使其更符合自己的工作流程。 其次,二次开发还可以通过添加新的功能和工具来增强Sumo的GUI。用户可以根据自己的研究或实践需要,开发新的数据可视化工具或交互式控制面板。这些新功能可以使用户更好地理解交通仿真模型的行为和结果。 此外,二次开发Sumo的GUI还可以集成其他相关工具和平台。用户可以利用API和插件架构,将Sumo与其他软件或平台进行集成,以实现更高级的仿真和分析功能。例如,可以将Sumo的仿真结果导入到地理信息系统(GIS)软件中进行地理可视化和分析。 总之,对Sumo的GUI进行二次开发可以提供更灵活和定制化的用户体验,并使仿真过程更高效和准确。通过修改界面、添加功能、集成其他工具,用户可以根据自己的需求进行定制,以便更好地应用和研究交通流量和模型。 ### 回答2: Sumo是一种用于交通仿真的开源软件包,它提供了一个强大的命令行界面(CLI),但它的图形用户界面(GUI)功能相对有限。为了进行Sumo的GUI二次开发,我们可以采取以下步骤: 1. 理解Sumo的GUI结构:首先,我们需要深入了解Sumo的GUI结构,包括界面元素、布局和交互方式。这包括熟悉Sumo使用的GUI框架和相关工具。 2. 设计GUI增强功能:根据需求,我们可以设计并确定要在Sumo的GUI中添加的功能。这可以包括添加额外的按钮、菜单、工具栏或对话框等。 3. 使用GUI开发工具:接下来,我们可以选择适合的GUI开发工具,例如Python的Tkinter、Qt等。根据Sumo的GUI框架,我们可以使用选定的工具来创建和修改界面元素,并实现所需的功能。 4. 集成到Sumo中:完成GUI的开发后,我们需要将其集成到Sumo中。这可能涉及将GUI代码与Sumo的源代码合并,并进行相关配置和编译。整合后,我们可以通过运行Sumo启动相应的GUI界面。 5. 测试和优化:完成集成后,我们应该对二次开发的GUI进行测试,以确保其功能和性能的稳定性。如果发现问题或改进的空间,我们可以进行相应的优化和修复。 通过以上步骤,我们可以进行Sumo的GUI二次开发,为该软件添加自定义的功能和界面,以满足特定的交通仿真需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值