Skip to content

faq 108401428

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

Is it possible to specify an agent's exact arrival time at node?

by Celeste Manu on 2017-03-13 16:43:04


Is it possible to specify the exact departure and arrival times for agent's plans? For example:

Agent 1 plan:
 [node 1, time 0:00]
 [node 2, time 0:05]
 [node 3, time 0:14]]  ]>

Agent 2 plan: [node 2, time 0:00] [node 3, time 0:04] [node 4, time 0:10]] ]>


I read either here on the community space or in the documentation somewhere that the duration specified in the population/plans.xml is only used for scoring, so how can I specify the exact times per leg?


Comments: 2


Re: Is it possible to specify an agent's exact arrival time at node?

by Kai Nagel on 2017-03-13 17:08:10

Dear Celeste,

No this is not possible.  Link travel times, and in consequence arrivals at nodes, are generated by the traffic simulation, and are thus emergent.  

Having said that, there are probably ways to emulate what you want.  Options that come to my mind:

  • Put an activity with a departure time at the end of each link where you want to do this. – This feels relatively easy to do.
  • "Mis-"use the public transit extension for what you need (for vehicles one can define departure times at each stop).  – This feels like a fair amount of work, since using the pt extension is not easy.
  • If you are just interested in visualization, you could generate the events file (which contains link enter and link leave event) by some other means.
  • Maybe the multimodal extension does things similar to what you need?  I don't know it well enough.

And maybe other people have more ideas.

Greetings, Kai


Re: Is it possible to specify an agent's exact arrival time at node?

by Celeste Manu on 2017-03-14 15:48:42

Thanks  for your suggestions and quick response. I know this is not the intended way to use MATSim.

I think creating my own events.xml rather than having MATSim generate it would be easiest for this purpose. I compiled this events.xml together for one agent only from the events.xml generated from my zeroth iteration from MATSim. 

<?xml version="1.0" ?>
 <!DOCTYPE plans SYSTEM "http://www.matsim.org/files/dtd/plans_v4.dtd">
 <plans>
 <person id="1">
 	<plan>
 		<act type="w" link="1" end_time="06:30"/>
 		<leg mode="car">
 		</leg>
 		<act type="h" link="15"/>
 	</plan>
 </person>
 </plans>
<?xml version="1.0" encoding="utf-8"?>
 <events version="1.0">
 	<event time="23400.0" type="actend" person="1" link="1" actType="w"  />
 	<event time="23400.0" type="departure" person="1" link="1" legMode="car"  />
 	<event time="23400.0" type="PersonEntersVehicle" person="1" vehicle="1"  />
 	<event time="23400.0" type="vehicle enters traffic" person="1" link="1" vehicle="1" networkMode="car" relativePosition="1.0"  />
 	<event time="23401.0" type="left link" vehicle="1" link="1"  />
 	<event time="23401.0" type="entered link" vehicle="1" link="2"  />
 	<event time="23412.0" type="left link" vehicle="1" link="2"  />
 	<event time="23412.0" type="entered link" vehicle="1" link="14"  />
 	<event time="23423.0" type="left link" vehicle="1" link="14"  />
 	<event time="23423.0" type="entered link" vehicle="1" link="11"  />
 	<event time="23434.0" type="left link" vehicle="1" link="11"  />
 	<event time="23434.0" type="entered link" vehicle="1" link="15"  />
 	<event time="23444.0" type="vehicle leaves traffic" person="1" link="15" vehicle="1" networkMode="car" relativePosition="1.0"  />
 	<event time="23444.0" type="PersonLeavesVehicle" person="1" vehicle="1"  />
 	<event time="23444.0" type="arrival" person="1" link="15" legMode="car"  />
 	<event time="23444.0" type="actstart" person="1" link="15" actType="h"  />
 </events>
Clone this wiki locally