Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reserve details #143

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
unzip cbc-win64.zip
cp cbc.exe $CONDA_PREFIX
else
conda install coincbc
conda install coincbc==2.10.5
fi
# test cbc executable
cbc -quit
Expand Down
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ examples/simple_nostorage_scengen/

.mypy_cache

tests/simulator_tests/test_cases/deterministic_with_network_simulation_output/
tests/simulator_tests/test_cases/deterministic_simulation_output/
tests/simulator_tests/test_cases/deterministic_simulation_csv_output/
prescient/simulator/tests/regression_tests_data/custom_data_provider_output/
prescient/simulator/tests/regression_tests_data/deterministic_shortcut_output/
prescient/simulator/tests/regression_tests_data/deterministic_simulation_csv_output/
prescient/simulator/tests/regression_tests_data/deterministic_simulation_output/
prescient/simulator/tests/regression_tests_data/deterministic_with_network_simulation_output_python/
prescient/simulator/tests/regression_tests_data/deterministic_with_network_simulation_output_python_csv/

24 changes: 23 additions & 1 deletion prescient/engine/data_extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ class PreQuickstartCache(NamedTuple):
total_cost: float
power_generated: float

class ReserveIdentifier(NamedTuple):
region_type: str
region_name: str
reserve_name: str

@property
def scope(self) -> str:
if self.region_name is None:
return self.region_type
else:
return f'{self.region_type} {self.region_name}'


class ScedDataExtractor(ABC):
"""Extracts information from operations model instances."""
Expand Down Expand Up @@ -337,9 +349,19 @@ def get_fleet_thermal_capacity(self, sced: OperationsModel) -> float:
return sum(self.get_max_power_output(sced, g)
for g in self.get_thermal_generators(sced))

@abstractmethod
def get_implicit_thermal_headroom(self, sced: OperationsModel, g: G) -> float:
pass

def get_thermal_headroom(self, sced: OperationsModel, g: G) -> float:
return self.get_max_power_available(sced, g) - self.get_power_generated(sced, g)

@abstractmethod
def get_thermal_reserve_provided(self, sced: OperationsModel,
res: ReserveIdentifier, g: G) -> float:
''' Get a generator's contribution to a reserve product '''
pass

def get_all_generator_fuels(self, sced: OperationsModel) -> Dict[G, str]:
"""Get the power generated by each generator."""
return {g: self.get_generator_fuel(sced, g)
Expand All @@ -365,7 +387,7 @@ def get_all_thermal_headroom_levels(self, sced: OperationsModel) -> Dict[G, floa
return {g: self.get_thermal_headroom(sced, g)
for g in self.get_thermal_generators(sced)}

def get_available_reserve(self, sced: OperationsModel) -> float:
def get_total_thermal_headroom(self, sced: OperationsModel) -> float:
return sum(self.get_thermal_headroom(sced, g)
for g in self.get_thermal_generators(sced))

Expand Down
Loading