iliekturtles / uom

Units of measurement -- type-safe zero-cost dimensional analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request: FrequencyShift

jossriLDR opened this issue · comments

For radar data processing "frequency slope" is a commonly used quantity, especially in FMCW radars.

It is also listed here as 'frequency drift": https://en.wikipedia.org/wiki/SI_derived_unit#Examples_of_derived_quantities_and_units

In my application I defined it like this:

use uom::{Kind, typenum::{N2, int::Z0}, si::{Quantity, ISQ, SI}};
type FrequencyDrift = Quantity<ISQ<Z0, Z0, N2, Z0, Z0, Z0, Z0, dyn Kind + 'static>, SI<f64>, f64>;

But it does not implement new() or any unit of course. From the documentation I do not understand how properly add a new quantity.

How do I add this properly? Maybe even with some commonly used units like hertz_per_second, megahertz_per_microsecond.

As you found out you can use a type alias to easily use a quantity not explicitly defined in uom but you don't get any units. If you're willing to submit a PR adding a new quantity is really easy. See #349/ede7791 for an example where TemperatureGradient was added.

MR #388 solves this