sumo icon indicating copy to clipboard operation
sumo copied to clipboard

Difference between sumo-gui flow and flow calculated from edge data output

Open gladysmcgan opened this issue 7 months ago • 4 comments

Hi, we are looking into the flow/segment flow plot in sumo-gui and saw that it is different compared to the edge data.

Image

For example in this case, the edge (mostly congested at this time, the one with orange cars in the picture) shows in the plot a flow of around 2300 veh/h/lane at the latest time interval.

In the edge_data, aggregated also to 5 min, the flow is calculated as such: 478.25 * 0.65 * 3.6 = 1119 veh/h

<edge id="5156219" sampledSeconds="5637.41" traveltime="96.14" overlapTraveltime="104.46" density="478.25" laneDensity="95.65" occupancy="51.36" waitingTime="180.89" timeLoss="5311.82" speed="0.65" speedRelative="0.05" departed="0" arrived="0" entered="60" left="53" laneChangedFrom="0" laneChangedTo="0"/>

Why is there a difference between these two?

A side question is also what is the difference between segment flow and flow? They appear to be the same here.

Thanks for your help :)

gladysmcgan avatar May 22 '25 14:05 gladysmcgan

  1. the edge parameter dialog doesn't show aggregated flow but rather momentary flow based on the estimated meanSpeed on the segment: https://github.com/eclipse-sumo/sumo/blob/1043cf555c5cecd8f6943ee8dabf32ced0a8b9cc/src/mesosim/MESegment.cpp#L842-L844 Obviously, this number is quite volatile, especially at traffic lights.
  2. the edge flow is the average flow over all segments of an edge. For short edges with only a single segment, there is no difference.

namdre avatar May 22 '25 21:05 namdre

Thanks for the reply! I still don't quite understand how momentary flow is shown in 5 minutes. The segment flow in the dialog toward the latest time interval was stable around above 2000, which I would then expect after aggregation to be around that number, instead of 1100.

gladysmcgan avatar May 26 '25 09:05 gladysmcgan

Please put together a minimal simulation that replicates unexpected behavior and attach it here

namdre avatar May 26 '25 11:05 namdre

This simulation shows the same area as above, where the dialog shows a higher flow (around 3000) than in edge data (calculated to be around 1600) issue_test.zip

gladysmcgan avatar May 28 '25 12:05 gladysmcgan

I think it comes down to the computation of speed:

  • the flow computation from the dialog uses time-mean speed (averaging over all vehicles currently on the edge)
  • the flow computation from edge data uses space-mean speed (averaging over vehicles and time). In the later case, slow vehicles have more impact on the average speed because they spend more time on the edge.

The result is not intuitive (at least to me) because I would expect both averages to be the same when the speeds in the fleet are somewhat homogeneous. However, the meso speeds are not the real thing. They should be homogeneous along the edge but you can see that the cars are red in the front and quite green in the back. It's a very rough approximation from a queuing model that doesn't actually deal with speeds. And so the seemingly fast vehicles at the downstream end of the segment skew the results of the flow shown in the dialog.

namdre avatar Jun 20 '25 13:06 namdre

Thanks for looking into this again. I think I understand where the discrepancy comes from now. Somehow, I think it makes more sense to show the space-mean speed flow computation, no?

ambuehll avatar Jun 20 '25 13:06 ambuehll

Agreed. I think the original reason is that the current speeds (used in the flow computation) can be computed without storing extra values, whereas the space mean speed requires extra state to average over time.

namdre avatar Jun 20 '25 13:06 namdre