All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentrafficsim.kpi.sampling.indicator.MeanIntensity Maven / Gradle / Ivy

package org.opentrafficsim.kpi.sampling.indicator;

import java.util.List;

import org.djunits.unit.FrequencyUnit;
import org.djunits.value.vdouble.scalar.Frequency;
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;

/**
 * Total travel distance divided by the sum of areas (X * T).
 * 

* 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 MeanIntensity extends AbstractIndicator { /** Travel distance indicator. */ private final TotalTravelDistance travelDistance; /** * @param travelDistance TotalTravelDistance; travel distance indicator */ public MeanIntensity(final TotalTravelDistance travelDistance) { this.travelDistance = travelDistance; } /** {@inheritDoc} */ @Override protected Frequency calculate(final Query query, final Time startTime, final Time endTime, final List> trajectoryGroups) { double ttd = this.travelDistance.getValue(query, startTime, endTime, trajectoryGroups).si; double area = 0; for (TrajectoryGroup trajectoryGroup : trajectoryGroups) { area += trajectoryGroup.getLength().si * (endTime.si - startTime.si); } return new Frequency(ttd / area, FrequencyUnit.SI); } /** {@inheritDoc} */ @Override public final String toString() { return "MeanIntensity [travelDistance=" + this.travelDistance + "]"; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy