// Generated by cimgen — do not edit by hand.
#![allow(clippy::all, dead_code, unused)]
use cimdecoder::CimDataset;
use crate::Violation;
use crate::helpers::*;
pub fn validate_p61970_301_equipment_ap_con_complex_shacl(dataset: &CimDataset) -> Vec<Violation> {
let mut v = Vec::new();
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_dc_terminal_dc_conduc_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_dc_terminal_dc_conduc_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_pcc_terminal_or_class(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_dc_terminal_dc_conduc_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_dc_terminal_dc_conduc_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_pcc_terminal_or_class(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ac_line_segment_conductor_length_min_incl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_active_power_limit_active_power_limit_normal_valu_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_apparent_power_limit_apparent_power_limit_normal_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_asynchronous_machine_rotating_machine_rated_u_min_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_asynchronous_machine_rotating_machine_rated_s_min_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_asynchronous_machine_rotating_machine_rated_power_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_base_voltage_base_voltage_nominal_voltage_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_battery_unit_battery_unit_rated_e_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_name_max_l_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_iso_code_m_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_iso_code_m_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_name_tso_max_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_name_tso_m_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_iso_code_min_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_iso_code_max_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_name_max_length(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_iso_code_in(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_iso_code_m_etc_3(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_iso_code_m_etc_4(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_iso_code_in(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_iso_code_min_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_iso_code_max_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_breaker_switch_rated_current_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_breaker_terminal_conducting_equipment_min_count(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_breaker_terminal_conducting_equipment_max_count(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_busbar_section_terminal_conducting_equipment_requ_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_clamp_clamp_length_from_terminal1_min_incl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_clamp_and(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_ground_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_busbar_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_shunt_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ground_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_energy_source_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_energy_consumer_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_conform_load_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_non_conform_load_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_station_supply_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_power_electronics_connection_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_external_network_injection_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_linear_shunt_compensator_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_nonlinear_shunt_compensator_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_static_var_compensator_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_synchronous_machine_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_asynchronous_machine_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_equivalent_injection_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_equivalent_shunt_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_junction_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ac_line_segment_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_line_segment_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_series_device_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_switch_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_disconnector_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_breaker_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_chopper_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_switch_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_disconnector_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_fuse_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ground_disconnector_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_jumper_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_breaker_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_load_break_switch_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_disconnecting_circuit_breaker_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cut_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_series_compensator_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_equivalent_branch_or(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_min_gamma_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_switching_loss_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_min_udc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_rated_idc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_max_alpha_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_base_s_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_max_udc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_resistive_loss_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_min_alpha_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_max_idc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_min_idc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_rated_udc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_idle_loss_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_max_gamma_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_current_limit_current_limit_normal_value_min_incl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cut_switch_rated_current_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cut_cut_length_from_terminal1_min_incl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cut_terminal_conducting_equipment_min_count(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_cut_terminal_conducting_equipment_max_count(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_breaker_dc_conducting_equipment_rated_udc_min_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_busbar_dc_conducting_equipment_rated_udc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_chopper_dc_conducting_equipment_rated_udc_min_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_disconnector_dc_conducting_equipment_rated_udc_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_ground_dc_conducting_equipment_rated_udc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_line_segment_dc_conducting_equipment_rated_udc_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_line_segment_dc_line_segment_length_min_incl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_series_device_dc_conducting_equipment_rated_ud_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_shunt_dc_conducting_equipment_rated_udc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_dc_switch_dc_conducting_equipment_rated_udc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_disconnecting_circuit_breaker_switch_rated_curren_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_disconnecting_circuit_breaker_terminal_conducting_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_disconnecting_circuit_breaker_terminal_conducting_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_disconnector_switch_rated_current_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_disconnector_terminal_conducting_equipment_min_count(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_disconnector_terminal_conducting_equipment_max_count(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_grounding_impedance_terminal_conducting_equipment_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_grounding_impedance_terminal_conducting_equipment_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_petersen_coil_terminal_conducting_equipment_min_c_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_petersen_coil_terminal_conducting_equipment_max_c_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_fuse_switch_rated_current_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_fuse_terminal_conducting_equipment_min_count(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_fuse_terminal_conducting_equipment_max_count(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_generating_unit_generating_unit_rated_net_max_p_m_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_generating_unit_generating_unit_rated_gross_min_p_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_generating_unit_generating_unit_rated_gross_max_p_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ground_disconnector_switch_rated_current_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ground_disconnector_terminal_conducting_equipment_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ground_disconnector_terminal_conducting_equipment_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_hydro_generating_unit_generating_unit_rated_net_m_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_hydro_generating_unit_generating_unit_rated_gross_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_hydro_generating_unit_generating_unit_rated_gross_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_hydro_generating_unit_hydro_generating_unit_drop_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_jumper_switch_rated_current_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_jumper_terminal_conducting_equipment_min_count(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_jumper_terminal_conducting_equipment_max_count(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_linear_shunt_compensator_shunt_compensator_normal_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_linear_shunt_compensator_shunt_compensator_normal_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_linear_shunt_compensator_terminal_conducting_equi_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_load_break_switch_switch_rated_current_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_load_break_switch_terminal_conducting_equipment_m_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_load_break_switch_terminal_conducting_equipment_m_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_nonlinear_shunt_compensator_shunt_compensator_nor_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_nonlinear_shunt_compensator_shunt_compensator_nor_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_nonlinear_shunt_compensator_terminal_conducting_e_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_nuclear_generating_unit_generating_unit_rated_net_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_nuclear_generating_unit_generating_unit_rated_gro_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_nuclear_generating_unit_generating_unit_rated_gro_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_asymmetrical_tap_changer_normal_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_asymmetrical_tap_changer_low_st_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_asymmetrical_tap_changer_neutra_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_asymmetrical_tap_changer_low_st_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_asymmetrical_tap_changer_low_st_etc_3(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_linear_tap_changer_normal_step_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_linear_tap_changer_low_step_les_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_linear_tap_changer_neutral_step_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_linear_tap_changer_low_step_les_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_linear_tap_changer_low_step_les_etc_3(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_symmetrical_tap_changer_normal_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_symmetrical_tap_changer_low_ste_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_symmetrical_tap_changer_neutral_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_symmetrical_tap_changer_low_ste_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_symmetrical_tap_changer_low_ste_etc_3(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_tabular_tap_changer_normal_step_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_tabular_tap_changer_low_step_le_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_tabular_tap_changer_neutral_ste_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_tabular_tap_changer_low_step_le_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_tabular_tap_changer_low_step_le_etc_3(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_power_electronics_connection_power_electronics_co_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_power_electronics_connection_power_electronics_co_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_power_transformer_end_power_transformer_end_rated_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ratio_tap_changer_tap_changer_normal_step_less_th_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ratio_tap_changer_tap_changer_low_step_less_than_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ratio_tap_changer_tap_changer_neutral_step_less_t_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ratio_tap_changer_tap_changer_low_step_less_than_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ratio_tap_changer_tap_changer_low_step_less_than(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_curve_data_and(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_regular_time_point_regular_time_point_sequence_nu_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_series_compensator_terminal_conducting_equipment_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_series_compensator_terminal_conducting_equipment_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_solar_generating_unit_generating_unit_rated_net_m_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_solar_generating_unit_generating_unit_rated_gross_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_solar_generating_unit_generating_unit_rated_gross_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_static_var_compensator_static_var_compensator_slo_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_static_var_compensator_static_var_compensator_ind_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_static_var_compensator_static_var_compensator_cap_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_switch_switch_rated_current_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_switch_terminal_conducting_equipment_min_count(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_switch_terminal_conducting_equipment_max_count(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_synchronous_machine_rotating_machine_rated_u_min_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_synchronous_machine_rotating_machine_rated_s_min_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_synchronous_machine_rotating_machine_rated_power_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_grounding_impedance_terminal_conducting_equipment_etc_3(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_petersen_coil_terminal_conducting_equipment_has_v_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ground_disconnector_terminal_conducting_equipment_etc_3(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_ground_terminal_conducting_equipment_has_value(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_thermal_generating_unit_generating_unit_rated_net_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_thermal_generating_unit_generating_unit_rated_gro_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_thermal_generating_unit_generating_unit_rated_gro_etc_2(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_voltage_limit_voltage_limit_normal_value_min_incl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_idle_loss_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_min_udc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_resistive_loss_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_rated_udc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_max_udc_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_vs_converter_max_modulation_index_ma_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_switching_loss_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_base_s_min_excl(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_wind_generating_unit_generating_unit_rated_net_ma_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_wind_generating_unit_generating_unit_rated_gross_etc(dataset));
v.extend(check_p61970_301_equipment_ap_con_complex_shacl_wind_generating_unit_generating_unit_rated_gross_etc_2(dataset));
v
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_dc_terminal_dc_conduc_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("ACDCConverterDCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::ACDCConverterDCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.DCTerminals-numberOfTerminals".to_string(),
class: "VsConverter".to_string(),
property: "C:301:EQ:ACDCConverter.DCTerminals:numberOfTerminals".to_string(),
message: "The converter does not have two terminals, i.e. two instances of ACDCConverterDCTerminal.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.DCTerminals:numberOfTerminals".to_string(),
description: "A converter has two DC converter terminals.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_dc_terminal_dc_conduc_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("ACDCConverterDCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::ACDCConverterDCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.DCTerminals-numberOfTerminals".to_string(),
class: "VsConverter".to_string(),
property: "C:301:EQ:ACDCConverter.DCTerminals:numberOfTerminals".to_string(),
message: "The converter does not have two terminals, i.e. two instances of ACDCConverterDCTerminal.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.DCTerminals:numberOfTerminals".to_string(),
description: "A converter has two DC converter terminals.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_pcc_terminal_or_class(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
let ref0 = match obj.base.pcc_terminal.as_ref() {
Some(r) => r.mrid.trim_start_matches('#'), None => continue,
};
let entry0 = match dataset.entries.get(ref0) {
Some(e) => e, None => continue,
};
let hop1 = match entry0.element.as_any()
.downcast_ref::<cimstructs::Terminal>() {
Some(o) => o, None => continue,
};
let ref1 = match hop1.conducting_equipment.as_ref() {
Some(r) => r.mrid.trim_start_matches('#'), None => continue,
};
let entry1 = match dataset.entries.get(ref1) {
Some(e) => e, None => continue,
};
let allowed: &[&str] = &["Breaker", "Cut", "DisconnectingCircuitBreaker", "Disconnector", "Fuse", "GroundDisconnector", "Jumper", "LoadBreakSwitch", "PowerTransformer", "ProtectedSwitch", "Switch"];
if !allowed.contains(&entry1.element.type_name()) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.PccTerminal-valueType".to_string(),
class: "VsConverter".to_string(),
property: "ACDCConverter.PccTerminal".to_string(),
message: "The terminal is not a terminal of a PowerTransformer or a Switch.".to_string(),
severity: "sh:Warning".to_string(),
name: "C:301:EQ:ACDCConverter.PccTerminal:valueType".to_string(),
description: "It is typically the terminal on the power transformer (or switch) closest to the AC network.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_dc_terminal_dc_conduc_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("ACDCConverterDCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::ACDCConverterDCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.DCTerminals-numberOfTerminals".to_string(),
class: "CsConverter".to_string(),
property: "C:301:EQ:ACDCConverter.DCTerminals:numberOfTerminals".to_string(),
message: "The converter does not have two terminals, i.e. two instances of ACDCConverterDCTerminal.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.DCTerminals:numberOfTerminals".to_string(),
description: "A converter has two DC converter terminals.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_dc_terminal_dc_conduc_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("ACDCConverterDCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::ACDCConverterDCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.DCTerminals-numberOfTerminals".to_string(),
class: "CsConverter".to_string(),
property: "C:301:EQ:ACDCConverter.DCTerminals:numberOfTerminals".to_string(),
message: "The converter does not have two terminals, i.e. two instances of ACDCConverterDCTerminal.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.DCTerminals:numberOfTerminals".to_string(),
description: "A converter has two DC converter terminals.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_pcc_terminal_or_class(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
let ref0 = match obj.base.pcc_terminal.as_ref() {
Some(r) => r.mrid.trim_start_matches('#'), None => continue,
};
let entry0 = match dataset.entries.get(ref0) {
Some(e) => e, None => continue,
};
let hop1 = match entry0.element.as_any()
.downcast_ref::<cimstructs::Terminal>() {
Some(o) => o, None => continue,
};
let ref1 = match hop1.conducting_equipment.as_ref() {
Some(r) => r.mrid.trim_start_matches('#'), None => continue,
};
let entry1 = match dataset.entries.get(ref1) {
Some(e) => e, None => continue,
};
let allowed: &[&str] = &["Breaker", "Cut", "DisconnectingCircuitBreaker", "Disconnector", "Fuse", "GroundDisconnector", "Jumper", "LoadBreakSwitch", "PowerTransformer", "ProtectedSwitch", "Switch"];
if !allowed.contains(&entry1.element.type_name()) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.PccTerminal-valueType".to_string(),
class: "CsConverter".to_string(),
property: "ACDCConverter.PccTerminal".to_string(),
message: "The terminal is not a terminal of a PowerTransformer or a Switch.".to_string(),
severity: "sh:Warning".to_string(),
name: "C:301:EQ:ACDCConverter.PccTerminal:valueType".to_string(),
description: "It is typically the terminal on the power transformer (or switch) closest to the AC network.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ac_line_segment_conductor_length_min_incl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("ACLineSegment").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::ACLineSegment>() {
Some(o) => o, None => continue,
};
if obj.base.length.is_none() { continue; }
if obj.base.length.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Conductor.length-length".to_string(),
class: "ACLineSegment".to_string(),
property: "Conductor.length".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Length:valueRange".to_string(),
description: "It shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_active_power_limit_active_power_limit_normal_valu_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("ActivePowerLimit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::ActivePowerLimit>() {
Some(o) => o, None => continue,
};
if obj.normal_value.is_none() { continue; }
if obj.normal_value.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ActivePowerLimit.normalValue-valueRange".to_string(),
class: "ActivePowerLimit".to_string(),
property: "ActivePowerLimit.normalValue".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ActivePowerLimit.normalValue:valueRange".to_string(),
description: "The attribute shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_apparent_power_limit_apparent_power_limit_normal_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("ApparentPowerLimit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::ApparentPowerLimit>() {
Some(o) => o, None => continue,
};
if obj.normal_value.is_none() { continue; }
if obj.normal_value.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ApparentPowerLimit.normalValue-valueRange".to_string(),
class: "ApparentPowerLimit".to_string(),
property: "ApparentPowerLimit.normalValue".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ApparentPowerLimit.normalValue:valueRange".to_string(),
description: "The attribute shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_asynchronous_machine_rotating_machine_rated_u_min_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("AsynchronousMachine").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::AsynchronousMachine>() {
Some(o) => o, None => continue,
};
if obj.base.rated_u.is_none() { continue; }
if obj.base.rated_u.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:RotatingMachine.ratedU-valueRange".to_string(),
class: "AsynchronousMachine".to_string(),
property: "RotatingMachine.ratedU".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:RotatingMachine.ratedU:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_asynchronous_machine_rotating_machine_rated_s_min_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("AsynchronousMachine").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::AsynchronousMachine>() {
Some(o) => o, None => continue,
};
if obj.base.rated_s.is_none() { continue; }
if obj.base.rated_s.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:RotatingMachine.ratedS-valueRange".to_string(),
class: "AsynchronousMachine".to_string(),
property: "RotatingMachine.ratedS".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:RotatingMachine.ratedS:valueRange".to_string(),
description: "The attribute shall have a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_asynchronous_machine_rotating_machine_rated_power_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("AsynchronousMachine").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::AsynchronousMachine>() {
Some(o) => o, None => continue,
};
if obj.base.rated_power_factor.is_none() { continue; }
if obj.base.rated_power_factor.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:RotatingMachine.ratedPowerFactor-valueRange".to_string(),
class: "AsynchronousMachine".to_string(),
property: "RotatingMachine.ratedPowerFactor".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:RotatingMachine.ratedPowerFactor:valueRange".to_string(),
description: "The attribute cannot be a negative value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_base_voltage_base_voltage_nominal_voltage_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BaseVoltage").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BaseVoltage>() {
Some(o) => o, None => continue,
};
if obj.nominal_voltage.is_none() { continue; }
if obj.nominal_voltage.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BaseVoltage.nominalVoltage-valueRange".to_string(),
class: "BaseVoltage".to_string(),
property: "BaseVoltage.nominalVoltage".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BaseVoltage.nominalVoltage:valueRange".to_string(),
description: "Shall be a positive value and not zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_battery_unit_battery_unit_rated_e_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BatteryUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BatteryUnit>() {
Some(o) => o, None => continue,
};
if obj.rated_e.is_none() { continue; }
if obj.rated_e.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BatteryUnit.ratedE-valueRange".to_string(),
class: "BatteryUnit".to_string(),
property: "BatteryUnit.ratedE".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BatteryUnit.ratedE:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_name_max_l_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.from_end_name.is_empty() { continue; }
if obj.from_end_name.chars().count() > 64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.fromEndName-stringLength".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.fromEndName".to_string(),
message: "String length is greater than 64 characters.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.fromEndName:stringLength".to_string(),
description: "A human readable name with length of the string 64 characters maximum. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_iso_code_m_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.from_end_iso_code.is_empty() { continue; }
if obj.from_end_iso_code.chars().count() < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.fromEndIsoCode-stringLength".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.fromEndIsoCode".to_string(),
message: "String length is not 2 characters.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.fromEndIsoCode:stringLength".to_string(),
description: "The length of the string is 2 characters maximum.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_iso_code_m_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.from_end_iso_code.is_empty() { continue; }
if obj.from_end_iso_code.chars().count() > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.fromEndIsoCode-stringLength".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.fromEndIsoCode".to_string(),
message: "String length is not 2 characters.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.fromEndIsoCode:stringLength".to_string(),
description: "The length of the string is 2 characters maximum.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_name_tso_max_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.to_end_name_tso.is_empty() { continue; }
if obj.to_end_name_tso.chars().count() > 64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.toEndNameTso-stringLength".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.toEndNameTso".to_string(),
message: "String length is greater than 64 characters.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.toEndNameTso:stringLength".to_string(),
description: "The length of the string is 64 characters maximum.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_name_tso_m_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.from_end_name_tso.is_empty() { continue; }
if obj.from_end_name_tso.chars().count() > 64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.fromEndNameTso-stringLength".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.fromEndNameTso".to_string(),
message: "String length is greater than 64 characters.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.fromEndNameTso:stringLength".to_string(),
description: "The length of the string is 64 characters maximum.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_iso_code_min_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.to_end_iso_code.is_empty() { continue; }
if obj.to_end_iso_code.chars().count() < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.toEndIsoCode-stringLength".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.toEndIsoCode".to_string(),
message: "String length is not 2 characters.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.toEndIsoCode:stringLength".to_string(),
description: "The length of the string is 2 characters maximum.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_iso_code_max_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.to_end_iso_code.is_empty() { continue; }
if obj.to_end_iso_code.chars().count() > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.toEndIsoCode-stringLength".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.toEndIsoCode".to_string(),
message: "String length is not 2 characters.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.toEndIsoCode:stringLength".to_string(),
description: "The length of the string is 2 characters maximum.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_name_max_length(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.to_end_name.is_empty() { continue; }
if obj.to_end_name.chars().count() > 64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.toEndName-stringLength".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.toEndName".to_string(),
message: "String length is greater than 64 characters.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.toEndName:stringLength".to_string(),
description: "A human readable name with length of the string 64 characters maximum.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_iso_code_in(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
const ALLOWED: &[&str] = &["AL", "AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IS", "IE", "IT", "LV", "LI", "LT", "LU", "MT", "MD", "ME", "NL", "NO", "PL", "PT", "RO", "RS", "SK", "SI", "ES", "SE", "CH", "TR", "UA", "MK", "GB", "BA", "BY", "TN", "MA", "RU"];
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.from_end_iso_code.is_empty() { continue; }
if !ALLOWED.contains(&obj.from_end_iso_code.as_str()) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.fromEndIsoCode-valueValidity".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.fromEndIsoCode".to_string(),
message: "Not valid two-character ISO code for Europe.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.fromEndIsoCode:valueValidity".to_string(),
description: "The ISO code is a two-character country code as defined by ISO 3166 (http://www.iso.org/iso/country_codes).".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_iso_code_m_etc_3(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.from_end_iso_code.is_empty() { continue; }
if obj.from_end_iso_code.chars().count() < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.fromEndIsoCode-valueValidity".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.fromEndIsoCode".to_string(),
message: "Not valid two-character ISO code for Europe.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.fromEndIsoCode:valueValidity".to_string(),
description: "The ISO code is a two-character country code as defined by ISO 3166 (http://www.iso.org/iso/country_codes).".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_from_end_iso_code_m_etc_4(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.from_end_iso_code.is_empty() { continue; }
if obj.from_end_iso_code.chars().count() > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.fromEndIsoCode-valueValidity".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.fromEndIsoCode".to_string(),
message: "Not valid two-character ISO code for Europe.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.fromEndIsoCode:valueValidity".to_string(),
description: "The ISO code is a two-character country code as defined by ISO 3166 (http://www.iso.org/iso/country_codes).".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_iso_code_in(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
const ALLOWED: &[&str] = &["AL", "AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IS", "IE", "IT", "LV", "LI", "LT", "LU", "MT", "MD", "ME", "NL", "NO", "PL", "PT", "RO", "RS", "SK", "SI", "ES", "SE", "CH", "TR", "UA", "MK", "GB", "BA", "BY", "TN", "MA", "RU"];
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.to_end_iso_code.is_empty() { continue; }
if !ALLOWED.contains(&obj.to_end_iso_code.as_str()) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.toEndIsoCode-valueValidity".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.toEndIsoCode".to_string(),
message: "Not valid two-character ISO code for Europe.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.toEndIsoCode:valueValidity".to_string(),
description: "The ISO code is a two-character country code as defined by ISO 3166 (http://www.iso.org/iso/country_codes).".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_iso_code_min_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.to_end_iso_code.is_empty() { continue; }
if obj.to_end_iso_code.chars().count() < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.toEndIsoCode-valueValidity".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.toEndIsoCode".to_string(),
message: "Not valid two-character ISO code for Europe.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.toEndIsoCode:valueValidity".to_string(),
description: "The ISO code is a two-character country code as defined by ISO 3166 (http://www.iso.org/iso/country_codes).".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_boundary_point_boundary_point_to_end_iso_code_max_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BoundaryPoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::BoundaryPoint>() {
Some(o) => o, None => continue,
};
if obj.to_end_iso_code.is_empty() { continue; }
if obj.to_end_iso_code.chars().count() > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:BoundaryPoint.toEndIsoCode-valueValidity".to_string(),
class: "BoundaryPoint".to_string(),
property: "BoundaryPoint.toEndIsoCode".to_string(),
message: "Not valid two-character ISO code for Europe.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BoundaryPoint.toEndIsoCode:valueValidity".to_string(),
description: "The ISO code is a two-character country code as defined by ISO 3166 (http://www.iso.org/iso/country_codes).".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_breaker_switch_rated_current_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Breaker").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::Breaker>() {
Some(o) => o, None => continue,
};
if obj.base.base.rated_current.is_none() { continue; }
if obj.base.base.rated_current.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch.ratedCurrent-valueRange".to_string(),
class: "Breaker".to_string(),
property: "Switch.ratedCurrent".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch.ratedCurrent:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_breaker_terminal_conducting_equipment_min_count(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Breaker").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "Breaker".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_breaker_terminal_conducting_equipment_max_count(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Breaker").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "Breaker".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_busbar_section_terminal_conducting_equipment_requ_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("BusbarSection").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Terminal.ConductingEquipmentBusbarSection-valueType".to_string(),
class: "BusbarSection".to_string(),
property: "C:301:EQ:BusbarSection:numberOfTerminals".to_string(),
message: "The BusbarSection has more than one terminal.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:BusbarSection:numberOfTerminals".to_string(),
description: "A bus bar section may have many physical terminals but for analysis is modelled with exactly one logical terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_clamp_clamp_length_from_terminal1_min_incl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Clamp").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::Clamp>() {
Some(o) => o, None => continue,
};
if obj.length_from_terminal1.is_none() { continue; }
if obj.length_from_terminal1.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Clamp.lengthFromTerminal1-length".to_string(),
class: "Clamp".to_string(),
property: "Clamp.lengthFromTerminal1".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Length:valueRange".to_string(),
description: "It shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_clamp_and(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if src.connectivity_node.is_some() {
if let Some(r) = &src.conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Clamp").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 || counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Clamp-numberOfTerminals".to_string(),
class: "Clamp".to_string(),
property: "C:452:EQ:Clamp:numberOfTerminals".to_string(),
message: "Either the Clamp does not have exactly one Terminal or the Terminal is not associated with a ConnectivityNode.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:452:EQ:Clamp:numberOfTerminals".to_string(),
description: "A Clamp is ConductingEquipment and has one Terminal with an associated ConnectivityNode.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_ground_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCGround").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "DCGround".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_busbar_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCBusbar").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "DCBusbar".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_shunt_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCShunt").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "DCShunt".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ground_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Ground").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "Ground".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_energy_source_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("EnergySource").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "EnergySource".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_energy_consumer_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("EnergyConsumer").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "EnergyConsumer".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_conform_load_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("ConformLoad").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "ConformLoad".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_non_conform_load_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("NonConformLoad").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "NonConformLoad".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_station_supply_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("StationSupply").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "StationSupply".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_power_electronics_connection_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PowerElectronicsConnection").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "PowerElectronicsConnection".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_external_network_injection_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("ExternalNetworkInjection").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "ExternalNetworkInjection".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_linear_shunt_compensator_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("LinearShuntCompensator").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "LinearShuntCompensator".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_nonlinear_shunt_compensator_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("NonlinearShuntCompensator").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "NonlinearShuntCompensator".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_static_var_compensator_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("StaticVarCompensator").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "StaticVarCompensator".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_synchronous_machine_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SynchronousMachine").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "SynchronousMachine".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_asynchronous_machine_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("AsynchronousMachine").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "AsynchronousMachine".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_equivalent_injection_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("EquivalentInjection").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "EquivalentInjection".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_equivalent_shunt_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("EquivalentShunt").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "EquivalentShunt".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_junction_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Junction").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 1 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-oneTerminal".to_string(),
class: "Junction".to_string(),
property: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:oneTerminal".to_string(),
description: "All other ConductingEquipment leaf classes (notably also including Clamp and BusbarSection) and DCConductingEquipment have a single terminal.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ac_line_segment_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("ACLineSegment").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "ACLineSegment".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_line_segment_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCLineSegment").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "DCLineSegment".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_series_device_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCSeriesDevice").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "DCSeriesDevice".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_switch_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCSwitch").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "DCSwitch".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_disconnector_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCDisconnector").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "DCDisconnector".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_breaker_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCBreaker").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "DCBreaker".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_chopper_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCChopper").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "DCChopper".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_switch_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Switch").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "Switch".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_disconnector_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Disconnector").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "Disconnector".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_fuse_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Fuse").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "Fuse".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ground_disconnector_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("GroundDisconnector").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "GroundDisconnector".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_jumper_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Jumper").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "Jumper".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_breaker_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Breaker").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "Breaker".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_load_break_switch_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("LoadBreakSwitch").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "LoadBreakSwitch".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_disconnecting_circuit_breaker_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DisconnectingCircuitBreaker").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "DisconnectingCircuitBreaker".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cut_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Cut").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "Cut".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_series_compensator_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SeriesCompensator").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "SeriesCompensator".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_equivalent_branch_or(dataset: &CimDataset) -> Vec<Violation> {
let mut counts0: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment {
*counts0.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut counts1: std::collections::HashMap<String, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("DCTerminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::DCTerminal>()) {
if let Some(r) = &src.dc_conducting_equipment {
*counts1.entry(r.mrid.trim_start_matches('#').to_string()).or_insert(0) += 1;
}
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("EquivalentBranch").into_iter().flatten() {
if counts0.get(mrid.as_str()).copied().unwrap_or(0) != 2 && counts1.get(mrid.as_str()).copied().unwrap_or(0) != 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ConductingEquipment-twoTerminals".to_string(),
class: "EquivalentBranch".to_string(),
property: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
message: "The ConductingEquipment does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ConductingEquipment:twoTerminals".to_string(),
description: "The following ConductingEquipment classes have two terminals: ACLineSegment, DCLineSegment, DCSeriesDevice, DCSwitch (and its specializations), DCChopper, Switch and all its specializations (including Jumper, Fuse, Breaker, Disconnector, LoadBreakSwitch, and Cut), SeriesCompensator, and EquivalentBranch. The PowerTransformer class typically has two terminals, but may also have one or more terminals. For example a zig-zag connected grounding transformer may have one terminal. Three terminal transformers are commonly used in transmission systems and in special cases transformers may have four, five, or more terminals. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_min_gamma_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.min_gamma.is_none() { continue; }
if obj.min_gamma.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:CsConverter.minGamma-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "CsConverter.minGamma".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:CsConverter.minGamma:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_switching_loss_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.switching_loss.is_none() { continue; }
if obj.base.switching_loss.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.switchingLoss-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "ACDCConverter.switchingLoss".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.switchingLoss:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_min_udc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.min_udc.is_none() { continue; }
if obj.base.min_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.minUdc-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "ACDCConverter.minUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.minUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_rated_idc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.rated_idc.is_none() { continue; }
if obj.rated_idc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:CsConverter.ratedIdc-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "CsConverter.ratedIdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:CsConverter.ratedIdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_max_alpha_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.max_alpha.is_none() { continue; }
if obj.max_alpha.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:CsConverter.maxAlpha-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "CsConverter.maxAlpha".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:CsConverter.maxAlpha:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_base_s_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.base_s.is_none() { continue; }
if obj.base.base_s.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.baseS-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "ACDCConverter.baseS".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.baseS:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_max_udc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.max_udc.is_none() { continue; }
if obj.base.max_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.maxUdc-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "ACDCConverter.maxUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.maxUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_resistive_loss_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.resistive_loss.is_none() { continue; }
if obj.base.resistive_loss.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.resistiveLoss-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "ACDCConverter.resistiveLoss".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.resistiveLoss:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_min_alpha_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.min_alpha.is_none() { continue; }
if obj.min_alpha.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:CsConverter.minAlpha-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "CsConverter.minAlpha".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:CsConverter.minAlpha:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_max_idc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.max_idc.is_none() { continue; }
if obj.max_idc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:CsConverter.maxIdc-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "CsConverter.maxIdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:CsConverter.maxIdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_min_idc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.min_idc.is_none() { continue; }
if obj.min_idc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:CsConverter.minIdc-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "CsConverter.minIdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:CsConverter.minIdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_rated_udc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.rated_udc.is_none() { continue; }
if obj.base.rated_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.ratedUdc-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "ACDCConverter.ratedUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.ratedUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_acdc_converter_idle_loss_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.idle_loss.is_none() { continue; }
if obj.base.idle_loss.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.idleLoss-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "ACDCConverter.idleLoss".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.idleLoss:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cs_converter_cs_converter_max_gamma_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CsConverter>() {
Some(o) => o, None => continue,
};
if obj.max_gamma.is_none() { continue; }
if obj.max_gamma.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:CsConverter.maxGamma-valueRange".to_string(),
class: "CsConverter".to_string(),
property: "CsConverter.maxGamma".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:CsConverter.maxGamma:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_current_limit_current_limit_normal_value_min_incl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CurrentLimit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CurrentLimit>() {
Some(o) => o, None => continue,
};
if obj.normal_value.is_none() { continue; }
if obj.normal_value.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:CurrentLimit.normalValue-valueRange".to_string(),
class: "CurrentLimit".to_string(),
property: "CurrentLimit.normalValue".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:CurrentLimit.normalValue:valueRange".to_string(),
description: "The attribute shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cut_switch_rated_current_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Cut").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::Cut>() {
Some(o) => o, None => continue,
};
if obj.base.rated_current.is_none() { continue; }
if obj.base.rated_current.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch.ratedCurrent-valueRange".to_string(),
class: "Cut".to_string(),
property: "Switch.ratedCurrent".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch.ratedCurrent:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cut_cut_length_from_terminal1_min_incl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Cut").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::Cut>() {
Some(o) => o, None => continue,
};
if obj.length_from_terminal1.is_none() { continue; }
if obj.length_from_terminal1.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Cut.lengthFromTerminal1-length".to_string(),
class: "Cut".to_string(),
property: "Cut.lengthFromTerminal1".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Length:valueRange".to_string(),
description: "It shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cut_terminal_conducting_equipment_min_count(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Cut").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "Cut".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_cut_terminal_conducting_equipment_max_count(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Cut").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "Cut".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_breaker_dc_conducting_equipment_rated_udc_min_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCBreaker").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCBreaker>() {
Some(o) => o, None => continue,
};
if obj.base.base.rated_udc.is_none() { continue; }
if obj.base.base.rated_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:DCConductingEquipment.ratedUdc-valueRange".to_string(),
class: "DCBreaker".to_string(),
property: "DCConductingEquipment.ratedUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:DCConductingEquipment.ratedUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_busbar_dc_conducting_equipment_rated_udc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCBusbar").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCBusbar>() {
Some(o) => o, None => continue,
};
if obj.base.rated_udc.is_none() { continue; }
if obj.base.rated_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:DCConductingEquipment.ratedUdc-valueRange".to_string(),
class: "DCBusbar".to_string(),
property: "DCConductingEquipment.ratedUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:DCConductingEquipment.ratedUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_chopper_dc_conducting_equipment_rated_udc_min_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCChopper").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCChopper>() {
Some(o) => o, None => continue,
};
if obj.base.rated_udc.is_none() { continue; }
if obj.base.rated_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:DCConductingEquipment.ratedUdc-valueRange".to_string(),
class: "DCChopper".to_string(),
property: "DCConductingEquipment.ratedUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:DCConductingEquipment.ratedUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_disconnector_dc_conducting_equipment_rated_udc_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCDisconnector").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCDisconnector>() {
Some(o) => o, None => continue,
};
if obj.base.base.rated_udc.is_none() { continue; }
if obj.base.base.rated_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:DCConductingEquipment.ratedUdc-valueRange".to_string(),
class: "DCDisconnector".to_string(),
property: "DCConductingEquipment.ratedUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:DCConductingEquipment.ratedUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_ground_dc_conducting_equipment_rated_udc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCGround").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCGround>() {
Some(o) => o, None => continue,
};
if obj.base.rated_udc.is_none() { continue; }
if obj.base.rated_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:DCConductingEquipment.ratedUdc-valueRange".to_string(),
class: "DCGround".to_string(),
property: "DCConductingEquipment.ratedUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:DCConductingEquipment.ratedUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_line_segment_dc_conducting_equipment_rated_udc_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCLineSegment").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCLineSegment>() {
Some(o) => o, None => continue,
};
if obj.base.rated_udc.is_none() { continue; }
if obj.base.rated_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:DCConductingEquipment.ratedUdc-valueRange".to_string(),
class: "DCLineSegment".to_string(),
property: "DCConductingEquipment.ratedUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:DCConductingEquipment.ratedUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_line_segment_dc_line_segment_length_min_incl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCLineSegment").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCLineSegment>() {
Some(o) => o, None => continue,
};
if obj.length.is_none() { continue; }
if obj.length.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:DCLineSegment.length-length".to_string(),
class: "DCLineSegment".to_string(),
property: "DCLineSegment.length".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Length:valueRange".to_string(),
description: "It shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_series_device_dc_conducting_equipment_rated_ud_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCSeriesDevice").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCSeriesDevice>() {
Some(o) => o, None => continue,
};
if obj.base.rated_udc.is_none() { continue; }
if obj.base.rated_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:DCConductingEquipment.ratedUdc-valueRange".to_string(),
class: "DCSeriesDevice".to_string(),
property: "DCConductingEquipment.ratedUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:DCConductingEquipment.ratedUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_shunt_dc_conducting_equipment_rated_udc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCShunt").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCShunt>() {
Some(o) => o, None => continue,
};
if obj.base.rated_udc.is_none() { continue; }
if obj.base.rated_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:DCConductingEquipment.ratedUdc-valueRange".to_string(),
class: "DCShunt".to_string(),
property: "DCConductingEquipment.ratedUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:DCConductingEquipment.ratedUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_dc_switch_dc_conducting_equipment_rated_udc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DCSwitch").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DCSwitch>() {
Some(o) => o, None => continue,
};
if obj.base.rated_udc.is_none() { continue; }
if obj.base.rated_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:DCConductingEquipment.ratedUdc-valueRange".to_string(),
class: "DCSwitch".to_string(),
property: "DCConductingEquipment.ratedUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:DCConductingEquipment.ratedUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_disconnecting_circuit_breaker_switch_rated_curren_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DisconnectingCircuitBreaker").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::DisconnectingCircuitBreaker>() {
Some(o) => o, None => continue,
};
if obj.base.base.base.rated_current.is_none() { continue; }
if obj.base.base.base.rated_current.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch.ratedCurrent-valueRange".to_string(),
class: "DisconnectingCircuitBreaker".to_string(),
property: "Switch.ratedCurrent".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch.ratedCurrent:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_disconnecting_circuit_breaker_terminal_conducting_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DisconnectingCircuitBreaker").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "DisconnectingCircuitBreaker".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_disconnecting_circuit_breaker_terminal_conducting_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("DisconnectingCircuitBreaker").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "DisconnectingCircuitBreaker".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_disconnector_switch_rated_current_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Disconnector").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::Disconnector>() {
Some(o) => o, None => continue,
};
if obj.base.rated_current.is_none() { continue; }
if obj.base.rated_current.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch.ratedCurrent-valueRange".to_string(),
class: "Disconnector".to_string(),
property: "Switch.ratedCurrent".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch.ratedCurrent:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_disconnector_terminal_conducting_equipment_min_count(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Disconnector").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "Disconnector".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_disconnector_terminal_conducting_equipment_max_count(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Disconnector").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "Disconnector".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_grounding_impedance_terminal_conducting_equipment_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("GroundingImpedance").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:EarthFaultCompensator-numberOfTerminals".to_string(),
class: "GroundingImpedance".to_string(),
property: "C:301:EQ:EarthFaultCompensator:numberOfTerminals".to_string(),
message: "The EarthFaultCompensator does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:EarthFaultCompensator:numberOfTerminals".to_string(),
description: "The EarthFaultCompensator can have either one or two terminals modelled. If the second terminal of an EarthFaultCompensator is omitted, it is assumed the terminal solidly connects to ground. If there is some kind of topology or local earth resistivity that is important to model on the ground side of the device, then a second terminal is added.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_grounding_impedance_terminal_conducting_equipment_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("GroundingImpedance").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:EarthFaultCompensator-numberOfTerminals".to_string(),
class: "GroundingImpedance".to_string(),
property: "C:301:EQ:EarthFaultCompensator:numberOfTerminals".to_string(),
message: "The EarthFaultCompensator does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:EarthFaultCompensator:numberOfTerminals".to_string(),
description: "The EarthFaultCompensator can have either one or two terminals modelled. If the second terminal of an EarthFaultCompensator is omitted, it is assumed the terminal solidly connects to ground. If there is some kind of topology or local earth resistivity that is important to model on the ground side of the device, then a second terminal is added.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_petersen_coil_terminal_conducting_equipment_min_c_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PetersenCoil").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:EarthFaultCompensator-numberOfTerminals".to_string(),
class: "PetersenCoil".to_string(),
property: "C:301:EQ:EarthFaultCompensator:numberOfTerminals".to_string(),
message: "The EarthFaultCompensator does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:EarthFaultCompensator:numberOfTerminals".to_string(),
description: "The EarthFaultCompensator can have either one or two terminals modelled. If the second terminal of an EarthFaultCompensator is omitted, it is assumed the terminal solidly connects to ground. If there is some kind of topology or local earth resistivity that is important to model on the ground side of the device, then a second terminal is added.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_petersen_coil_terminal_conducting_equipment_max_c_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PetersenCoil").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:EarthFaultCompensator-numberOfTerminals".to_string(),
class: "PetersenCoil".to_string(),
property: "C:301:EQ:EarthFaultCompensator:numberOfTerminals".to_string(),
message: "The EarthFaultCompensator does not have the required number of Terminal-s.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:EarthFaultCompensator:numberOfTerminals".to_string(),
description: "The EarthFaultCompensator can have either one or two terminals modelled. If the second terminal of an EarthFaultCompensator is omitted, it is assumed the terminal solidly connects to ground. If there is some kind of topology or local earth resistivity that is important to model on the ground side of the device, then a second terminal is added.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_fuse_switch_rated_current_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Fuse").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::Fuse>() {
Some(o) => o, None => continue,
};
if obj.base.rated_current.is_none() { continue; }
if obj.base.rated_current.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch.ratedCurrent-valueRange".to_string(),
class: "Fuse".to_string(),
property: "Switch.ratedCurrent".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch.ratedCurrent:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_fuse_terminal_conducting_equipment_min_count(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Fuse").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "Fuse".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_fuse_terminal_conducting_equipment_max_count(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Fuse").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "Fuse".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_generating_unit_generating_unit_rated_net_max_p_m_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("GeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::GeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.rated_net_max_p.is_none() { continue; }
if obj.rated_net_max_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedNetMaxP-valueRange".to_string(),
class: "GeneratingUnit".to_string(),
property: "GeneratingUnit.ratedNetMaxP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedNetMaxP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_generating_unit_generating_unit_rated_gross_min_p_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("GeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::GeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.rated_gross_min_p.is_none() { continue; }
if obj.rated_gross_min_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedGrossMinP-valueRange".to_string(),
class: "GeneratingUnit".to_string(),
property: "GeneratingUnit.ratedGrossMinP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedGrossMinP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_generating_unit_generating_unit_rated_gross_max_p_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("GeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::GeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.rated_gross_max_p.is_none() { continue; }
if obj.rated_gross_max_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedGrossMaxP-valueRange".to_string(),
class: "GeneratingUnit".to_string(),
property: "GeneratingUnit.ratedGrossMaxP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedGrossMaxP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ground_disconnector_switch_rated_current_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("GroundDisconnector").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::GroundDisconnector>() {
Some(o) => o, None => continue,
};
if obj.base.rated_current.is_none() { continue; }
if obj.base.rated_current.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch.ratedCurrent-valueRange".to_string(),
class: "GroundDisconnector".to_string(),
property: "Switch.ratedCurrent".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch.ratedCurrent:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ground_disconnector_terminal_conducting_equipment_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("GroundDisconnector").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "GroundDisconnector".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ground_disconnector_terminal_conducting_equipment_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("GroundDisconnector").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "GroundDisconnector".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_hydro_generating_unit_generating_unit_rated_net_m_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("HydroGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::HydroGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_net_max_p.is_none() { continue; }
if obj.base.rated_net_max_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedNetMaxP-valueRange".to_string(),
class: "HydroGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedNetMaxP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedNetMaxP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_hydro_generating_unit_generating_unit_rated_gross_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("HydroGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::HydroGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_gross_min_p.is_none() { continue; }
if obj.base.rated_gross_min_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedGrossMinP-valueRange".to_string(),
class: "HydroGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedGrossMinP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedGrossMinP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_hydro_generating_unit_generating_unit_rated_gross_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("HydroGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::HydroGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_gross_max_p.is_none() { continue; }
if obj.base.rated_gross_max_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedGrossMaxP-valueRange".to_string(),
class: "HydroGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedGrossMaxP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedGrossMaxP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_hydro_generating_unit_hydro_generating_unit_drop_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("HydroGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::HydroGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.drop_height.is_none() { continue; }
if obj.drop_height.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:HydroGeneratingUnit.dropHeight-length".to_string(),
class: "HydroGeneratingUnit".to_string(),
property: "HydroGeneratingUnit.dropHeight".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Length:valueRange".to_string(),
description: "It shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_jumper_switch_rated_current_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Jumper").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::Jumper>() {
Some(o) => o, None => continue,
};
if obj.base.rated_current.is_none() { continue; }
if obj.base.rated_current.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch.ratedCurrent-valueRange".to_string(),
class: "Jumper".to_string(),
property: "Switch.ratedCurrent".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch.ratedCurrent:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_jumper_terminal_conducting_equipment_min_count(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Jumper").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "Jumper".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_jumper_terminal_conducting_equipment_max_count(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Jumper").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "Jumper".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_linear_shunt_compensator_shunt_compensator_normal_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("LinearShuntCompensator").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::LinearShuntCompensator>() {
Some(o) => o, None => continue,
};
if obj.base.normal_sections.is_none() { continue; }
if (obj.base.normal_sections.unwrap() as f64) < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ShuntCompensator.normalSections-valueRangePair".to_string(),
class: "LinearShuntCompensator".to_string(),
property: "ShuntCompensator.normalSections".to_string(),
message: "The value is either negative or greater than ShuntCompensator.maximumSections.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ShuntCompensator.normalSections:valueRangePair".to_string(),
description: "The value shall be between zero and ShuntCompensator.maximumSections.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_linear_shunt_compensator_shunt_compensator_normal_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("LinearShuntCompensator").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::LinearShuntCompensator>() {
Some(o) => o, None => continue,
};
if obj.base.normal_sections.is_none() || obj.base.maximum_sections.is_none() { continue; }
if !((obj.base.normal_sections.unwrap() as f64) <= obj.base.maximum_sections.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ShuntCompensator.normalSections-valueRangePair".to_string(),
class: "LinearShuntCompensator".to_string(),
property: "ShuntCompensator.normalSections".to_string(),
message: "The value is either negative or greater than ShuntCompensator.maximumSections.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ShuntCompensator.normalSections:valueRangePair".to_string(),
description: "The value shall be between zero and ShuntCompensator.maximumSections.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_linear_shunt_compensator_terminal_conducting_equi_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("LinearShuntCompensator").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ShuntCompensator-numberOfTerminals".to_string(),
class: "LinearShuntCompensator".to_string(),
property: "C:301:EQ:ShuntCompensator:numberOfTerminals".to_string(),
message: "The ShuntCompensator does not have one terminal.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ShuntCompensator:numberOfTerminals".to_string(),
description: "ShuntCompensator is a single terminal device. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_load_break_switch_switch_rated_current_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("LoadBreakSwitch").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::LoadBreakSwitch>() {
Some(o) => o, None => continue,
};
if obj.base.base.rated_current.is_none() { continue; }
if obj.base.base.rated_current.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch.ratedCurrent-valueRange".to_string(),
class: "LoadBreakSwitch".to_string(),
property: "Switch.ratedCurrent".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch.ratedCurrent:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_load_break_switch_terminal_conducting_equipment_m_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("LoadBreakSwitch").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "LoadBreakSwitch".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_load_break_switch_terminal_conducting_equipment_m_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("LoadBreakSwitch").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "LoadBreakSwitch".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_nonlinear_shunt_compensator_shunt_compensator_nor_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("NonlinearShuntCompensator").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::NonlinearShuntCompensator>() {
Some(o) => o, None => continue,
};
if obj.base.normal_sections.is_none() { continue; }
if (obj.base.normal_sections.unwrap() as f64) < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ShuntCompensator.normalSections-valueRangePair".to_string(),
class: "NonlinearShuntCompensator".to_string(),
property: "ShuntCompensator.normalSections".to_string(),
message: "The value is either negative or greater than ShuntCompensator.maximumSections.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ShuntCompensator.normalSections:valueRangePair".to_string(),
description: "The value shall be between zero and ShuntCompensator.maximumSections.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_nonlinear_shunt_compensator_shunt_compensator_nor_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("NonlinearShuntCompensator").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::NonlinearShuntCompensator>() {
Some(o) => o, None => continue,
};
if obj.base.normal_sections.is_none() || obj.base.maximum_sections.is_none() { continue; }
if !((obj.base.normal_sections.unwrap() as f64) <= obj.base.maximum_sections.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ShuntCompensator.normalSections-valueRangePair".to_string(),
class: "NonlinearShuntCompensator".to_string(),
property: "ShuntCompensator.normalSections".to_string(),
message: "The value is either negative or greater than ShuntCompensator.maximumSections.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ShuntCompensator.normalSections:valueRangePair".to_string(),
description: "The value shall be between zero and ShuntCompensator.maximumSections.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_nonlinear_shunt_compensator_terminal_conducting_e_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("NonlinearShuntCompensator").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 1 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ShuntCompensator-numberOfTerminals".to_string(),
class: "NonlinearShuntCompensator".to_string(),
property: "C:301:EQ:ShuntCompensator:numberOfTerminals".to_string(),
message: "The ShuntCompensator does not have one terminal.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ShuntCompensator:numberOfTerminals".to_string(),
description: "ShuntCompensator is a single terminal device. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_nuclear_generating_unit_generating_unit_rated_net_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("NuclearGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::NuclearGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_net_max_p.is_none() { continue; }
if obj.base.rated_net_max_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedNetMaxP-valueRange".to_string(),
class: "NuclearGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedNetMaxP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedNetMaxP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_nuclear_generating_unit_generating_unit_rated_gro_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("NuclearGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::NuclearGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_gross_min_p.is_none() { continue; }
if obj.base.rated_gross_min_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedGrossMinP-valueRange".to_string(),
class: "NuclearGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedGrossMinP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedGrossMinP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_nuclear_generating_unit_generating_unit_rated_gro_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("NuclearGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::NuclearGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_gross_max_p.is_none() { continue; }
if obj.base.rated_gross_max_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedGrossMaxP-valueRange".to_string(),
class: "NuclearGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedGrossMaxP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedGrossMaxP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_asymmetrical_tap_changer_normal_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerAsymmetrical").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerAsymmetrical>() {
Some(o) => o, None => continue,
};
if obj.base.base.base.normal_step.is_none() || obj.base.base.base.high_step.is_none() { continue; }
if !((obj.base.base.base.normal_step.unwrap() as f64) <= obj.base.base.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.normalStep-valueRangePairTo".to_string(),
class: "PhaseTapChangerAsymmetrical".to_string(),
property: "TapChanger.normalStep".to_string(),
message: "The value of TapChanger.normalStep is greater than the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.normalStep:valueRangePairTo".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal to or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_asymmetrical_tap_changer_low_st_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerAsymmetrical").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerAsymmetrical>() {
Some(o) => o, None => continue,
};
if obj.base.base.base.low_step.is_none() || obj.base.base.base.normal_step.is_none() { continue; }
if !((obj.base.base.base.low_step.unwrap() as f64) <= obj.base.base.base.normal_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.normalStep-valueRangePairFrom".to_string(),
class: "PhaseTapChangerAsymmetrical".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than the value of TapChanger.normalStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.normalStep:valueRangePairFrom".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal to or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_asymmetrical_tap_changer_neutra_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerAsymmetrical").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerAsymmetrical>() {
Some(o) => o, None => continue,
};
if obj.base.base.base.neutral_step.is_none() || obj.base.base.base.high_step.is_none() { continue; }
if !((obj.base.base.base.neutral_step.unwrap() as f64) <= obj.base.base.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.neutralStep-valueRangePairTo".to_string(),
class: "PhaseTapChangerAsymmetrical".to_string(),
property: "TapChanger.neutralStep".to_string(),
message: "The value of TapChanger.neutralStep is greater than the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.neutralStep:valueRangePairTo".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_asymmetrical_tap_changer_low_st_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerAsymmetrical").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerAsymmetrical>() {
Some(o) => o, None => continue,
};
if obj.base.base.base.low_step.is_none() || obj.base.base.base.neutral_step.is_none() { continue; }
if !((obj.base.base.base.low_step.unwrap() as f64) <= obj.base.base.base.neutral_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.neutralStep-valueRangePairFrom".to_string(),
class: "PhaseTapChangerAsymmetrical".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than the value of TapChanger.neutralStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.neutralStep:valueRangePairFrom".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_asymmetrical_tap_changer_low_st_etc_3(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerAsymmetrical").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerAsymmetrical>() {
Some(o) => o, None => continue,
};
if obj.base.base.base.low_step.is_none() || obj.base.base.base.high_step.is_none() { continue; }
if !((obj.base.base.base.low_step.unwrap() as f64) < obj.base.base.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.highStep-valueRangePair".to_string(),
class: "PhaseTapChangerAsymmetrical".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than or equal to the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.highStep:valueRangePair".to_string(),
description: "The attribute shall be greater than lowStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_linear_tap_changer_normal_step_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerLinear").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerLinear>() {
Some(o) => o, None => continue,
};
if obj.base.base.normal_step.is_none() || obj.base.base.high_step.is_none() { continue; }
if !((obj.base.base.normal_step.unwrap() as f64) <= obj.base.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.normalStep-valueRangePairTo".to_string(),
class: "PhaseTapChangerLinear".to_string(),
property: "TapChanger.normalStep".to_string(),
message: "The value of TapChanger.normalStep is greater than the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.normalStep:valueRangePairTo".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal to or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_linear_tap_changer_low_step_les_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerLinear").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerLinear>() {
Some(o) => o, None => continue,
};
if obj.base.base.low_step.is_none() || obj.base.base.normal_step.is_none() { continue; }
if !((obj.base.base.low_step.unwrap() as f64) <= obj.base.base.normal_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.normalStep-valueRangePairFrom".to_string(),
class: "PhaseTapChangerLinear".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than the value of TapChanger.normalStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.normalStep:valueRangePairFrom".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal to or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_linear_tap_changer_neutral_step_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerLinear").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerLinear>() {
Some(o) => o, None => continue,
};
if obj.base.base.neutral_step.is_none() || obj.base.base.high_step.is_none() { continue; }
if !((obj.base.base.neutral_step.unwrap() as f64) <= obj.base.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.neutralStep-valueRangePairTo".to_string(),
class: "PhaseTapChangerLinear".to_string(),
property: "TapChanger.neutralStep".to_string(),
message: "The value of TapChanger.neutralStep is greater than the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.neutralStep:valueRangePairTo".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_linear_tap_changer_low_step_les_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerLinear").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerLinear>() {
Some(o) => o, None => continue,
};
if obj.base.base.low_step.is_none() || obj.base.base.neutral_step.is_none() { continue; }
if !((obj.base.base.low_step.unwrap() as f64) <= obj.base.base.neutral_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.neutralStep-valueRangePairFrom".to_string(),
class: "PhaseTapChangerLinear".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than the value of TapChanger.neutralStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.neutralStep:valueRangePairFrom".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_linear_tap_changer_low_step_les_etc_3(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerLinear").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerLinear>() {
Some(o) => o, None => continue,
};
if obj.base.base.low_step.is_none() || obj.base.base.high_step.is_none() { continue; }
if !((obj.base.base.low_step.unwrap() as f64) < obj.base.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.highStep-valueRangePair".to_string(),
class: "PhaseTapChangerLinear".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than or equal to the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.highStep:valueRangePair".to_string(),
description: "The attribute shall be greater than lowStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_symmetrical_tap_changer_normal_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerSymmetrical").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerSymmetrical>() {
Some(o) => o, None => continue,
};
if obj.base.base.base.normal_step.is_none() || obj.base.base.base.high_step.is_none() { continue; }
if !((obj.base.base.base.normal_step.unwrap() as f64) <= obj.base.base.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.normalStep-valueRangePairTo".to_string(),
class: "PhaseTapChangerSymmetrical".to_string(),
property: "TapChanger.normalStep".to_string(),
message: "The value of TapChanger.normalStep is greater than the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.normalStep:valueRangePairTo".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal to or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_symmetrical_tap_changer_low_ste_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerSymmetrical").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerSymmetrical>() {
Some(o) => o, None => continue,
};
if obj.base.base.base.low_step.is_none() || obj.base.base.base.normal_step.is_none() { continue; }
if !((obj.base.base.base.low_step.unwrap() as f64) <= obj.base.base.base.normal_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.normalStep-valueRangePairFrom".to_string(),
class: "PhaseTapChangerSymmetrical".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than the value of TapChanger.normalStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.normalStep:valueRangePairFrom".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal to or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_symmetrical_tap_changer_neutral_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerSymmetrical").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerSymmetrical>() {
Some(o) => o, None => continue,
};
if obj.base.base.base.neutral_step.is_none() || obj.base.base.base.high_step.is_none() { continue; }
if !((obj.base.base.base.neutral_step.unwrap() as f64) <= obj.base.base.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.neutralStep-valueRangePairTo".to_string(),
class: "PhaseTapChangerSymmetrical".to_string(),
property: "TapChanger.neutralStep".to_string(),
message: "The value of TapChanger.neutralStep is greater than the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.neutralStep:valueRangePairTo".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_symmetrical_tap_changer_low_ste_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerSymmetrical").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerSymmetrical>() {
Some(o) => o, None => continue,
};
if obj.base.base.base.low_step.is_none() || obj.base.base.base.neutral_step.is_none() { continue; }
if !((obj.base.base.base.low_step.unwrap() as f64) <= obj.base.base.base.neutral_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.neutralStep-valueRangePairFrom".to_string(),
class: "PhaseTapChangerSymmetrical".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than the value of TapChanger.neutralStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.neutralStep:valueRangePairFrom".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_symmetrical_tap_changer_low_ste_etc_3(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerSymmetrical").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerSymmetrical>() {
Some(o) => o, None => continue,
};
if obj.base.base.base.low_step.is_none() || obj.base.base.base.high_step.is_none() { continue; }
if !((obj.base.base.base.low_step.unwrap() as f64) < obj.base.base.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.highStep-valueRangePair".to_string(),
class: "PhaseTapChangerSymmetrical".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than or equal to the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.highStep:valueRangePair".to_string(),
description: "The attribute shall be greater than lowStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_tabular_tap_changer_normal_step_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerTabular").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerTabular>() {
Some(o) => o, None => continue,
};
if obj.base.base.normal_step.is_none() || obj.base.base.high_step.is_none() { continue; }
if !((obj.base.base.normal_step.unwrap() as f64) <= obj.base.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.normalStep-valueRangePairTo".to_string(),
class: "PhaseTapChangerTabular".to_string(),
property: "TapChanger.normalStep".to_string(),
message: "The value of TapChanger.normalStep is greater than the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.normalStep:valueRangePairTo".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal to or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_tabular_tap_changer_low_step_le_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerTabular").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerTabular>() {
Some(o) => o, None => continue,
};
if obj.base.base.low_step.is_none() || obj.base.base.normal_step.is_none() { continue; }
if !((obj.base.base.low_step.unwrap() as f64) <= obj.base.base.normal_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.normalStep-valueRangePairFrom".to_string(),
class: "PhaseTapChangerTabular".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than the value of TapChanger.normalStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.normalStep:valueRangePairFrom".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal to or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_tabular_tap_changer_neutral_ste_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerTabular").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerTabular>() {
Some(o) => o, None => continue,
};
if obj.base.base.neutral_step.is_none() || obj.base.base.high_step.is_none() { continue; }
if !((obj.base.base.neutral_step.unwrap() as f64) <= obj.base.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.neutralStep-valueRangePairTo".to_string(),
class: "PhaseTapChangerTabular".to_string(),
property: "TapChanger.neutralStep".to_string(),
message: "The value of TapChanger.neutralStep is greater than the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.neutralStep:valueRangePairTo".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_tabular_tap_changer_low_step_le_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerTabular").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerTabular>() {
Some(o) => o, None => continue,
};
if obj.base.base.low_step.is_none() || obj.base.base.neutral_step.is_none() { continue; }
if !((obj.base.base.low_step.unwrap() as f64) <= obj.base.base.neutral_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.neutralStep-valueRangePairFrom".to_string(),
class: "PhaseTapChangerTabular".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than the value of TapChanger.neutralStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.neutralStep:valueRangePairFrom".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_phase_tap_changer_tabular_tap_changer_low_step_le_etc_3(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PhaseTapChangerTabular").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PhaseTapChangerTabular>() {
Some(o) => o, None => continue,
};
if obj.base.base.low_step.is_none() || obj.base.base.high_step.is_none() { continue; }
if !((obj.base.base.low_step.unwrap() as f64) < obj.base.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.highStep-valueRangePair".to_string(),
class: "PhaseTapChangerTabular".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than or equal to the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.highStep:valueRangePair".to_string(),
description: "The attribute shall be greater than lowStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_power_electronics_connection_power_electronics_co_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PowerElectronicsConnection").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PowerElectronicsConnection>() {
Some(o) => o, None => continue,
};
if obj.rated_u.is_none() { continue; }
if obj.rated_u.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:PowerElectronicsConnection.ratedU-valueRange".to_string(),
class: "PowerElectronicsConnection".to_string(),
property: "PowerElectronicsConnection.ratedU".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:PowerElectronicsConnection.ratedU:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_power_electronics_connection_power_electronics_co_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PowerElectronicsConnection").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PowerElectronicsConnection>() {
Some(o) => o, None => continue,
};
if obj.rated_s.is_none() { continue; }
if obj.rated_s.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:PowerElectronicsConnection.ratedS-valueRange".to_string(),
class: "PowerElectronicsConnection".to_string(),
property: "PowerElectronicsConnection.ratedS".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:PowerElectronicsConnection.ratedS:valueRange".to_string(),
description: "The attribute shall have a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_power_transformer_end_power_transformer_end_rated_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PowerTransformerEnd").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PowerTransformerEnd>() {
Some(o) => o, None => continue,
};
if obj.rated_s.is_none() { continue; }
if obj.rated_s.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:PowerTransformerEnd.ratedS-valueRange".to_string(),
class: "PowerTransformerEnd".to_string(),
property: "PowerTransformerEnd.ratedS".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:PowerTransformerEnd.ratedS:valueRange".to_string(),
description: "The attribute shall be a positive value. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ratio_tap_changer_tap_changer_normal_step_less_th_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("RatioTapChanger").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::RatioTapChanger>() {
Some(o) => o, None => continue,
};
if obj.base.normal_step.is_none() || obj.base.high_step.is_none() { continue; }
if !((obj.base.normal_step.unwrap() as f64) <= obj.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.normalStep-valueRangePairTo".to_string(),
class: "RatioTapChanger".to_string(),
property: "TapChanger.normalStep".to_string(),
message: "The value of TapChanger.normalStep is greater than the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.normalStep:valueRangePairTo".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal to or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ratio_tap_changer_tap_changer_low_step_less_than_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("RatioTapChanger").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::RatioTapChanger>() {
Some(o) => o, None => continue,
};
if obj.base.low_step.is_none() || obj.base.normal_step.is_none() { continue; }
if !((obj.base.low_step.unwrap() as f64) <= obj.base.normal_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.normalStep-valueRangePairFrom".to_string(),
class: "RatioTapChanger".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than the value of TapChanger.normalStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.normalStep:valueRangePairFrom".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal to or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ratio_tap_changer_tap_changer_neutral_step_less_t_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("RatioTapChanger").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::RatioTapChanger>() {
Some(o) => o, None => continue,
};
if obj.base.neutral_step.is_none() || obj.base.high_step.is_none() { continue; }
if !((obj.base.neutral_step.unwrap() as f64) <= obj.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.neutralStep-valueRangePairTo".to_string(),
class: "RatioTapChanger".to_string(),
property: "TapChanger.neutralStep".to_string(),
message: "The value of TapChanger.neutralStep is greater than the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.neutralStep:valueRangePairTo".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ratio_tap_changer_tap_changer_low_step_less_than_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("RatioTapChanger").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::RatioTapChanger>() {
Some(o) => o, None => continue,
};
if obj.base.low_step.is_none() || obj.base.neutral_step.is_none() { continue; }
if !((obj.base.low_step.unwrap() as f64) <= obj.base.neutral_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.neutralStep-valueRangePairFrom".to_string(),
class: "RatioTapChanger".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than the value of TapChanger.neutralStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.neutralStep:valueRangePairFrom".to_string(),
description: "The attribute shall be equal to or greater than lowStep and equal or less than highStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ratio_tap_changer_tap_changer_low_step_less_than(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("RatioTapChanger").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::RatioTapChanger>() {
Some(o) => o, None => continue,
};
if obj.base.low_step.is_none() || obj.base.high_step.is_none() { continue; }
if !((obj.base.low_step.unwrap() as f64) < obj.base.high_step.unwrap() as f64) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:TapChanger.highStep-valueRangePair".to_string(),
class: "RatioTapChanger".to_string(),
property: "TapChanger.lowStep".to_string(),
message: "The value of TapChanger.lowStep is greater than or equal to the value of TapChanger.highStep.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:TapChanger.highStep:valueRangePair".to_string(),
description: "The attribute shall be greater than lowStep.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_curve_data_and(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("CurveData").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::CurveData>() {
Some(o) => o, None => continue,
};
if obj.y1value.is_none() || obj.y2value.is_none() {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ReactiveCapabilityCurve-curveYvalues".to_string(),
class: "CurveData".to_string(),
property: "C:301:EQ:ReactiveCapabilityCurve:yvalues".to_string(),
message: "CurveData associated with a ReactiveCapabilityCurve does not have both .y1value and .y2value defined.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ReactiveCapabilityCurve:yvalues".to_string(),
description: "For each active power value there is a corresponding high and low reactive power limit value. Typically there will be a separate curve for each coolant condition, such as hydrogen pressure. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_regular_time_point_regular_time_point_sequence_nu_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("RegularTimePoint").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::RegularTimePoint>() {
Some(o) => o, None => continue,
};
if obj.sequence_number.is_none() { continue; }
if (obj.sequence_number.unwrap() as f64) < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:RegularTimePoint.sequenceNumber-valueRange".to_string(),
class: "RegularTimePoint".to_string(),
property: "RegularTimePoint.sequenceNumber".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:RegularTimePoint.sequenceNumber:valueRange".to_string(),
description: "The sequence number cannot be negative.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_series_compensator_terminal_conducting_equipment_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SeriesCompensator").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:SeriesCompensator-numberOfTerminals".to_string(),
class: "SeriesCompensator".to_string(),
property: "C:301:EQ:SeriesCompensator:numberOfTerminals".to_string(),
message: "The SeriesCompensator does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:SeriesCompensator:numberOfTerminals".to_string(),
description: "It is a two terminal device.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_series_compensator_terminal_conducting_equipment_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SeriesCompensator").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:SeriesCompensator-numberOfTerminals".to_string(),
class: "SeriesCompensator".to_string(),
property: "C:301:EQ:SeriesCompensator:numberOfTerminals".to_string(),
message: "The SeriesCompensator does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:SeriesCompensator:numberOfTerminals".to_string(),
description: "It is a two terminal device.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_solar_generating_unit_generating_unit_rated_net_m_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SolarGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SolarGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_net_max_p.is_none() { continue; }
if obj.base.rated_net_max_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedNetMaxP-valueRange".to_string(),
class: "SolarGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedNetMaxP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedNetMaxP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_solar_generating_unit_generating_unit_rated_gross_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SolarGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SolarGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_gross_min_p.is_none() { continue; }
if obj.base.rated_gross_min_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedGrossMinP-valueRange".to_string(),
class: "SolarGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedGrossMinP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedGrossMinP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_solar_generating_unit_generating_unit_rated_gross_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SolarGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SolarGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_gross_max_p.is_none() { continue; }
if obj.base.rated_gross_max_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedGrossMaxP-valueRange".to_string(),
class: "SolarGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedGrossMaxP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedGrossMaxP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_static_var_compensator_static_var_compensator_slo_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("StaticVarCompensator").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::StaticVarCompensator>() {
Some(o) => o, None => continue,
};
if obj.slope.is_none() { continue; }
if obj.slope.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:StaticVarCompensator.slope-valueRange".to_string(),
class: "StaticVarCompensator".to_string(),
property: "StaticVarCompensator.slope".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:StaticVarCompensator.slope:valueRange".to_string(),
description: "The attribute shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_static_var_compensator_static_var_compensator_ind_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("StaticVarCompensator").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::StaticVarCompensator>() {
Some(o) => o, None => continue,
};
if obj.inductive_rating.is_none() { continue; }
if obj.inductive_rating.unwrap() >= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:StaticVarCompensator.inductiveRating-valueRange".to_string(),
class: "StaticVarCompensator".to_string(),
property: "StaticVarCompensator.inductiveRating".to_string(),
message: "The value is positive or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:StaticVarCompensator.inductiveRating:valueRange".to_string(),
description: "Shall always be negative. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_static_var_compensator_static_var_compensator_cap_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("StaticVarCompensator").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::StaticVarCompensator>() {
Some(o) => o, None => continue,
};
if obj.capacitive_rating.is_none() { continue; }
if obj.capacitive_rating.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:StaticVarCompensator.capacitiveRating-valueRange".to_string(),
class: "StaticVarCompensator".to_string(),
property: "StaticVarCompensator.capacitiveRating".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:StaticVarCompensator.capacitiveRating:valueRange".to_string(),
description: "Shall always be positive.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_switch_switch_rated_current_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Switch").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::Switch>() {
Some(o) => o, None => continue,
};
if obj.rated_current.is_none() { continue; }
if obj.rated_current.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch.ratedCurrent-valueRange".to_string(),
class: "Switch".to_string(),
property: "Switch.ratedCurrent".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch.ratedCurrent:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_switch_terminal_conducting_equipment_min_count(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Switch").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count < 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "Switch".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_switch_terminal_conducting_equipment_max_count(dataset: &CimDataset) -> Vec<Violation> {
let mut ref_counts: std::collections::HashMap<&str, usize> = std::collections::HashMap::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
if let Some(src) = dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
if let Some(r) = &src.conducting_equipment { *ref_counts.entry(r.mrid.as_str()).or_insert(0) += 1; }
}
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Switch").into_iter().flatten() {
let count = ref_counts.get(mrid.as_str()).copied().unwrap_or(0);
if count > 2 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Switch-numberOfTerminals".to_string(),
class: "Switch".to_string(),
property: "C:301:EQ:Switch:numberOfTerminals".to_string(),
message: "The Switch (or subclass) does not have two terminals.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Switch:numberOfTerminals".to_string(),
description: "All switches are two terminal devices including grounding switches. ".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_synchronous_machine_rotating_machine_rated_u_min_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SynchronousMachine").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SynchronousMachine>() {
Some(o) => o, None => continue,
};
if obj.base.rated_u.is_none() { continue; }
if obj.base.rated_u.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:RotatingMachine.ratedU-valueRange".to_string(),
class: "SynchronousMachine".to_string(),
property: "RotatingMachine.ratedU".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:RotatingMachine.ratedU:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_synchronous_machine_rotating_machine_rated_s_min_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SynchronousMachine").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SynchronousMachine>() {
Some(o) => o, None => continue,
};
if obj.base.rated_s.is_none() { continue; }
if obj.base.rated_s.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:RotatingMachine.ratedS-valueRange".to_string(),
class: "SynchronousMachine".to_string(),
property: "RotatingMachine.ratedS".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:RotatingMachine.ratedS:valueRange".to_string(),
description: "The attribute shall have a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_synchronous_machine_rotating_machine_rated_power_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SynchronousMachine").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SynchronousMachine>() {
Some(o) => o, None => continue,
};
if obj.base.rated_power_factor.is_none() { continue; }
if obj.base.rated_power_factor.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:RotatingMachine.ratedPowerFactor-valueRange".to_string(),
class: "SynchronousMachine".to_string(),
property: "RotatingMachine.ratedPowerFactor".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:RotatingMachine.ratedPowerFactor:valueRange".to_string(),
description: "The attribute cannot be a negative value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_grounding_impedance_terminal_conducting_equipment_etc_3(dataset: &CimDataset) -> Vec<Violation> {
let mut has_value: std::collections::HashSet<&str> = std::collections::HashSet::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
let src = match dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
Some(o) => o, None => continue,
};
if src.phases.as_ref().map_or(true, |u| u.uri != "PhaseCode.N") { continue; }
if let Some(r) = src.conducting_equipment.as_ref() { has_value.insert(r.mrid.trim_start_matches('#')); }
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("GroundingImpedance").into_iter().flatten() {
if !has_value.contains(mrid.as_str()) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Terminal.phases-phaseCodeN".to_string(),
class: "GroundingImpedance".to_string(),
property: "Terminal.ConductingEquipment".to_string(),
message: "Terminal.phases differs from PhaseCode.N for a grounding related class.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Terminal.phases:phaseCode".to_string(),
description: "If the attribute is missing, three phases (ABC) shall be assumed, except for terminals of grounding classes (specializations of EarthFaultCompensator, GroundDisconnector, and Ground) which will be assumed to be N. Therefore, phase code ABCN is explicitly declared when needed, e.g. for star point grounding equipment.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_petersen_coil_terminal_conducting_equipment_has_v_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut has_value: std::collections::HashSet<&str> = std::collections::HashSet::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
let src = match dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
Some(o) => o, None => continue,
};
if src.phases.as_ref().map_or(true, |u| u.uri != "PhaseCode.N") { continue; }
if let Some(r) = src.conducting_equipment.as_ref() { has_value.insert(r.mrid.trim_start_matches('#')); }
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PetersenCoil").into_iter().flatten() {
if !has_value.contains(mrid.as_str()) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Terminal.phases-phaseCodeN".to_string(),
class: "PetersenCoil".to_string(),
property: "Terminal.ConductingEquipment".to_string(),
message: "Terminal.phases differs from PhaseCode.N for a grounding related class.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Terminal.phases:phaseCode".to_string(),
description: "If the attribute is missing, three phases (ABC) shall be assumed, except for terminals of grounding classes (specializations of EarthFaultCompensator, GroundDisconnector, and Ground) which will be assumed to be N. Therefore, phase code ABCN is explicitly declared when needed, e.g. for star point grounding equipment.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ground_disconnector_terminal_conducting_equipment_etc_3(dataset: &CimDataset) -> Vec<Violation> {
let mut has_value: std::collections::HashSet<&str> = std::collections::HashSet::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
let src = match dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
Some(o) => o, None => continue,
};
if src.phases.as_ref().map_or(true, |u| u.uri != "PhaseCode.N") { continue; }
if let Some(r) = src.conducting_equipment.as_ref() { has_value.insert(r.mrid.trim_start_matches('#')); }
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("GroundDisconnector").into_iter().flatten() {
if !has_value.contains(mrid.as_str()) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Terminal.phases-phaseCodeN".to_string(),
class: "GroundDisconnector".to_string(),
property: "Terminal.ConductingEquipment".to_string(),
message: "Terminal.phases differs from PhaseCode.N for a grounding related class.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Terminal.phases:phaseCode".to_string(),
description: "If the attribute is missing, three phases (ABC) shall be assumed, except for terminals of grounding classes (specializations of EarthFaultCompensator, GroundDisconnector, and Ground) which will be assumed to be N. Therefore, phase code ABCN is explicitly declared when needed, e.g. for star point grounding equipment.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_ground_terminal_conducting_equipment_has_value(dataset: &CimDataset) -> Vec<Violation> {
let mut has_value: std::collections::HashSet<&str> = std::collections::HashSet::new();
for src_mrid in dataset.by_type.get("Terminal").into_iter().flatten() {
let src = match dataset.entries.get(src_mrid)
.and_then(|e| e.element.as_any().downcast_ref::<cimstructs::Terminal>()) {
Some(o) => o, None => continue,
};
if src.phases.as_ref().map_or(true, |u| u.uri != "PhaseCode.N") { continue; }
if let Some(r) = src.conducting_equipment.as_ref() { has_value.insert(r.mrid.trim_start_matches('#')); }
}
let mut violations = Vec::new();
for mrid in dataset.by_type.get("Ground").into_iter().flatten() {
if !has_value.contains(mrid.as_str()) {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:Terminal.phases-phaseCodeN".to_string(),
class: "Ground".to_string(),
property: "Terminal.ConductingEquipment".to_string(),
message: "Terminal.phases differs from PhaseCode.N for a grounding related class.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:Terminal.phases:phaseCode".to_string(),
description: "If the attribute is missing, three phases (ABC) shall be assumed, except for terminals of grounding classes (specializations of EarthFaultCompensator, GroundDisconnector, and Ground) which will be assumed to be N. Therefore, phase code ABCN is explicitly declared when needed, e.g. for star point grounding equipment.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_thermal_generating_unit_generating_unit_rated_net_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("ThermalGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::ThermalGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_net_max_p.is_none() { continue; }
if obj.base.rated_net_max_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedNetMaxP-valueRange".to_string(),
class: "ThermalGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedNetMaxP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedNetMaxP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_thermal_generating_unit_generating_unit_rated_gro_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("ThermalGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::ThermalGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_gross_min_p.is_none() { continue; }
if obj.base.rated_gross_min_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedGrossMinP-valueRange".to_string(),
class: "ThermalGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedGrossMinP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedGrossMinP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_thermal_generating_unit_generating_unit_rated_gro_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("ThermalGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::ThermalGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_gross_max_p.is_none() { continue; }
if obj.base.rated_gross_max_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedGrossMaxP-valueRange".to_string(),
class: "ThermalGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedGrossMaxP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedGrossMaxP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_voltage_limit_voltage_limit_normal_value_min_incl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VoltageLimit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VoltageLimit>() {
Some(o) => o, None => continue,
};
if obj.normal_value.is_none() { continue; }
if obj.normal_value.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:VoltageLimit.normalValue-valueRange".to_string(),
class: "VoltageLimit".to_string(),
property: "VoltageLimit.normalValue".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:VoltageLimit.normalValue:valueRange".to_string(),
description: "The attribute shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_idle_loss_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.idle_loss.is_none() { continue; }
if obj.base.idle_loss.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.idleLoss-valueRange".to_string(),
class: "VsConverter".to_string(),
property: "ACDCConverter.idleLoss".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.idleLoss:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_min_udc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.min_udc.is_none() { continue; }
if obj.base.min_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.minUdc-valueRange".to_string(),
class: "VsConverter".to_string(),
property: "ACDCConverter.minUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.minUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_resistive_loss_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.resistive_loss.is_none() { continue; }
if obj.base.resistive_loss.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.resistiveLoss-valueRange".to_string(),
class: "VsConverter".to_string(),
property: "ACDCConverter.resistiveLoss".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.resistiveLoss:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_rated_udc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.rated_udc.is_none() { continue; }
if obj.base.rated_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.ratedUdc-valueRange".to_string(),
class: "VsConverter".to_string(),
property: "ACDCConverter.ratedUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.ratedUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_max_udc_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.max_udc.is_none() { continue; }
if obj.base.max_udc.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.maxUdc-valueRange".to_string(),
class: "VsConverter".to_string(),
property: "ACDCConverter.maxUdc".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.maxUdc:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_vs_converter_max_modulation_index_ma_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.max_modulation_index.is_none() { continue; }
if obj.max_modulation_index.unwrap() > 1_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:VsConverter.maxModulationIndex-valueRangeTypical".to_string(),
class: "VsConverter".to_string(),
property: "VsConverter.maxModulationIndex".to_string(),
message: "The value is greater than 1.".to_string(),
severity: "sh:Warning".to_string(),
name: "C:301:EQ:VsConverter.maxModulationIndex:valueRangeTypical".to_string(),
description: "A factor typically less than 1.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_switching_loss_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.switching_loss.is_none() { continue; }
if obj.base.switching_loss.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.switchingLoss-valueRange".to_string(),
class: "VsConverter".to_string(),
property: "ACDCConverter.switchingLoss".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.switchingLoss:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_vs_converter_acdc_converter_base_s_min_excl(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("VsConverter").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::VsConverter>() {
Some(o) => o, None => continue,
};
if obj.base.base_s.is_none() { continue; }
if obj.base.base_s.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:ACDCConverter.baseS-valueRange".to_string(),
class: "VsConverter".to_string(),
property: "ACDCConverter.baseS".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:ACDCConverter.baseS:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_wind_generating_unit_generating_unit_rated_net_ma_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("WindGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::WindGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_net_max_p.is_none() { continue; }
if obj.base.rated_net_max_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedNetMaxP-valueRange".to_string(),
class: "WindGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedNetMaxP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedNetMaxP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_wind_generating_unit_generating_unit_rated_gross_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("WindGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::WindGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_gross_min_p.is_none() { continue; }
if obj.base.rated_gross_min_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedGrossMinP-valueRange".to_string(),
class: "WindGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedGrossMinP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedGrossMinP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_equipment_ap_con_complex_shacl_wind_generating_unit_generating_unit_rated_gross_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("WindGeneratingUnit").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::WindGeneratingUnit>() {
Some(o) => o, None => continue,
};
if obj.base.rated_gross_max_p.is_none() { continue; }
if obj.base.rated_gross_max_p.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "equ:GeneratingUnit.ratedGrossMaxP-valueRange".to_string(),
class: "WindGeneratingUnit".to_string(),
property: "GeneratingUnit.ratedGrossMaxP".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:EQ:GeneratingUnit.ratedGrossMaxP:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}