Hi Robert, Robert Ramey wrote:
I have a program in which there is the notion of consumption rate such as m^3/sec, gallons/hour, etc.
I have consumption_rate unit defined in terms of si units. I read in a quanity in gallons/hour and so far so good. If I display the quantity it is displayed as m^3/sec. This displays the "compound units" as expected - very cool. All this is OK as far as it goes. When I try to display the quantity as gallons/hour again I have a whole host of problems. The attached test fill illustrates the issues. The only way I've been able to do is is by making a complete end run around the units system itself - sort of self defeating.
I would appreciate insight anyone might be able to offer into this issue.
It's a little confusing, but it's printing in the si units because
consumption_rate_unit is generated from the si::system. You can
create your own system with volume and time and create the consumption
rate from it. The following shows how:
#include <iostream>
#include
::type consumption_rate_dimension;
typedef boost::units::make_system
consumption_rate_unit;
typedef quantity