@Override public void recalcTimeVariantAttributes() { double now = context.getSimTimer().getTimeOfDay() ; qlane.changeUnscaledFlowCapacityPerSecond( this.getLink().getFlowCapacityPerSec(now ) ); qlane.changeEffectiveNumberOfLanes(this.getLink().getNumberOfLanes(now)); // qlane.changeSpeedMetersPerSecond( getLink().getFreespeed(now) ) ; flowCap & nLanes are "push", freeSpeed is //"pull". This is not completely honest w.r.t. freeSpeed consequences to the fdiag, but also wasn't correctly //thought through/implemented when I found it. kai, feb'18 qlane.recalcTimeVariantAttributes(); }
@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; }
/** * Move as many waiting cars to the link as it is possible */ private void moveWaitToRoad() { while (!getWaitingList().isEmpty()) { if (!qlane.isAcceptingFromWait(this.getWaitingList().peek())) { return; } QVehicle veh = this.getWaitingList().poll(); double now = context.getSimTimer().getTimeOfDay() ; context.getEventsManager().processEvent( new VehicleEntersTrafficEvent(now, veh.getDriver().getId(), this.getLink().getId(), veh.getId(), veh.getDriver().getMode(), 1.0)); if ( this.getTransitQLink().addTransitToStopQueue(now, veh, this.getLink().getId()) ) { continue ; } if ( veh.getDriver().isWantingToArriveOnCurrentLink() ) { // If the driver wants to stop (again) on this link, give them a special treatment. // addFromWait doesn't work here, because after that, they cannot stop anymore. qlane.addTransitSlightlyUpstreamOfStop(veh) ; continue; } qlane.addFromWait(veh); } }
@Test public void testInit() { Fixture f = new Fixture(isUsingFastCapacityUpdate); assertNotNull(f.qlink1); assertEquals(1.0, f.qlink1.getSimulatedFlowCapacityPerTimeStep(), EPSILON); assertEquals(1.0, f.qlink1.getSpaceCap(), EPSILON); // TODO dg[april2008] this assertions are not covering everything in // QueueLink's constructor. // Extend the tests by checking the methods initFlowCapacity and // recalcCapacity assertEquals(f.link1, f.qlink1.getLink()); assertEquals(f.queueNetwork.getNetsimNode(Id.create("2", Node.class)), f.qlink1.getToNode()); }
((QNetsimEngine)this.simEngine).addParkedVehicle(this.transitVehicle, this.qlink1.getLink().getId()) ; ((QNetsimEngine)this.simEngine).addParkedVehicle(this.normalVehicle, this.qlink1.getLink().getId()) ; ((QNetsimEngine)this.simEngine).addParkedVehicle(this.normalVehicle2, this.qlink1.getLink().getId()) ;