-
Notifications
You must be signed in to change notification settings - Fork 181
faq 108541234
by Celeste Manu on 2017-03-21 17:04:12
I've created a plans file for my agents by specifying the links, but now I would like to change them to nodes. One thing I noticed is that when I enter the nodes for the agent to travel on, the agent will start on the "to" side of the link that is connected to the node. For example:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE population SYSTEM "http://www.matsim.org/files/dtd/population_v5.dtd">
<population>
<person id="1">
<plan selected="yes">
<act type="h" x="0" y="0" end_time="06:30:00" />
<leg mode="car"></leg>
<act type="h" x="0" y="0" end_time="06:30:00" />
<leg mode="car"></leg>
<act type="h" x="1.5" y="1"/>
</plan>
</person>
</population>
Relevant part of my network:
...
<node id="1" x="0" y="0"/>
<node id="2" x="1" y="0"/>
<node id="3" x="1.5" y="0"/>
...
<link id="1" from="1" to="2" length="10" freespeed="1" capacity="480.0" permlanes="1.0" oneway="1" modes="car"/>
<link id="2" from="2" to="1" length="10" freespeed="1" capacity="480.0" permlanes="1.0" oneway="1" modes="car"/>
...
Here my agent will not start on the node I specified (node 0). It will start on link 1's "to" node (node 2) rather than the from node, node 1. I want my agent to start on the beginning of link 1 at 0,0. How can I change this mapping when the events.xml is created from the population.xml/plans.xml?
I just want my agent to start on the node that I specify. I don't have a problem modifying the events file after matsim generates it if necessary to accomplish this.
Here is the events file associated with running this:
<?xml version="1.0" encoding="utf-8"?>
<events version="1.0">
<event time="23400.0" type="actend" person="1" link="1" actType="h" />
<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="vehicle leaves traffic" person="1" link="1" vehicle="1" networkMode="car" relativePosition="1.0" />
<event time="23401.0" type="PersonLeavesVehicle" person="1" vehicle="1" />
<event time="23401.0" type="arrival" person="1" link="1" legMode="car" />
<event time="23401.0" type="actstart" person="1" link="1" actType="h" />
<event time="23401.0" type="actend" person="1" link="1" actType="h" />
<event time="23401.0" type="departure" person="1" link="1" legMode="car" />
<event time="23401.0" type="PersonEntersVehicle" person="1" vehicle="1" />
<event time="23401.0" type="vehicle enters traffic" person="1" link="1" vehicle="1" networkMode="car" relativePosition="1.0" />
<event time="23402.0" type="left link" vehicle="1" link="1" />
<event time="23402.0" type="entered link" vehicle="1" link="4" />
<event time="23413.0" type="left link" vehicle="1" link="4" />
<event time="23413.0" type="entered link" vehicle="1" link="6" />
<event time="23423.0" type="vehicle leaves traffic" person="1" link="6" vehicle="1" networkMode="car" relativePosition="1.0" />
<event time="23423.0" type="PersonLeavesVehicle" person="1" vehicle="1" />
<event time="23423.0" type="arrival" person="1" link="6" legMode="car" />
<event time="23423.0" type="actstart" person="1" link="6" actType="h" />
</events>
I can see the vehicle never enters link 1.
by Kai Nagel on 2017-03-21 18:06:17
Dear Celeste,
I know this is sometimes annoying, but in MATSim vehicles start on links, not on nodes. Vehicles starting on nodes is a fiction of the modelling world, implying that vehicles fall from the sky into the middle of an intersection.
If you insist, I would try around with "nodeconnector" links. Something like
<link id="nodeconnector1" from="nc1" to="1" .../>
Obviously, you will also need a node "nc1". It could have the same coordinates as node 1, but for visualization it might be better to pull it away a bit from node 1.
Then you would start your plans on links:
<act type="home" link="nodeconnector1" .../>
(And don't use coordinates.)
Please let us know how it goes; this should work in principle but there are always situations where the automagic plays tricks.
Best wishes, Kai
You are viewing an archive of the previous MATSim Q&A site. The real site is now at https://matsim.org/faq