Boost logo

Boost Users :

Subject: [Boost-users] units use and weird cases....suggestions needed
From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2009-09-08 18:08:29


I'm using the units library to make sure values supplied to functions
make sense, dimensionally, and are in the units expected. I've got a
strange case I have to work with though.

For the most part we've decided to standardize on the SI system. I
write my functions to be system independent when possible, but most of
what I'm working with is empirically based. For this I'll take the SI
units expected and write the function only for that system (since other
systems will use different equations entirely).

The problem domain is fluid dynamics so enter the Kv and Cv values.

Technically these are a measure of volumetric flow. For instance, Kv is
defined as:

the flow of water with temperature ranging 5 - 30 oC through a valve in
cubic meters per hour (m3/h) with a pressure drop of 1 bar

The problem is that engineers see this as a "unitless" value and treat
it as having no units at all. They use Kv in SI based equations, not
m3/s as we'd expect. Thus all equations being fed to us use Kv as if it
were a natural part of the equation.

Most of the time these dimensions do not compute dimensionally anyway
but there's rare cases when they do. I have gotten the engineers (those
giving me specs for code I write) to decide on Kv instead of doing both
Kv and Cv (it's a basic conversion).

The options I see are:

1. Convert both Kv and Cv into m3/s and require engineers to give
equations with that in mind. This will be very unnatural for them though.

1a. Do the conversion but don't tell them I'm doing it. This one seems
the least preferable as we've tried to make sure eng. documents and code
match and further...it might be hard for maintenance developers later.

2. Pretend...just use m3ps and pretend I'm using Kv (m3/h). Don't
convert or anything...just lie. I have a hard time with that one since
it sort of goes against the purpose of the library and again would seem
to introduce confusion for maintenance.

3. Use different types either in the form of a different unit "system"
or using BOOST_STRONG_TYPEDEF...or something.

What are some suggestions here?


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