Noah Roberts wrote:
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.
We've picked this course of action. It turns out that the flow coefficient is a volumetric flow over sqrt(pressure). Now I just need to figure out how to represent that in the dimension system of the library and all is good.