Preparing an Initial Demand

The process of creating an initial demand (the "population" of the scenario) can be quiet challanging, as a lot of different data sources may be used, depending on what's available. The good thing about MATSim is, that you can start with a fairly simple initial demand and improved it later.

Initial Plans

The simplest description of agents is as follows:

 
<person id="1">
  <plan>
    <act type="home" x="20" y="-5" end_time="06:00:00"  />
    <leg mode="car"  />
    <act type="work" x="80" y="5" dur="08:00:00"  />
    <leg mode="car"  />
    <act type="home" x="20" y="-5"  />
  </plan>
</person> 

Each person needs a unique identifier id and at least one plan. The plan contains acts and legs. The activities need at least the type and a coordinate-pair (x, y). Additionally, the first activity needs an end time (end_time), while all other activities except the last one need a duration (dur) set. Legs between activities need a mode, usually set to "car", but do not need any route information at this stage.

end_time and dur do not have to be exact values, but can be generic ones (like the ones shown in the example). The simulation will modify these attributes to find better values on its own.

XY2Links

The simulation expects all activities to take place on links. To assign each activity a link based on its coordinates, use the tool org.matsim.run.XY2Links. As an argument, pass it a configuration file which contains the information about the network, input-plans and output-plans. The tool will then read all plans from the input-file and search for each activity the nearest link from the network. The plans with this additional information are then written to the output-file. That output-file could then be used to start the simulation with org.matsim.run.Controler (see the Getting-Started Tutorial).

Attached are a very small sample network, a very simplistic plans file and a configuration file that can be used with XY2Links.

network.xmlnetwork.xml
862 bytes
plans.xmlplans.xml
345 bytes
config.xmlconfig.xml
352 bytes