@@ -131,7 +131,7 @@ def set_upstream_flow(self, upstream_flow: pd.Series) -> None:
131131
132132 self .upstream_flow = upstream_flow
133133
134- def simulate (self ) -> None :
134+ def simulate (self , initial_storage : float = None ) -> None :
135135 """Simulate the operation of the reservoir. This method calculates the release,
136136 spill, storage, level, and daily hydropower.
137137 """
@@ -152,13 +152,17 @@ def simulate(self) -> None:
152152
153153 # Simulate the reservoir operation to extract the release, spill, and storage
154154 # Assume the initial storage equals to the target storage in the first day
155+
156+ if initial_storage is None :
157+ initial_storage = self .target_storage [1 ]
158+
155159 self .release , self .spill , self .storage , _ = solve_release_from_target_storage (
156160 reservoir_name = self .name ,
157161 start_day = 1 ,
158162 end_day = self .sim_days ,
159163 max_release = self .max_release ,
160164 max_storage = self .max_storage ,
161- initial_storage = self . target_storage [ 1 ] ,
165+ initial_storage = initial_storage ,
162166 target_storage = self .target_storage ,
163167 minflow = self .minflow_ts ,
164168 total_inflow = self .inflow_ts + self .upstream_flow ,
@@ -465,7 +469,7 @@ def get_reop_daily_hydropower(self) -> pd.Series:
465469 """Return the reoperated daily hydropower values."""
466470 return self .reop_daily_hydropower
467471
468- def plot_state (self , output_folder : str = None ) -> None :
472+ def plot_state (self , year : int = None , output_folder : str = None ) -> None :
469473 fig , ax = plt .subplots (figsize = (13 , 7 ), layout = "constrained" , dpi = 350 )
470474 ax .plot (self .inflow_ts + self .upstream_flow , label = "Total inflow (m3/day)" )
471475 ax .plot (self .release , label = "Release (m3/day)" )
@@ -477,7 +481,7 @@ def plot_state(self, output_folder: str = None) -> None:
477481 )
478482 ax .set_xlabel ("Day" )
479483 ax .set_ylabel ("Flow rate (m3/day)" )
480- ax .set_title (self .name )
484+ ax .set_title (f" { self .name } { year } " )
481485
482486 ax2 = ax .twinx ()
483487 ax2 .plot (self .storage , label = "Storage (m3)" , color = "k" , linewidth = 1 )
0 commit comments