Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] conversion factor for non-base
From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2010-04-22 14:01:24


In article <388A1D61-4B3A-4BEB-854D-99047F58191E_at_[hidden]>,
boost_at_[hidden] says...
>
> > The flow coefficient is Q/sqrt(dP), a volumetric flow/sqrt(pressure).
> > We have derived and defined a unit that would be the si standard for
> > this quantity if there was one and things work fine. I have a runtime
> > unit system that then converts between user values that make sense, to
> > our internal si version that does not but works.
> >
[cut]
> > The second part is what I can't find. The conversion templates in
> > conversion.hpp seem to specifically expect base units which at least the
> > si part is not and my conversions should use my funky si unit as their
> > basis. So the question I have is how can I write conversions such that
> > I can do this:
> >
> > quantity<si::flow_coefficient> fc(42 * Kv);
> >
> > and this:
> >
> > void f(quantity<Kv::coefficient>);
> > void f(quantity<Cv::coefficient>);
> > void f(quantity<si::coefficient>);
> >
> > Where Kv and Cv are base units in their own systems.
>
> The units all need to be dimensionally equivalent to be convertible. That is, as long as Cv::coefficient, Kv::coefficient, and si::coefficient have the same dimensions, and conversions are defined between all base units, conversion should work transparently. It's hard to provide more input without seeing the definitions for the three flow coefficients.
>
> Matthias

>From the quoted text above:

"The flow coefficient is Q/sqrt(dP), a volumetric flow/sqrt(pressure)."

The units, specifically, are:

Kv = (m3/h)/sqrt(bar)
Cv = (usgal/min)/sqrt(psi)

Repasted from the omitted text:

"The only way I can think of to do it is to make a system with the
components within the derived dimension and make conversion factors for
those. The problem is that I am not sure such systems can be coherent
and it would be a significant effort above and beyond the direct
conversion factors I already know."

-- 
http://crazyeddiecpp.blogspot.com/

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net