iliekturtles / uom

Units of measurement -- type-safe zero-cost dimensional analysis
Apache License 2.0
1.01k stars 92 forks source link

uom::si::f64::AvailableEnergy not working #435

Closed calbaker closed 1 year ago

calbaker commented 1 year ago

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.

calbaker commented 1 year ago

@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.