use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
#[non_exhaustive]
pub enum DcConvention {
#[default]
PaperPure,
Matpower,
}
impl DcConvention {
#[must_use]
pub fn branch_susceptance(self, reactance: f64, effective_tap: f64) -> f64 {
match self {
Self::PaperPure => 1.0 / reactance,
Self::Matpower => 1.0 / (reactance * effective_tap),
}
}
#[must_use]
pub fn includes_phase_shifts(self) -> bool {
match self {
Self::PaperPure => false,
Self::Matpower => true,
}
}
}