diff --git a/doc/horse_configurations.txt b/doc/horse_configurations.txt index 4f65692f..ac053358 100644 --- a/doc/horse_configurations.txt +++ b/doc/horse_configurations.txt @@ -15,7 +15,7 @@ Simulator Options: --plot-individual-generators --traceback --output-sced-initial-conditions ---output-sced-demands +--output-sced-loads --output-sced-solutions --output-ruc-initial-conditions --output-ruc-solutions @@ -39,9 +39,9 @@ Simulator Options: --plot-individual-generators --traceback --output-sced-initial-conditions ---output-sced-demands +--output-sced-loads --output-sced-solutions --output-ruc-initial-conditions --output-ruc-solutions --output-ruc-dispatches ---output-directory output_horse_racer/horse2_sim \ No newline at end of file +--output-directory output_horse_racer/horse2_sim diff --git a/examples/prescient_tutorial.ipynb b/examples/prescient_tutorial.ipynb index 4a53adaa..141381c4 100644 --- a/examples/prescient_tutorial.ipynb +++ b/examples/prescient_tutorial.ipynb @@ -333,7 +333,7 @@ " - `--traceback`: If enabled, the simulator will print a trace if it failed.\n", " - `--random-seed`: Unused currently.\n", " - `--output-sced-initial-conditions`: Prints the initial conditions for the economic dispatch problem to the screen.\n", - " - `--output-sced-demands`: Prints the demands for the economic dispatch problem to the screen.\n", + " - `--output-sced-loads`: Prints the loads for the economic dispatch problem to the screen.\n", " - `--output-sced-solutions`: Prints the solution for the economic dispatch problem to the screen.\n", " - `--output-ruc-initial-conditions`: Prints the initial conditions for the unit commitment problem to the screen.\n", " - `--output-ruc-solutions`: Prints the commitment solution for the unit commitment problem to the screen.\n", diff --git a/prescient/downloaders/rts_gmlc_prescient/runners/simulate_with_network_deterministic.txt b/prescient/downloaders/rts_gmlc_prescient/runners/simulate_with_network_deterministic.txt index 95d3fc55..2175a1b8 100644 --- a/prescient/downloaders/rts_gmlc_prescient/runners/simulate_with_network_deterministic.txt +++ b/prescient/downloaders/rts_gmlc_prescient/runners/simulate_with_network_deterministic.txt @@ -7,7 +7,7 @@ command/exec simulator.py --num-days=7 --sced-horizon=4 --output-sced-initial-conditions ---output-sced-demands +--output-sced-loads --output-ruc-initial-conditions --output-ruc-solutions --output-solver-logs diff --git a/prescient/downloaders/rts_gmlc_prescient/runners/simulate_with_network_deterministic_year.txt b/prescient/downloaders/rts_gmlc_prescient/runners/simulate_with_network_deterministic_year.txt index 0f7dac43..59fca6c1 100644 --- a/prescient/downloaders/rts_gmlc_prescient/runners/simulate_with_network_deterministic_year.txt +++ b/prescient/downloaders/rts_gmlc_prescient/runners/simulate_with_network_deterministic_year.txt @@ -7,7 +7,7 @@ command/exec simulator.py --num-days=364 --sced-horizon=4 --output-sced-initial-conditions ---output-sced-demands +--output-sced-loads --output-ruc-initial-conditions --output-ruc-solutions --output-solver-logs diff --git a/prescient/engine/data_extractors.py b/prescient/engine/data_extractors.py index 75b65634..2bc31ab4 100644 --- a/prescient/engine/data_extractors.py +++ b/prescient/engine/data_extractors.py @@ -40,6 +40,11 @@ def get_buses(self, sced: OperationsModel) -> Iterable[B]: """Get all buses in the model.""" pass + @abstractmethod + def get_loads(self, sced: OperationsModel) -> Iterable[L]: + """Get all loads in the model.""" + pass + @abstractmethod def get_transmission_lines(self, sced: OperationsModel) -> Iterable[L]: """Get all transmission lines in the model.""" @@ -123,7 +128,17 @@ def get_power_generated_T0(self, sced: OperationsModel, g: G) -> float: @abstractmethod def get_bus_demand(self, sced: OperationsModel, bus: B) -> float: """Get the demand at a specific bus.""" - pass + pass + + @abstractmethod + def get_load_bus(self, sced: OperationsModel, load: L) -> float: + """Get the bus for a specific load.""" + pass + + @abstractmethod + def get_load_demand(self, sced: OperationsModel, load: L) -> float: + """Get the demand for a specific load.""" + pass @abstractmethod def get_bus_mismatch(self, sced: OperationsModel, bus: B) -> float: diff --git a/prescient/engine/egret/data_extractors.py b/prescient/engine/egret/data_extractors.py index 078044ff..12b7f491 100644 --- a/prescient/engine/egret/data_extractors.py +++ b/prescient/engine/egret/data_extractors.py @@ -29,6 +29,9 @@ def get_sced_duration_minutes(self, sced: OperationsModel) -> int: def get_buses(self, sced: OperationsModel) -> Iterable[B]: return sced.data['elements']['bus'].keys() + def get_loads(self, sced: OperationsModel) -> Iterable[L]: + return sced.data['elements']['load'].keys() + def get_transmission_lines(self, sced: OperationsModel) -> Iterable[L]: return sced.data['elements']['branch'].keys() @@ -205,6 +208,14 @@ def get_bus_demand(self, sced: OperationsModel, bus: B) -> float: ''' get the demand on a bus in a given time period ''' return sced.data['elements']['bus'][bus]['pl']['values'][0] + def get_load_bus(self, sced: OperationsModel, load: L) -> float: + ''' get the bus associated with a given load ''' + return sced.data['elements']['load'][load]['bus'] + + def get_load_demand(self, sced: OperationsModel, load: L) -> float: + ''' get the demand associated with a load in a given time period ''' + return sced.data['elements']['load'][load]['p_load']['values'][0] + def get_reserve_RT_price(self, lmp_sced: OperationsModel) -> float: if 'reserve_price' in lmp_sced.data['system']: return lmp_sced.data['system']['reserve_price']['values'][0] diff --git a/prescient/engine/egret/engine.py b/prescient/engine/egret/engine.py index 1838bc8c..041a75df 100644 --- a/prescient/engine/egret/engine.py +++ b/prescient/engine/egret/engine.py @@ -139,7 +139,7 @@ def solve_sced_instance(self, options, sced_instance, output_initial_conditions = False, - output_demands = False, + output_loads = False, lp_filename: str = None): ptdf_manager = self._ptdf_manager @@ -158,7 +158,7 @@ def solve_sced_instance(self, self._p._zero_out_costs(pyo_model, self._hours_in_objective) - self._print_sced_info(sced_instance, output_initial_conditions, output_demands) + self._print_sced_info(sced_instance, output_initial_conditions, output_loads) if options.output_solver_logs: print("") print("------------------------------------------------------------------------------") @@ -300,16 +300,20 @@ def _transform_for_lmp(self, pyo_model, pyo_solver, lmp_sced_instance): def _print_sced_info(self, sced_instance: OperationsSced, output_initial_conditions: bool, - output_demands: bool): - if not output_initial_conditions and not output_demands: + output_loads: bool): + if not output_initial_conditions and not output_loads: return sced_data_extractor = self.operations_data_extractor - # for pretty-printing purposes, compute the maximum bus and generator label lengths. + # for pretty-printing purposes, compute the maximum label lengths for various set types. + buses = list(sced_data_extractor.get_buses(sced_instance)) max_bus_label_length = max((len(this_bus) for this_bus in buses)) + loads = list(sced_data_extractor.get_loads(sced_instance)) + max_load_label_length = max((len(this_load) for this_load in loads)) + lines = list(sced_data_extractor.get_transmission_lines(sced_instance)) if len(lines) == 0: max_line_label_length = None @@ -331,6 +335,7 @@ def _print_sced_info(self, (len(this_generator) for this_generator in nondispatchable_gens)) if output_initial_conditions: + print("") print("Initial condition detail (gen-name t0-unit-on t0-power-generated t1-unit-on ):") for g in thermal_gens: print(("%-" + str(max_thermal_generator_label_length) + "s %5d %12.2f %5d") % @@ -340,12 +345,14 @@ def _print_sced_info(self, sced_data_extractor.is_generator_on(sced_instance, g), )) - if output_demands: - print("Demand detail:") - for b in buses: - print(("%-" + str(max_bus_label_length) + "s %12.2f") % - (b, - sced_data_extractor.get_bus_demand(sced_instance,b))) + if output_loads: + print("") + print("Load detail (load bus demand):") + for l in loads: + print(("%-" + str(max_load_label_length) + "s %-" + str(max_bus_label_length) + "s %12.2f") % + (l, + sced_data_extractor.get_load_bus(sced_instance,l), + sced_data_extractor.get_load_demand(sced_instance,l))) print("") print(("%-" + str(max_bus_label_length) + "s %12.2f") % diff --git a/prescient/engine/modeling_engine.py b/prescient/engine/modeling_engine.py index be1caae8..fc056881 100644 --- a/prescient/engine/modeling_engine.py +++ b/prescient/engine/modeling_engine.py @@ -117,7 +117,7 @@ def solve_sced_instance(self, options: Options, sced_instance: OperationsModel, output_initial_conditions: bool = False, - output_demands: bool = False, + output_loads: bool = False, lp_filename: str = None ) -> Tuple[OperationsModel, float]: ''' diff --git a/prescient/gosm/horse_configurations.txt b/prescient/gosm/horse_configurations.txt index b7ed2683..9bcb7582 100644 --- a/prescient/gosm/horse_configurations.txt +++ b/prescient/gosm/horse_configurations.txt @@ -22,7 +22,7 @@ Simulator Options: --plot-individual-generators --traceback --output-sced-initial-conditions ---output-sced-demands +--output-sced-loads --output-sced-solutions --output-ruc-initial-conditions --output-ruc-solutions @@ -49,7 +49,7 @@ Simulator Options: --plot-individual-generators --traceback --output-sced-initial-conditions ---output-sced-demands +--output-sced-loads --output-sced-solutions --output-ruc-initial-conditions --output-ruc-solutions @@ -76,7 +76,7 @@ Simulator Options: --plot-individual-generators --traceback --output-sced-initial-conditions ---output-sced-demands +--output-sced-loads --output-sced-solutions --output-ruc-initial-conditions --output-ruc-solutions @@ -103,7 +103,7 @@ Simulator Options: --plot-individual-generators --traceback --output-sced-initial-conditions ---output-sced-demands +--output-sced-loads --output-sced-solutions --output-ruc-initial-conditions --output-ruc-solutions diff --git a/prescient/gosm/prescient_test.ipynb b/prescient/gosm/prescient_test.ipynb index de1c45de..6189cd1a 100644 --- a/prescient/gosm/prescient_test.ipynb +++ b/prescient/gosm/prescient_test.ipynb @@ -75,7 +75,7 @@ { "data": { "text/plain": [ - "" + "" ] }, "execution_count": 17, @@ -444,7 +444,7 @@ "output_ruc_dispatches : False\n", "output_ruc_initial_conditions : False\n", "output_ruc_solutions : False\n", - "output_sced_demands : False\n", + "output_sced_loads : False\n", "output_sced_initial_conditions : False\n", "output_sced_solutions : False\n", "output_solver_logs : True\n", @@ -23094,7 +23094,7 @@ "output_ruc_dispatches : False\n", "output_ruc_initial_conditions : False\n", "output_ruc_solutions : False\n", - "output_sced_demands : False\n", + "output_sced_loads : False\n", "output_sced_initial_conditions : False\n", "output_sced_solutions : False\n", "output_solver_logs : True\n", diff --git a/prescient/gosm/runcombo.py b/prescient/gosm/runcombo.py index 56c8329f..274f3c4a 100644 --- a/prescient/gosm/runcombo.py +++ b/prescient/gosm/runcombo.py @@ -60,7 +60,7 @@ --plot-individual-generators --traceback --output-sced-initial-conditions ---output-sced-demands +--output-sced-loads --output-sced-solutions --output-ruc-initial-conditions --output-ruc-solutions diff --git a/prescient/simulator/config.py b/prescient/simulator/config.py index 9318587d..29f69e03 100644 --- a/prescient/simulator/config.py +++ b/prescient/simulator/config.py @@ -365,10 +365,10 @@ def register_plugin(key, value): description="Output sced initial conditions prior to each solve. Default is False.", )).declare_as_argument() - self.declare("output_sced_demands", ConfigValue( + self.declare("output_sced_loads", ConfigValue( domain=bool, default=False, - description="Output sced demands prior to each solve. Default is False.", + description="Output sced loads prior to each solve. Default is False.", )).declare_as_argument() self.declare("output_solver_logs", ConfigValue( diff --git a/prescient/simulator/oracle_manager.py b/prescient/simulator/oracle_manager.py index 9fe39e37..31e3443d 100644 --- a/prescient/simulator/oracle_manager.py +++ b/prescient/simulator/oracle_manager.py @@ -223,7 +223,7 @@ def call_operation_oracle(self, options: Options, time_step: PrescientTime): current_sced_instance, solve_time = self.engine.solve_sced_instance(options, current_sced_instance, options.output_sced_initial_conditions, - options.output_sced_demands, + options.output_sced_loads, lp_filename) pre_quickstart_cache = None diff --git a/tests/simulator_tests/test_simulator.py b/tests/simulator_tests/test_simulator.py index 0cda101a..1a7c0edd 100644 --- a/tests/simulator_tests/test_simulator.py +++ b/tests/simulator_tests/test_simulator.py @@ -27,7 +27,7 @@ '--random-seed=10', '--output-max-decimal-places=4', '--output-sced-initial-conditions', - '--output-sced-demands', + '--output-sced-loads', '--output-sced-solutions', '--output-ruc-initial-conditions', '--output-ruc-solutions',