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