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

org.opentrafficsim.road.gtu.lane.AccelerationChecker Maven / Gradle / Ivy

package org.opentrafficsim.road.gtu.lane;

import org.djunits.value.vdouble.scalar.Acceleration;
import org.djunits.value.vdouble.scalar.Duration;
import org.djunits.value.vdouble.scalar.Speed;
import org.opentrafficsim.core.network.Network;

/**
 * Checks acceleration bounds.
 * 

* Copyright (c) 2013-2024 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 AccelerationChecker extends AbstractLaneBasedMoveChecker { /** Minimum allowable acceleration. */ private final Acceleration min; /** Maximum allowable acceleration. */ private final Acceleration max; /** Speed above which acceleration should be checked. */ private final Speed minSpeed; /** * Constructor. * @param network Network; network */ public AccelerationChecker(final Network network) { this(network, Acceleration.instantiateSI(-10.0), Acceleration.instantiateSI(5), Speed.instantiateSI(2.5)); } /** * Constructor. * @param network Network; network * @param min Acceleration; minimum allowable acceleration * @param max Acceleration; maximum allowable acceleration * @param minSpeed Speed; speed above which acceleration should be checked */ public AccelerationChecker(final Network network, final Acceleration min, final Acceleration max, final Speed minSpeed) { super(network); this.min = min; this.max = max; this.minSpeed = minSpeed; } /** {@inheritDoc} */ @Override public void checkMove(final LaneBasedGtu gtu) throws Exception { Acceleration a = gtu.getOperationalPlan().getAcceleration(Duration.ZERO); if (gtu.getOperationalPlan().getSpeed(Duration.ZERO).si > this.minSpeed.si && (a.si < this.min.si || a.si > this.max.si)) { gtu.getSimulator().getLogger().always().error("GTU: {} acceleration out of bounds ({}, {})", this.min, this.max); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy