基于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.mzph.cn/news/601136.shtml

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

相关文章

php 数组中的元素进行排列组合

需求背景&#xff1a;计算出数组[A,B,C,D]各种排列组合&#xff0c;希望得到的是数据如下图 直接上代码&#xff1a; private function finish_combination($array, &$groupResult [], $splite ,){$result [];$finish_result [];$this->diffArrayItems($array, $…

12、DolphinScheduler

1、DolphinScheduler简介 1.1、 DolphinScheduler概述 Apache DolphinScheduler是一个分布式、易扩展的可视化DAG工作流任务调度平台。致力于解决数据处理流程中错综复杂的依赖关系&#xff0c;使调度系统在数据处理流程中开箱即用。 1.2、 DolphinScheduler核心架构 Dolph…

USB -- STM32F103缓冲区描述表及USB数据存放位置讲解(续)

目录 链接快速定位 前沿 1 0x40005C00和0x40006000地址的区别和联系 2 USB_BTABLE寄存器介绍 3 USB缓冲区描述表&#xff08;SRAM&#xff09;介绍 3.1 发送缓冲区地址寄存器n&#xff08;n[0..7]&#xff09; 3.2 发送数据字节数寄存器n&#xff08;n[0..7]&#xff09…

机器学习中的概念 张量、标量、向量、矩阵等数据结构的区别

张量、标量、向量和矩阵等数据结构在深度学习和数学中扮演着重要角色&#xff0c;它们之间的区别如下&#xff1a; 标量&#xff08;Scalar&#xff09;&#xff1a;标量是一个单独的数&#xff0c;它没有方向&#xff0c;只有大小。在深度学习中&#xff0c;标量通常表示一个…

从C++习题中思考

目录 一.开始1.1 二.变量和基本类型1.11.21.31.31.41.5 C Peimer习题集第5版练习。 一.开始 1.1 编写程序&#xff0c;提示用户输入2个整数&#xff0c;打印出这两个整数指定的范围内的所有整数。 方式1&#xff1a;使用while循环。 #include<iostream> using namespac…

socket实现视频通话-WebRTC

最近喜欢研究视频流&#xff0c;所以思考了双向通信socket&#xff0c;接下来我们就一起来看看本地如何实现双向视频通讯的功能吧~ 客户端获取视频流 首先思考如何获取视频流呢&#xff1f; 其实跟录音的功能差不多&#xff0c;都是查询电脑上是否有媒体设备&#xff0c;如果…

JavaScript 中 callee 与 caller 的作用

在 JavaScript 中&#xff0c;callee 和 caller 是与函数调用有关的属性。 callee&#xff1a;callee 属性是一个指向正在执行的函数的指针。它可以在函数内部使用&#xff0c;通过 arguments.callee 访问。这对于递归函数或匿名函数非常有用&#xff0c;因为函数名可能不知道…

C语言学习NO.11-字符函数strlen,strlen函数的使用,与三种strlen函数的模拟实现

&#xff08;一&#xff09;strlen函数的使用 strlen函数的演示 #include <stdio.h> #include <string.h>int main() {char arr1[] "abcdef";char arr2[] "good";printf("arr1 %d,arr2 %d",strlen(arr1),strlen(arr2));return …

GUI三维绘图

绘制三维图plot3 t0:pi/50:10*pi; xsin(t); ycos(t); zt; plot3(x,y,z); 产生栅格数据点meshgrid 这个接口在绘制三维图像里面相当重要&#xff0c;很多时候要将向量变成矩阵才能绘制三维图。 x0:0.5:5; y0:1:10; [X,Y]meshgrid(x,y); plot(X,Y,o); x和y是向量&#xff0c;…

Python开发环境搭建

Python程序设计语言是解释型语言&#xff0c;其广泛应用于运维开发领域、数据分析领域、人工智能领域&#xff0c;本文主要描述Python开发环境的搭建。 www.python.org 如上所示&#xff0c;从官方网站下载Python最新的稳定版本3.12.1 如上所示&#xff0c;在本地的开发环境安…

