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

Gp 209 replacement with uap #213

Merged
merged 2 commits into from
Jan 2, 2025
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
12 changes: 8 additions & 4 deletions emf/loadflow_tool/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,17 @@ def get_model_outages(network: pypowsybl.network):
outage_log = []
lines = network.get_lines().reset_index(names=['grid_id'])
lines['element_type'] = 'Line'
dls = get_network_elements(network, pypowsybl.network.ElementType.DANGLING_LINE).reset_index(names=['grid_id'])
dls['element_type'] = 'Tieline'
dlines = get_network_elements(network, pypowsybl.network.ElementType.DANGLING_LINE).reset_index(names=['grid_id'])
dlines['element_type'] = 'Tieline'
gens = get_network_elements(network, pypowsybl.network.ElementType.GENERATOR).reset_index(names=['grid_id'])
gens['element_type'] = 'Generator'

disconnected_lines = lines[(lines['connected1'] == False) | (lines['connected2'] == False)]
disconnected_dls = dls[dls['connected'] == False]
disconnected_dlines = dlines[dlines['connected'] == False]
disconnected_gens = gens[gens['connected'] == False]

outage_log.extend(disconnected_lines[['grid_id', 'name', 'element_type']].to_dict('records'))
outage_log.extend(disconnected_dls[['grid_id', 'name', 'element_type']].to_dict('records'))
outage_log.extend(disconnected_dlines[['grid_id', 'name', 'element_type']].to_dict('records'))
outage_log.extend(disconnected_gens[['grid_id', 'name', 'element_type']].to_dict('records'))

return outage_log
6 changes: 5 additions & 1 deletion emf/loadflow_tool/model_validator/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def validate_model(opdm_objects, loadflow_parameters=getattr(loadflow_settings,
model_data["validation_duration_s"] = round(time.time() - start_time, 3)
logger.info(f"Load flow validation status: {model_valid} [duration {model_data['validation_duration_s']}s]")

# Get outages of the model
try:
model_data['outages'] = get_model_outages(network)
except Exception as e:
Expand All @@ -131,6 +132,7 @@ def validate_model(opdm_objects, loadflow_parameters=getattr(loadflow_settings,
model_data['@scenario_timestamp'] = model_metadata['pmd:scenarioDate']
model_data['@time_horizon'] = model_metadata['pmd:timeHorizon']
model_data['@version'] = model_metadata['pmd:versionNumber']
model_data['tso'] = model_metadata['pmd:TSO']

# Pop out pypowsybl network object
model_data.pop('network')
Expand Down Expand Up @@ -160,7 +162,9 @@ def validate_model(opdm_objects, loadflow_parameters=getattr(loadflow_settings,
opdm = OPDM()

latest_boundary = opdm.get_latest_boundary()
available_models = opdm.get_latest_models_and_download(time_horizon='1D', scenario_date="2023-08-16T09:30")#, tso="ELERING")
available_models = opdm.get_latest_models_and_download(time_horizon='1D',
scenario_date="2025-01-01T09:30",
tso="AST")

validated_models = []

Expand Down
Loading