#![allow(clippy::all, dead_code, unused)]
use cimdecoder::CimDataset;
use crate::Violation;
use crate::helpers::*;
pub fn validate_p61970_301_shortcircuit_ap_con_complex_shacl(dataset: &CimDataset) -> Vec<Violation> {
let mut v = Vec::new();
v.extend(check_p61970_301_shortcircuit_ap_con_complex_shacl_mutual_coupling_mutual_coupling_distance11_min_etc(dataset));
v.extend(check_p61970_301_shortcircuit_ap_con_complex_shacl_mutual_coupling_mutual_coupling_distance12_min_etc(dataset));
v.extend(check_p61970_301_shortcircuit_ap_con_complex_shacl_mutual_coupling_mutual_coupling_distance21_min_etc(dataset));
v.extend(check_p61970_301_shortcircuit_ap_con_complex_shacl_mutual_coupling_mutual_coupling_distance22_min_etc(dataset));
v.extend(check_p61970_301_shortcircuit_ap_con_complex_shacl_petersen_coil_petersen_coil_position_current_m_etc(dataset));
v.extend(check_p61970_301_shortcircuit_ap_con_complex_shacl_petersen_coil_petersen_coil_position_current_m_etc_2(dataset));
v.extend(check_p61970_301_shortcircuit_ap_con_complex_shacl_petersen_coil_petersen_coil_offset_current_min_etc(dataset));
v.extend(check_p61970_301_shortcircuit_ap_con_complex_shacl_petersen_coil_petersen_coil_offset_current_max_etc(dataset));
v.extend(check_p61970_301_shortcircuit_ap_con_complex_shacl_power_transformer_end_power_transformer_end_ph_etc(dataset));
v.extend(check_p61970_301_shortcircuit_ap_con_complex_shacl_power_transformer_end_power_transformer_end_ph_etc_2(dataset));
v.extend(check_p61970_301_shortcircuit_ap_con_complex_shacl_series_compensator_series_compensator_varistor_etc(dataset));
v
}
pub fn check_p61970_301_shortcircuit_ap_con_complex_shacl_mutual_coupling_mutual_coupling_distance11_min_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("MutualCoupling").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::MutualCoupling>() {
Some(o) => o, None => continue,
};
if obj.distance11.is_none() { continue; }
if obj.distance11.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "scu:MutualCoupling.distance11-lengthValueRange".to_string(),
class: "MutualCoupling".to_string(),
property: "MutualCoupling.distance11".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:SC:MutualCoupling:lengthValueRange".to_string(),
description: "Length datatype defines that: It shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_shortcircuit_ap_con_complex_shacl_mutual_coupling_mutual_coupling_distance12_min_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("MutualCoupling").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::MutualCoupling>() {
Some(o) => o, None => continue,
};
if obj.distance12.is_none() { continue; }
if obj.distance12.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "scu:MutualCoupling.distance12-lengthValueRange".to_string(),
class: "MutualCoupling".to_string(),
property: "MutualCoupling.distance12".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:SC:MutualCoupling:lengthValueRange".to_string(),
description: "Length datatype defines that: It shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_shortcircuit_ap_con_complex_shacl_mutual_coupling_mutual_coupling_distance21_min_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("MutualCoupling").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::MutualCoupling>() {
Some(o) => o, None => continue,
};
if obj.distance21.is_none() { continue; }
if obj.distance21.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "scu:MutualCoupling.distance21-lengthValueRange".to_string(),
class: "MutualCoupling".to_string(),
property: "MutualCoupling.distance21".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:SC:MutualCoupling:lengthValueRange".to_string(),
description: "Length datatype defines that: It shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_shortcircuit_ap_con_complex_shacl_mutual_coupling_mutual_coupling_distance22_min_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("MutualCoupling").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::MutualCoupling>() {
Some(o) => o, None => continue,
};
if obj.distance22.is_none() { continue; }
if obj.distance22.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "scu:MutualCoupling.distance22-lengthValueRange".to_string(),
class: "MutualCoupling".to_string(),
property: "MutualCoupling.distance22".to_string(),
message: "The value is negative.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:SC:MutualCoupling:lengthValueRange".to_string(),
description: "Length datatype defines that: It shall be a positive value or zero.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_shortcircuit_ap_con_complex_shacl_petersen_coil_petersen_coil_position_current_m_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PetersenCoil").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PetersenCoil>() {
Some(o) => o, None => continue,
};
if obj.position_current.is_none() { continue; }
if obj.position_current.unwrap() < 0.02_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "scu:PetersenCoil.positionCurrent-valueRangeTypical".to_string(),
class: "PetersenCoil".to_string(),
property: "PetersenCoil.positionCurrent".to_string(),
message: "The value is outside the range: 20-200 mA.".to_string(),
severity: "sh:Warning".to_string(),
name: "C:301:SC:PetersenCoil.positionCurrent:valueRangeTypical".to_string(),
description: "Typically in the range of 20 mA to 200 mA.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_shortcircuit_ap_con_complex_shacl_petersen_coil_petersen_coil_position_current_m_etc_2(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PetersenCoil").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PetersenCoil>() {
Some(o) => o, None => continue,
};
if obj.position_current.is_none() { continue; }
if obj.position_current.unwrap() > 0.2_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "scu:PetersenCoil.positionCurrent-valueRangeTypical".to_string(),
class: "PetersenCoil".to_string(),
property: "PetersenCoil.positionCurrent".to_string(),
message: "The value is outside the range: 20-200 mA.".to_string(),
severity: "sh:Warning".to_string(),
name: "C:301:SC:PetersenCoil.positionCurrent:valueRangeTypical".to_string(),
description: "Typically in the range of 20 mA to 200 mA.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_shortcircuit_ap_con_complex_shacl_petersen_coil_petersen_coil_offset_current_min_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PetersenCoil").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PetersenCoil>() {
Some(o) => o, None => continue,
};
if obj.offset_current.is_none() { continue; }
if obj.offset_current.unwrap() < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "scu:PetersenCoil.offsetCurrent-valueRangeTypical".to_string(),
class: "PetersenCoil".to_string(),
property: "PetersenCoil.offsetCurrent".to_string(),
message: "The value is outside the range: 0-60 A.".to_string(),
severity: "sh:Warning".to_string(),
name: "C:301:SC:PetersenCoil.offsetCurrent:valueRangeTypical".to_string(),
description: "This is normally a fixed amount for which the controller is configured and could be positive or negative. Typically 0 to 60 A depending on voltage and resonance conditions.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_shortcircuit_ap_con_complex_shacl_petersen_coil_petersen_coil_offset_current_max_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("PetersenCoil").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::PetersenCoil>() {
Some(o) => o, None => continue,
};
if obj.offset_current.is_none() { continue; }
if obj.offset_current.unwrap() > 60_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "scu:PetersenCoil.offsetCurrent-valueRangeTypical".to_string(),
class: "PetersenCoil".to_string(),
property: "PetersenCoil.offsetCurrent".to_string(),
message: "The value is outside the range: 0-60 A.".to_string(),
severity: "sh:Warning".to_string(),
name: "C:301:SC:PetersenCoil.offsetCurrent:valueRangeTypical".to_string(),
description: "This is normally a fixed amount for which the controller is configured and could be positive or negative. Typically 0 to 60 A depending on voltage and resonance conditions.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_shortcircuit_ap_con_complex_shacl_power_transformer_end_power_transformer_end_ph_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.phase_angle_clock.is_none() { continue; }
if (obj.phase_angle_clock.unwrap() as f64) < 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "scu:PowerTransformerEnd.phaseAngleClock-valueRange".to_string(),
class: "PowerTransformerEnd".to_string(),
property: "PowerTransformerEnd.phaseAngleClock".to_string(),
message: "The value is outside the valid range: 0-11.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:SC:PowerTransformerEnd.phaseAngleClock:valueRange".to_string(),
description: "The valid values are 0 to 11.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_shortcircuit_ap_con_complex_shacl_power_transformer_end_power_transformer_end_ph_etc_2(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.phase_angle_clock.is_none() { continue; }
if (obj.phase_angle_clock.unwrap() as f64) > 11_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "scu:PowerTransformerEnd.phaseAngleClock-valueRange".to_string(),
class: "PowerTransformerEnd".to_string(),
property: "PowerTransformerEnd.phaseAngleClock".to_string(),
message: "The value is outside the valid range: 0-11.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:SC:PowerTransformerEnd.phaseAngleClock:valueRange".to_string(),
description: "The valid values are 0 to 11.".to_string(),
});
}
}
violations
}
pub fn check_p61970_301_shortcircuit_ap_con_complex_shacl_series_compensator_series_compensator_varistor_etc(dataset: &CimDataset) -> Vec<Violation> {
let mut violations = Vec::new();
for mrid in dataset.by_type.get("SeriesCompensator").into_iter().flatten() {
let entry = &dataset.entries[mrid];
let obj = match entry.element.as_any()
.downcast_ref::<cimstructs::SeriesCompensator>() {
Some(o) => o, None => continue,
};
if obj.varistor_rated_current.is_none() { continue; }
if obj.varistor_rated_current.unwrap() <= 0_f64 {
violations.push(Violation {
object_id: mrid.clone(),
rule_id: "scu:SeriesCompensator.varistorRatedCurrent-valueRange".to_string(),
class: "SeriesCompensator".to_string(),
property: "SeriesCompensator.varistorRatedCurrent".to_string(),
message: "The value is negative or zero.".to_string(),
severity: "sh:Violation".to_string(),
name: "C:301:SC:SeriesCompensator.varistorRatedCurrent:valueRange".to_string(),
description: "The attribute shall be a positive value.".to_string(),
});
}
}
violations
}