Spring面试篇

Spring面试篇 前置知识ApplicationContextInitializerApplicationListenerBeanFactoryBeanDefinitionBeanFactoryPostProcesssorAwareInitialzingBean&#xff0c;DisposableBeanBeanPostProcessor SpringBoot启动流程IOC容器初始化流程Bean生命周期Bean循环依赖解决 SpringMvc…

关于kthread_stop的疑问(linux3.16)

线程一旦启动起来后&#xff0c;会一直运行&#xff0c;除非该线程主动调用do_exit函数&#xff0c;或者其他的进程调用kthread_stop函数&#xff0c;结束线程的运行。 之前找销毁内核线程的接口时&#xff0c;发现了kthread_stop这个接口。网上说这个函数能够销毁一个内核线程…

Linux 的引导与服务控制

一 开机启动过程 bios加电自检-->mbr-->grub-->加载内核文件-->启动第一个进程 1 bios加电自检 检测硬件是否正常&#xff0c;然后根据bios中的启动项设置&#xff0c;去找内核文件 2 mbr 因为grup太大,第一个扇区存不下所有的grub程序&#xff0c;所以分为…

Edge浏览器开启/关闭侧栏和找回CopilotBing按钮

文章目录 Edge浏览器开启/关闭侧栏找回Copilot&Bing按钮&#xff08;正常使用其功能需要能够访问外网&#xff09; Edge浏览器开启/关闭侧栏 打开Edge浏览器&#xff0c;通过快捷键 Ctrl Shift / 来开启/关闭侧栏。 找回Copilot&Bing按钮&#xff08;正常使用其功能…

【Tools】VS基本使用

文章目录 0 前言1 下载安装与基本使用1.1 下载安装1.2 项目创建1.3 编译运行和调试1.4 界面和设置 2 项目属性配置【重点】2.1 打开项目属性配置窗口2.2 静态库和动态库2.3 包含目录&库目录&依赖项&工作目录2.4 代码中添加附加依赖项2.5 配置项目环境变量2.6 修改属…

护眼台灯是智商税吗?眼科医生告诉你哪款护眼台灯最好

青少年近视发病率高达67%&#xff0c;如今&#xff0c;人们都被屏幕包围着&#xff0c;电脑、手机和电视已经成为最重要的信息手段&#xff0c;我们周围的屏幕也隐藏着有害的光污染。 对于4-15岁年龄段的孩子而言&#xff0c;除了学习本身带来的视力损伤外&#xff0c;每天接触…

Linux编写SH脚本启动单个jar应用

目录 一、启动脚本第一步&#xff1a;创建一个脚本文件第二步&#xff1a;把下面代码复制到脚本中第三步&#xff1a;给脚本授权 二、停止脚本第一步&#xff1a;创建一个脚本文件第二步&#xff1a;把下面代码复制到脚本中第三步&#xff1a;给脚本授权 结尾 一、启动脚本 第一…

Trino:分区表上的SQL提交 查询流程浅析

Trino SQL执行过程的关键特性 Client、Coordinator、Worker之间的通讯&#xff0c;基于HTTP协议。SQL提交、解析、调度、执行等的流程全异步&#xff0c;最大化运行效率。逻辑计划树被在Coordinator侧被拆分成PlanFragment&#xff0c;可以对应于Spark中的Stage概念&#xff0…

C语言学习NO.12-字符函数(二)-strcpy,strcat,strcmp长度不受限制的字符串函数

一、strcpy的使用和模拟实现 &#xff08;一&#xff09;strcpy使用 //strcpy的使用 #include <stdio.h>int main() {char arr1[] "abcdef";char arr2[10] "qwertt";char arr3[10] "okl";strcpy(arr2, arr1);printf("arr2 %s\n&…

iOS 解决push证书不受信任

重新下载&#xff1a;https://www.apple.com/certificateauthority/