Skip to content

Commit

Permalink
Fixes for rts-gmlc data sources
Browse files Browse the repository at this point in the history
  • Loading branch information
darrylmelander committed May 11, 2021
1 parent f8b6132 commit b8b14e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions prescient/data/providers/gmlc_data_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ def _populate_with_forecastable_data(self,
self._cache.populate_skeleton_with_data(model.data, sim_type, start_time, end_time)
else:
copy_from = self._cache.generate_model(sim_type, start_time, end_time)
self._recurse_copy_at_ratio(copy_from.data, model.data, step_ratio)
_recurse_copy_at_ratio(copy_from.data, model.data, step_ratio)
# Fill in the times
time_labels = model.data['system']['time_keys']
delta = timedelta(minutes=time_period_length_minutes)
for i in range(len(time_labels)):
dt = start_date + i*delta
time_labels[t] = dt.strftime('%Y-%m-%d %H:%M')
dt = start_time + i*delta
time_labels[i] = dt.strftime('%Y-%m-%d %H:%M')

def _recurse_copy_at_ratio(src:dict[str, Any], target:dict[str, Any], ratio:int) -> None:
''' Copy every Nth value from a src dict's time_series values into corresponding arrays in a target dict.
Expand Down
16 changes: 11 additions & 5 deletions prescient/engine/egret/data_extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,19 @@ def get_max_power_output(self, sced: OperationsModel, g: G) -> float:
return p_max

def get_max_power_available(self, sced: OperationsModel, g: G) -> float:
return sced.data['elements']['generator'][g]['headroom']['values'][0] \
+ self.get_power_generated(sced, g)*int(self.is_generator_on(sced,g)) \
+ sced.data['elements']['generator'][g]['rg']['values'][0]
gdata = sced.data['elements']['generator'][g]
val = gdata['headroom']['values'][0] \
+ self.get_power_generated(sced, g)*int(self.is_generator_on(sced,g))
if 'rg' in gdata:
val += sced.data['elements']['generator'][g]['rg']['values'][0]
return val

def get_thermal_headroom(self, sced: OperationsModel, g: G) -> float:
return sced.data['elements']['generator'][g]['headroom']['values'][0] \
+ sced.data['elements']['generator'][g]['rg']['values'][0]
gdata = sced.data['elements']['generator'][g]
val = gdata['headroom']['values'][0]
if 'rg' in gdata:
val += gdata['rg']['values'][0]
return val

def get_min_downtime(self, sced: OperationsModel, g: G) -> float:
return sced.data['elements']['generator'][g]['min_up_time']
Expand Down
3 changes: 2 additions & 1 deletion prescient/engine/forecast_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def get_forecastables(*models: EgretModel) -> Iterable[ Tuple[MutableSequence[fl
yield tuple(m.data['elements']['load'][bus]['p_load']['values'] for m in models)

# Reserve requirement
yield tuple(m.data['system']['reserve_requirement']['values'] for m in models)
if 'reserve_requirement' in model1.data['system']:
yield tuple(m.data['system']['reserve_requirement']['values'] for m in models)

return

Expand Down

0 comments on commit b8b14e5

Please sign in to comment.