public Road(Scheduler scheduler, Link link) { super(scheduler); this.link = link; /* * calculate the maximum number of cars, which can be on the road at the * same time */ this.maxNumberOfCarsOnRoad = Math.round(link.getLength() * NetworkUtils.getNumberOfLanesAsInt(Time.UNDEFINED_TIME, link) * config.getStorageCapacityFactor() / config.getCarSize()); /** * it is assured here, that a road must have the space of at least one * car */ if (this.maxNumberOfCarsOnRoad == 0) { this.maxNumberOfCarsOnRoad = 1; } double maxInverseInFlowCapacity = 3600 / (config.getMinimumInFlowCapacity() * config.getFlowCapacityFactor() * NetworkUtils.getNumberOfLanesAsInt(Time.UNDEFINED_TIME, link)); this.inverseOutFlowCapacity = 1 / (((Link) link).getFlowCapacityPerSec() * config.getFlowCapacityFactor()); if (this.inverseOutFlowCapacity > maxInverseInFlowCapacity) { this.inverseInFlowCapacity = maxInverseInFlowCapacity; } else { this.inverseInFlowCapacity = this.inverseOutFlowCapacity; } this.gapTravelTime = link.getLength() / config.getGapTravelSpeed(); // gap must be initialized to null because of the application logic this.gap = null; }
public void testParametersSetCorrectly() { Config config = super.loadConfig(this.getPackageInputDirectory() + "config.xml"); JDEQSimConfigGroup jdeqSimConfigGroup = ConfigUtils.addOrGetModule(config, JDEQSimConfigGroup.NAME, JDEQSimConfigGroup.class); assertEquals(360.0, jdeqSimConfigGroup.getSimulationEndTime(), EPSILON); assertEquals(2.0, jdeqSimConfigGroup.getFlowCapacityFactor(), EPSILON); assertEquals(3.0, jdeqSimConfigGroup.getStorageCapacityFactor(), EPSILON); assertEquals(3600.0, jdeqSimConfigGroup.getMinimumInFlowCapacity(), EPSILON); assertEquals(10.0, jdeqSimConfigGroup.getCarSize(), EPSILON); assertEquals(20.0, jdeqSimConfigGroup.getGapTravelSpeed(), EPSILON); assertEquals(9000.0, jdeqSimConfigGroup.getSqueezeTime(), EPSILON); } }