View Javadoc
1   package org.opentrafficsim.water.network.infra;
2   
3   import org.djunits.value.vdouble.scalar.Duration;
4   import org.djunits.value.vdouble.scalar.Length;
5   import org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface;
6   import org.opentrafficsim.water.network.WaterwayLocation;
7   
8   /**
9    * <br>
10   * Copyright (c) 2013 Rijkswaterstaat - Dienst Water, Verkeer en Leefomgeving. All rights reserved. <br>
11   * Some parts of the software (c) 2011-2013 TU Delft, Faculty of TBM, Systems and Simulation <br>
12   * This software is licensed without restrictions to Nederlandse Organisatie voor Toegepast Natuurwetenschappelijk Onderzoek TNO
13   * (TNO), Erasmus University Rotterdam, Delft University of Technology, Panteia B.V., Stichting Projecten Binnenvaart, Ab Ovo
14   * Nederland B.V., Modality Software Solutions B.V., and Rijkswaterstaat - Dienst Water, Verkeer en Leefomgeving, including the
15   * right to sub-license sources and derived products to third parties. <br>
16   * @version Sep 28, 2012 <br>
17   * @author <a href="http://tudelft.nl/averbraeck">Alexander Verbraeck </a>
18   */
19  public class Lock extends Obstacle implements OperatedObstacle
20  {
21      /** */
22      private static final long serialVersionUID = 1L;
23  
24      /** the simulator to schedule on. */
25      private OTSDEVSSimulatorInterface simulator;
26  
27      /** hours per day. */
28      private int operationHoursPerDay;
29  
30      /** days per week. */
31      private int operationDaysPerWeek;
32  
33      /** length. */
34      private Length length;
35  
36      /** width. */
37      private Length width;
38  
39      /** number of lock chambers. */
40      private int numberChambers;
41  
42      /** priority for cargo? */
43      private boolean cargoPriority;
44  
45      /** estimated average opening time. */
46      private Duration estimatedAverageLockageTime;
47  
48      /**
49       * @param simulator the simulator to schedule on
50       * @param name the name of the lock
51       * @param waterwayLocation the location along the waterway
52       * @param numberChambers the number of lock chambers
53       * @param operationHoursPerDay  hours per day
54       * @param operationDaysPerWeek days per week
55       * @param length the length
56       * @param width the width
57       * @param cargoPriority does cargo have priority?
58       */
59      @SuppressWarnings("checkstyle:parameternumber")
60      public Lock(final OTSDEVSSimulatorInterface simulator, final String name, final WaterwayLocation waterwayLocation,
61              final int numberChambers, final int operationHoursPerDay, final int operationDaysPerWeek, final Length length,
62              final Length width, final boolean cargoPriority)
63      {
64          super(name, waterwayLocation);
65          this.simulator = simulator;
66          this.operationHoursPerDay = operationHoursPerDay;
67          this.operationDaysPerWeek = operationDaysPerWeek;
68          this.numberChambers = numberChambers;
69          this.length = length;
70          this.width = width;
71          this.cargoPriority = cargoPriority;
72      }
73  
74      /**
75       * @return the estimated lockage delay in hours during normal opening time
76       */
77      public final Duration estimateLockageDelay()
78      {
79          return this.estimatedAverageLockageTime;
80      }
81  
82      /**
83       * @return the lockage delay in hours during normal opening time
84       */
85      public final Duration drawLockageDelay()
86      {
87          return this.estimatedAverageLockageTime;
88      }
89  
90      /** {@inheritDoc} */
91      @Override
92      public final int getOperationHoursPerDay()
93      {
94          return this.operationHoursPerDay;
95      }
96  
97      /** {@inheritDoc} */
98      @Override
99      public final int getOperationDaysPerWeek()
100     {
101         return this.operationDaysPerWeek;
102     }
103 
104     /**
105      * @return the length
106      */
107     public final Length getLength()
108     {
109         return this.length;
110     }
111 
112     /**
113      * @return the width
114      */
115     public final Length getWidth()
116     {
117         return this.width;
118     }
119 
120     /**
121      * @return numberChambers
122      */
123     public final int getNumberChambers()
124     {
125         return this.numberChambers;
126     }
127     /**
128      * @return the cargoPriority
129      */
130     public final boolean isCargoPriority()
131     {
132         return this.cargoPriority;
133     }
134 
135     /** {@inheritDoc} */
136     @Override
137     public final OTSDEVSSimulatorInterface getSimulator()
138     {
139         return this.simulator;
140     }
141 
142     /** {@inheritDoc} */
143     @Override
144     @SuppressWarnings("checkstyle:designforextension")
145     public String toString()
146     {
147         return "Lock " + this.getName() + " at " + this.getWaterwayLocation();
148     }
149 
150 }