SUMO生成车流(二)

flow 定义多个车辆

上面我们每次设置都需要单独对每一辆车进行设置,如果车辆很多就会很麻烦。例如我们希望给定起点和终点,给定这条路线上车辆的数量,一次性生成多个车辆,前面的方法就不适用了。这个时候就需要使用 flow,flow 的参数如下所示(flow 是主要设置车辆数量,可以有以下的参数,vehsPerHour、period、probability、number):

  • begin, 第一个车辆的出发时间;
  • end, end of departure interval (if undefined, defaults to 24 hours);
  • vehsPerHournumber of vehicles per hour, equally spaced (not together with period or probability);(每小时的车辆数量
  • period, insert equally spaced vehicles at that period (not together with vehsPerHour or probability);
  • probability, probability for emitting a vehicle each second (not together with vehsPerHour or period), see also Simulation/Randomness;
  • number, total number of vehicles, equally spaced;(给定总的车辆)

通过 flow 中的 period 和 vehsPerHour 定义连续车辆

定义两个 flow,分别是每小时 1000 辆车,和每 5 秒会有一辆车。同时下面使用了两种不同的定义 flow 的方式(具体的如下所示):

<routes>
    <!-- 定义两个车辆类型 -->
    <vType id="type1" accel="0.8" decel="4.5" sigma="0.5" length="5" maxSpeed="70"/>
    <vType id="type2" accel="1.2" decel="4.5" sigma="0.5" length="7" maxSpeed="120"/>
    <!-- 定义 flow, 每小时 1000 辆车 -->
    <flow id="flow1" color="1,1,0"  begin="0" end= "7200" vehsPerHour="1000" type='type1'>
        <route edges="3fi 3si 4o"/>
    </flow>
    <!-- 定义 flow, 每个 5 秒有车 -->
    <flow id="flow2" color="0,1,1"  begin="0" end="7200" period="5" type="type2" from="1si" to="2o"/>
</routes>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值