View Javadoc
1   package org.opentrafficsim.demo.fd;
2   
3   import java.io.Serializable;
4   
5   import org.opentrafficsim.core.dsol.AbstractOTSModel;
6   import org.opentrafficsim.core.dsol.OTSSimulatorInterface;
7   import org.opentrafficsim.core.network.OTSNetwork;
8   import org.opentrafficsim.road.network.OTSRoadNetwork;
9   
10  import nl.tudelft.simulation.dsol.SimRuntimeException;
11  
12  /**
13   * Fundamental diagram model.
14   * <p>
15   * Copyright (c) 2020-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
16   * BSD-style license. See <a href="https://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
17   * </p>
18   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
19   * @author <a href="https://www.tudelft.nl/pknoppers">Peter Knoppers</a>
20   * @author <a href="https://www.transport.citg.tudelft.nl">Wouter Schakel</a>
21   */
22  public class FundamentalDiagramModel extends AbstractOTSModel
23  {
24  
25      /** */
26      private static final long serialVersionUID = 20200516L;
27      
28      /** The network. */
29      private OTSRoadNetwork network;
30      
31      /**
32       * @param simulator OTSSimulatorInterface; the simulator to use
33       */
34      public FundamentalDiagramModel(final OTSSimulatorInterface simulator)
35      {
36          super(simulator, "FD Demo", "Fundamental Diagram Demo");
37      }
38  
39      /** {@inheritDoc} */
40      @Override
41      public OTSNetwork getNetwork()
42      {
43          return this.network;
44      }
45  
46      /** {@inheritDoc} */
47      @Override
48      public void constructModel() throws SimRuntimeException
49      {
50          this.network = new OTSRoadNetwork("FdNetwork", true, getSimulator());
51      }
52  
53      /** {@inheritDoc} */
54      @Override
55      public Serializable getSourceId()
56      {
57          return "FdDemo";
58      }
59  
60  }
61