diff --git a/src/si/heat_capacity.rs b/src/si/heat_capacity.rs index 79b385d3..246213e7 100644 --- a/src/si/heat_capacity.rs +++ b/src/si/heat_capacity.rs @@ -169,6 +169,8 @@ quantity! { "British thermal units (IT) per degree Fahrenheit"; @boltzmann_constant: 1.380_649_E-23; "k", "Boltzmann constant", "Boltzmann constants"; + + @calorie_per_kelvin: 4.184_E0; "cal/K", "calorie per kelvin", "calories per kelvin"; } } @@ -261,6 +263,8 @@ mod tests { test::(); test::(); + test::(); + fn test, TI: ti::Conversion, HC: hc::Conversion>() { Test::assert_approx_eq(&HeatCapacity::new::(V::one()), &(Energy::new::(V::one()) diff --git a/src/si/mod.rs b/src/si/mod.rs index 0807110c..cbf44093 100644 --- a/src/si/mod.rs +++ b/src/si/mod.rs @@ -141,6 +141,7 @@ system! { volume::Volume, volume_rate::VolumeRate, volumetric_density_of_states::VolumetricDensityOfStates, + volumetric_heat_capacity::VolumetricHeatCapacity, volumetric_number_density::VolumetricNumberDensity, volumetric_number_rate::VolumetricNumberRate, volumetric_power_density::VolumetricPowerDensity, diff --git a/src/si/specific_heat_capacity.rs b/src/si/specific_heat_capacity.rs index 1d744b4b..9ad2c65f 100644 --- a/src/si/specific_heat_capacity.rs +++ b/src/si/specific_heat_capacity.rs @@ -120,6 +120,11 @@ quantity! { @btu_it_per_ton_degree_fahrenheit: 1.899_100_799_999_999_999_E0; "Btu (IT)/(t · °F)", "British thermal unit (IT) per ton degree Fahrenheit", "British thermal units (IT) per ton degree Fahrenheit"; + + @calorie_per_kilogram_kelvin: 4.184_E0; "cal/(kg · K)", "calorie per kilogram kelvin", + "calories per kilogram kelvin"; + @calorie_per_gram_kelvin: prefix!(kilo) * 4.184_E0; "cal/(g · K)", + "calorie per gram kelvin", "calories per gram kelvin"; } } @@ -218,6 +223,9 @@ mod tests { test::(); + test::(); + test::(); + fn test< E: e::Conversion, M: m::Conversion, diff --git a/src/si/volumetric_heat_capacity.rs b/src/si/volumetric_heat_capacity.rs new file mode 100644 index 00000000..7a8360a0 --- /dev/null +++ b/src/si/volumetric_heat_capacity.rs @@ -0,0 +1,53 @@ +//! Volumetric heat capacity (base unit joule per cubic meter kelvin, m⁻¹ · kg · s⁻² · K⁻¹). + +quantity! { + /// Volumetric heat capacity (base unit joule per cubic meter kelvin, m⁻¹ · kg · s⁻² · K⁻¹). + quantity: VolumetricHeatCapacity; "volumetric heat capacity"; + /// Dimension of volumetric heat capacity, L⁻¹MT⁻²Th⁻¹(base unit joule per cubic meter kelvin, + /// m⁻¹ · kg · s⁻² · K⁻¹). + dimension: ISQ< + N1, // length + P1, // mass + N2, // time + Z0, // electric current + N1, // thermodynamic temperature + Z0, // amount of substance + Z0>; // luminous intensity + units { + @joule_per_cubic_meter_kelvin: prefix!(none); "J/(m³ · K)", "joule per cubic meter kelvin", + "joules per cubic meter kelvin"; + @calorie_per_cubic_meter_kelvin: 4.184_E0; "cal/(m³ · K)", "calorie per cubic meter kelvin", + "calories per cubic meter kelvin"; + } +} + +#[cfg(test)] +mod tests { + storage_types! { + use crate::num::One; + use crate::si::heat_capacity as hc; + use crate::si::volume as vol; + use crate::si::quantities::*; + use crate::si::volumetric_heat_capacity as vhc; + use crate::tests::Test; + + #[test] + fn check_dimension() { + let _: VolumetricHeatCapacity = HeatCapacity::new::(V::one()) + / Volume::new::(V::one()); + } + + #[test] + fn check_heat_capacity_volume_units() { + test::(); + test::(); + + fn test, VOL: vol::Conversion, VHC: vhc::Conversion>() + { + Test::assert_approx_eq(&VolumetricHeatCapacity::new::(V::one()), + &(HeatCapacity::new::(V::one()) / (Volume::new::(V::one()))) + ); + } + } + } +}