@Override public Collection<MobsimVehicle> getAllNonParkedVehicles(){ Collection<MobsimVehicle> vehicles = new ArrayList<>(); vehicles.addAll(this.getTransitQLink().getTransitVehicleStopQueue()); vehicles.addAll(this.getWaitingList()); vehicles.addAll( qlane.getAllVehicles() ) ; return vehicles; }
private boolean checkForActivity() { /* * Leave Link active as long as there are vehicles on the link (ignore * buffer because the buffer gets emptied by nodes and not links) and leave * link active until buffercap has accumulated (so a newly arriving vehicle * is not delayed). */ return qlane.isActive() || !this.getWaitingList().isEmpty() || !this.getTransitQLink().getTransitVehicleStopQueue().isEmpty() ; }
@Override public Collection<AgentSnapshotInfo> addAgentSnapshotInfo( final Collection<AgentSnapshotInfo> positions) { double now = context.getSimTimer().getTimeOfDay() ; if (visLink != null) { for (QLaneI ql : QLinkLanesImpl.this.laneQueues.values()) { VisLane otfLane = visLink.getLaneData().get( ql.getId().toString()); ((QueueWithBuffer.VisDataImpl) ql.getVisData()).setVisInfo( otfLane.getStartCoord(), otfLane.getEndCoord()); } } for (QLaneI road : QLinkLanesImpl.this.getQueueLanes().values()) { road.getVisData().addAgentSnapshotInfo(positions, now); } int cnt2 = 10; // treat vehicles from transit stops cnt2 = context.snapshotInfoBuilder.positionVehiclesFromTransitStop(positions, getLink(), getTransitQLink().getTransitVehicleStopQueue(), cnt2); // treat vehicles from waiting list: context.snapshotInfoBuilder.positionVehiclesFromWaitingList(positions, QLinkLanesImpl.this.getLink(), cnt2, QLinkLanesImpl.this.getWaitingList()); cnt2 = QLinkLanesImpl.this.getWaitingList().size(); context.snapshotInfoBuilder.positionAgentsInActivities(positions, QLinkLanesImpl.this.getLink(), QLinkLanesImpl.this.getAdditionalAgentsOnLink(), cnt2); return positions; } }
@Override public boolean doSimStep() { double now = context.getSimTimer().getTimeOfDay() ; boolean lanesActive = false; boolean movedWaitToRoad = false; if ( context.qsimConfig.isInsertingWaitingVehiclesBeforeDrivingVehicles() ) { //TODO //Because moveBufferToNextLane() (called from moveLanes()) is kind of "moveInternalNodes()", //it should be executed before moveWaitToRoad() to keep the sequence fully consistent. //The sequence is broken only if isInsertingWaitingVehiclesBeforeDrivingVehicles==true. //Currently, the buffer of the accepting lane gets emptied after moveWaitToRoad(), //which gives preference to already driving vehicles //michalm, jan'17 this.moveWaitToRoad(now); this.getTransitQLink().handleTransitVehiclesInStopQueue(now); lanesActive = this.moveLanes(); } else { this.getTransitQLink().handleTransitVehiclesInStopQueue(now); lanesActive = this.moveLanes(); movedWaitToRoad = this.moveWaitToRoad(now); } this.setActive(lanesActive || movedWaitToRoad || (!this.getWaitingList().isEmpty()) || !this.getTransitQLink().getTransitVehicleStopQueue().isEmpty()); return this.isActive(); }
@Override public Collection<AgentSnapshotInfo> addAgentSnapshotInfo( Collection<AgentSnapshotInfo> positions) { // AbstractAgentSnapshotInfoBuilder snapshotInfoBuilder = qnetwork.simEngine.getAgentSnapshotInfoBuilder(); QLaneI.VisData roadVisData = getAcceptingQLane().getVisData() ; if (visLink != null) { ((QueueWithBuffer.VisDataImpl)roadVisData).setVisInfo(visLink.getLinkStartCoord(), visLink.getLinkEndCoord()) ; // yyyy not so great but an elegant solution needs more thinking about visualizer structure. kai, jun'13 } double now = context.getSimTimer().getTimeOfDay() ; positions = roadVisData.addAgentSnapshotInfo(positions,now) ; int cnt2 = 10 ; // a counter according to which non-moving items can be "spread out" in the visualization // initialize a bit away from the lane // treat vehicles from transit stops cnt2 = context.snapshotInfoBuilder.positionVehiclesFromTransitStop(positions, getLink(), getTransitQLink().getTransitVehicleStopQueue(), cnt2 ); // treat vehicles from waiting list: cnt2 = context.snapshotInfoBuilder.positionVehiclesFromWaitingList(positions, QLinkImpl.this.getLink(), cnt2, QLinkImpl.this.getWaitingList()); cnt2 = context.snapshotInfoBuilder.positionAgentsInActivities(positions, QLinkImpl.this.getLink(), QLinkImpl.this.getAdditionalAgentsOnLink(), cnt2); return positions; }