1 # Copyright (C) 2010-2011 Richard Lincoln
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 from CIM14
.IEC61970
.Core
.PowerSystemResource
import PowerSystemResource
23 class Reservoir(PowerSystemResource
):
24 """A water storage facility within a hydro system, including: ponds, lakes, lagoons, and rivers. The storage is usually behind some type of dam.
27 def __init__(self
, spillWayGateType
="", fullSupplyLevel
=0.0, spillTravelDelay
=0.0, spillwayCrestLength
=0.0, grossCapacity
=0.0, riverOutletWorks
='', spillwayCapacity
=0.0, spillwayCrestLevel
=0.0, normalMinOperateLevel
=0.0, energyStorageRating
=0.0, activeStorageCapacity
=0.0, LevelVsVolumeCurves
=None, InflowForecasts
=None, TargetLevelSchedule
=None, HydroPowerPlants
=None, UpstreamFromHydroPowerPlants
=None, SpillsFromReservoir
=None, SpillsIntoReservoirs
=None, *args
, **kw_args
):
28 """Initialises a new 'Reservoir' instance.
30 @param spillWayGateType: Type of spillway gate, including parameters
31 @param fullSupplyLevel: Full supply level, above which water will spill. This can be the spillway crest level or the top of closed gates.
32 @param spillTravelDelay: The spillway water travel delay to the next downstream reservoir
33 @param spillwayCrestLength: The length of the spillway crest
34 @param grossCapacity: Total capacity of reservoir
35 @param riverOutletWorks: River outlet works for riparian right releases or other purposes
36 @param spillwayCapacity: The flow capacity of the spillway in cubic meters per second
37 @param spillwayCrestLevel: Spillway crest level above which water will spill
38 @param normalMinOperateLevel: Normal minimum operating level below which the penstocks will draw air
39 @param energyStorageRating: The reservoir's energy storage rating in energy for given head conditions
40 @param activeStorageCapacity: Storage volume between the full supply level and the normal minimum operating level
41 @param LevelVsVolumeCurves: A reservoir may have a level versus volume relationship.
42 @param InflowForecasts: A reservoir may have a 'natural' inflow forecast.
43 @param TargetLevelSchedule: A reservoir may have a water level target schedule.
44 @param HydroPowerPlants: Generators discharge water to or pumps are supplied water from a downstream reservoir
45 @param UpstreamFromHydroPowerPlants: Generators are supplied water from or pumps discharge water to an upstream reservoir
46 @param SpillsFromReservoir: A reservoir may spill into a downstream reservoir
47 @param SpillsIntoReservoirs: A reservoir may spill into a downstream reservoir
49 #: Type of spillway gate, including parameters
50 self
.spillWayGateType
= spillWayGateType
52 #: Full supply level, above which water will spill. This can be the spillway crest level or the top of closed gates.
53 self
.fullSupplyLevel
= fullSupplyLevel
55 #: The spillway water travel delay to the next downstream reservoir
56 self
.spillTravelDelay
= spillTravelDelay
58 #: The length of the spillway crest
59 self
.spillwayCrestLength
= spillwayCrestLength
61 #: Total capacity of reservoir
62 self
.grossCapacity
= grossCapacity
64 #: River outlet works for riparian right releases or other purposes
65 self
.riverOutletWorks
= riverOutletWorks
67 #: The flow capacity of the spillway in cubic meters per second
68 self
.spillwayCapacity
= spillwayCapacity
70 #: Spillway crest level above which water will spill
71 self
.spillwayCrestLevel
= spillwayCrestLevel
73 #: Normal minimum operating level below which the penstocks will draw air
74 self
.normalMinOperateLevel
= normalMinOperateLevel
76 #: The reservoir's energy storage rating in energy for given head conditions
77 self
.energyStorageRating
= energyStorageRating
79 #: Storage volume between the full supply level and the normal minimum operating level
80 self
.activeStorageCapacity
= activeStorageCapacity
82 self
._LevelVsVolumeCurves
= []
83 self
.LevelVsVolumeCurves
= [] if LevelVsVolumeCurves
is None else LevelVsVolumeCurves
85 self
._InflowForecasts
= []
86 self
.InflowForecasts
= [] if InflowForecasts
is None else InflowForecasts
88 self
._TargetLevelSchedule
= None
89 self
.TargetLevelSchedule
= TargetLevelSchedule
91 self
._HydroPowerPlants
= []
92 self
.HydroPowerPlants
= [] if HydroPowerPlants
is None else HydroPowerPlants
94 self
._UpstreamFromHydroPowerPlants
= []
95 self
.UpstreamFromHydroPowerPlants
= [] if UpstreamFromHydroPowerPlants
is None else UpstreamFromHydroPowerPlants
97 self
._SpillsFromReservoir
= None
98 self
.SpillsFromReservoir
= SpillsFromReservoir
100 self
._SpillsIntoReservoirs
= []
101 self
.SpillsIntoReservoirs
= [] if SpillsIntoReservoirs
is None else SpillsIntoReservoirs
103 super(Reservoir
, self
).__init
__(*args
, **kw_args
)
105 _attrs
= ["spillWayGateType", "fullSupplyLevel", "spillTravelDelay", "spillwayCrestLength", "grossCapacity", "riverOutletWorks", "spillwayCapacity", "spillwayCrestLevel", "normalMinOperateLevel", "energyStorageRating", "activeStorageCapacity"]
106 _attr_types
= {"spillWayGateType": str, "fullSupplyLevel": float, "spillTravelDelay": float, "spillwayCrestLength": float, "grossCapacity": float, "riverOutletWorks": str, "spillwayCapacity": float, "spillwayCrestLevel": float, "normalMinOperateLevel": float, "energyStorageRating": float, "activeStorageCapacity": float}
107 _defaults
= {"spillWayGateType": "", "fullSupplyLevel": 0.0, "spillTravelDelay": 0.0, "spillwayCrestLength": 0.0, "grossCapacity": 0.0, "riverOutletWorks": '', "spillwayCapacity": 0.0, "spillwayCrestLevel": 0.0, "normalMinOperateLevel": 0.0, "energyStorageRating": 0.0, "activeStorageCapacity": 0.0}
108 _enums
= {"spillWayGateType": "SpillwayGateType"}
109 _refs
= ["LevelVsVolumeCurves", "InflowForecasts", "TargetLevelSchedule", "HydroPowerPlants", "UpstreamFromHydroPowerPlants", "SpillsFromReservoir", "SpillsIntoReservoirs"]
110 _many_refs
= ["LevelVsVolumeCurves", "InflowForecasts", "HydroPowerPlants", "UpstreamFromHydroPowerPlants", "SpillsIntoReservoirs"]
112 def getLevelVsVolumeCurves(self
):
113 """A reservoir may have a level versus volume relationship.
115 return self
._LevelVsVolumeCurves
117 def setLevelVsVolumeCurves(self
, value
):
118 for x
in self
._LevelVsVolumeCurves
:
122 self
._LevelVsVolumeCurves
= value
124 LevelVsVolumeCurves
= property(getLevelVsVolumeCurves
, setLevelVsVolumeCurves
)
126 def addLevelVsVolumeCurves(self
, *LevelVsVolumeCurves
):
127 for obj
in LevelVsVolumeCurves
:
130 def removeLevelVsVolumeCurves(self
, *LevelVsVolumeCurves
):
131 for obj
in LevelVsVolumeCurves
:
134 def getInflowForecasts(self
):
135 """A reservoir may have a 'natural' inflow forecast.
137 return self
._InflowForecasts
139 def setInflowForecasts(self
, value
):
140 for x
in self
._InflowForecasts
:
144 self
._InflowForecasts
= value
146 InflowForecasts
= property(getInflowForecasts
, setInflowForecasts
)
148 def addInflowForecasts(self
, *InflowForecasts
):
149 for obj
in InflowForecasts
:
152 def removeInflowForecasts(self
, *InflowForecasts
):
153 for obj
in InflowForecasts
:
156 def getTargetLevelSchedule(self
):
157 """A reservoir may have a water level target schedule.
159 return self
._TargetLevelSchedule
161 def setTargetLevelSchedule(self
, value
):
162 if self
._TargetLevelSchedule
is not None:
163 self
._TargetLevelSchedule
._Reservoir
= None
165 self
._TargetLevelSchedule
= value
166 if self
._TargetLevelSchedule
is not None:
167 self
._TargetLevelSchedule
.Reservoir
= None
168 self
._TargetLevelSchedule
._Reservoir
= self
170 TargetLevelSchedule
= property(getTargetLevelSchedule
, setTargetLevelSchedule
)
172 def getHydroPowerPlants(self
):
173 """Generators discharge water to or pumps are supplied water from a downstream reservoir
175 return self
._HydroPowerPlants
177 def setHydroPowerPlants(self
, value
):
178 for x
in self
._HydroPowerPlants
:
182 self
._HydroPowerPlants
= value
184 HydroPowerPlants
= property(getHydroPowerPlants
, setHydroPowerPlants
)
186 def addHydroPowerPlants(self
, *HydroPowerPlants
):
187 for obj
in HydroPowerPlants
:
190 def removeHydroPowerPlants(self
, *HydroPowerPlants
):
191 for obj
in HydroPowerPlants
:
194 def getUpstreamFromHydroPowerPlants(self
):
195 """Generators are supplied water from or pumps discharge water to an upstream reservoir
197 return self
._UpstreamFromHydroPowerPlants
199 def setUpstreamFromHydroPowerPlants(self
, value
):
200 for x
in self
._UpstreamFromHydroPowerPlants
:
201 x
.GenSourcePumpDischargeReservoir
= None
203 y
._GenSourcePumpDischargeReservoir
= self
204 self
._UpstreamFromHydroPowerPlants
= value
206 UpstreamFromHydroPowerPlants
= property(getUpstreamFromHydroPowerPlants
, setUpstreamFromHydroPowerPlants
)
208 def addUpstreamFromHydroPowerPlants(self
, *UpstreamFromHydroPowerPlants
):
209 for obj
in UpstreamFromHydroPowerPlants
:
210 obj
.GenSourcePumpDischargeReservoir
= self
212 def removeUpstreamFromHydroPowerPlants(self
, *UpstreamFromHydroPowerPlants
):
213 for obj
in UpstreamFromHydroPowerPlants
:
214 obj
.GenSourcePumpDischargeReservoir
= None
216 def getSpillsFromReservoir(self
):
217 """A reservoir may spill into a downstream reservoir
219 return self
._SpillsFromReservoir
221 def setSpillsFromReservoir(self
, value
):
222 if self
._SpillsFromReservoir
is not None:
223 filtered
= [x
for x
in self
.SpillsFromReservoir
.SpillsIntoReservoirs
if x
!= self
]
224 self
._SpillsFromReservoir
._SpillsIntoReservoirs
= filtered
226 self
._SpillsFromReservoir
= value
227 if self
._SpillsFromReservoir
is not None:
228 if self
not in self
._SpillsFromReservoir
._SpillsIntoReservoirs
:
229 self
._SpillsFromReservoir
._SpillsIntoReservoirs
.append(self
)
231 SpillsFromReservoir
= property(getSpillsFromReservoir
, setSpillsFromReservoir
)
233 def getSpillsIntoReservoirs(self
):
234 """A reservoir may spill into a downstream reservoir
236 return self
._SpillsIntoReservoirs
238 def setSpillsIntoReservoirs(self
, value
):
239 for x
in self
._SpillsIntoReservoirs
:
240 x
.SpillsFromReservoir
= None
242 y
._SpillsFromReservoir
= self
243 self
._SpillsIntoReservoirs
= value
245 SpillsIntoReservoirs
= property(getSpillsIntoReservoirs
, setSpillsIntoReservoirs
)
247 def addSpillsIntoReservoirs(self
, *SpillsIntoReservoirs
):
248 for obj
in SpillsIntoReservoirs
:
249 obj
.SpillsFromReservoir
= self
251 def removeSpillsIntoReservoirs(self
, *SpillsIntoReservoirs
):
252 for obj
in SpillsIntoReservoirs
:
253 obj
.SpillsFromReservoir
= None