Skip to content

faq 49512463

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

Meaning of the Capacity attribute in the network xml

by Thibaut Dubernet on 2016-03-04 09:23:41


--- redirected from the mailing list ---


Hi All,

 

I’m trying to understand the capacity variable in the network file so that I can write some python scripts to compare the time an agent takes to complete a plan (with waiting) vs the time it would take based on the distance / rate (which I understand to be the free speed of the link) for the links used in the plan. The capacity variable has me a bit confused because I am wondering how it fits into the picture. I have been reading thought the mailing list messages and the MATSim book but I can’t quite understand what it means. I would expect the capacity to be related to the distance of the link and the speed at which an agent can traverse the link, or the distance of the link based upon the length of a vehicle. But looking at the capacity values in the example xlm and my own network xml, neither of these seem to fit. I appreciate any explanation that will help me to understand how network xml capacity is used.

 

Thanks, Joe

 


Comments: 3


Re: Meaning of the Capacity attribute in the network xml

by Thibaut Dubernet on 2016-03-04 09:23:52

Dear Joe,

 

the capacity in the queue model simply corresponds to the amount of vehicles that can be in the queue. Once the queue is full, vehicles cannot enter the link anymore and accumulate in upstream links ("spillback"). That's for the queue model.

 

Now to the data structures. I cannot say what is the case of the files you looked at, but it scared me a bit, so I had a quick look through the code and here are the results:

- When creating a Link, capacity is set to a default of 1.0 if not specified (it is not inferred from the length). If your value is different, I do not know where it comes from.

- however, this is not as bad as it seems for the simulation: in the QSim initialization process, and after a lot of delegation and redirection, capacity is actually not gotten from the link attribute, but computed from the length, number of lanes, and "effective cell size" of the network. The method responsible of this is org.matsim.core.mobsim.qsim.qnetsimengine.QueueWithBuffer.calculateStorageCapacity(), in case you want to have a look.

 

So for your computations, you might just want to have a look at how the QSim computes this value and recompute it from your Python script.

 

In the simulation, the capacity only seems to be used to determine the priority in activating the links incoming to a same node (links are discharged in random order, with higher probability as the capacity attribute of the link increases), in QNode.doSimStep().

 

The bottom line is: this attribute is ignored. I agree this is confusing, and I will create an issue in the issue tracker immediately.

 

Hope this helps.

Thibaut


Re: Meaning of the Capacity attribute in the network xml

by Marcel Rieser on 2016-03-04 09:34:18

Maybe we have to clarify, which capacity you mean.

The network contains one "capacityPeriod", which be default should be set to 01:00:00 (i.e. one hour). And then, each link contains a capacity. This is the flow capacity and specifies, how many vehicles can leave the link per the defined-above capacityPeriod. As mentioned, by default it is the number of vehicles per hour.

So for a road with one lane, it is usually somewhere between 1000 and 2000 vehicles per hour.

This is independent on the length of the link, as it is only a flow capacity.

One could calculate a so-called "storage capacity" which describes how many vehicles can be put on the link at the same time. For this, MATSim usually makes an approximation by number-of-lanes * link-length / 7.5m. But this value is only used internally in the mobility simulation.

The capacity value in the network file is most likely the flow capacity, which is independent of the link's length. It should be set dependent on real world infrastructure, e.g. if you have a traffic light at the end of the link, the flow capacity should be lower than without traffic light.


Re: Meaning of the Capacity attribute in the network xml

by Kai Nagel on 2016-04-09 15:57:36

So an answer to one of the original questions is: The "capacity" value in the link has nothing to do with free speed travel time.  Free speed travel time on a link simply is

  link.length / link.freeSpeed

Normally, lengths should be given in meters and speeds in meters/sec.

Clone this wiki locally