use crate::impl_macros::macros::*;
#[cfg_attr(feature = "strum", derive(EnumIter))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
#[cfg_attr(feature = "pyo3", pyclass(eq, eq_int))]
pub enum VoltageUnit {
V,
kV,
MV,
GV,
TV,
}
impl PhysicsUnit for VoltageUnit {
fn name(&self) -> &str {
match &self {
VoltageUnit::V => "V",
VoltageUnit::kV => "kV",
VoltageUnit::MV => "MV",
VoltageUnit::GV => "GV",
VoltageUnit::TV => "TV",
}
}
fn base_per_x(&self) -> (f64, i32) {
match self {
VoltageUnit::V => (1., 0),
VoltageUnit::kV => (1., 3),
VoltageUnit::MV => (1., 6),
VoltageUnit::GV => (1., 9),
VoltageUnit::TV => (1., 12),
}
}
}
impl_quantity!(Voltage, VoltageUnit, [VoltageUnit::V]);
impl_div_with_self_to_f64!(Voltage);