/** * @see org.matsim.counts.CountSimComparison#calculateRelativeError() * @return signed relative error */ @Override public double calculateRelativeError() { double count = this.getCountValue(); double sim = this.getSimulationValue(); if (count > 0) { return Math.min((sim - count) / count, 1000d); } if (sim > 0) { return 1000d; } return 0; }
public List<CountSimComparison> ceateCountSimCompList() { List<CountSimComparison> csc_l = new Vector<CountSimComparison>(24); for (int i = 0; i < 24; i++) { csc_l.add(new CountSimComparisonImpl(Id.create(100, Link.class), "", i + 1, 1.0,1.0)); } return csc_l; } }
public List<CountSimComparison> ceateCountSimCompList() { List<CountSimComparison> csc_l = new Vector<CountSimComparison>(24); for (int i=0; i<24; i++) { csc_l.add(new CountSimComparisonImpl(Id.create(100, Link.class), "", i+1, 1.0, 1.0)); } return csc_l; } }
this.content.append(this.CHR_NL); this.countSimComp.add(new CountSimComparisonImpl(stopId, hour, countValue, simValue));
/** * 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)); } } } }
public void testOutputHtml() { CountsFixture fixture = new CountsFixture(); fixture.setUp(); CountsSimRealPerHourGraph sg = null; List<CountSimComparison> countSimCompList=new Vector<CountSimComparison>(); for (int i=0; i<24; i++) { countSimCompList.add(new CountSimComparisonImpl(Id.create(i+1, Link.class), "", 1, 1.0, 1.0)); } sg = new CountsSimRealPerHourGraph(countSimCompList, 1, "testOutPutAll"); new File(getOutputDirectory() + "graphs").mkdir(); OutputDelegate outputDelegate=new OutputDelegate(getOutputDirectory() + "graphs/"); outputDelegate.addSection(new Section("testOutPutAll")); assertNotNull("No graph was created", sg.createChart(0)); outputDelegate.addCountsGraph(sg); outputDelegate.outputHtml(); String filename = getOutputDirectory() + "graphs/png/" + sg.getFilename() +".png"; File fPng = new File(filename); assertTrue("The png output file " + filename + " doesn't exist", fPng.exists()); assertTrue("The png output file " + filename + " is empty", fPng.length()>0.0); } }