diff --git a/example/storage_tank.cpp b/example/storage_tank.cpp index 4ec3f725..a7bf2e03 100644 --- a/example/storage_tank.cpp +++ b/example/storage_tank.cpp @@ -20,6 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +#include #include #include #include @@ -28,10 +29,13 @@ #include #include #include +#include #include #include #include +// allows standard gravity (acceleration) and weight (force) to be expressed with scalar representation +// types instead of requiring the usage of Linear Algebra library for this simple example template requires mp_units::is_scalar inline constexpr bool mp_units::is_vector = true; @@ -108,22 +112,23 @@ public: int main() { - const auto height = isq::height(200 * mm); + const quantity height = isq::height(200 * mm); auto tank = RectangularStorageTank(horizontal_length(1'000 * mm), isq::width(500 * mm), height); tank.set_contents_density(1'000 * isq::mass_density[kg / m3]); - const auto fill_time = 200 * s; // time since starting fill - const auto measured_mass = 20. * kg; // measured mass at fill_time + const auto duration = std::chrono::seconds{200}; + const quantity fill_time = value_cast(quantity{duration}); // time since starting fill + const quantity measured_mass = 20. * kg; // measured mass at fill_time - const auto fill_level = tank.fill_level(measured_mass); - const auto spare_capacity = tank.spare_capacity(measured_mass); - const auto filled_weight = tank.filled_weight(); + const quantity fill_level = tank.fill_level(measured_mass); + const quantity spare_capacity = tank.spare_capacity(measured_mass); + const quantity filled_weight = tank.filled_weight(); const QuantityOf auto input_flow_rate = measured_mass / fill_time; const QuantityOf auto float_rise_rate = fill_level / fill_time; const QuantityOf auto fill_time_left = (height / fill_level - 1 * one) * fill_time; - const auto fill_ratio = fill_level / height; + const quantity fill_ratio = fill_level / height; std::cout << MP_UNITS_STD_FMT::format("fill height at {} = {} ({} full)\n", fill_time, fill_level, fill_ratio.in(percent));