AnyLogic道路库巷道选择问题
创始人
2024-08-22 15:30:16
0
  1. 创建道路图层和车道地图 在模型画布上,右键单击Roads并选择'Library”,在下拉菜单中选择'Custom”. 选中新建出的图层,然后在页面工具栏中选择'Create Object”来创建车道地图对象。

  2. 设置车道地图 您可以单击'Lanes”,然后在'Properties”窗口上的'Lane Setup”选项卡上设置车道数、车道宽度、车道长度和车道颜色。

  3. 将车辆行为赋予路口 选择交叉口,并在'Properties”窗口上的'Connections”选项卡中设置连接属性。设置'Lane Selection Algorithm”为'Simple”. 在'Number of Lanes”框中输入车道数。

  4. 编写车辆行为 在交通流(Traffic Flow)对象上单击右键并选择'Create Agent”, 然后选择'Vehicle”. 您可以定义车辆的速度和加速度。 在'Advanced”标签上, 设置'Speed Limit”为车道地图设定的最大速度。

示例代码: Intersection intersection = (Intersection)getFirstAgent(); RoadConnector inConnector = (RoadConnector)intersection.getInputConnector("In"); RoadConnector outConnector = (RoadConnector)intersection.getOutputConnector("Out"); Vehicle[] vehicles = inConnector.getEnteredVehicles(); for (Vehicle v : vehicles) { // Use a random number to pick a lane int laneIndex = (int) Math.floor(Math.random() * outConnector.getLanesCount()); Lane lane = outConnector.getLane(laneIndex); // Move the vehicle to the lane outConnector.moveVehicleToLane(v, lane); }

相关内容

热门资讯

5分钟辅助!约局吧德州真的有透... 5分钟辅助!约局吧德州真的有透视挂吗,we-poker软件,妙计教程(今日头条)约局吧德州真的有透视...
第九分钟辅助!wpk插件,hh... 第九分钟辅助!wpk插件,hh poker辅助有用吗,资料教程(确实有挂)1、首先打开hh poke...
第三分钟辅助!wepoker透... 第三分钟辅助!wepoker透视脚本苹果版,pokemmo辅助器,教程书教程(确实有挂)1、完成we...
第三分钟辅助!哈糖大菠萝能开挂... 第三分钟辅助!哈糖大菠萝能开挂吗,aapoker脚本,法门教程(有人有挂)1、超多福利:超高返利,海...
两分钟辅助!wepoker游戏... 两分钟辅助!wepoker游戏的安装教程,wepoker透视苹果系统,法子教程(确实有挂)1、这是跨...
七分钟辅助!德扑之心免费透视,... 七分钟辅助!德扑之心免费透视,wepoker私人辅助器,方案教程(有挂教学)1、德扑之心免费透视免费...
三分钟辅助!hhpoker可以... 三分钟辅助!hhpoker可以开挂吗,wepoker私人局透视教程,操作教程(有挂讲解)1、wepo...
4分钟辅助!wepoker辅助... 4分钟辅助!wepoker辅助工具,hhpoker透视方法,教程书教程(有挂教程)1、起透看视 we...
9分钟辅助!wepoker怎么... 9分钟辅助!wepoker怎么获得好牌,pokerworld破解版下载,练习教程(有挂分析)1、不需...
第九分钟辅助!拱趴大菠萝挂怎么... 第九分钟辅助!拱趴大菠萝挂怎么安装,pokemmo手机版脚本免费,机巧教程(有挂讲解)1、上手简单,...