diff --git a/src/si/electrical_conductance.rs b/src/si/electrical_conductance.rs new file mode 100644 index 00000000..86ae2b5e --- /dev/null +++ b/src/si/electrical_conductance.rs @@ -0,0 +1,100 @@ +//! Electrical conductance +//! (base unit siemens, m-2 · kg-1 · s3 · A2). + +quantity! { + /// Electrical conductance (base unit siemens, + /// m-2 · kg-1 · s3 · A2). + quantity: ElectricalConductance; "electrical conductance"; + /// Electrical conductance dimension, + /// m-2 · kg-1 · s3 · A2. + dimension: ISQ< + N2, // length + N1, // mass + P3, // time + P2, // electric current + Z0, // thermodynamic temperature + Z0, // amount of substance + Z0>; // luminous intensity + units { + @yottasiemens: prefix!(yotta); "YS", "yottasiemens", "yottasiemens"; + @zettasiemens: prefix!(zetta); "ZS", "zettasiemens", "zettasiemens"; + @exasiemens: prefix!(exa); "ES", "exasiemens", "exasiemens"; + @petasiemens: prefix!(peta); "PS", "petasiemens", "petasiemens"; + @terasiemens: prefix!(tera); "TS", "terasiemens", "terasiemens"; + @gigasiemens: prefix!(giga); "GS", "gigasiemens", "gigasiemens"; + @megasiemens: prefix!(mega); "MS", "megasiemens", "megasiemens"; + @kilosiemens: prefix!(kilo); "kS", "kilosiemens", "kilosiemens"; + @hectosiemens: prefix!(hecto); "hS", "hectosiemens", "hectosiemens"; + @decasiemens: prefix!(deca); "daS", "decasiemens", "decasiemens"; + /// Derived unit of electrical conductance. + @siemens: prefix!(none); "S", "siemens", "siemens"; + @mho: prefix!(none); "S", "mho", "mhos"; + @decisiemens: prefix!(deci); "dS", "decisiemens", "decisiemens"; + @centisiemens: prefix!(centi); "cS", "centisiemens", "centisiemens"; + @millisiemens: prefix!(milli); "mS", "millisiemens", "millisiemens"; + @microsiemens: prefix!(micro); "µS", "microsiemens", "microsiemens"; + @nanosiemens: prefix!(nano); "nS", "nanosiemens", "nanosiemens"; + @picosiemens: prefix!(pico); "pS", "picosiemens", "picosiemens"; + @femtosiemens: prefix!(femto); "fS", "femtosiemens", "femtosiemens"; + @attosiemens: prefix!(atto); "aS", "attosiemens", "attosiemens"; + @zeptosiemens: prefix!(zepto); "zS", "zeptosiemens", "zeptosiemens"; + @yoctosiemens: prefix!(yocto); "yS", "yoctosiemens", "yoctosiemens"; + + @abmho: 1.0_E9; "abmho", "abmho", "abmhos"; + @absiemens: 1.0_E9; "abS", "abmsiemens", "abmsiemens"; + @statsiemens: 1.112_650_E-12; "statS", "statsiemens", "statsiemens"; + @statmho: 1.112_650_E-12; "statmho", "statmho", "statmhos"; + } +} + +#[cfg(test)] +mod tests { + storage_types! { + use num::One; + use si::quantities::*; + use si::electrical_resistance as r; + use si::electrical_conductance as g; + use tests::Test; + + #[test] + fn check_dimension() { + let _: ElectricalConductance = V::one() + / ElectricalResistance::new::(V::one()); + } + + #[test] + fn check_units() { + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + + test::(); + test::(); + test::(); + test::(); + + fn test, G: g::Conversion>() { + Test::assert_approx_eq(&ElectricalConductance::new::(V::one()), + &(V::one() / ElectricalResistance::new::(V::one()))); + } + } + } +} diff --git a/src/si/mod.rs b/src/si/mod.rs index c165659b..b8237ad9 100644 --- a/src/si/mod.rs +++ b/src/si/mod.rs @@ -28,6 +28,7 @@ system! { capacitance::Capacitance, density::Density, electrical_resistance::ElectricalResistance, + electrical_conductance::ElectricalConductance, electric_current::ElectricCurrent, electric_potential::ElectricPotential, energy::Energy,