热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.matsim.core.mobsim.qsim.QSim.addAgentSource()方法的使用及代码示例

本文整理了Java中org.matsim.core.mobsim.qsim.QSim.addAgentSource方法的一些代码示例,展示了QSim.add

本文整理了Java中org.matsim.core.mobsim.qsim.QSim.addAgentSource方法的一些代码示例,展示了QSim.addAgentSource的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QSim.addAgentSource方法的具体详情如下:
包路径:org.matsim.core.mobsim.qsim.QSim
类名称:QSim
方法名:addAgentSource

QSim.addAgentSource介绍

暂无

代码示例

代码示例来源:origin: matsim-org/matsim

qSim.addAgentSource(instance);
log.info("Added AgentSource " + instance.getClass());

代码示例来源:origin: matsim-org/matsim

@Override
public Mobsim get() {
QSimConfigGroup cOnf= scenario.getConfig().qsim();
if (cOnf== null) {
throw new NullPointerException(
"There is no configuration set for the QSim. Please add the module 'qsim' to your config file.");
}
final QSim sim = new QSimBuilder(scenario.getConfig()).useDefaults().build(scenario, eventsManager);
Collection vRoutes = carrierAgentTracker.createPlans();
FreightAgentSource agentSource = new FreightAgentSource(vRoutes, new DefaultAgentFactory(sim), sim);
sim.addAgentSource(agentSource);
if (carrierConfig.getPhysicallyEnforceTimeWindowBeginnings()) {
WithinDayActivityReScheduling withinDayActivityRescheduling = new WithinDayActivityReScheduling(agentSource, carrierAgentTracker);
sim.addQueueSimulationListeners(withinDayActivityRescheduling);
}
return sim;
}

代码示例来源:origin: matsim-org/matsim

private TestHandleStopSimulation(final MutableScenario scenario, final EventsManager events, final TransitLine line, final TransitRoute route, final Departure departure) {
this.line = line;
this.route = route;
this.departure = departure;
this.qSim = new QSimBuilder(scenario.getConfig()) //
.useDefaults() //
.build(scenario, events);
TransitQSimEngine transitEngine = qSim.getChildInjector().getInstance(TransitQSimEngine.class);

qSim.addAgentSource(new AgentSource() {
@Override
public void insertAgentsIntoMobsim() {
TestHandleStopSimulation.this.driver = new SpyDriver(TestHandleStopSimulation.this.line,
TestHandleStopSimulation.this.route, TestHandleStopSimulation.this.departure,
transitEngine.getAgentTracker(), transitEngine);
VehicleType vehicleType = new VehicleTypeImpl(Id.create("transitVehicleType", VehicleType.class));
VehicleCapacity capacity = new VehicleCapacityImpl();
capacity.setSeats(101);
capacity.setStandingRoom(0);
vehicleType.setCapacity(capacity);
TransitQVehicle veh = new TransitQVehicle(new VehicleImpl(Id.create(TestHandleStopSimulation.this.driver.getId(), Vehicle.class), vehicleType));
veh.setDriver(TestHandleStopSimulation.this.driver);
veh.setStopHandler(new SimpleTransitStopHandler());
TestHandleStopSimulation.this.driver.setVehicle(veh);
TestHandleStopSimulation.this.departure.setVehicleId(veh.getVehicle().getId());
qSim.addParkedVehicle(veh, route.getRoute().getStartLinkId());
qSim.insertAgentIntoMobsim(TestHandleStopSimulation.this.driver);
}
});
}

推荐阅读
author-avatar
0鞋包控0
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有