Skip to content

Commit

Permalink
Add ruc_delay property to PrescientConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
darrylmelander authored and bknueven committed May 23, 2023
1 parent 7bc7b43 commit 3a8493a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions prescient/data/simulation_state/mutable_simulation_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def apply_ruc(self, options, ruc:RucModel) -> None:
is used to set up the initial simulation state with no offset.
'''

ruc_delay = -(options.ruc_execution_hour % (-options.ruc_every_hours))
ruc_delay = options.ruc_delay

# If we've never stored a RUC before...
first_ruc = (len(self._init_gen_state) == 0)
Expand Down Expand Up @@ -261,7 +261,7 @@ def get_state_with_step_length(self, minutes_per_step:int) -> SimulationState:

def _save_forecastables(options, model, where_to_store, steps_per_hour):
first_data = (len(where_to_store) == 0)
ruc_delay = -(options.ruc_execution_hour % (-options.ruc_every_hours))
ruc_delay = options.ruc_delay
max_length = steps_per_hour*(ruc_delay + options.ruc_horizon)

# Save all forecastables, indexed by unique forecastable key
Expand Down
2 changes: 1 addition & 1 deletion prescient/engine/egret/egret_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def create_deterministic_ruc(options,
60, md)

# Make some near-term forecasts more accurate
ruc_delay = -(options.ruc_execution_hour%(-options.ruc_every_hours))
ruc_delay = options.ruc_delay
if options.ruc_prescience_hour > ruc_delay:
improved_hour_count = options.ruc_prescience_hour - ruc_delay
for forecastable, forecast in get_forecastables(md):
Expand Down
5 changes: 5 additions & 0 deletions prescient/simulator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,11 @@ def parse_args(self, args: List[str]) -> ConfigDict:
self.import_argparse(args)
return self

@property
def ruc_delay(self) -> int:
''' Get the number of hours before each RUC goes into effect that it is generated '''
return -(self.ruc_execution_hour % (-self.ruc_every_hours))



class _InEnumStr(InEnum):
Expand Down
2 changes: 1 addition & 1 deletion prescient/simulator/oracle_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def initialize(self,

def _get_ruc_delay(self, options):
''' The number of hours between the generation of a RUC plan and when it is activated '''
return -(options.ruc_execution_hour % (-options.ruc_every_hours))
return options.ruc_delay

def _get_uc_activation_time(self, options, time_step):
''' Get the hour and date that a RUC generated at the given time will be activated '''
Expand Down

0 comments on commit 3a8493a

Please sign in to comment.