Volume volume = count.getVolume(hour); if (volume != null) {
/** * Creates the List with the counts vs sim values stored in the * countAttribute Attribute of this class. */ private void compare() { for (Count<Link> count : this.counts.getCounts().values()) { if (!distanceFilter.isInRange(count)) { continue; } double[] volumes = this.volumesPerLinkPerHour.getVolumesForStop(Id.create(count.getId(), TransitStopFacility.class)); if (volumes == null || volumes.length == 0) { log.warn("No volumes for count location: " + count.getId().toString()); continue; } for (int hour = 1; hour <= 24; hour++) { Volume volume = count.getVolume(hour); if (volume != null) { double countValue = volume.getValue(); double simValue=volumes[hour-1]; simValue *= this.countsScaleFactor; this.result.add(new CountSimComparisonImpl(count.getId(), count.getCsLabel(), hour, countValue, simValue)); } } } }
writer.write(stopId.toString() + TAB); for (int i = 0; i < ocuppancy.length; i++) { Volume v = count.getVolume(i + 1); if (v != null) { writer.write(v.getValue() + TAB);
public void testGetVolume() { Count count = new Count(Id.create(0, Link.class), "1"); count.createVolume(1, 100.0); assertTrue("Getting volume failed", count.getVolume(1).getValue() == 100.0); }
public void testSEVolume() { AttributeFactory attributeFactory = new AttributeFactory(); final Counts counts = new Counts(); CountsReaderMatsimV1 reader = new CountsReaderMatsimV1(counts); reader.startTag("counts", attributeFactory.createCountsAttributes(), null); reader.startTag("count", attributeFactory.createCountAttributes(), null); reader.startTag("volume", attributeFactory.createVolumeAttributes(), null); assertEquals("Volume attribute setting failed", 100.0, counts.getCount(Id.create(1, Link.class)).getVolume(1).getValue(), EPSILON); } }
public void testSEElementVolume() throws SAXException { AttributeFactory attributeFactory = new AttributeFactory(); final Counts counts = new Counts(); MatsimCountsReader reader = new MatsimCountsReader(counts); reader.setDoctype("counts_v1.xsd"); reader.startElement("", "counts", "counts", attributeFactory.createCountsAttributes()); reader.startElement("", "count", "count", attributeFactory.createCountAttributes()); reader.startElement("", "volume", "volume", attributeFactory.createVolumeAttributes()); assertEquals("Volume attribute setting failed", 100.0, counts.getCount(Id.create(1, Link.class)).getVolume(1).getValue(), EPSILON); reader.endElement("", "volume", "volume"); reader.endElement("", "count", "count"); reader.endElement("", "counts", "counts"); } }