steinhart_hart: Beta Parameter uom dimensions #117
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "atse/thermostat:b-parameter-uom"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Beta Parameter is not dimensionless, and has unit kelvin.
Incorporate that into the type system.
@ -26,2 +25,3 @@
/// Perform the resistance to temperature conversion.
pub fn get_temperature(&self, r: ElectricalResistance) -> ThermodynamicTemperature {
let inv_temp = 1.0 / self.t0.get::<kelvin>() + (r / self.r0).get::<ratio>().ln() / self.b;
let inv_temp = 1.0 / self.t0.get::<kelvin>() + (r / self.r0).get::<ratio>().ln() / self.b.get::<kelvin>();
if you add kelvin unit to
b
, don't useself.b.get::<kelvin>()
. The unit is correct now.maybe simplify it into one line?
ThermodynamicTemperature
s couldn't be added together, and the same applies to its reciprocal, which is why I did that initially.Upon further inspection of the uom crate though, turns out I've used the wrong type for
Parameters::b
, andTemperatureInterval
should be used instead, albeit with weird ergonomics, and probably can't be simplified onto just one line.c1b183ddd5
to8b0ad14311
8b0ad14311
tob3a6d16c3d
b3a6d16c3d
to1c30ff08de