iliekturtles / uom

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

uom::si::f64::AvailableEnergy not working

calbaker opened this issue · comments

I'm trying to provide a type for a struct field like this:

pub SomeStruct {
    /// specific energy of fuel 
    pub specific_energy: uom::si::f64::AvailableEnergy,
}

which results in

error: Unknown si quantity!
  --> fastsim-core/src/vehicle/powertrain/fuel_storage.rs:13:26
   |
13 |     pub specific_energy: uom::si::f64::AvailableEnergy,
   |                          ^^^

The work is in an open source project, so if needed, I could share the full source code.

@iliekturtles , I edited the above because I had it wrong about uom::si::f64::AvailableEnergy and uom::si::f64::Pressure having the same units. Pressure has the same units as energy density, and uom::si::f64::AvailableEnergy has the same units as specific energy. I'd also advocate for changing AvailableEnergy to SpecificEnergy because AvailableEnergy might get confused with thermodynamic availability, aka exergy, which is not exactly the same thing. Availability usually has energy units, e.g. joules. Specific availibility has the same units as specific energy and uom::si::f64::AvailableEnergy.