1 package org.opentrafficsim.road.network.speed; 2 3 import java.io.Serializable; 4 5 import org.djunits.unit.SpeedUnit; 6 import org.djunits.value.vdouble.scalar.Acceleration; 7 import org.djunits.value.vdouble.scalar.Length; 8 import org.djunits.value.vdouble.scalar.Speed; 9 import org.djutils.exceptions.Throw; 10 11 /** 12 * Class with curvature info for curvature speed limit type. 13 * <p> 14 * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 15 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>. 16 * </p> 17 * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a> 18 * @author <a href="https://github.com/wjschakel">Wouter Schakel</a> 19 * @param radius Length; curvature radius 20 */ 21 public record SpeedInfoCurvature(Length radius) implements Serializable 22 { 23 24 /** */ 25 private static final long serialVersionUID = 20160501L; 26 27 /** 28 * Constructor with curvature radius. 29 * @param radius Length; curvature radius 30 * @throws NullPointerException if radius is null 31 */ 32 public SpeedInfoCurvature 33 { 34 Throw.whenNull(radius, "Radius may not be null."); 35 } 36 37 /** 38 * Returns the speed for which the current lateral acceleration follows in the corner. 39 * @param acceleration Acceleration; acceleration to result from speed in corner 40 * @return speed for which the current lateral acceleration follows in the corner 41 * @throws NullPointerException if acceleration is null 42 */ 43 public final Speed getSpeedForLateralAcceleration(final Acceleration acceleration) 44 { 45 Throw.whenNull(acceleration, "Acceleration may not be null."); 46 // a=v*v/r => v=sqrt(a*r) 47 return new Speed(Math.sqrt(acceleration.si * this.radius.si), SpeedUnit.SI); 48 } 49 50 }