基于sumo实现交通灯控制算法的模板

基于sumo实现交通灯控制算法的模板

目录

  • 在windows安装
  • run hello world
    • network
    • routes
    • viewsettings & configuration
    • simulation
  • 交通灯控制系统
    • 介绍
    • 文件生成器类(FileGenerator)
    • 道路网络(Network)
    • 辅助函数
    • 生成道路网络(GenerateNetwork)
    • 生成路径(route)
    • 生成车辆(vehicle)
    • 生成交通信号灯(tlLogic)
    • 生成探测器(detector)
    • py程序接口(TraCI)
  • 附录
    • node
    • edge
    • connection
    • route
    • vehicle
    • tlLogic
    • TraCI
    • Detector
    • simulation
    • 参考资料
    • 有关文件

原文地址:https://www.wolai.com/7SsvyQLdZQr5TPikSDG9rR

代码在附录中

在windows安装

SUMO 软件包中的大多数应用程序都是命令行工具,目前只有sumo-gui和netedit不是。

SUMO 应用程序是普通的可执行文件。你只需在命令行中输入其名称即可启动它们;例如,netgenerate的调用方式是

netgenerate.exe

这只是启动应用程序(本例中为netgenerate)。由于没有给出参数,应用程序不知道要做什么,只能打印有关自身的信息:

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

SUMO 中有两个gui程序:

  • netedit:生成network、routes等
  • sumo-gui:执行simulation

这两个程序均可通过命令行启动:

启动netedit:

netedit

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

启动sumo-gui:

sumo-gui

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

run hello world

通过GUI创建和仿真的详细操作参考此处:https://sumo.dlr.de/docs/Tutorials/Hello_World.html

我们接下来要讨论的是通过文件创建和仿真,这将用到如下文件:

  • *.nod.xml:记录节点信息
  • *.edg.xml:记录边信息
  • *.net.xml:记录网络信息,通过 netconvert 生成
  • *.rou.xml:记录车辆信息
  • *.settings.xml:记录仿真界面的配置信息
  • *.sumocfg:记录仿真信息,sumo通过此文件执行仿真

network

所有节点都有一个位置(x 坐标和 y 坐标,描述到原点的距离,以米为单位)和一个 ID,以供将来参考。因此,我们的简单节点文件如下:

<nodes><node id="1" x="-250.0" y="0.0" /><node id="2" x="+250.0" y="0.0" /><node id="3" x="+251.0" y="0.0" />
</nodes>

您可以使用自己选择的文本编辑器编辑文件,并将其保存为hello.nod.xml,其中.nod.xml是 Sumo 节点文件的默认后缀。

现在我们用边来连接节点。这听起来很简单。我们有一个源节点 ID、一个目标节点 ID 和一个边 ID,以备将来参考。边是有方向的,因此每辆车在这条边上行驶时,都会from给出的源节点开始,在给出的to节点结束。

<edges><edge from="1" id="1to2" to="2" /><edge from="2" id="out" to="3" />
</edges>

将这些数据保存到名为hello.edg.xml 的文件中。

现在我们有了节点和边,就可以调用第一个 SUMO 工具来创建网络了。 确保netconvert位于PATH中的某个位置,然后调用

netconvert --node-files=hello.nod.xml --edge-files=hello.edg.xml --output-file=hello.net.xml

这将生成名为hello.net.xml 的网络。

启动netedit并查看文件:

netedit hello.net.xml

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

routes

更多信息请参阅"车辆、车辆类型和路线的定义"

定义如下几个字段:

  • vType :车辆类型的信息
  • route :路径的信息
  • vehicle :车辆的信息

如下所示的hello.rou.xml文件:

<routes><vType id="typeCar" accel="0.8" decel="4.5" sigma="0.5" length="5" minGap="2.5" maxSpeed="16.67" guiShape="passenger"/><route id="route0" edges="1to2 out"/><vehicle depart="1" id="veh0" route="route0" type="typeCar" /><vehicle depart="20" id="veh1" route="route0" type="typeCar" />
</routes>

注意:定义多辆车时,应该按照depart属性排序

viewsettings & configuration

使用图形用户界面进行模拟时,添加一个 gui-settings 文件非常有用,这样就不必在启动程序后更改设置。为此,创建一个viewsettings文件:

<viewsettings><viewport y="0" x="250" zoom="100"/><delay value="100"/>
</viewsettings>

将其保存为配置文件中包含的名称,在本例中就是hello.settings.xml

在这里,我们使用视口(viewport)来设置摄像机的位置,并使用延迟(delay)来设置模拟的每一步之间的延迟(毫秒)。

现在,我们将所有内容粘合到一个配置文件中:

<configuration><input><net-file value="hello.net.xml"/><route-files value="hello.rou.xml"/><gui-settings-file value="hello.settings.xml"/></input><time><begin value="0"/><end value="10000"/></time>
</configuration>

将其保存到hello.sumocfg

simulation

Using the Command Line Applications - SUMO Documentation (dlr.de)

我们就可以开始模拟了,方法如下:

sumo-gui -c hello.sumocfg

交通灯控制系统

看不懂的参数请看附录

介绍

Quick Start (old style) - SUMO Documentation (dlr.de)

我们的目的是生成如下类型的道路网络:

  • 十字路口的规模是可自定义的
  • 十字路口的道路是有专用转向车道的

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

道路网络network:

  • 节点node
  • 边edge
  • 道路lane:每条边对应多条道路
  • 连接connection:边与边之间的连接关系

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

我们的项目按照如下流程进行:

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

文件生成器类(FileGenerator)

import os
import subprocess
from sample.NetworkFileGenerator import NetworkFileGenerator
from sample.SumoFileGenerator import SumoFileGeneratorclass FileGenerator:def __init__(self):self._networkGenerator = NetworkFileGenerator()self._sumoGenerator = SumoFileGenerator()self.network = Nonepassdef GenerateAllFile(self, netconvert: str = "netconvert", cwd: str = "", name: str = "sample",height: int = 1, width: int = 1, unity: int = 100,avgCarAmount: int = 5, timePeriod: int = 100):if cwd == "":cwd = os.getcwd() + "/data"  # 输出目录# 生成所需文件self._networkGenerator.GenerateAllFile(cwd, name, width, height, unity)self._sumoGenerator.GenerateAllFile(cwd, name, self._networkGenerator.network, avgCarAmount, timePeriod)p = subprocess.Popen([netconvert,"-c", "%s.netccfg" % (name),"--no-turnarounds.tls", "true"],stdin=subprocess.PIPE, stdout=subprocess.PIPE,cwd=cwd)p.wait()self.network = self._networkGenerator.networkpasspass
  • 负责根据参数生成绝大多数有关文件
  • 支持输出目录的自定义
  • 支持输出文件名的自定义
  • 外界通过调用GenerateAllFile以使用该类

道路网络(Network)

道路网络的数据结构:

from collections import defaultdictclass Network:def __init__(self):"""Node: (int, int)Edge: (Node, Node)Connection: (Node, Node, Node, lane: int)"""self.width = 1  # 水平方向的交通灯数量self.height = 1  # 竖直方向的交通灯数量self.nodes = []  # 节点self.edges = []  # 边self.connections = []  # 连接self.tlNodes = []  # 交通灯节点self.boundaryNodes = []  # 边界节点self.inEdges = defaultdict(list)  # 入边表,Node -> [Edge]self.outEdges = defaultdict(list)  # 出边表,Node -> [Edge]passpass
  • 节点使用二维坐标来描述
  • 边使用两个节点来描述
  • 连接使用三个节点来描述
  • width、height是交通灯的数量信息

辅助函数

