View Javadoc
1   package org.opentrafficsim.road.network.sampling.data;
2   
3   import org.djunits.unit.DurationUnit;
4   import org.djunits.value.vfloat.scalar.FloatDuration;
5   import org.opentrafficsim.base.parameters.ParameterException;
6   import org.opentrafficsim.base.parameters.ParameterTypes;
7   import org.opentrafficsim.kpi.sampling.data.ExtendedDataTypeDuration;
8   import org.opentrafficsim.road.network.sampling.GtuData;
9   
10  /**
11   * Leader id in trajectory information.
12   * <p>
13   * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
14   * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
15   * <p>
16   * @version $Revision$, $LastChangedDate$, by $Author$, initial version 19 mrt. 2019 <br>
17   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
18   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
19   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
20   */
21  public class ReactionTime extends ExtendedDataTypeDuration<GtuData>
22  {
23  
24      /**
25       * Constructor.
26       */
27      public ReactionTime()
28      {
29          super("Tr");
30      }
31  
32      /** {@inheritDoc} */
33      @Override
34      public FloatDuration getValue(final GtuData gtu)
35      {
36          try
37          {
38              return new FloatDuration(gtu.getGtu().getParameters().getParameter(ParameterTypes.TR).getSI(), DurationUnit.SI);
39          }
40          catch (ParameterException exception)
41          {
42              return FloatDuration.NaN;
43          }
44      }
45  
46  }