diff --git a/src/si/mod.rs b/src/si/mod.rs index 6d288deb..efa9ea5d 100644 --- a/src/si/mod.rs +++ b/src/si/mod.rs @@ -145,6 +145,7 @@ system! { temperature_interval::TemperatureInterval, thermal_conductance::ThermalConductance, thermal_conductivity::ThermalConductivity, + thermal_resistance::ThermalResistance, thermodynamic_temperature::ThermodynamicTemperature, time::Time, torque::Torque, diff --git a/src/si/thermal_resistance.rs b/src/si/thermal_resistance.rs new file mode 100644 index 00000000..81731edd --- /dev/null +++ b/src/si/thermal_resistance.rs @@ -0,0 +1,113 @@ +//! Thermal resistance (base unit kelvin per watt, kg⁻¹ · m⁻² · s³ · K). + +quantity! { + /// Thermal resistance (base unit kelvin per watt, kg⁻¹ · m⁻² · s³ · K). + quantity: ThermalResistance; "thermal resistance"; + /// Dimension of thermal resistance, L⁻²M⁻¹T³Th (base unit kelvin per watt, + /// kg⁻¹ · m⁻² · s³ · K). + dimension: ISQ< + N2, // length + N1, // mass + P3, // time + Z0, // electric current + P1, // thermodynamic temperature + Z0, // ammount of substance + Z0>; // luminous intensity + units { + @kelvin_per_yottawatt: prefix!(none) / prefix!(yotta); "K/YW", "kelvin per yottawatt", + "kelvins per yottawatt"; + @kelvin_per_zettawatt: prefix!(none) / prefix!(zetta); "K/ZW", "kelvin per zettawatt", + "kelvins per zettawatt"; + @kelvin_per_exawatt: prefix!(none) / prefix!(exa); "K/EW", "kelvin per exawatt", + "kelvins per exawatt"; + @kelvin_per_petawatt: prefix!(none) / prefix!(peta); "K/PW", "kelvin per petawatt", + "kelvins per petawatt"; + @kelvin_per_terawatt: prefix!(none) / prefix!(tera); "K/TW", "kelvin per terawatt", + "kelvins per terawatt"; + @kelvin_per_gigawatt: prefix!(none) / prefix!(giga); "K/GW", "kelvin per gigawatt", + "kelvins per gigawatt"; + @kelvin_per_megawatt: prefix!(none) / prefix!(mega); "K/MW", "kelvin per megawatt", + "kelvins per megawatt"; + @kelvin_per_kilowatt: prefix!(none) / prefix!(kilo); "K/kw", "kelvin per kilowatt", + "kelvins per kilowatt"; + @kelvin_per_hectowatt: prefix!(none) / prefix!(hecto); "K/hW", "kelvin per hectowatt", + "kelvins per hectowatt"; + @kelvin_per_decawatt: prefix!(none) / prefix!(deca); "K/daW", "kelvin per decawatt", + "kelvins per decawatt"; + @kelvin_per_watt: prefix!(none) / prefix!(none); "K/W", "kelvin per watt", + "kelvins per watt"; + @kelvin_per_deciwatt: prefix!(none) / prefix!(deci); "K/dW", "kelvin per deciwatt", + "kelvins per deciwatt"; + @kelvin_per_centiwatt: prefix!(none) / prefix!(centi); "K/cW", "kelvin per centiwatt", + "kelvins per centiwatt"; + @kelvin_per_milliwatt: prefix!(none) / prefix!(milli); "K/mW", "kelvin per milliwatt", + "kelvins per milliwatt"; + @kelvin_per_microwatt: prefix!(none) / prefix!(micro); "K/µW", "kelvin per microwatt", + "kelvins per microwatt"; + @kelvin_per_nanowatt: prefix!(none) / prefix!(nano); "K/nW", "kelvin per nanowatt", + "kelvins per nanowatt"; + @kelvin_per_picowatt: prefix!(none) / prefix!(pico); "K/pW", "kelvin per picowatt", + "kelvins per picowatt"; + @kelvin_per_femtowatt: prefix!(none) / prefix!(femto); "K/fW", "kelvin per femtowatt", + "kelvins per femtowatt"; + @kelvin_per_attowatt: prefix!(none) / prefix!(atto); "K/aW", "kelvin per attowatt", + "kelvins per attowatt"; + @kelvin_per_zeptowatt: prefix!(none) / prefix!(zepto); "K/zW", "kelvin per zeptowatt", + "kelvins per zeptowatt"; + @kelvin_per_yoctowatt: prefix!(none) / prefix!(yocto); "K/yW", "kelvin per yoctowatt", + "kelvins per yoctowatt"; + } +} + +#[cfg(test)] +mod tests { + storage_types! { + use crate::num::One; + use crate::si::power as p; + use crate::si::quantities::*; + use crate::si::temperature_interval as ti; + use crate::si::thermal_resistance as tr; + use crate::tests::Test; + + #[test] + fn check_dimension() { + let _: ThermalResistance = TemperatureInterval::new::(V::one()) + / Power::new::(V::one()); + } + + #[test] + fn check_power_ti_units() { + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + test::(); + + fn test< + TI: ti::Conversion, + P: p::Conversion, + TR: tr::Conversion>() + { + Test::assert_approx_eq(&ThermalResistance::new::(V::one()), + &(TemperatureInterval::new::(V::one()) + / Power::new::

(V::one()))); + } + } + } +}