pub struct StrainGaugeSample {
pub gauge_id: u32,
pub timestamp: f64,
pub bridge_voltage_v: f64,
pub microstrain: f64,
pub temperature_c: f64,
}Expand description
A reading from a resistive strain gauge.
Fields§
§gauge_id: u32Gauge identifier (0-based).
timestamp: f64Timestamp in seconds.
bridge_voltage_v: f64Raw bridge voltage imbalance in Volts.
microstrain: f64Calibrated strain in µm/m (microstrain).
temperature_c: f64Gauge temperature in °C (for temperature compensation).
Implementations§
Source§impl StrainGaugeSample
impl StrainGaugeSample
Sourcepub fn new(
gauge_id: u32,
timestamp: f64,
bridge_voltage_v: f64,
microstrain: f64,
temperature_c: f64,
) -> Self
pub fn new( gauge_id: u32, timestamp: f64, bridge_voltage_v: f64, microstrain: f64, temperature_c: f64, ) -> Self
Create a new sample.
Sourcepub fn stress_mpa(&self, e_gpa: f64) -> f64
pub fn stress_mpa(&self, e_gpa: f64) -> f64
Stress estimate in MPa from microstrain and Young’s modulus e_gpa.
Uses Hooke’s law: σ = E · ε, with ε in µm/m → m/m.
Sourcepub fn from_bytes(data: &[u8]) -> Option<Self>
pub fn from_bytes(data: &[u8]) -> Option<Self>
Deserialize from bytes.
Trait Implementations§
Source§impl Clone for StrainGaugeSample
impl Clone for StrainGaugeSample
Source§fn clone(&self) -> StrainGaugeSample
fn clone(&self) -> StrainGaugeSample
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StrainGaugeSample
impl Debug for StrainGaugeSample
Source§impl PartialEq for StrainGaugeSample
impl PartialEq for StrainGaugeSample
Source§fn eq(&self, other: &StrainGaugeSample) -> bool
fn eq(&self, other: &StrainGaugeSample) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for StrainGaugeSample
Auto Trait Implementations§
impl Freeze for StrainGaugeSample
impl RefUnwindSafe for StrainGaugeSample
impl Send for StrainGaugeSample
impl Sync for StrainGaugeSample
impl Unpin for StrainGaugeSample
impl UnsafeUnpin for StrainGaugeSample
impl UnwindSafe for StrainGaugeSample
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.