The "Counts" Package

'package org.matsim.demandmodeling.counts:'

Summary:

  1. Used for link volume validation
  2. Structure analog to package matrices
  3. Uses Schema (.xsd) instead of Document Type Definition (.dtd)
    • Input data (database as .xml) has to reference to schema (results in a different header)
  4. Files Config.java and Gbl.java adapted
  5. Config files have to use:
    • <param name="localInputXSD" value="[SOME PATH]/counts_v1.xsd" />
    • <param name="outputCountsXSD" value="[SOME PATH]/counts_v1.xsd" />
  6. ...algorithms.CountsWriteSimpleTable produces the file "[iteration_nr].linkcounts.cts" containing a table with the following columns:
    • link_id, hour, matsim volumes, real volumes, relative error [%]
  7. Validation using java tools for graph creation (LGPL library JFreeChart)

 

Details:

(The following informations are of temporary worth and will be adapted in the future. Code specific informations can be seen in javadoc)

2. The structure has to be slightly refactored as a future task. It should use MatsimXmlParser and MatsimXmlWriter instead of Parser and Writer as parent classes for CountsParser and CountsWriter

3. The usage of schemas reduces the amount of needed error checking code in the package counts. To minimize the amount of changes to the existing code, the existing MATSIM folder 'dtd' is also used for the xsd-file. Additionally the entity resolver (Resolver.java) is also used for "resolving" the schema. Refactoring regarding this two issues is needed in the future while changing to schemas in general or using both in parallel to a certain extent.

The header of an input file must be of the following form (information about actual data sets can be found at: Internal/Internal Information/Data Sets)

<counts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="[SOME URL]/counts_v1.xsd"
name="[SOME NAME]" desc="[SOME DESC]" year="[SOME YEAR]" layer="[SOME LAYER]">

4. Similar code blocks as for matrices are inserted with the following differences:

(Config.java)

public static final String COUNTS_LOCALINPUTXSD = "localInputXSD";
public static final String COUNTS_OUTXSD = "outputCountsXSD";


5. A dummy config file (config_counts_test.xml) can be found in the playground of anhorni

6. To use the counts package uncomment the respective lines (marked as 'needed if using the counts package') in the controler (Controler.java). Comments are used to keep older config files working. The file "[iteration_nr].linkcounts.cts" only contains the links for which counting data exists.

7. Automated graph creation is available using the LGPL library JFreeChart (+ the LGPL library jCommon), the MPL and LGPL library  iText (for pdf output), overlib.js (for tooltips) (licence conditions to check) and stylesheets:

  • Instantiate CountsGraphWriter in the controler.
  • To create our own graphs you can derive them from the abstract class CountsGraph and plug them into CountsGraphWriter (in the run method).
  • The simulation values can be scaled with a user supplied scaling factor.
  • CountsGraphWriter creates either pdf files or linked html output (formated with css).
  • The html output provides tooltips (using overlib.js) and links on the graphs.
  • All needed helper files (e.g. stylesheets etc.) are automatically copied (rough-and-ready from my playground) into the folder div of the iteration output folder, that is, the graph output folder can be used standing alone.
  • Future work:
    • Move hardcoded parameters in controler to config file
    • Add more tick marks in the graphs (be aware to lose hours!)  
    • Ordering of datasets while using CustomXYURLGenerator (see code for further informations).
    • Testing with a real scenario (performance, etc.)

The simple perl script (Public/Daten/Zaehldaten/scripts/validation.pl) can still be used to create gnuplot graphs. As input the file "[iteration_nr].linkcounts.cts" must be provided in the same directory.

 

 Contact:

In case of questions or comments, please contact: horni(at)ivt.baug.ethz.ch