@@ -101,7 +101,8 @@ def parse_arguments(args):
101101 "Setting the seeds will ensure that you get the same results each "
102102 "time, but can compromise randomness. Make sure to set "
103103 "'--user_provided_seeding' flag to True to use this functionality and "
104- "proceed with caution." ,
104+ "proceed with caution. If the '--user_provided_seeding' flag is not set, "
105+ "this seed will be ignored." ,
105106 )
106107 parser .add_argument (
107108 "-max_unit_seed_int" ,
@@ -111,6 +112,13 @@ def parse_arguments(args):
111112 "simulation for a given project. The --user_provided_seeding flag must "
112113 "be set to True for this to take effect. Proceed with caution." ,
113114 )
115+ parser .add_argument (
116+ "-hyb_s_seed_inc" ,
117+ "--hybrid_storage_seed_increment" ,
118+ default = 1000 ,
119+ help = "The seed increment for hybrid storage components relative to "
120+ "the generator component. If the --user_provided_seeding flag is not set, this value will be ignored." ,
121+ )
114122 parser .add_argument (
115123 "-s_y" ,
116124 "--study_year" ,
@@ -171,6 +179,7 @@ def get_weighted_availability_adjustment(
171179 user_provided_seeding ,
172180 project_iteration_seed ,
173181 max_integer_for_unit_outage_seeding ,
182+ hyb_stor_seed_unit_increment ,
174183):
175184 project_outage_adjustment = []
176185 project_hyb_stor_outage_adjustment = []
@@ -199,7 +208,7 @@ def get_weighted_availability_adjustment(
199208 unit_mttr = row ["unit_mttr" ]
200209 hybrid_stor = row ["hybrid_stor" ]
201210
202- # Reset seed to None if
211+ # This is None if no seed was provided
203212 unit_seed = unit_seeds [index ]
204213
205214 unit_for_array = np .full ((len (tmps ), 1 ), unit_for , dtype = float )
@@ -212,18 +221,38 @@ def get_weighted_availability_adjustment(
212221 unit_seed = unit_seed ,
213222 )
214223
215- if not hybrid_stor :
216- project_outage_adjustment .append (unit_outage_adjustment * unit_weight )
217- else :
224+ # Get the project outage
225+ # For hybrids, this is applied to the generator component
226+ project_outage_adjustment .append (unit_outage_adjustment * unit_weight )
227+
228+ # For hybrids, also get the outage for the storage component
229+ # TODO: check that this works properly
230+ if hybrid_stor :
231+ unit_outage_adjustment = simulate_unit_outages (
232+ outage_model = outage_model ,
233+ for_array = unit_for_array ,
234+ mttr = unit_mttr ,
235+ n_units = n_units ,
236+ unit_seed = (
237+ None
238+ if unit_seed is None
239+ else unit_seed + hyb_stor_seed_unit_increment
240+ ),
241+ )
218242 project_hyb_stor_outage_adjustment .append (
219243 unit_outage_adjustment * unit_weight
220244 )
245+
221246 # Only sum the unit outages if there were units, otherwise, pass None
222247 if project_outage_adjustment :
223248 adjustment = sum (project_outage_adjustment )
224249 else :
225250 adjustment = None
226- hyb_stor_adjustment = sum (project_hyb_stor_outage_adjustment )
251+
252+ if hybrid_stor :
253+ hyb_stor_adjustment = sum (project_hyb_stor_outage_adjustment )
254+ else :
255+ hyb_stor_adjustment = None
227256
228257 return adjustment , hyb_stor_adjustment
229258
@@ -235,6 +264,7 @@ def simulate_project_availability(
235264 user_provided_seeding ,
236265 project_iteration_seed ,
237266 max_integer_for_unit_outage_seeding ,
267+ hyb_stor_seed_unit_increment ,
238268 stage_id ,
239269 study_year ,
240270 filepath ,
@@ -251,6 +281,7 @@ def simulate_project_availability(
251281 user_provided_seeding = user_provided_seeding ,
252282 project_iteration_seed = project_iteration_seed ,
253283 max_integer_for_unit_outage_seeding = max_integer_for_unit_outage_seeding ,
284+ hyb_stor_seed_unit_increment = hyb_stor_seed_unit_increment ,
254285 )
255286
256287 export_df = pd .DataFrame (
@@ -296,8 +327,8 @@ def simulate_unit_outages(
296327 if starting_outage_states is None :
297328 starting_outage_states = []
298329
299- # TODO: probably remove derates; should be handled default availablity
300- # values
330+ # TODO: probably remove derates; should be handled via default availablity
331+ # values rather than writing timepoint-level derates
301332 if outage_model == "Derate" :
302333 availability = 1 - np .outer (for_array , np .ones (n_units ))
303334
@@ -366,6 +397,7 @@ def simulate_project_availability_pool(pool_datum):
366397 user_provided_seeding ,
367398 project_iteration_seed ,
368399 max_integer_for_unit_outage_seeding ,
400+ hyb_stor_seed_unit_increment ,
369401 stage_id ,
370402 study_year ,
371403 filepath ,
@@ -378,6 +410,7 @@ def simulate_project_availability_pool(pool_datum):
378410 user_provided_seeding = user_provided_seeding ,
379411 project_iteration_seed = project_iteration_seed ,
380412 max_integer_for_unit_outage_seeding = max_integer_for_unit_outage_seeding ,
413+ hyb_stor_seed_unit_increment = hyb_stor_seed_unit_increment ,
381414 stage_id = stage_id ,
382415 study_year = study_year ,
383416 filepath = filepath ,
@@ -428,6 +461,7 @@ def main(args=None):
428461 all_files = []
429462 pool_data = []
430463 project_iteration_seed = int (parsed_args .starting_project_iteration_seed )
464+ hyb_stor_seed_unit_increment = int (parsed_args .hybrid_storage_seed_increment )
431465 for project in projects :
432466 # Write header if we are overwriting the file or it doesn't exist
433467 overwrite = parsed_args .overwrite
@@ -478,6 +512,11 @@ def main(args=None):
478512 if parsed_args .user_provided_seeding
479513 else None
480514 ),
515+ (
516+ hyb_stor_seed_unit_increment
517+ if parsed_args .user_provided_seeding
518+ else None
519+ ),
481520 parsed_args .stage_id ,
482521 int (parsed_args .study_year ),
483522 filepath ,
0 commit comments