![JAR search and dependency download from the Maven repository](/logo.png)
org.opentrafficsim.kpi.sampling.indicator.MeanTravelTimePerDistance Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ots-kpi Show documentation
Show all versions of ots-kpi Show documentation
OpenTrafficSim KPI Module without dependencies to ots-road or ots-core
package org.opentrafficsim.kpi.sampling.indicator;
import java.util.List;
import org.djunits.unit.DurationUnit;
import org.djunits.value.vdouble.scalar.Duration;
import org.djunits.value.vdouble.scalar.Time;
import org.opentrafficsim.kpi.interfaces.GtuData;
import org.opentrafficsim.kpi.sampling.Query;
import org.opentrafficsim.kpi.sampling.TrajectoryGroup;
/**
* Inverse of mean speed.
*
* Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License.
*
* @author Alexander Verbraeck
* @author Peter Knoppers
* @author Wouter Schakel
*/
public class MeanTravelTimePerDistance extends AbstractIndicator
{
/** Mean speed indicator. */
private final MeanSpeed meanSpeed;
/**
* @param meanSpeed MeanSpeed; mean speed indicator
*/
public MeanTravelTimePerDistance(final MeanSpeed meanSpeed)
{
this.meanSpeed = meanSpeed;
}
/** {@inheritDoc} */
@Override
protected Duration calculate(final Query query, final Time startTime, final Time endTime,
final List> trajectoryGroups)
{
return new Duration(1.0 / this.meanSpeed.getValue(query, startTime, endTime, trajectoryGroups).si, DurationUnit.SI);
}
/** {@inheritDoc} */
@Override
@SuppressWarnings("checkstyle:designforextension")
public String toString()
{
return "MeanTravelTime [meanTravelTime=" + this.meanSpeed + " (per km)]";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy