frclib-core 0.2.4

A collection of utilities to be used across the FRC in rust ecosystem
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::units::time::Second;
use crate::{unit, unit_conversion, unit_dim_analysis};

unit!(Joule: float);
unit!(Volt: float);
unit!(Amp: float);
unit!(Watt: float);
unit!(WattHour: float);
unit!(Ohm: float);

unit_conversion!(Joule(float) <-> WattHour(float) ~ joule_to_watthour);

fn joule_to_watthour(joule: f64) -> f64 {
    joule / 3600.0
}

unit_dim_analysis!(Volt * Ohm = Watt);
unit_dim_analysis!(Watt * Second = Joule);