eclipse-sumo/sumo

Discrepancy in Calculated "StatisticOutput" Metrics: Average Route Length vs. (Average Vehicle Speed * Average Travel Time)

Closed this issue · 2 comments

I am currently working with SUMO for a simulation project and have encountered an issue that I would like your assistance with. In my simulation output, I have observed that the product of average vehicle speed and average travel time does not seem to equal the reported average route length.

Here is a snippet of the relevant statistics from my SUMO simulation:

<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on 2023-12-15 17:14:53 by Eclipse SUMO sumo Version 1.17.0
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/sumoConfiguration.xsd">

    <input>
        <net-file value="net_20231213d408fd505fc8467899ecd34c70838469.net.xml"/>
        <route-files value="routeSampler_20231213d408fd505fc8467899ecd34c70838469.rou.xml"/>
        <additional-files value="detectors_20231213d408fd505fc8467899ecd34c70838469.add.xml"/>
    </input>

    <output>
        <queue-output value="queueOutput_20231213d408fd505fc8467899ecd34c70838469.xml"/>
        <tripinfo-output value="tripinfo_20231213d408fd505fc8467899ecd34c70838469.xml"/>
        <tripinfo-output.write-unfinished value="true"/>
        <statistic-output value="statisticOutput_20231213d408fd505fc8467899ecd34c70838469.xml"/>
    </output>

    <time>
        <begin value="0"/>
        <end value="9000"/>
    </time>

    <report>
        <verbose value="true"/>
    </report>

    <gui_only>
        <quit-on-end value="true"/>
        <start value="true"/>
    </gui_only>

</configuration>
-->

<statistics xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/statistic_file.xsd">
    <performance clockBegin="26285.66" clockEnd="26521.57" clockDuration="235.90" traciDuration="62.91" realTimeFactor="38.15" vehicleUpdatesPerSecond="32395.39" personUpdatesPerSecond="0.00" begin="0.00" end="9000.00" duration="9000.00"/>
    <vehicles loaded="33396" inserted="31621" running="1748" waiting="1767"/>
    <teleports total="366" jam="128" yield="160" wrongLane="78"/>
    <safety collisions="0" emergencyStops="0"/>
    <persons loaded="0" running="0" jammed="0"/>
    <personTeleports total="0" abortWait="0" wrongDest="0"/>
    <vehicleTripStatistics count="31621" routeLength="795.30" speed="7.75" duration="241.68" waitingTime="161.82" timeLoss="188.92" departDelay="21.60" departDelayWaiting="1663.91" totalTravelTime="7642170.00" totalDepartDelay="3636586.11"/>
    <pedestrianStatistics number="0" routeLength="0.00" duration="0.00" timeLoss="0.00"/>
    <rideStatistics number="0"/>
    <transportStatistics number="0"/>
</statistics>

Based on the provided statistics:

Average Route Length: 795.30
Average Vehicle Speed: 7.75
Average Travel Time: 241.68
I expected the product of Average Vehicle Speed and Average Travel Time to be approximately equal to the Average Route Length, but the calculated result is different.
7.75×241.68≠795.30

Thank you very much for your time and expertise. I appreciate any assistance or guidance you can provide.

After carefully summing and averaging the relevant values from TripInfo ((https://sumo.dlr.de/docs/Simulation/Output/TripInfo.html#generated_output), I compared the results with the values provided in StatisticOutput (https://sumo.dlr.de/docs/Simulation/Output/StatisticOutput.html#generated_output). Surprisingly, I found that all metrics, except for average speed, align perfectly between the two outputs.

To gain a better understanding, I would like to inquire about the specific calculation method employed for average speed in StatisticOutput. Are there any notable differences or considerations in the computation of average speed between these two output sources?
Thank you!

The average speed in the statistics is calculated as the average of the travel speeds of all vehicles so the sum of all individual travel speeds divided by the number of vehicles. This is different from the sum of all distances divided by the sum of all travel times (or the average distance divided by the average travel time). Both calculations are valid but give different results. You can think of the first as being the "one vehicle, one vote" approach to averaging the speeds while the latter gives higher weights to vehicles with longer routes so it is more of an average speed in the network regardless of how many vehicles actually drove.