steinhart_hart: Beta Parameter uom dimensions #117

Merged
sb10q merged 1 commits from atse/thermostat:b-parameter-uom into master 2024-10-21 11:12:47 +08:00
Contributor

The Beta Parameter is not dimensionless, and has unit kelvin.
Incorporate that into the type system.

The Beta Parameter is not dimensionless, and has unit kelvin. Incorporate that into the type system.
atse added 1 commit 2024-08-06 17:26:44 +08:00
c1b183ddd5 steinhart_hart: Beta Parameter uom dimensions
The Beta Parameter is not dimensionless, and has unit Kelvin.
Incorporate that into the type system for better checks.
linuswck reviewed 2024-08-06 17:55:33 +08:00
@ -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>();
Owner

if you add kelvin unit to b, don't use self.b.get::<kelvin>(). The unit is correct now.
maybe simplify it into one line?

if you add kelvin unit to `b`, don't use `self.b.get::<kelvin>()`. The unit is correct now. maybe simplify it into one line?
Author
Contributor

ThermodynamicTemperatures 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, and TemperatureInterval should be used instead, albeit with weird ergonomics, and probably can't be simplified onto just one line.

`ThermodynamicTemperature`s [couldn't be added together](https://github.com/iliekturtles/uom/issues/403), 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`, and `TemperatureInterval` should be used instead, albeit with weird ergonomics, and probably can't be simplified onto just one line.
atse force-pushed b-parameter-uom from c1b183ddd5 to 8b0ad14311 2024-08-08 13:30:34 +08:00 Compare
atse force-pushed b-parameter-uom from 8b0ad14311 to b3a6d16c3d 2024-08-20 12:41:00 +08:00 Compare
atse force-pushed b-parameter-uom from b3a6d16c3d to 1c30ff08de 2024-10-21 10:51:52 +08:00 Compare
sb10q merged commit 45eb55d36d into master 2024-10-21 11:12:47 +08:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/thermostat#117
No description provided.