package org.opentrafficsim.demo.ntm.fundamentaldiagrams; import java.awt.geom.Point2D; import java.util.ArrayList; import org.djunits.unit.FrequencyUnit; import org.djunits.value.vdouble.scalar.Frequency; import org.opentrafficsim.demo.ntm.LinearFunctionLibrary; /** * * A (Network) Fundamental diagram shows the network production as a function of (network or link) density (number of cars in * a CELL). An example (PieceWiseLinear) is shown below: * *
 *   production
 *      |      
 *    Y |      _____________________ 
 *      |     /                      \
 *      |    /                        \ 
 *      |   /                          \  
 *      |  /                            \   
 *      | /                              \ 
 *      |/________________________________\__________ density (number of vehicles)
 *            ^                     ^ 
 *         accCritica     accCritical2    accJam
 * 
*

* Copyright (c) 2013-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License. *

* $LastChangedDate$, @version $Revision$, by $Author$, * initial version 9 Sep 2014
* @author Alexander Verbraeck * @author Hans van Lint * @author Peter Knoppers * @author Guus Tamminga * @author Yufei Yuan */ public class FundamentalDiagram { /** * @param xyPairs ArrayList<Point2D>; * @param accumulatedCars double; * @return piecewise linear */ public static Frequency PieceWiseLinear(ArrayList xyPairs, double accumulatedCars) { double production = LinearFunctionLibrary.createPieceWiseLinear(xyPairs, accumulatedCars); return new Frequency(production, FrequencyUnit.PER_HOUR); } }