def GetNodeId(i: int, j: int) -> str:return "%01d%01d" % (i, j)def GetEdgeId(i: int, j: int, u: int, v: int) -> str:# from (i, j) to (u, v)return "%sto%s" % (GetNodeId(i, j), GetNodeId(u, v))def GetRouteId(i: int, j: int, u: int, v: int, additional: int) -> str:# from (i, j) to (u, v)return "%s_%08d" % (GetEdgeId(i, j, u, v), additional)def GetLaneId(i: int, j: int, u: int, v: int, lane: int) -> str:# from (i, j) to (u, v)return "%s_%1d" % (GetEdgeId(i, j, u, v), lane)def GetDetectorId(i: int, j: int, u: int, v: int, lane: int) -> str:# from (i, j) to (u, v)return "det_%s" % (GetLaneId(i, j, u, v, lane))def IsTrafficLightNode(width: int, height: int, i: int, j: int) -> bool:# [1, width] * [1, height] 范围内是交通灯节点return 1 <= i and i <= width and 1 <= j and j <= heightdef IsBoundaryNode(width: int, height: int, i: int, j: int) -> bool:# [1, width] * [1, height] 范围外的一圈是边界return i == 0 or i == width + 1 or j == 0 or j == height + 1def IsIllegalNode(width: int, height: int, i: int, j: int) -> bool:# [0, width + 1] * [0, height + 1] 范围外是非法的return i < 0 or i > width + 1 or j < 0 or j > height + 1def IsCornerNode(width: int, height: int, i: int, j: int) -> bool:# (0, 0) (width + 1, 0) (0, height + 1) (width + 1, height + 1) 是角落return i == 0 and j == 0 or \i == width + 1 and j == 0 or \i == 0 and j == height + 1 or \i == width + 1 and j == height + 1def GetEdgesOfRoute(path: list) -> str:# 从节点列表,以字符串形式,给出途经的边ret = ""for i in range(1, len(path)):ret += GetEdgeId(*path[i - 1], *path[i]) + " "return retdef ToXMLElement(name: str, *arg: str):import xml.domdoc = xml.dom.minidom.Document()# doc = xml.dom.minidom.Document()element = doc.createElement(name)for i in range(1, len(arg), 2):element.setAttribute(arg[i - 1], arg[i])return elementpass
  • [1, width] * [1, height]是交通灯的坐标
  • [1, width] * [1, height] 范围外的一圈是边界
  • [0, width + 1] * [0, height + 1] 范围外是非法的
  • (0, 0) (width + 1, 0) (0, height + 1) (width + 1, height + 1) 是角落

生成道路网络(GenerateNetwork)

  • 规定方向编号:参考极坐标系,角度与方向编号有线性关系
    • 0:x轴正向
    • 1:y轴正向
    • 2:x轴负向
    • 3:y轴负向
  • 规定转向编号:即方向编号的差分量
    • -1:右转
    • 0:直行
    • 1:左转

这样规定转向编号的原因是,转向编号与sumo的车道编号相对应。sumo的车道编号是从右到左的。

代码如下:

class NetworkFileGenerator:def __init__(self):self.cwd = None  # 输出目录self.name = None  # 文件名self.network = None  # 道路网络self._unity = None  # 单位长passdef GenerateNetwork(self, width: int, height: int) -> Network:self.network = Network()self.network.width = widthself.network.height = heightdx = [1, 0, -1, 0]dy = [0, 1, 0, -1]turn = [-1, 0, 1]  # 车道编号 -> 转向编号,分别对应:右转,直行,左转for i in range(width + 2):for j in range(height + 2):# 生成节点 (i, j)# 角落不需要生成if Utils.IsCornerNode(width, height, i, j):continuenode1 = (i, j)self.network.nodes.append(node1)if Utils.IsTrafficLightNode(self.network.width, self.network.height, i, j):self.network.tlNodes.append(node1)else:self.network.boundaryNodes.append(node1)passfor dir in range(len(dx)):u = i + dx[dir]v = j + dy[dir]# 生成边 (i, j)->(u, v)# 排除非法节点if Utils.IsIllegalNode(width, height, u, v):continue# 角落不需要生成if Utils.IsCornerNode(width, height, u, v):continue# 边界节点与边界节点互不相连,排除if Utils.IsBoundaryNode(width, height, i, j) and Utils.IsBoundaryNode(width, height, u, v):continue# 生成边node2 = (u, v)edge = (node1, node2)self.network.edges.append(edge)self.network.outEdges[node1].append(edge)self.network.inEdges[node2].append(edge)passfor lane in range(len(turn)):dir2 = (dir + turn[lane] + len(dx)) % len(dx)x = u + dx[dir2]y = v + dy[dir2]# (i, j)->(u,v)->(x,y)# 排除非法的if Utils.IsIllegalNode(width, height, x, y):continue# 角落不需要生成if Utils.IsCornerNode(width, height, x, y):continue# 边界节点与边界节点互不相连if Utils.IsBoundaryNode(width, height, u, v) and Utils.IsBoundaryNode(width, height, x, y):continue# 生成连接node3 = (x, y)connection = (node1, node2, node3, lane)self.network.connections.append(connection)passpasspasspassreturn self.network

生成路径(route)

SUMO Road Networks - SUMO Documentation (dlr.de)

我们使用回溯算法生成所有可能的路径。

由于该算法的时间开销较大,如果地图大小超过4*4,那么建议导入路径而不是生成

import xml.dom
import numpy as np
import Utils
from Network import Network
from collections import defaultdictfrom sample.Utils import _GetEdgesOfRouteclass SumoFileGenerator:def __init__(self):self.cwd = None  # 输出目录self.name = None  # 文件名self.network = None  # 道路网络# for dfsself._visit = Noneself._path = Noneself._ans = Nonepassdef _dfsrc(self, nodeP: tuple or None, nodeU: tuple):# 深度优先搜索递归核心 Depth First Search Recursive Coreif nodeU in self.network.boundaryNodes and nodeP is not None:self._ans.append([x for x in self._path])returnfor _, nodeV in self.network.outEdges[nodeU]:if self._visit[nodeV] is True:continueself._visit[nodeV] = Trueself._path.append(nodeV)self._dfsrc(nodeU, nodeV)self._path.pop()self._visit[nodeV] = Falsepassdef _GetRoutes(self, nodeU: tuple) -> list:# 生成所有以 nodeU 为起点的路径self._visit = defaultdict(bool)self._path = []self._ans = []self._visit[nodeU] = Trueself._path.append(nodeU)self._dfsrc(None, nodeU)return self._anspassdef _GenerateRouteFile(self, avgCarAmount, timePeriod)://...pass

生成车辆(vehicle)

用分布来模拟车辆到达,实际上是在采样。因为各个样本点独立同分布

设随机变量X是车辆到达的数量,P{X=k}是有k辆车到达的概率。

我们采取timePeriod个样本,各个样本就对应了各个时刻车辆的到达情况。

    def _GenerateRouteFile(self, avgCarAmount, timePeriod):// ...# 创建车辆arrivals = np.random.poisson(avgCarAmount, timePeriod)vehicleId = 0for time in range(len(arrivals)):for i in range(arrivals[time]):rootElement.appendChild(Utils.ToXMLElement("vehicle","id", "%08d" % (vehicleId),"type", "typeCar","route", routeIds[np.random.randint(0, len(routeIds))],"depart", "%d" % (time),))vehicleId += 1pass// ...pass

生成交通信号灯(tlLogic)

直接遍历network中的交通灯节点,然后生成对应的XML元素,其中:

  • id是节点id
  • programID是随便填的
  • 相位暂时使用默认相位,以进行测试
    def _GenerateDefaultPhases(self) -> list:ret = []phase = "ggggrrgrrgrr"for i in range(4):ret.append(("17", phase))ret.append(("3", phase.replace("g", "y")))phase = phase[3:] + phase[:3]return retpassdef _GenerateTrafficLightFile(self):# *.add.xml,# 创建一个XML文档对象doc = xml.dom.minidom.Document()rootElement = doc.createElement("additional")  # 根节点doc.appendChild(rootElement)defaultPhases = self._GenerateDefaultPhases()  # 使用默认相位进行测试# attribute = ["id", "type", "programID", "offset"]for node in self.network.tlNodes:# 遍历交通灯节点TLElement = doc.createElement("tlLogic")rootElement.appendChild(TLElement)TLElement.setAttribute("id", Utils.GetNodeId(*node))TLElement.setAttribute("type", "static")TLElement.setAttribute("programID", "runner")TLElement.setAttribute("offset", "0")# 交通灯的相位for duration, state in defaultPhases:phaseElement = doc.createElement("phase")phaseElement.setAttribute("duration", duration)phaseElement.setAttribute("state", state)TLElement.appendChild(phaseElement)with open("%s/%s.add.xml" % (self.cwd, self.name), "w") as fileOut:fileOut.write(doc.toprettyxml())pass

生成探测器(detector)

为了使探测器能覆盖整条道路,我们只填入pos属性,而不填入endPos或length属性。

    def _GenerateDetectorFile(self):# *.det.xml,# 创建一个XML文档对象doc = xml.dom.minidom.Document()rootElement = doc.createElement("additional")  # 根节点doc.appendChild(rootElement)# attribute = ["id", "lane", "pos", "file", "friendlyPos"]for (i, j), (u, v) in self.network.edges:for lane in range(3):rootElement.appendChild(Utils.ToXMLElement("laneAreaDetector","id", Utils.GetDetectorId(i, j, u, v, lane),"lane", Utils.GetLaneId(i, j, u, v, lane),"pos", "0",# "endPos", "100",# "length", "%d" % (72.80),"file", "%s/%s.out.xml" % (self.cwd, self.name),"friendlyPos", "true", ))with open("%s/%s.det.xml" % (self.cwd, self.name), "w") as fileOut:fileOut.write(doc.toprettyxml())pass

py程序接口(TraCI)

TraCI 采用基于 TCP 的客户端/服务器架构来访问sumo。因此,使用附加命令行选项启动时,sumo将充当服务器:–remote-port <INT>,其中 是sumo用于监听传入连接的端口。

当使用 –remote-port<INT>选项启动时,sumo只准备模拟,等待所有外部应用程序连接并接管控制权。请注意,当sumo作为 TraCI 服务器运行时,–end <TIME>选项将被忽略。

使用sumo-gui作为服务器时,在处理 TraCI 命令之前,必须通过使用播放按钮或设置选项 –start来启动模拟。

import os
import sys
from FileGenerator import FileGenerator
from Network import Networktry:sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', "tools"))  # tutorial in testssys.path.append(os.path.join(os.environ.get("SUMO_HOME", os.path.join(os.path.dirname(__file__), "..", "..", "..")), "tools"))  # tutorial in docssys.path.append("/usr/local/Cellar/sumo/1.2.0/share/sumo/tools")from sumolib import checkBinary  # noqa
except ImportError:sys.exit("please declare environment variable 'SUMO_HOME' as the root directory of your sumo installation""(it should contain folders 'bin', 'tools' and 'docs')")import traci# ====================================================================================================# adapted from SUMO tutorials
def run(network: Network):"""execute the TraCI control loop"""# step = 0# amber = 0# waits = []# phase = [0, 0, 0, 0, 0, 0, 0, 0, 0]# for i in range(0, NUM_JUNCTIONS):#     waits.append([0] * len(PHASES))cnt = 0while traci.simulation.getMinExpectedNumber() > 0:  # step <= 900:traci.simulationStep()traci.trafficlight.setPhase("11", cnt % 2)traci.trafficlight.setPhase("22", cnt % 2)cnt = cnt + 1# if step % PHASE_LENGTH == 0:#     for i in range(0, NUM_JUNCTIONS):#         if MAX_WAIT in waits[i]:#             phase[i] = waits[i].index(MAX_WAIT)#         else:#             if noPhaseChange(phase[i], i) != True:#                 phase[i] = backPressure(i)#                 amber = amber + 1#         traci.trafficlight.setPhase("0" + getNodeId(i), phase[i])#         for j in range(0, len(PHASES), 2):#             if j == phase[i]:#                 waits[i][j] = 0#             else:#                 if waits[i][j] < MAX_WAIT:#                     waits[i][j] += 1# step += 1# logging.warning(amber)traci.close()sys.stdout.flush()if __name__ == '__main__':# constCWD = os.getcwd() + "/data"NAME = "sample"OUTPUTDIR = os.getcwd() + "/output"NETCONVERT = checkBinary('netconvert')SUMO = checkBinary('sumo-gui')# maingenerator = FileGenerator()generator.GenerateAllFile(NETCONVERT, CWD, NAME,2, 2, 100,2, 10)  # 生成文件print("GenerateAll finish")traci.start([SUMO,"-c", "%s/%s.sumocfg" % (CWD, NAME),"--tripinfo-output", "%s/%s.tripinfo.xml" % (OUTPUTDIR, NAME),"--summary", "%s/%s.sum.xml" % (OUTPUTDIR, NAME)])run(generator.network)

附录

node

PlainXML - SUMO Documentation (dlr.de)

nod的属性:

属性名称类型说明
idid (string)节点名称
xfloat节点在平面上的 x 位置,以米为单位
yfloat节点在平面上的 y 轴位置,以米为单位
zfloat节点在平面上的 Z 位置,以米为单位
typeenum ( “priority”, “traffic_light”……)节点的可选类型

edge

PlainXML - SUMO Documentation (dlr.de)

edge的属性:

属性名称类型说明
idid (string)边的 ID(必须唯一)
fromreferenced node idThe name of a node within the nodes-file the edge shall start at
toreferenced node idThe name of a node within the nodes-file the edge shall end at
typereferenced type idThe name of a type within the SUMO edge type file

connection

PlainXML - SUMO Documentation (dlr.de)

SUMO Road Networks - SUMO Documentation (dlr.de)

connection的属性:

名称类型说明
fromedge id (string)开始连接的输入边 ID
toedge id (string)连接结束时出线边的 ID
fromLaneindex (unsigned int)开始连接的输入边的车道
toLaneindex (unsigned int)连接结束时出线边缘的车道

route

Definition of Vehicles, Vehicle Types, and Routes - SUMO Documentation (dlr.de)

route 的属性:

属性名称价值类型说明
idid (string)路线名称
edgesid list车辆应行驶的路线,以 ID 表示,用空格隔开

vehicle

Definition of Vehicles, Vehicle Types, and Routes - SUMO Documentation (dlr.de)

vType 的属性:

属性名称价值类型默认值说明
idid (string)-车辆类型名称
accelfloat2.6此类车辆的加速能力(单位:m/s^2)
decelfloat4.5此类车辆的减速能力(单位:m/s^2)
sigmafloat0.5汽车跟随模型参数,见下文
lengthfloat5.0车辆长度(米)
minGapfloat2.5最小车距(米)
maxSpeedfloat55.55(200 km/h),车辆的最大速度(米/秒)
guiShapeshape (enum)“unknown”绘制车辆形状。默认情况下,绘制的是标准客车车身。

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

vehicle 的属性:

属性名称价值类型说明
idstring车辆名称
typestring该车辆使用的车辆类型 ID
routestring车辆行驶路线的 ID
departfloat(s)车辆进入网络的时间步长

tlLogic

Traffic Lights - SUMO Documentation (dlr.de)

tlLogic 的属性:

属性名称价值类型说明
idid (string)交通信号灯的 id。必须是 .net.xml 文件中已有的交通信号灯 id。交通信号灯的 id 通常与路口 id 相同。名称可通过右键单击受控路口前的红/绿条获得。
typeenum (static, actuated, delay_based)交通信号灯的类型(固定相位持续时间、基于车辆间时间间隔的相位延长(驱动式)或基于排队车辆累积时间损失的相位延长(基于延迟式) )
programIDid (string)交通灯程序的 id;必须是交通灯 id 的新程序名称。请注意,"off "为保留名,见下文。
offsetint程序的初始时间偏移

phase 的属性:

属性名称价值类型说明
durationtime (int)阶段的持续时间
statelist of signal states该阶段的红绿灯状态如下

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

对于控制单个交叉路口的交通信号灯,由 netconvert 生成的默认指数以顺时针方式编号,从 12 点钟方向的 0 开始,右转顺序在直行和左转之前。人行横道总是被分配在最后,也是按顺时针方向。

如果将交通信号灯连接起来,由一个程序控制多个交叉路口,则每个交叉路口的排序保持不变,但指数会根据输入文件中受控路口的顺序增加。

例如:ggrgrrrggrrg对应:

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

TraCI

TraCI - SUMO Documentation (dlr.de)

Detector

Detector - SUMO Documentation (dlr.de)

Lanearea Detectors (E2) - SUMO Documentation (dlr.de)

Attribute NameValue TypeDescription
idid (string)A string holding the id of the detector
lanereferenced lane idThe id of the lane the detector shall be laid on. The lane must be a part of the network used. This argument excludes the argument lanes.
posfloatThe position on the first lane covered by the detector. See information about the same attribute within the detector loop description for further information. Per default, the start position is placed at the first lane’s begin.
endPosfloatThe end position on the last lane covered by the detector. Per default the end position is placed at the last lane’s end.
lengthfloatThe length of the detector in meters. If the detector reaches over the lane’s end, it is extended to preceding / consecutive lanes.
filefilenameThe path to the output file. The path may be relative.
friendlyPosboolIf set, no error will be reported if the detector is placed behind the lane. Instead, the detector will be placed 0.1 meters from the lane’s end or at position 0.1, if the position was negative and larger than the lane’s length after multiplication with -1; default: false.

simulation

参考资料

SUMO官方文档

SUMO学习入门(一)SUMO介绍 - 知乎 (zhihu.com)

SUMO 从入门到基础 SUMO入门一篇就够了_sumo文档-CSDN博客

XML - Wikipedia

有关文件

windows安装包:

sumo-win64-1.19.0.msi

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/324903.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

B端产品经理学习-B端产品的业务规划

B端产品的业务规划 什么是业务规划能力 B/C端产品区别以及对架构的影响 C端 B端 用户 角色&#xff1a;面向单一的消费者&#xff0c;通常只有一个用户角色 角色&#xff1a;通常涉及多个角色 架构要求&#xff1a;需要额外的权限和角色管理来实现的分工和写作 产品类型…

视频剪辑方法:一键批量转码,视频转GIF教程详解

在数字媒体时代&#xff0c;视频剪辑已经成为一项必备技能。无论是专业人士还是普通用户&#xff0c;都要对视频进行剪辑、转码和制作。但是视频剪辑并不简单&#xff0c;要掌握一定的技巧和知识。下面一起来看云炫AI智剪简单易学的视频剪辑方法&#xff1a;一键批量转码和视频…

时代变革,亿发进销存引领批发业转型:从‘瞎盲’到高效盈利

