diff --git a/emf/loadflow_tool/helper.py b/emf/loadflow_tool/helper.py index 8cf0118..28915c4 100644 --- a/emf/loadflow_tool/helper.py +++ b/emf/loadflow_tool/helper.py @@ -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 diff --git a/emf/loadflow_tool/model_validator/validator.py b/emf/loadflow_tool/model_validator/validator.py index 5d6cd4d..5ac4335 100644 --- a/emf/loadflow_tool/model_validator/validator.py +++ b/emf/loadflow_tool/model_validator/validator.py @@ -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: @@ -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') @@ -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 = []