@Override public void startVolume(final Volume volume, final BufferedWriter out) throws IOException { out.write("\t\t<volume"); out.write(" h=\"" + volume.getHourOfDayStartingWithOne() + "\""); out.write(" val=\"" + volume.getValue() + "\""); out.write(" />\n"); }
this.content.append(this.CHR_HT); countValue = volume.getValue(); double simValue = volumes[hour - 1];
for (Volume volume : entry.getValue().getVolumes().values()){ sum += volume.getValue() ;
public void testGetVolumes() { Count count = new Count(Id.create(0, Link.class), "1"); count.createVolume(1, 100.0); Iterator<Volume> vol_it = count.getVolumes().values().iterator(); while (vol_it.hasNext()) { Volume v = vol_it.next(); assertTrue("Getting volumes failed", v.getValue() == 100.0); } } }
/** * 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)); } } } }
count = 0 ; count += volume.getValue() ; if ( ! ( (timeBinIndex%multiple) == (multiple-1) ) ) { log.warn( " NOT adding measurement: timeBinIndex: " + timeBinIndex + "; multiple: " + multiple ) ;
Volume v = count.getVolume(i + 1); if (v != null) { writer.write(v.getValue() + TAB); } else { writer.write("n/a" + 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 testCreateVolume() { Count count = new Count(Id.create(0, Link.class), "1"); Volume volume = count.createVolume(1, 100.0); assertTrue("Creation and initialization of volume failed", volume.getHourOfDayStartingWithOne()==1); assertTrue("Creation and initialization of volume failed", volume.getValue()==100.0); }
Volume v = vol_it.next(); Assert.assertTrue(v.getHourOfDayStartingWithOne()>0); Assert.assertTrue(v.getValue()>=0.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"); } }