作者:0鞋包控0 | 来源:互联网 | 2023-08-13 14:45
本文整理了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);
}
});
}