2024年&#xff0c;许多传统批发老板们忙得不可开交。抱怨生意难做、年关难熬。 有些老板为了降低成本&#xff0c;开除了一两个店员&#xff0c;结果却发现自己要同时盯着店&#xff0c;又得亲自开单&#xff0c;一天中至少有10个小时被拴在店里&#xff0c;就是为了减少支出…

linux防护与集群——系统安全及应用

一、账号安全控制&#xff1a; 用户账号是计算机使用者的身份凭证或标识&#xff0c;每个要访问系统资源的人&#xff0c;必须凭借其用户账号才能进入计算机。在Linux系统中&#xff0c;提供了多种机制来确保用户账号的正当、安全使用 1.1 基本安全措施&#xff1a; 在Linux…

PCIe 6.0生态业内进展分析总结

上一篇&#xff0c;我们针对PCIe 6.0的功能更新与实现挑战做了简单的分析与总结。更多详细内容可以参考&#xff1a; 扩展阅读&#xff1a;浅析PCIe 6.0功能更新与实现的挑战 那么&#xff0c;PCIe 6.0已经发布了一段时间了&#xff0c;业内硬件支持PCIe 6.0目前有哪些进展呢…

c语言:用共同体输出数据|练习题

一、题目 设置一个c语言共同体&#xff0c;并用共同体输出数据 如图&#xff1a; 二、代码图片【带注释】 三、源代码【带注释】 #include <stdio.h> #include<string.h> //定义一个共同体 union test { int i; char ch[10]; int id; }; //注意&…

创意无限:火星文和变异字体的魅力世界

在互联网的浩瀚星空里&#xff0c;火星文和变异字体如同璀璨的繁星&#xff0c;照亮了网络世界的角落。它们以独特的创意和视觉冲击力&#xff0c;吸引着无数网友的目光。让我们一起走进这个充满创意和想象力的世界&#xff0c;感受火星文和变异字体的无限魅力。 火星文生成器…

深入理解Python中的二分查找与bisect模块

&#x1f497;&#x1f497;&#x1f497;欢迎来到我的博客&#xff0c;你将找到有关如何使用技术解决问题的文章&#xff0c;也会找到某个技术的学习路线。无论你是何种职业&#xff0c;我都希望我的博客对你有所帮助。最后不要忘记订阅我的博客以获取最新文章&#xff0c;也欢…

互联网广告行业发展历程

在20年的历程中&#xff0c;广告主与媒体方持续面对着一些问题&#xff0c;一些核心问题推动了行业的迭代。 互联网广告经过了20年左右的高速发展&#xff0c;已愈发成熟&#xff0c;其历程是有趣的。 对互联网广告发展的理解&#xff0c;网上的文章并不多&#xff0c;已有的…

Linux-端口、nmap命令、netstat命令

端口是设备与外界通讯交流的出入口&#xff0c;可分为物理端口和虚拟端口 物理端口实际存在可以看见&#xff0c;而虚拟端口是指计算机内部的端口&#xff0c;是不可见的&#xff0c;用来操作系统和外部交互使用。 IP地址不能锁定程序&#xff0c;所以可以通过端口&#xff0…

图像分割-Grabcut法(C#)

版权声明&#xff1a;本文为博主原创文章&#xff0c;转载请在显著位置标明本文出处以及作者网名&#xff0c;未经作者允许不得用于商业目的。 本文的VB版本请访问&#xff1a;图像分割-Grabcut法-CSDN博客 GrabCut是一种基于图像分割的技术&#xff0c;它可以用于将图像中的…

三勾点餐|基于java+springboot+vue3实现H5在线点餐系统

三勾点餐系统基于javaspringbootelement-plusuniapp打造的面向开发的小程序商城&#xff0c;方便二次开发或直接使用&#xff0c;可发布到多端&#xff0c;包括微信小程序、微信公众号、QQ小程序、支付宝小程序、字节跳动小程序、百度小程序、android端、ios端外卖点餐系统的应…